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

Side by Side Diff: src/core/SkFontDescriptor.cpp

Issue 147053003: fix (some) 64bit warnings -- size_t -> int (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkError.cpp ('k') | src/core/SkGlyphCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkFontDescriptor.h" 8 #include "SkFontDescriptor.h"
9 #include "SkStream.h" 9 #include "SkStream.h"
10 10
11 enum { 11 enum {
12 // these must match the sfnt 'name' enums 12 // these must match the sfnt 'name' enums
13 kFontFamilyName = 0x01, 13 kFontFamilyName = 0x01,
14 kFullName = 0x04, 14 kFullName = 0x04,
15 kPostscriptName = 0x06, 15 kPostscriptName = 0x06,
16 16
17 // These count backwards from 0xFF, so as not to collide with the SFNT 17 // These count backwards from 0xFF, so as not to collide with the SFNT
18 // defines for names in its 'name' table. 18 // defines for names in its 'name' table.
19 kFontFileName = 0xFE, 19 kFontFileName = 0xFE,
20 kSentinel = 0xFF, 20 kSentinel = 0xFF,
21 }; 21 };
22 22
23 SkFontDescriptor::SkFontDescriptor(SkTypeface::Style style) { 23 SkFontDescriptor::SkFontDescriptor(SkTypeface::Style style) {
24 fStyle = style; 24 fStyle = style;
25 } 25 }
26 26
27 static void read_string(SkStream* stream, SkString* string) { 27 static void read_string(SkStream* stream, SkString* string) {
28 const uint32_t length = stream->readPackedUInt(); 28 const uint32_t length = SkToU32(stream->readPackedUInt());
29 if (length > 0) { 29 if (length > 0) {
30 string->resize(length); 30 string->resize(length);
31 stream->read(string->writable_str(), length); 31 stream->read(string->writable_str(), length);
32 } 32 }
33 } 33 }
34 34
35 static void write_string(SkWStream* stream, const SkString& string, 35 static void write_string(SkWStream* stream, const SkString& string,
36 uint32_t id) { 36 uint32_t id) {
37 if (!string.isEmpty()) { 37 if (!string.isEmpty()) {
38 stream->writePackedUInt(id); 38 stream->writePackedUInt(id);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void SkFontDescriptor::serialize(SkWStream* stream) { 70 void SkFontDescriptor::serialize(SkWStream* stream) {
71 stream->writePackedUInt(fStyle); 71 stream->writePackedUInt(fStyle);
72 72
73 write_string(stream, fFamilyName, kFontFamilyName); 73 write_string(stream, fFamilyName, kFontFamilyName);
74 write_string(stream, fFullName, kFullName); 74 write_string(stream, fFullName, kFullName);
75 write_string(stream, fPostscriptName, kPostscriptName); 75 write_string(stream, fPostscriptName, kPostscriptName);
76 write_string(stream, fFontFileName, kFontFileName); 76 write_string(stream, fFontFileName, kFontFileName);
77 77
78 stream->writePackedUInt(kSentinel); 78 stream->writePackedUInt(kSentinel);
79 } 79 }
OLDNEW
« no previous file with comments | « src/core/SkError.cpp ('k') | src/core/SkGlyphCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698