Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: src/ots.cc

Issue 512923003: Fix MSVC warnings about possible value truncation. (Closed) Base URL: https://chromium.googlesource.com/external/ots.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/name.cc ('k') | src/post.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ots.cc
diff --git a/src/ots.cc b/src/ots.cc
index f364191a59651d2d02bb2195c65349e893eb58f6..e2dd0a29692307f3cbd6b7af76f7ff29348e4d54 100644
--- a/src/ots.cc
+++ b/src/ots.cc
@@ -208,8 +208,8 @@ bool ProcessTTF(ots::OpenTypeFile *header,
// range_shift is NumTables x 16-searchRange. We know that 16*num_tables
// doesn't over flow because we range checked it above. Also, we know that
// it's > header->search_range by construction of search_range.
- const uint32_t expected_range_shift
- = 16 * header->num_tables - header->search_range;
+ const uint16_t expected_range_shift =
+ 16 * header->num_tables - header->search_range;
if (header->range_shift != expected_range_shift) {
OTS_WARNING("bad range shift");
header->range_shift = expected_range_shift; // the same as above.
@@ -567,7 +567,7 @@ bool ProcessGeneric(ots::OpenTypeFile *header, uint32_t signature,
}
}
- unsigned num_output_tables = 0;
+ uint16_t num_output_tables = 0;
for (unsigned i = 0; ; ++i) {
if (table_parsers[i].parse == NULL) {
break;
@@ -578,7 +578,7 @@ bool ProcessGeneric(ots::OpenTypeFile *header, uint32_t signature,
}
}
- unsigned max_pow2 = 0;
+ uint16_t max_pow2 = 0;
while (1u << (max_pow2 + 1) <= num_output_tables) {
max_pow2++;
}
« no previous file with comments | « src/name.cc ('k') | src/post.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698