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

Side by Side Diff: tools/flags/SkCommandLineFlags.cpp

Issue 14472017: Fix the build. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 8 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 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 "SkCommandLineFlags.h" 8 #include "SkCommandLineFlags.h"
9 #include "SkTDArray.h" 9 #include "SkTDArray.h"
10 10
11 bool SkFlagInfo::CreateStringFlag(const char* name, const char* shortName, 11 bool SkFlagInfo::CreateStringFlag(const char* name, const char* shortName,
12 SkCommandLineFlags::StringArray* pStrings, 12 SkCommandLineFlags::StringArray* pStrings,
13 const char* defaultValue, const char* helpStri ng) { 13 const char* defaultValue, const char* helpStri ng) {
14 SkFlagInfo* info = SkNEW_ARGS(SkFlagInfo, (name, shortName, kString_FlagType , helpString)); 14 SkFlagInfo* info = SkNEW_ARGS(SkFlagInfo, (name, shortName, kString_FlagType , helpString));
15 info->fDefaultString.set(defaultValue); 15 info->fDefaultString.set(defaultValue);
16 16
17 info->fStrings = pStrings; 17 info->fStrings = pStrings;
18 SetDefaultStrings(pStrings, defaultValue); 18 SetDefaultStrings(pStrings, defaultValue);
19 return true; 19 return true;
20 } 20 }
21 21
22 void SkFlagInfo::SetDefaultStrings(SkCommandLineFlags::StringArray* pStrings, 22 void SkFlagInfo::SetDefaultStrings(SkCommandLineFlags::StringArray* pStrings,
23 const char* defaultValue) { 23 const char* defaultValue) {
24 pStrings->reset(); 24 pStrings->reset();
25 if (NULL == defaultValue) {
26 return;
27 }
25 // If default is "", leave the array empty. 28 // If default is "", leave the array empty.
26 size_t defaultLength = strlen(defaultValue); 29 size_t defaultLength = strlen(defaultValue);
27 if (defaultLength > 0) { 30 if (defaultLength > 0) {
28 const char* const defaultEnd = defaultValue + defaultLength; 31 const char* const defaultEnd = defaultValue + defaultLength;
29 const char* begin = defaultValue; 32 const char* begin = defaultValue;
30 while (true) { 33 while (true) {
31 while (begin < defaultEnd && ' ' == *begin) { 34 while (begin < defaultEnd && ' ' == *begin) {
32 begin++; 35 begin++;
33 } 36 }
34 if (begin < defaultEnd) { 37 if (begin < defaultEnd) {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 gHead = NULL; 296 gHead = NULL;
294 while (flag != NULL) { 297 while (flag != NULL) {
295 SkFlagInfo* next = flag->next(); 298 SkFlagInfo* next = flag->next();
296 SkDELETE(flag); 299 SkDELETE(flag);
297 flag = next; 300 flag = next;
298 } 301 }
299 if (helpPrinted) { 302 if (helpPrinted) {
300 exit(0); 303 exit(0);
301 } 304 }
302 } 305 }
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