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

Unified Diff: src/gasp.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/cmap.cc ('k') | src/hdmx.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gasp.cc
diff --git a/src/gasp.cc b/src/gasp.cc
index 311219bf7593e0b2877a52090bf4bf8b02416dbb..fcabac81ea7c06bf46d0558761cf501123eb757b 100644
--- a/src/gasp.cc
+++ b/src/gasp.cc
@@ -84,12 +84,14 @@ bool ots_gasp_should_serialise(OpenTypeFile *file) {
bool ots_gasp_serialise(OTSStream *out, OpenTypeFile *file) {
const OpenTypeGASP *gasp = file->gasp;
- if (!out->WriteU16(gasp->version) ||
- !out->WriteU16(gasp->gasp_ranges.size())) {
+ const uint16_t num_ranges = static_cast<uint16_t>(gasp->gasp_ranges.size());
+ if (num_ranges != gasp->gasp_ranges.size() ||
+ !out->WriteU16(gasp->version) ||
+ !out->WriteU16(num_ranges)) {
return OTS_FAILURE();
}
- for (unsigned i = 0; i < gasp->gasp_ranges.size(); ++i) {
+ for (uint16_t i = 0; i < num_ranges; ++i) {
if (!out->WriteU16(gasp->gasp_ranges[i].first) ||
!out->WriteU16(gasp->gasp_ranges[i].second)) {
return OTS_FAILURE();
« no previous file with comments | « src/cmap.cc ('k') | src/hdmx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698