Revert of remove sprintf (https://codereview.chromium.org/230413005/)
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 9 Apr 2014 23:38:57 +0000 (23:38 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 9 Apr 2014 23:38:57 +0000 (23:38 +0000)
Reason for revert:
Boo, hiss, SK_ARRAY_COUNT not defined in skia_launcher.cpp!

Original issue's description:
> remove sprintf
>
> Committed: http://code.google.com/p/skia/source/detail?r=14123

R=halcanary@google.com
TBR=halcanary@google.com
NOTREECHECKS=true
NOTRY=true

Author: mtklein@google.com

Review URL: https://codereview.chromium.org/232323002

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

platform_tools/android/launcher/skia_launcher.cpp
src/core/SkError.cpp

index d1bdcb5..746d470 100644 (file)
@@ -8,10 +8,6 @@
 #include <dlfcn.h>
 #include <stdio.h>
 
-#ifdef SK_BUILD_FOR_WIN
-    #define snprintf _snprintf
-#endif
-
 void usage() {
     printf("[USAGE] skia_launcher program_name [options]\n");
     printf("  program_name: the skia program you want to launch (e.g. tests, bench)\n");
@@ -36,8 +32,7 @@ void* load_library(const char* appLocation, const char* libraryName)
 {
      // attempt to lookup the location of the shared libraries
     char libraryLocation[100];
-    snprintf(libraryLocation, SK_ARRAY_COUNT(libraryLocation),
-             "%s/lib%s.so", appLocation, libraryName);
+    sprintf(libraryLocation, "%s/lib%s.so", appLocation, libraryName);
     if (!file_exists(libraryLocation)) {
         printf("ERROR: Unable to find the '%s' library in the Skia App.\n", libraryName);
         printf("ERROR: Did you provide the correct program_name?\n");
index 2c4abc6..9e8ff2d 100644 (file)
 #include <stdio.h>
 #include <stdarg.h>
 
-#ifdef SK_BUILD_FOR_WIN
-    #define snprintf _snprintf
-#endif
-
 namespace {
     void *CreateThreadError() {
         return SkNEW_ARGS(SkError, (kNoError_SkError));
@@ -133,7 +129,7 @@ void SkErrorInternals::SetError(SkError code, const char *fmt, ...) {
             break;
     }
 
-    snprintf(str, ERROR_STRING_LENGTH, "%s: ", error_name);
+    sprintf( str, "%s: ", error_name );
     int string_left = SkToInt(ERROR_STRING_LENGTH - strlen(str));
     str += strlen(str);