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

Side by Side Diff: src/ports/SkFontConfigParser_android.cpp

Issue 24171003: cleanup XML_Parser after reading android config files. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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 | « no previous file | no next file » | 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 2011 The Android Open Source Project 2 * Copyright 2011 The Android Open Source Project
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 "SkFontConfigParser_android.h" 8 #include "SkFontConfigParser_android.h"
9 #include "SkTDArray.h" 9 #include "SkTDArray.h"
10 #include "SkTypeface.h" 10 #include "SkTypeface.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 char buffer[512]; 212 char buffer[512];
213 bool done = false; 213 bool done = false;
214 while (!done) { 214 while (!done) {
215 fgets(buffer, sizeof(buffer), file); 215 fgets(buffer, sizeof(buffer), file);
216 int len = strlen(buffer); 216 int len = strlen(buffer);
217 if (feof(file) != 0) { 217 if (feof(file) != 0) {
218 done = true; 218 done = true;
219 } 219 }
220 XML_Parse(parser, buffer, len, done); 220 XML_Parse(parser, buffer, len, done);
221 } 221 }
222 XML_ParserFree(parser);
222 fclose(file); 223 fclose(file);
223 } 224 }
224 225
225 static void getSystemFontFamilies(SkTDArray<FontFamily*> &fontFamilies) { 226 static void getSystemFontFamilies(SkTDArray<FontFamily*> &fontFamilies) {
226 parseConfigFile(SYSTEM_FONTS_FILE, fontFamilies); 227 parseConfigFile(SYSTEM_FONTS_FILE, fontFamilies);
227 } 228 }
228 229
229 static void getFallbackFontFamilies(SkTDArray<FontFamily*> &fallbackFonts) { 230 static void getFallbackFontFamilies(SkTDArray<FontFamily*> &fallbackFonts) {
230 SkTDArray<FontFamily*> vendorFonts; 231 SkTDArray<FontFamily*> vendorFonts;
231 parseConfigFile(FALLBACK_FONTS_FILE, fallbackFonts); 232 parseConfigFile(FALLBACK_FONTS_FILE, fallbackFonts);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 SkString locale(6); 310 SkString locale(6);
310 char* localeCStr = locale.writable_str(); 311 char* localeCStr = locale.writable_str();
311 312
312 strncpy(localeCStr, propLang, 2); 313 strncpy(localeCStr, propLang, 2);
313 localeCStr[2] = '-'; 314 localeCStr[2] = '-';
314 strncpy(&localeCStr[3], propRegn, 2); 315 strncpy(&localeCStr[3], propRegn, 2);
315 localeCStr[5] = '\0'; 316 localeCStr[5] = '\0';
316 317
317 return locale; 318 return locale;
318 } 319 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698