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}
CrOS-Libchrome-Original-Commit: 5604a11d546e02859db5dc75af72ce27bc14c158
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;