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

Unified Diff: src/loca.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/kern.cc ('k') | src/ltsh.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/loca.cc
diff --git a/src/loca.cc b/src/loca.cc
index a2947b279922992712e316d478916196e1d033a1..ad74b267354d3f6d9e41517831b5fe3a364920d5 100644
--- a/src/loca.cc
+++ b/src/loca.cc
@@ -76,7 +76,9 @@ bool ots_loca_serialise(OTSStream *out, OpenTypeFile *file) {
if (head->index_to_loc_format == 0) {
for (unsigned i = 0; i < loca->offsets.size(); ++i) {
- if (!out->WriteU16(loca->offsets[i] >> 1)) {
+ const uint16_t offset = static_cast<uint16_t>(loca->offsets[i] >> 1);
+ if ((offset != (loca->offsets[i] >> 1)) ||
+ !out->WriteU16(offset)) {
return OTS_FAILURE();
}
}
« no previous file with comments | « src/kern.cc ('k') | src/ltsh.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698