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

Unified Diff: src/cmap.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/cff_type2_charstring.cc ('k') | src/gasp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmap.cc
diff --git a/src/cmap.cc b/src/cmap.cc
index 5f83839de84971676f467e7e34c6ed36961039cc..66be75de24fabe517c7060d773d4844309807e97 100644
--- a/src/cmap.cc
+++ b/src/cmap.cc
@@ -214,7 +214,7 @@ bool ParseFormat4(ots::OpenTypeFile *file, int platform, int encoding,
// glyphs and that we don't access anything out-of-bounds.
for (unsigned i = 0; i < segcount; ++i) {
for (unsigned cp = ranges[i].start_range; cp <= ranges[i].end_range; ++cp) {
- const uint16_t code_point = cp;
+ const uint16_t code_point = static_cast<uint16_t>(cp);
if (ranges[i].id_range_offset == 0) {
// this is explictly allowed to overflow in the spec
const uint16_t glyph = code_point + ranges[i].id_delta;
@@ -838,13 +838,13 @@ bool ots_cmap_serialise(OTSStream *out, OpenTypeFile *file) {
const bool have_314 = (!have_304) && file->cmap->subtable_3_1_4_data;
const bool have_31012 = file->cmap->subtable_3_10_12.size() != 0;
const bool have_31013 = file->cmap->subtable_3_10_13.size() != 0;
- const unsigned num_subtables = static_cast<unsigned>(have_034) +
- static_cast<unsigned>(have_0514) +
- static_cast<unsigned>(have_100) +
- static_cast<unsigned>(have_304) +
- static_cast<unsigned>(have_314) +
- static_cast<unsigned>(have_31012) +
- static_cast<unsigned>(have_31013);
+ const uint16_t num_subtables = static_cast<uint16_t>(have_034) +
+ static_cast<uint16_t>(have_0514) +
+ static_cast<uint16_t>(have_100) +
+ static_cast<uint16_t>(have_304) +
+ static_cast<uint16_t>(have_314) +
+ static_cast<uint16_t>(have_31012) +
+ static_cast<uint16_t>(have_31013);
const off_t table_start = out->Tell();
// Some fonts don't have 3-0-4 MS Symbol nor 3-1-4 Unicode BMP tables
« no previous file with comments | « src/cff_type2_charstring.cc ('k') | src/gasp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698