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

Unified Diff: tools/flags/SkCommandLineFlags.cpp

Issue 924343002: Negative numbers are not flags. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/flags/SkCommandLineFlags.cpp
diff --git a/tools/flags/SkCommandLineFlags.cpp b/tools/flags/SkCommandLineFlags.cpp
index 50c193fdf23f309ef92bc081f33676813084d97e..6f1491bf1cb00dcd8bd506c1fec4458dc781860b 100644
--- a/tools/flags/SkCommandLineFlags.cpp
+++ b/tools/flags/SkCommandLineFlags.cpp
@@ -282,7 +282,12 @@ void SkCommandLineFlags::Parse(int argc, char** argv) {
case SkFlagInfo::kString_FlagType:
flag->resetStrings();
// Add all arguments until another flag is reached.
- while (i+1 < argc && !SkStrStartsWith(argv[i+1], '-')) {
+ while (i+1 < argc) {
+ char* end = NULL;
+ (void)strtod(argv[i+1], &end); // Negative numbers aren't flags.
+ if (end == argv[i+1] && SkStrStartsWith(argv[i+1], '-')) {
+ break;
+ }
i++;
flag->append(argv[i]);
}
« 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