Fixed doParse functions
authorsugoi@google.com <sugoi@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 4 Mar 2013 21:03:17 +0000 (21:03 +0000)
committersugoi@google.com <sugoi@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 4 Mar 2013 21:03:17 +0000 (21:03 +0000)
For some reason, "success" wasn't set in a bunch of template specializations, causing it to be invalid when used later on.
Review URL: https://codereview.appspot.com/7370052

git-svn-id: http://skia.googlecode.com/svn/trunk@7969 2bbb7eff-a529-9590-31e7-b0007b416f81

src/utils/SkRTConf.cpp

index c701552..29f0238 100644 (file)
@@ -145,7 +145,7 @@ void SkRTConfRegistry::registerConf(SkRTConfBase *conf) {
     }
 }
 
-template <typename T> T doParse(const char *s, bool *success ) {
+template <typename T> T doParse(const char *, bool *success ) {
     SkDebugf("WARNING: Invoked non-specialized doParse function...\n");
     if (success) {
         *success = false;
@@ -177,18 +177,30 @@ template<> const char * doParse<const char *>(const char * s, bool *success) {
 }
 
 template<> int doParse<int>(const char * s, bool *success) {
+    if (success) {
+        *success = true;
+    }
     return atoi(s);
 }
 
 template<> unsigned int doParse<unsigned int>(const char * s, bool *success) {
+    if (success) {
+        *success = true;
+    }
     return (unsigned int) atoi(s);
 }
 
 template<> float doParse<float>(const char * s, bool *success) {
+    if (success) {
+        *success = true;
+    }
     return (float) atof(s);
 }
 
 template<> double doParse<double>(const char * s, bool *success) {
+    if (success) {
+        *success = true;
+    }
     return atof(s);
 }