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

Unified Diff: src/ltsh.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/loca.cc ('k') | src/name.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ltsh.cc
diff --git a/src/ltsh.cc b/src/ltsh.cc
index 9145527dc745ed670a78053bf9f67c03f4dba950..16700daa7ab33cd2120648af5d051e48b9a223a9 100644
--- a/src/ltsh.cc
+++ b/src/ltsh.cc
@@ -61,12 +61,13 @@ bool ots_ltsh_should_serialise(OpenTypeFile *file) {
bool ots_ltsh_serialise(OTSStream *out, OpenTypeFile *file) {
const OpenTypeLTSH *ltsh = file->ltsh;
-
- if (!out->WriteU16(ltsh->version) ||
- !out->WriteU16(ltsh->ypels.size())) {
+ const uint16_t num_ypels = static_cast<uint16_t>(ltsh->ypels.size());
+ if (num_ypels != ltsh->ypels.size() ||
+ !out->WriteU16(ltsh->version) ||
+ !out->WriteU16(num_ypels)) {
return OTS_FAILURE();
}
- for (unsigned i = 0; i < ltsh->ypels.size(); ++i) {
+ for (uint16_t i = 0; i < num_ypels; ++i) {
if (!out->Write(&(ltsh->ypels[i]), 1)) {
return OTS_FAILURE();
}
« no previous file with comments | « src/loca.cc ('k') | src/name.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698