mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 12:10:06 +02:00
mozc: bump version (#2165)
* Update patch for x86. * Sort REQUIRES. * Add support for x86 secondary architecture but keep it disabled for now, since the build fails at step [386/767], i.e. at ~50%.
This commit is contained in:
@@ -1,50 +1,51 @@
|
||||
SUMMARY="Japanese input method editor"
|
||||
DESCRIPTION="A Japanese Input Method Editor (IME) designed for multi-platform. \
|
||||
This is open source version."
|
||||
HOMEPAGE="https://github.com/google/mozc/"
|
||||
COPYRIGHT="2010-2016, Google Inc."
|
||||
HOMEPAGE="https://github.com/google/mozc"
|
||||
COPYRIGHT="2010-2018 Google Inc."
|
||||
LICENSE="BSD (3-clause)"
|
||||
REVISION="2"
|
||||
fileVersion="v2.20.2677.102.6"
|
||||
SOURCE_URI="https://github.com/hanya/mozc/releases/download/$fileVersion/mozc-$fileVersion.tar.bz2"
|
||||
CHECKSUM_SHA256="cdb43a88d82db185299a8e396fccfe76ddbbe5a3c6b219220a36b55115cff4ac"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://github.com/hanya/mozc/releases/download/v$portVersion/mozc-v$portVersion.tar.bz2"
|
||||
CHECKSUM_SHA256="17ce4ee5d6a55678d804890d7e2fa7ffd7f852a9673e3b79671613c9167469f5"
|
||||
SOURCE_DIR="mozc"
|
||||
if [ $effectiveTargetArchitecture == "x86" ]; then
|
||||
if [ "$effectiveTargetArchitecture" = x86 ]; then
|
||||
PATCHES="mozc-$portVersion-x86.patch"
|
||||
fi
|
||||
SOURCE_URI_2="https://jaist.dl.sourceforge.net/project/zinnia/zinnia-tomoe/0.6.0-20080911/zinnia-tomoe-0.6.0-20080911.tar.bz2"
|
||||
zinniaTomoeVersion="0.6.0-20080911"
|
||||
SOURCE_URI_2="https://downloads.sourceforge.net/zinnia/zinnia-tomoe-$zinniaTomoeVersion.tar.bz2"
|
||||
CHECKSUM_SHA256_2="fd1a264b8aeea0ebec59e8c8765864a9543a75fb2dba349745bb3a3587790927"
|
||||
|
||||
ARCHITECTURES="!x86_gcc2 x86 x86_64"
|
||||
SECONDARY_ARCHITECTURES="!x86"
|
||||
|
||||
PROVIDES="
|
||||
mozc
|
||||
addon:mozc
|
||||
mozc$secondaryArchSuffix
|
||||
addon:mozc$secondaryArchSuffix
|
||||
"
|
||||
REQUIRES="
|
||||
haiku
|
||||
lib:libQt5Core
|
||||
lib:libQt5Gui
|
||||
lib:libQt5Widgets
|
||||
haiku$secondaryArchSuffix
|
||||
lib:libQt5Core$secondaryArchSuffix
|
||||
lib:libQt5Gui$secondaryArchSuffix
|
||||
lib:libQt5Widgets$secondaryArchSuffix
|
||||
"
|
||||
BUILD_REQUIRES="
|
||||
haiku_devel
|
||||
devel:libprotobuf
|
||||
devel:libQt5Core
|
||||
devel:libQt5Gui
|
||||
devel:libQt5Widgets
|
||||
devel:libGL
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
devel:libGL$secondaryArchSuffix
|
||||
devel:libprotobuf$secondaryArchSuffix
|
||||
devel:libQt5Core$secondaryArchSuffix
|
||||
devel:libQt5Gui$secondaryArchSuffix
|
||||
devel:libQt5Widgets$secondaryArchSuffix
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:python2
|
||||
cmd:g++
|
||||
cmd:gcc
|
||||
cmd:g++$secondaryArchSuffix
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:gyp
|
||||
cmd:pkg_config
|
||||
cmd:ninja
|
||||
cmd:pkg_config$secondaryArchSuffix
|
||||
cmd:protoc$secondaryArchSuffix
|
||||
cmd:python2
|
||||
cmd:which
|
||||
cmd:xres
|
||||
cmd:protoc
|
||||
cmd:ninja
|
||||
"
|
||||
|
||||
USER_SETTINGS_FILES="
|
||||
@@ -57,7 +58,8 @@ BUILD()
|
||||
|
||||
GYP_DEFINES="document_dir=$dataDir/mozc \
|
||||
zinnia_model_file=$dataDir/mozc/zinnia/handwriting-ja.model \
|
||||
zinnia_tomoe_dir=../../../../../sources-2/zinnia-tomoe-0.6.0-20080911" \
|
||||
zinnia_tomoe_dir=$sourceDir2/zinnia-tomoe-$zinniaTomoeVersion \
|
||||
enable_gtk_renderer=0" \
|
||||
$portPackageLinksDir/cmd~python2/bin/python2 build_mozc.py gyp \
|
||||
--target_platform=Linux --variant=Haiku \
|
||||
--server_dir=$dataDir/mozc
|
||||
@@ -1,233 +0,0 @@
|
||||
diff --git a/src/base/port.h b/src/base/port.h
|
||||
index 4e70bf2..072affb 100644
|
||||
--- a/src/base/port.h
|
||||
+++ b/src/base/port.h
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <cstddef>
|
||||
-
|
||||
+#ifndef OS_HAIKU
|
||||
// basic macros
|
||||
typedef signed char int8;
|
||||
typedef short int16;
|
||||
@@ -75,6 +75,9 @@ typedef int int32;
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned int uint32;
|
||||
+#else
|
||||
+#include <SupportDefs.h>
|
||||
+#endif // OS_HAIKU
|
||||
typedef unsigned int char32;
|
||||
#ifdef OS_WIN
|
||||
typedef unsigned __int64 uint64;
|
||||
diff --git a/src/base/logging.cc b/src/base/logging.cc
|
||||
index 41ff086..f38d6f3 100644
|
||||
--- a/src/base/logging.cc
|
||||
+++ b/src/base/logging.cc
|
||||
@@ -205,7 +205,7 @@ class LogStreamImpl {
|
||||
void Reset();
|
||||
|
||||
int verbose_level() const {
|
||||
- return max(FLAGS_v, config_verbose_level_);
|
||||
+ return max(FLAGS_v, (int32)config_verbose_level_);
|
||||
}
|
||||
|
||||
void set_verbose_level(int level) {
|
||||
diff --git a/src/config/config_handler.cc b/src/config/config_handler.cc
|
||||
index 0b02a95..a5fd6bc 100644
|
||||
--- a/src/config/config_handler.cc
|
||||
+++ b/src/config/config_handler.cc
|
||||
@@ -80,7 +80,7 @@ class ConfigHandlerImpl {
|
||||
ConfigHandlerImpl() {
|
||||
// <user_profile>/config1.db
|
||||
filename_ = kFileNamePrefix;
|
||||
- filename_ += NumberUtil::SimpleItoa(CONFIG_VERSION);
|
||||
+ filename_ += NumberUtil::SimpleItoa((int32)CONFIG_VERSION);
|
||||
filename_ += ".db";
|
||||
Reload();
|
||||
ConfigHandler::GetDefaultConfig(&default_config_);
|
||||
diff --git a/src/converter/candidate_filter.cc b/src/converter/candidate_filter.cc
|
||||
index 282162b..e093d70 100644
|
||||
--- a/src/converter/candidate_filter.cc
|
||||
+++ b/src/converter/candidate_filter.cc
|
||||
@@ -418,8 +418,8 @@ CandidateFilter::ResultType CandidateFilter::FilterCandidateInternal(
|
||||
}
|
||||
}
|
||||
|
||||
- const int top_cost = max(kMinCost, top_candidate_->cost);
|
||||
- const int top_structure_cost = max(kMinCost, top_candidate_->structure_cost);
|
||||
+ const int top_cost = max(kMinCost, (int)top_candidate_->cost);
|
||||
+ const int top_structure_cost = 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 a6ad5d4..42993d6 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 = max(compound_node->wcost / 2 - 1, 0);
|
||||
+ const int32 wcost = 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 = max(compound_node->wcost / 2 - 1, 0);
|
||||
+ const int32 wcost = max(compound_node->wcost / 2 - 1, (long int)0);
|
||||
|
||||
Node *prefix_node = lattice->NewNode();
|
||||
CHECK(prefix_node);
|
||||
@@ -1690,11 +1690,11 @@ void ImmutableConverterImpl::InsertFirstSegmentToCandidates(
|
||||
// cost penalty based on the cost diff.
|
||||
const Segment &first_segment = segments->conversion_segment(0);
|
||||
const int base_cost_diff =
|
||||
- max(0,
|
||||
+ max((long int)0,
|
||||
(first_segment.candidate(0).cost -
|
||||
first_segment.candidate(only_first_segment_candidate_pos).cost));
|
||||
const int base_wcost_diff =
|
||||
- max(0,
|
||||
+ max((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;
|
||||
diff --git a/src/rewriter/date_rewriter.cc b/src/rewriter/date_rewriter.cc
|
||||
index 2bbea10..9aa088e 100644
|
||||
--- a/src/rewriter/date_rewriter.cc
|
||||
+++ b/src/rewriter/date_rewriter.cc
|
||||
@@ -1634,9 +1634,9 @@ bool ExpandYear(const string &prefix, int year, std::vector<string> *result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
- result->push_back(prefix + NumberUtil::SimpleItoa(year));
|
||||
+ result->push_back(prefix + NumberUtil::SimpleItoa((int32)year));
|
||||
|
||||
- string arabic = NumberUtil::SimpleItoa(year);
|
||||
+ string arabic = NumberUtil::SimpleItoa((int32)year);
|
||||
|
||||
std::vector<NumberUtil::NumberString> output;
|
||||
|
||||
@@ -1778,7 +1778,7 @@ bool EraToAdForCourt(const YearData *data, size_t size, const string &key,
|
||||
// Get wide arabic numbers
|
||||
// e.g.) 1989 -> "1989", "一九八九"
|
||||
std::vector<NumberUtil::NumberString> output;
|
||||
- const string ad_year_str(NumberUtil::SimpleItoa(ad_year));
|
||||
+ const string ad_year_str(NumberUtil::SimpleItoa((int32)ad_year));
|
||||
NumberUtil::ArabicToWideArabic(ad_year_str, &output);
|
||||
// add half-width arabic number to `output` (e.g. "1989")
|
||||
output.push_back(NumberUtil::NumberString(
|
||||
diff --git a/src/rewriter/user_segment_history_rewriter.cc b/src/rewriter/user_segment_history_rewriter.cc
|
||||
index 4c5afe8..8fcf6e7 100644
|
||||
--- a/src/rewriter/user_segment_history_rewriter.cc
|
||||
+++ b/src/rewriter/user_segment_history_rewriter.cc
|
||||
@@ -333,7 +333,7 @@ inline bool GetFeatureS(const Segments &segments, size_t i,
|
||||
// used for number rewrite
|
||||
inline bool GetFeatureN(uint16 type, string *value) {
|
||||
DCHECK(value);
|
||||
- JoinStringsWithTab2(StringPiece("N", 1), NumberUtil::SimpleItoa(type), value);
|
||||
+ JoinStringsWithTab2(StringPiece("N", 1), NumberUtil::SimpleItoa((uint32)type), value);
|
||||
return true;
|
||||
}
|
||||
|
||||
diff --git a/src/session/session_handler.cc b/src/session/session_handler.cc
|
||||
index 765f5ae..51eafa1 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_ = max(2, min(FLAGS_max_session_size, 128));
|
||||
+ max_session_size_ = max((int32)2, 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 =
|
||||
- max(0, min(FLAGS_create_session_min_interval, 10));
|
||||
+ max((int32)0, min(FLAGS_create_session_min_interval, (int32)10));
|
||||
|
||||
uint64 current_time = Clock::GetTime();
|
||||
if (last_create_session_time_ != 0 &&
|
||||
@@ -754,12 +754,12 @@ bool SessionHandler::Cleanup(commands::Command *command) {
|
||||
// allow [1..600] sec. default: 300
|
||||
const uint64 create_session_timeout =
|
||||
suspend_time +
|
||||
- max(1, min(FLAGS_last_create_session_timeout, 600));
|
||||
+ max((int32)1, min(FLAGS_last_create_session_timeout, (int32)600));
|
||||
|
||||
// allow [10..7200] sec. default 3600
|
||||
const uint64 last_command_timeout =
|
||||
suspend_time +
|
||||
- max(10, min(FLAGS_last_command_timeout, 7200));
|
||||
+ max((int32)10, min(FLAGS_last_command_timeout, (long int)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 4454e62..4f1611b 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_ = max(1, min(interval_sec_, 600));
|
||||
+ interval_sec_ = max((int32)1, 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 = max(0, (interval_sec_ - 60)) * 1000;
|
||||
+ const int32 idle_interval_msec = max((int32)0, (interval_sec_ - (int32)60)) * 1000;
|
||||
|
||||
// last 60 sec: -> check CPU usage
|
||||
- const int32 cpu_check_interval_msec = min(60, interval_sec_) * 1000;
|
||||
+ const int32 cpu_check_interval_msec = min((int32)60, interval_sec_) * 1000;
|
||||
|
||||
// for every 5 second, get CPU load percentage
|
||||
- const int32 cpu_check_duration_msec = min(5, interval_sec_) * 1000;
|
||||
+ const int32 cpu_check_duration_msec = min((int32)5, interval_sec_) * 1000;
|
||||
|
||||
std::fill(cpu_loads, cpu_loads + arraysize(cpu_loads), 0.0);
|
||||
|
||||
diff --git a/src/usage_stats/upload_util.cc b/src/usage_stats/upload_util.cc
|
||||
index 44d5728..aa4fb09 100644
|
||||
--- a/src/usage_stats/upload_util.cc
|
||||
+++ b/src/usage_stats/upload_util.cc
|
||||
@@ -102,7 +102,7 @@ void UploadUtil::AddIntegerValue(const string &name, int int_value) {
|
||||
stat_values_.append("&");
|
||||
stat_values_.append(encoded_name);
|
||||
stat_values_.append(":i=");
|
||||
- stat_values_.append(NumberUtil::SimpleItoa(int_value));
|
||||
+ stat_values_.append(NumberUtil::SimpleItoa((int32)int_value));
|
||||
}
|
||||
|
||||
void UploadUtil::AddBooleanValue(const string &name, bool boolean_value) {
|
||||
diff --git a/src/usage_stats/usage_stats.cc b/src/usage_stats/usage_stats.cc
|
||||
index 6c362f5..8fcc73a 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(min(stats.min_time(), val));
|
||||
- stats.set_max_time(max(stats.max_time(), val));
|
||||
+ stats.set_min_time(min(stats.min_time(), (google::protobuf::uint32)val));
|
||||
+ stats.set_max_time(max(stats.max_time(), (google::protobuf::uint32)val));
|
||||
} else {
|
||||
stats.set_name(name);
|
||||
stats.set_type(Stats::TIMING);
|
||||
167
app-i18n/mozc/patches/mozc-2.23.2785.102.1-x86.patch
Normal file
167
app-i18n/mozc/patches/mozc-2.23.2785.102.1-x86.patch
Normal file
@@ -0,0 +1,167 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user