Fix MSVC "value may be truncated" warnings. (by pkasting@)
git-svn-id: https://cld2.googlecode.com/svn/trunk@168 b252ecd4-b096-bf77-eb8e-91563289f87e
This commit is contained in:
@@ -599,7 +599,8 @@ int ReliabilityExpected(int actual_score_1kb, int expected_score_1kb) {
|
||||
if (ratio <= kRatio100) {return 100;}
|
||||
if (ratio > kRatio0) {return 0;}
|
||||
|
||||
int percent_good = 100.0 * (kRatio0 - ratio) / (kRatio0 - kRatio100);
|
||||
int percent_good =
|
||||
static_cast<int>(100.0 * (kRatio0 - ratio) / (kRatio0 - kRatio100));
|
||||
return percent_good;
|
||||
}
|
||||
|
||||
|
@@ -392,7 +392,7 @@ inline void OctaFPJustHash(uint64 longwordhash,
|
||||
uint32* subscr, uint32* hashkey) {
|
||||
uint32 temp = (longwordhash + (longwordhash >> 12)) & (bucketcount - 1);
|
||||
*subscr = temp;
|
||||
temp = longwordhash >> 4;
|
||||
temp = static_cast<uint32>(longwordhash >> 4);
|
||||
*hashkey = temp & keymask;
|
||||
}
|
||||
|
||||
|
@@ -253,13 +253,13 @@ int runetochar(char *str, const char32 *rune) {
|
||||
// 1 char 00-7F
|
||||
c = *rune;
|
||||
if(c <= 0x7F) {
|
||||
str[0] = c;
|
||||
str[0] = static_cast<char>(c);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 2 char 0080-07FF
|
||||
if(c <= 0x07FF) {
|
||||
str[0] = 0xC0 | (c >> 1*6);
|
||||
str[0] = 0xC0 | static_cast<char>(c >> 1*6);
|
||||
str[1] = 0x80 | (c & 0x3F);
|
||||
return 2;
|
||||
}
|
||||
@@ -271,14 +271,14 @@ int runetochar(char *str, const char32 *rune) {
|
||||
|
||||
// 3 char 0800-FFFF
|
||||
if (c <= 0xFFFF) {
|
||||
str[0] = 0xE0 | (c >> 2*6);
|
||||
str[0] = 0xE0 | static_cast<char>(c >> 2*6);
|
||||
str[1] = 0x80 | ((c >> 1*6) & 0x3F);
|
||||
str[2] = 0x80 | (c & 0x3F);
|
||||
str[2] = 0x80 | (c & 0x3F);
|
||||
return 3;
|
||||
}
|
||||
|
||||
// 4 char 10000-1FFFFF
|
||||
str[0] = 0xF0 | (c >> 3*6);
|
||||
str[0] = 0xF0 | static_cast<char>(c >> 3*6);
|
||||
str[1] = 0x80 | ((c >> 2*6) & 0x3F);
|
||||
str[2] = 0x80 | ((c >> 1*6) & 0x3F);
|
||||
str[3] = 0x80 | (c & 0x3F);
|
||||
|
@@ -184,7 +184,7 @@ void GetTextSpanOffsets(const ScoringHitBuffer* hitbuffer,
|
||||
|
||||
|
||||
int DiffScore(const CLD2TableSummary* obj, int indirect,
|
||||
uint16 lang1, uint16 lang2) {
|
||||
uint8 lang1, uint8 lang2) {
|
||||
if (indirect < static_cast<int>(obj->kCLDTableSizeOne)) {
|
||||
// Up to three languages at indirect
|
||||
uint32 langprob = obj->kCLDTableInd[indirect];
|
||||
@@ -669,7 +669,7 @@ void DumpSummaryBuffer(FILE* df, const SummaryBuffer* summarybuffer) {
|
||||
int BetterBoundary(const char* text,
|
||||
ScoringHitBuffer* hitbuffer,
|
||||
ScoringContext* scoringcontext,
|
||||
uint16 pslang0, uint16 pslang1,
|
||||
uint8 pslang0, uint8 pslang1,
|
||||
int linear0, int linear1, int linear2) {
|
||||
// Degenerate case, no change
|
||||
if ((linear2 - linear0) <= 8) {return linear1;}
|
||||
|
@@ -236,7 +236,7 @@ void DocTote::Sort(int n) {
|
||||
value_[sub] = value_[sub2];
|
||||
value_[sub2] = tmpv;
|
||||
|
||||
double tmps = score_[sub];
|
||||
int tmps = score_[sub];
|
||||
score_[sub] = score_[sub2];
|
||||
score_[sub2] = tmps;
|
||||
|
||||
|
Reference in New Issue
Block a user