mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-05 14:38:51 +02:00
168 lines
7.5 KiB
Diff
168 lines
7.5 KiB
Diff
diff --git a/src/base/port.h b/src/base/port.h
|
|
index ec4139b5..d90e7485 100644
|
|
--- a/src/base/port.h
|
|
+++ b/src/base/port.h
|
|
@@ -96,6 +96,9 @@ using uint16 = uint16_t;
|
|
using uint32 = uint32_t;
|
|
using uint64 = uint64_t;
|
|
#else // OS_HAIKU
|
|
+#if __HAIKU_ARCH == x86
|
|
+#include <SupportDefs.h>
|
|
+#else
|
|
using int8 = int8_t;
|
|
using int16 = int16_t;
|
|
using int32 = int32_t;
|
|
@@ -108,6 +111,7 @@ using uint32 = uint32_t;
|
|
#ifndef uint64
|
|
using uint64 = __haiku_uint64;
|
|
#endif
|
|
+#endif // __HAIKU_ARCH_ABI
|
|
#endif // OS_HAIKU
|
|
#endif // OS_WIN
|
|
using char32 = uint32;
|
|
diff --git a/src/converter/candidate_filter.cc b/src/converter/candidate_filter.cc
|
|
index 5c5a8e7b..f659fd6c 100644
|
|
--- a/src/converter/candidate_filter.cc
|
|
+++ b/src/converter/candidate_filter.cc
|
|
@@ -418,9 +418,9 @@ CandidateFilter::ResultType CandidateFilter::FilterCandidateInternal(
|
|
}
|
|
}
|
|
|
|
- const int64 top_cost = std::max(kMinCost, top_candidate_->cost);
|
|
+ const int64 top_cost = std::max(kMinCost, (int)top_candidate_->cost);
|
|
const int64 top_structure_cost =
|
|
- std::max(kMinCost, top_candidate_->structure_cost);
|
|
+ std::max(kMinCost, (int)top_candidate_->structure_cost);
|
|
|
|
// If candidate size < 3, don't filter candidate aggressively
|
|
// TOOD(taku): This is a tentative workaround for the case where
|
|
diff --git a/src/converter/immutable_converter.cc b/src/converter/immutable_converter.cc
|
|
index 23e941df..1b96a0f8 100644
|
|
--- a/src/converter/immutable_converter.cc
|
|
+++ b/src/converter/immutable_converter.cc
|
|
@@ -480,7 +480,7 @@ bool ImmutableConverterImpl::ResegmentArabicNumberAndSuffix(
|
|
|
|
// do -1 so that resegmented nodes are boosted
|
|
// over compound node.
|
|
- const int32 wcost = std::max(compound_node->wcost / 2 - 1, 0);
|
|
+ const int32 wcost = std::max(compound_node->wcost / 2 - 1, (long int)0);
|
|
|
|
Node *number_node = lattice->NewNode();
|
|
CHECK(number_node);
|
|
@@ -557,7 +557,7 @@ bool ImmutableConverterImpl::ResegmentPrefixAndArabicNumber(
|
|
|
|
// do -1 so that resegmented nodes are boosted
|
|
// over compound node.
|
|
- const int32 wcost = std::max(compound_node->wcost / 2 - 1, 0);
|
|
+ const int32 wcost = std::max(compound_node->wcost / 2 - 1, (long int)0);
|
|
|
|
Node *prefix_node = lattice->NewNode();
|
|
CHECK(prefix_node);
|
|
@@ -1690,10 +1690,10 @@ void ImmutableConverterImpl::InsertFirstSegmentToCandidates(
|
|
// cost penalty based on the cost diff.
|
|
const Segment &first_segment = segments->conversion_segment(0);
|
|
const int base_cost_diff = std::max(
|
|
- 0, (first_segment.candidate(0).cost -
|
|
+ (long int)0, (first_segment.candidate(0).cost -
|
|
first_segment.candidate(only_first_segment_candidate_pos).cost));
|
|
const int base_wcost_diff = std::max(
|
|
- 0, (first_segment.candidate(0).wcost -
|
|
+ (long int)0, (first_segment.candidate(0).wcost -
|
|
first_segment.candidate(only_first_segment_candidate_pos).wcost));
|
|
for (size_t i = only_first_segment_candidate_pos;
|
|
i < first_segment.candidates_size();) {
|
|
diff --git a/src/gui/character_pad/character_palette.cc b/src/gui/character_pad/character_palette.cc
|
|
index ee2a4f3a..a40e50cb 100644
|
|
--- a/src/gui/character_pad/character_palette.cc
|
|
+++ b/src/gui/character_pad/character_palette.cc
|
|
@@ -333,7 +333,7 @@ void CharacterPalette::showUnicodeTableByRange(const UnicodeRange &range) {
|
|
for (char32 ucs4 = range.first; ucs4 <= range.last; ++ucs4) {
|
|
const char32 ucs4s[] = { ucs4 };
|
|
QTableWidgetItem *item =
|
|
- new QTableWidgetItem(QString::fromUcs4(ucs4s, arraysize(ucs4s)));
|
|
+ new QTableWidgetItem(QString::fromUcs4((const char32_t*)ucs4s, arraysize(ucs4s)));
|
|
item->setTextAlignment(Qt::AlignCenter);
|
|
tableWidget->setItem(ucs4 / kHexBase - offset, ucs4 % kHexBase, item);
|
|
tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
diff --git a/src/session/session_handler.cc b/src/session/session_handler.cc
|
|
index e32f9c43..fc69e5be 100644
|
|
--- a/src/session/session_handler.cc
|
|
+++ b/src/session/session_handler.cc
|
|
@@ -196,7 +196,7 @@ void SessionHandler::Init(
|
|
config::ConfigHandler::GetConfig(config_.get());
|
|
|
|
// allow [2..128] sessions
|
|
- max_session_size_ = std::max(2, std::min(FLAGS_max_session_size, 128));
|
|
+ max_session_size_ = std::max((int32)2, std::min(FLAGS_max_session_size, (int32)128));
|
|
session_map_.reset(new SessionMap(max_session_size_));
|
|
|
|
if (!engine_) {
|
|
@@ -626,7 +626,7 @@ bool SessionHandler::CreateSession(commands::Command *command) {
|
|
// prevent DOS attack
|
|
// don't allow CreateSession in very short period.
|
|
const int create_session_minimum_interval =
|
|
- std::max(0, std::min(FLAGS_create_session_min_interval, 10));
|
|
+ std::max((int32)0, std::min(FLAGS_create_session_min_interval, (int32)10));
|
|
|
|
uint64 current_time = Clock::GetTime();
|
|
if (last_create_session_time_ != 0 &&
|
|
@@ -754,11 +754,11 @@ bool SessionHandler::Cleanup(commands::Command *command) {
|
|
// allow [1..600] sec. default: 300
|
|
const uint64 create_session_timeout =
|
|
suspend_time +
|
|
- std::max(1, std::min(FLAGS_last_create_session_timeout, 600));
|
|
+ std::max((int32)1, std::min(FLAGS_last_create_session_timeout, (int32)600));
|
|
|
|
// allow [10..7200] sec. default 3600
|
|
const uint64 last_command_timeout =
|
|
- suspend_time + std::max(10, std::min(FLAGS_last_command_timeout, 7200));
|
|
+ suspend_time + std::max((int32)10, std::min(FLAGS_last_command_timeout, (int32)7200));
|
|
|
|
std::vector<SessionID> remove_ids;
|
|
for (SessionElement *element =
|
|
diff --git a/src/session/session_watch_dog.cc b/src/session/session_watch_dog.cc
|
|
index ad6571b3..7cfe7c02 100644
|
|
--- a/src/session/session_watch_dog.cc
|
|
+++ b/src/session/session_watch_dog.cc
|
|
@@ -67,7 +67,7 @@ SessionWatchDog::SessionWatchDog(int32 interval_sec)
|
|
: interval_sec_(interval_sec),
|
|
client_(NULL), cpu_stats_(NULL), event_(new UnnamedEvent) {
|
|
// allow [1..600].
|
|
- interval_sec_ = std::max(1, std::min(interval_sec_, 600));
|
|
+ interval_sec_ = std::max((int32)1, std::min(interval_sec_, (int32)600));
|
|
DCHECK(event_->IsAvailable())
|
|
<< "Unnamed event is not available";
|
|
}
|
|
@@ -128,13 +128,13 @@ void SessionWatchDog::Run() {
|
|
DCHECK_GE(number_of_processors, 1);
|
|
|
|
// the first (interval_sec_ - 60) sec: -> Do nothing
|
|
- const int32 idle_interval_msec = std::max(0, (interval_sec_ - 60)) * 1000;
|
|
+ const int32 idle_interval_msec = std::max((int32)0, (interval_sec_ - (int32)60)) * 1000;
|
|
|
|
// last 60 sec: -> check CPU usage
|
|
- const int32 cpu_check_interval_msec = std::min(60, interval_sec_) * 1000;
|
|
+ const int32 cpu_check_interval_msec = std::min((int32)60, interval_sec_) * 1000;
|
|
|
|
// for every 5 second, get CPU load percentage
|
|
- const int32 cpu_check_duration_msec = std::min(5, interval_sec_) * 1000;
|
|
+ const int32 cpu_check_duration_msec = std::min((int32)5, interval_sec_) * 1000;
|
|
|
|
std::fill(cpu_loads, cpu_loads + arraysize(cpu_loads), 0.0);
|
|
|
|
diff --git a/src/usage_stats/usage_stats.cc b/src/usage_stats/usage_stats.cc
|
|
index 0880bd5e..65fb65a4 100644
|
|
--- a/src/usage_stats/usage_stats.cc
|
|
+++ b/src/usage_stats/usage_stats.cc
|
|
@@ -174,8 +174,8 @@ void UsageStats::UpdateTiming(const string &name, uint32 val) {
|
|
stats.set_num_timings(stats.num_timings() + 1);
|
|
stats.set_total_time(stats.total_time() + val);
|
|
stats.set_avg_time(stats.total_time() / stats.num_timings());
|
|
- stats.set_min_time(std::min(stats.min_time(), val));
|
|
- stats.set_max_time(std::max(stats.max_time(), val));
|
|
+ stats.set_min_time(std::min(stats.min_time(), (google::protobuf::uint32)val));
|
|
+ stats.set_max_time(std::max(stats.max_time(), (google::protobuf::uint32)val));
|
|
} else {
|
|
stats.set_name(name);
|
|
stats.set_type(Stats::TIMING);
|