Upstream fix for DecodeBench.
Use SkBasename to get the basename.
Fixes a bug on Android where calling strrchar conflicts with
Android's setting for FORTIFY_SOURCE.
R=djsollen@google.com
Author: scroggo@google.com
Review URL: https://codereview.chromium.org/170783012
git-svn-id: http://skia.googlecode.com/svn/trunk@13511 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/DecodeBench.cpp b/bench/DecodeBench.cpp
index 3f535d2..a6ab4a5 100644
--- a/bench/DecodeBench.cpp
+++ b/bench/DecodeBench.cpp
@@ -9,6 +9,7 @@
#include "SkBitmap.h"
#include "SkCommandLineFlags.h"
#include "SkImageDecoder.h"
+#include "SkOSFile.h"
#include "SkString.h"
DEFINE_string(decodeBenchFilename, "resources/CMYK.jpeg", "Path to image for DecodeBench.");
@@ -24,11 +25,8 @@
DecodeBench(SkBitmap::Config c) {
fPrefConfig = c;
- const char* fname = strrchr(FLAGS_decodeBenchFilename[0], '/');
- if (fname) {
- fname++; // skip the slash
- }
- fName.printf("decode_%s_%s", gConfigName[c], fname);
+ SkString fname = SkOSPath::SkBasename(FLAGS_decodeBenchFilename[0]);
+ fName.printf("decode_%s_%s", gConfigName[c], fname.c_str());
}
virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {