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

Side by Side Diff: src/utils/SkRTConf.cpp

Issue 1467533003: Eliminate SkFILE - it always is the same as FILE. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-11-20 (Friday) 14:01:26 EST Created 5 years, 1 month 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
« no previous file with comments | « src/ports/SkOSFile_win.cpp ('k') | src/utils/SkWhitelistTypefaces.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 2013 Google Inc. 2 * Copyright 2013 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 "SkRTConf.h" 8 #include "SkRTConf.h"
9 #include "SkOSFile.h" 9 #include "SkOSFile.h"
10 10
11 #include <stdlib.h> 11 #include <stdlib.h>
12 12
13 SkRTConfRegistry::SkRTConfRegistry(): fConfs(100) { 13 SkRTConfRegistry::SkRTConfRegistry(): fConfs(100) {
14 14
15 SkFILE *fp = sk_fopen(configFileLocation(), kRead_SkFILE_Flag); 15 FILE *fp = sk_fopen(configFileLocation(), kRead_SkFILE_Flag);
16 16
17 if (!fp) { 17 if (!fp) {
18 return; 18 return;
19 } 19 }
20 20
21 char line[1024]; 21 char line[1024];
22 22
23 while (!sk_feof(fp)) { 23 while (!sk_feof(fp)) {
24 24
25 if (!sk_fgets(line, sizeof(line), fp)) { 25 if (!sk_fgets(line, sizeof(line), fp)) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 const char *SkRTConfRegistry::configFileLocation() const { 72 const char *SkRTConfRegistry::configFileLocation() const {
73 return "skia.conf"; // for now -- should probably do something fancier like home directories or whatever. 73 return "skia.conf"; // for now -- should probably do something fancier like home directories or whatever.
74 } 74 }
75 75
76 // dump all known runtime config options to the file with their default values. 76 // dump all known runtime config options to the file with their default values.
77 // to trigger this, make a config file of zero size. 77 // to trigger this, make a config file of zero size.
78 void SkRTConfRegistry::possiblyDumpFile() const { 78 void SkRTConfRegistry::possiblyDumpFile() const {
79 const char *path = configFileLocation(); 79 const char *path = configFileLocation();
80 SkFILE *fp = sk_fopen(path, kRead_SkFILE_Flag); 80 FILE *fp = sk_fopen(path, kRead_SkFILE_Flag);
81 if (!fp) { 81 if (!fp) {
82 return; 82 return;
83 } 83 }
84 size_t configFileSize = sk_fgetsize(fp); 84 size_t configFileSize = sk_fgetsize(fp);
85 if (configFileSize == 0) { 85 if (configFileSize == 0) {
86 printAll(path); 86 printAll(path);
87 } 87 }
88 sk_fclose(fp); 88 sk_fclose(fp);
89 } 89 }
90 90
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 template void SkRTConfRegistry::set(const char *name, int value, bool); 316 template void SkRTConfRegistry::set(const char *name, int value, bool);
317 template void SkRTConfRegistry::set(const char *name, unsigned int value, bool); 317 template void SkRTConfRegistry::set(const char *name, unsigned int value, bool);
318 template void SkRTConfRegistry::set(const char *name, float value, bool); 318 template void SkRTConfRegistry::set(const char *name, float value, bool);
319 template void SkRTConfRegistry::set(const char *name, double value, bool); 319 template void SkRTConfRegistry::set(const char *name, double value, bool);
320 template void SkRTConfRegistry::set(const char *name, char * value, bool); 320 template void SkRTConfRegistry::set(const char *name, char * value, bool);
321 321
322 SkRTConfRegistry &skRTConfRegistry() { 322 SkRTConfRegistry &skRTConfRegistry() {
323 static SkRTConfRegistry r; 323 static SkRTConfRegistry r;
324 return r; 324 return r;
325 } 325 }
OLDNEW
« no previous file with comments | « src/ports/SkOSFile_win.cpp ('k') | src/utils/SkWhitelistTypefaces.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698