summaryrefslogtreecommitdiffstats
path: root/base/files
diff options
context:
space:
mode:
authorbrucedawson <brucedawson@chromium.org>2015-10-06 12:22:00 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-06 19:22:59 +0000
commit5604a11d546e02859db5dc75af72ce27bc14c158 (patch)
tree4af3fe43eaec732842b4999cce507c37edb1a94c /base/files
parenta45aa1efa4b5e8307e9cfe119892899c3f922852 (diff)
downloadchromium_src-5604a11d546e02859db5dc75af72ce27bc14c158.zip
chromium_src-5604a11d546e02859db5dc75af72ce27bc14c158.tar.gz
chromium_src-5604a11d546e02859db5dc75af72ce27bc14c158.tar.bz2
Detecting and fixing stringprintf.h format bugs
The print functions in stringprintf.h were not annotated for /analyze so 13 Windows specific format-string bugs accumulated. This annotates the functions so that the /analyze builder will find the problems and fixes the bugs. R=thestig@chromium.org,wfh@chromium.org,jam@chromium.org Skipping wstring presubmit checks - no new wstring usage is added NOPRESUBMIT=true BUG=427616 Review URL: https://codereview.chromium.org/1372153002 Cr-Commit-Position: refs/heads/master@{#352659}
Diffstat (limited to 'base/files')
-rw-r--r--base/files/file_path.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/base/files/file_path.h b/base/files/file_path.h
index 25b8391..fba2f98 100644
--- a/base/files/file_path.h
+++ b/base/files/file_path.h
@@ -124,6 +124,15 @@
#define FILE_PATH_USES_WIN_SEPARATORS
#endif // OS_WIN
+// To print path names portably use PRIsFP (based on PRIuS and friends from
+// C99 and format_macros.h) like this:
+// base::StringPrintf("Path is %" PRIsFP ".\n", path.value().c_str());
+#if defined(OS_POSIX)
+#define PRIsFP "s"
+#elif defined(OS_WIN)
+#define PRIsFP "ls"
+#endif // OS_WIN
+
namespace base {
class Pickle;