mozc-2.23.2785.102.9-x86.patch revision 7b1c18b2
1diff --git a/src/base/port.h b/src/base/port.h
2index ec4139b5..d90e7485 100644
3--- a/src/base/port.h
4+++ b/src/base/port.h
5@@ -96,6 +96,9 @@ using uint16 = uint16_t;
6 using uint32 = uint32_t;
7 using uint64 = uint64_t;
8 #else // OS_HAIKU
9+#if __HAIKU_ARCH == x86
10+#include <SupportDefs.h>
11+#else
12 using int8 = int8_t;
13 using int16 = int16_t;
14 using int32 = int32_t;
15@@ -108,6 +111,7 @@ using uint32 = uint32_t;
16 #ifndef uint64
17 using uint64 = __haiku_uint64;
18 #endif
19+#endif // __HAIKU_ARCH_ABI
20 #endif  // OS_HAIKU
21 #endif  // OS_WIN
22 using char32 = uint32;
23diff --git a/src/converter/candidate_filter.cc b/src/converter/candidate_filter.cc
24index 5c5a8e7b..f659fd6c 100644
25--- a/src/converter/candidate_filter.cc
26+++ b/src/converter/candidate_filter.cc
27@@ -418,9 +418,9 @@ CandidateFilter::ResultType CandidateFilter::FilterCandidateInternal(
28     }
29   }
30 
31-  const int64 top_cost = std::max(kMinCost, top_candidate_->cost);
32+  const int64 top_cost = std::max(kMinCost, (int)top_candidate_->cost);
33   const int64 top_structure_cost =
34-      std::max(kMinCost, top_candidate_->structure_cost);
35+      std::max(kMinCost, (int)top_candidate_->structure_cost);
36 
37   // If candidate size < 3, don't filter candidate aggressively
38   // TOOD(taku): This is a tentative workaround for the case where
39diff --git a/src/converter/immutable_converter.cc b/src/converter/immutable_converter.cc
40index 23e941df..1b96a0f8 100644
41--- a/src/converter/immutable_converter.cc
42+++ b/src/converter/immutable_converter.cc
43@@ -480,7 +480,7 @@ bool ImmutableConverterImpl::ResegmentArabicNumberAndSuffix(
44 
45       // do -1 so that resegmented nodes are boosted
46       // over compound node.
47-      const int32 wcost = std::max(compound_node->wcost / 2 - 1, 0);
48+      const int32 wcost = std::max(compound_node->wcost / 2 - 1, (long int)0);
49 
50       Node *number_node = lattice->NewNode();
51       CHECK(number_node);
52@@ -557,7 +557,7 @@ bool ImmutableConverterImpl::ResegmentPrefixAndArabicNumber(
53 
54       // do -1 so that resegmented nodes are boosted
55       // over compound node.
56-      const int32 wcost = std::max(compound_node->wcost / 2 - 1, 0);
57+      const int32 wcost = std::max(compound_node->wcost / 2 - 1, (long int)0);
58 
59       Node *prefix_node = lattice->NewNode();
60       CHECK(prefix_node);
61@@ -1690,10 +1690,10 @@ void ImmutableConverterImpl::InsertFirstSegmentToCandidates(
62   // cost penalty based on the cost diff.
63   const Segment &first_segment = segments->conversion_segment(0);
64   const int base_cost_diff = std::max(
65-      0, (first_segment.candidate(0).cost -
66+      (long int)0, (first_segment.candidate(0).cost -
67           first_segment.candidate(only_first_segment_candidate_pos).cost));
68   const int base_wcost_diff = std::max(
69-      0, (first_segment.candidate(0).wcost -
70+      (long int)0, (first_segment.candidate(0).wcost -
71           first_segment.candidate(only_first_segment_candidate_pos).wcost));
72   for (size_t i = only_first_segment_candidate_pos;
73        i < first_segment.candidates_size();) {
74diff --git a/src/gui/character_pad/character_palette.cc b/src/gui/character_pad/character_palette.cc
75index ee2a4f3a..a40e50cb 100644
76--- a/src/gui/character_pad/character_palette.cc
77+++ b/src/gui/character_pad/character_palette.cc
78@@ -333,7 +333,7 @@ void CharacterPalette::showUnicodeTableByRange(const UnicodeRange &range) {
79   for (char32 ucs4 = range.first; ucs4 <= range.last; ++ucs4) {
80     const char32 ucs4s[] = { ucs4 };
81     QTableWidgetItem *item =
82-        new QTableWidgetItem(QString::fromUcs4(ucs4s, arraysize(ucs4s)));
83+        new QTableWidgetItem(QString::fromUcs4((const char32_t*)ucs4s, arraysize(ucs4s)));
84     item->setTextAlignment(Qt::AlignCenter);
85     tableWidget->setItem(ucs4 / kHexBase - offset, ucs4 % kHexBase, item);
86     tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
87diff --git a/src/session/session_handler.cc b/src/session/session_handler.cc
88index e32f9c43..fc69e5be 100644
89--- a/src/session/session_handler.cc
90+++ b/src/session/session_handler.cc
91@@ -196,7 +196,7 @@ void SessionHandler::Init(
92   config::ConfigHandler::GetConfig(config_.get());
93 
94   // allow [2..128] sessions
95-  max_session_size_ = std::max(2, std::min(FLAGS_max_session_size, 128));
96+  max_session_size_ = std::max((int32)2, std::min(FLAGS_max_session_size, (int32)128));
97   session_map_.reset(new SessionMap(max_session_size_));
98 
99   if (!engine_) {
100@@ -626,7 +626,7 @@ bool SessionHandler::CreateSession(commands::Command *command) {
101   // prevent DOS attack
102   // don't allow CreateSession in very short period.
103   const int create_session_minimum_interval =
104-      std::max(0, std::min(FLAGS_create_session_min_interval, 10));
105+      std::max((int32)0, std::min(FLAGS_create_session_min_interval, (int32)10));
106 
107   uint64 current_time = Clock::GetTime();
108   if (last_create_session_time_ != 0 &&
109@@ -754,11 +754,11 @@ bool SessionHandler::Cleanup(commands::Command *command) {
110   // allow [1..600] sec. default: 300
111   const uint64 create_session_timeout =
112       suspend_time +
113-      std::max(1, std::min(FLAGS_last_create_session_timeout, 600));
114+      std::max((int32)1, std::min(FLAGS_last_create_session_timeout, (int32)600));
115 
116   // allow [10..7200] sec. default 3600
117   const uint64 last_command_timeout =
118-      suspend_time + std::max(10, std::min(FLAGS_last_command_timeout, 7200));
119+      suspend_time + std::max((int32)10, std::min(FLAGS_last_command_timeout, (int32)7200));
120 
121   std::vector<SessionID> remove_ids;
122   for (SessionElement *element =
123diff --git a/src/session/session_watch_dog.cc b/src/session/session_watch_dog.cc
124index ad6571b3..7cfe7c02 100644
125--- a/src/session/session_watch_dog.cc
126+++ b/src/session/session_watch_dog.cc
127@@ -67,7 +67,7 @@ SessionWatchDog::SessionWatchDog(int32 interval_sec)
128     : interval_sec_(interval_sec),
129       client_(NULL), cpu_stats_(NULL), event_(new UnnamedEvent) {
130   // allow [1..600].
131-  interval_sec_ = std::max(1, std::min(interval_sec_, 600));
132+  interval_sec_ = std::max((int32)1, std::min(interval_sec_, (int32)600));
133   DCHECK(event_->IsAvailable())
134       << "Unnamed event is not available";
135 }
136@@ -128,13 +128,13 @@ void SessionWatchDog::Run() {
137   DCHECK_GE(number_of_processors, 1);
138 
139   // the first (interval_sec_ - 60) sec: -> Do nothing
140-  const int32 idle_interval_msec = std::max(0, (interval_sec_ - 60)) * 1000;
141+  const int32 idle_interval_msec = std::max((int32)0, (interval_sec_ - (int32)60)) * 1000;
142 
143   // last 60 sec: -> check CPU usage
144-  const int32 cpu_check_interval_msec = std::min(60, interval_sec_) * 1000;
145+  const int32 cpu_check_interval_msec = std::min((int32)60, interval_sec_) * 1000;
146 
147   // for every 5 second, get CPU load percentage
148-  const int32 cpu_check_duration_msec = std::min(5, interval_sec_) * 1000;
149+  const int32 cpu_check_duration_msec = std::min((int32)5, interval_sec_) * 1000;
150 
151   std::fill(cpu_loads, cpu_loads + arraysize(cpu_loads), 0.0);
152 
153diff --git a/src/usage_stats/usage_stats.cc b/src/usage_stats/usage_stats.cc
154index 0880bd5e..65fb65a4 100644
155--- a/src/usage_stats/usage_stats.cc
156+++ b/src/usage_stats/usage_stats.cc
157@@ -174,8 +174,8 @@ void UsageStats::UpdateTiming(const string &name, uint32 val) {
158     stats.set_num_timings(stats.num_timings() + 1);
159     stats.set_total_time(stats.total_time() + val);
160     stats.set_avg_time(stats.total_time() / stats.num_timings());
161-    stats.set_min_time(std::min(stats.min_time(), val));
162-    stats.set_max_time(std::max(stats.max_time(), val));
163+    stats.set_min_time(std::min(stats.min_time(), (google::protobuf::uint32)val));
164+    stats.set_max_time(std::max(stats.max_time(), (google::protobuf::uint32)val));
165   } else {
166     stats.set_name(name);
167     stats.set_type(Stats::TIMING);
168