OLD | NEW |
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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 while (!sk_feof(fp)) { | 21 while (!sk_feof(fp)) { |
22 | 22 |
23 if (!sk_fgets(line, sizeof(line), fp)) { | 23 if (!sk_fgets(line, sizeof(line), fp)) { |
24 break; | 24 break; |
25 } | 25 } |
26 | 26 |
27 char *commentptr = strchr(line, '#'); | 27 char *commentptr = strchr(line, '#'); |
28 if (commentptr == line) { | 28 if (commentptr == line) { |
29 continue; | 29 continue; |
30 } | 30 } |
31 if (NULL != commentptr) { | 31 if (commentptr) { |
32 *commentptr = '\0'; | 32 *commentptr = '\0'; |
33 } | 33 } |
34 | 34 |
35 char sep[] = " \t\r\n"; | 35 char sep[] = " \t\r\n"; |
36 | 36 |
37 char *keyptr = strtok(line, sep); | 37 char *keyptr = strtok(line, sep); |
38 if (!keyptr) { | 38 if (!keyptr) { |
39 continue; | 39 continue; |
40 } | 40 } |
41 | 41 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 for (int i = 0 ; i < fConfigFileKeys.count() ; i++) { | 92 for (int i = 0 ; i < fConfigFileKeys.count() ; i++) { |
93 if (!fConfs.find(fConfigFileKeys[i]->c_str())) { | 93 if (!fConfs.find(fConfigFileKeys[i]->c_str())) { |
94 SkDebugf("WARNING: You have config value %s in your configuration fi
le, but I've never heard of that.\n", fConfigFileKeys[i]->c_str()); | 94 SkDebugf("WARNING: You have config value %s in your configuration fi
le, but I've never heard of that.\n", fConfigFileKeys[i]->c_str()); |
95 } | 95 } |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 void SkRTConfRegistry::printAll(const char *fname) const { | 99 void SkRTConfRegistry::printAll(const char *fname) const { |
100 SkWStream *o; | 100 SkWStream *o; |
101 | 101 |
102 if (NULL != fname) { | 102 if (fname) { |
103 o = new SkFILEWStream(fname); | 103 o = new SkFILEWStream(fname); |
104 } else { | 104 } else { |
105 o = new SkDebugWStream(); | 105 o = new SkDebugWStream(); |
106 } | 106 } |
107 | 107 |
108 ConfMap::Iter iter(fConfs); | 108 ConfMap::Iter iter(fConfs); |
109 SkTDArray<SkRTConfBase *> *confArray; | 109 SkTDArray<SkRTConfBase *> *confArray; |
110 | 110 |
111 while (iter.next(&confArray)) { | 111 while (iter.next(&confArray)) { |
112 if (confArray->getAt(0)->isDefault()) { | 112 if (confArray->getAt(0)->isDefault()) { |
(...skipping 13 matching lines...) Expand all Loading... |
126 if (!confArray->getAt(0)->isDefault()) { | 126 if (!confArray->getAt(0)->isDefault()) { |
127 return true; | 127 return true; |
128 } | 128 } |
129 } | 129 } |
130 return false; | 130 return false; |
131 } | 131 } |
132 | 132 |
133 void SkRTConfRegistry::printNonDefault(const char *fname) const { | 133 void SkRTConfRegistry::printNonDefault(const char *fname) const { |
134 SkWStream *o; | 134 SkWStream *o; |
135 | 135 |
136 if (NULL != fname) { | 136 if (fname) { |
137 o = new SkFILEWStream(fname); | 137 o = new SkFILEWStream(fname); |
138 } else { | 138 } else { |
139 o = new SkDebugWStream(); | 139 o = new SkDebugWStream(); |
140 } | 140 } |
141 ConfMap::Iter iter(fConfs); | 141 ConfMap::Iter iter(fConfs); |
142 SkTDArray<SkRTConfBase *> *confArray; | 142 SkTDArray<SkRTConfBase *> *confArray; |
143 | 143 |
144 while (iter.next(&confArray)) { | 144 while (iter.next(&confArray)) { |
145 if (!confArray->getAt(0)->isDefault()) { | 145 if (!confArray->getAt(0)->isDefault()) { |
146 confArray->getAt(0)->print(o); | 146 confArray->getAt(0)->print(o); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 template void SkRTConfRegistry::set(const char *name, int value, bool); | 314 template void SkRTConfRegistry::set(const char *name, int value, bool); |
315 template void SkRTConfRegistry::set(const char *name, unsigned int value, bool); | 315 template void SkRTConfRegistry::set(const char *name, unsigned int value, bool); |
316 template void SkRTConfRegistry::set(const char *name, float value, bool); | 316 template void SkRTConfRegistry::set(const char *name, float value, bool); |
317 template void SkRTConfRegistry::set(const char *name, double value, bool); | 317 template void SkRTConfRegistry::set(const char *name, double value, bool); |
318 template void SkRTConfRegistry::set(const char *name, char * value, bool); | 318 template void SkRTConfRegistry::set(const char *name, char * value, bool); |
319 | 319 |
320 SkRTConfRegistry &skRTConfRegistry() { | 320 SkRTConfRegistry &skRTConfRegistry() { |
321 static SkRTConfRegistry r; | 321 static SkRTConfRegistry r; |
322 return r; | 322 return r; |
323 } | 323 } |
OLD | NEW |