| Index: base/strings/stringprintf.h
|
| diff --git a/base/strings/stringprintf.h b/base/strings/stringprintf.h
|
| index 523f7ee55bf3693895b2d2d43d73f1c50565cb12..4b2eab1424a9f02984a9a540be880b0aec0cc4ba 100644
|
| --- a/base/strings/stringprintf.h
|
| +++ b/base/strings/stringprintf.h
|
| @@ -11,15 +11,26 @@
|
|
|
| #include "base/base_export.h"
|
| #include "base/compiler_specific.h"
|
| +#include "build/build_config.h"
|
| +
|
| +#ifdef COMPILER_MSVC
|
| +// For _Printf_format_string_.
|
| +#include <sal.h>
|
| +#else
|
| +// For nacl builds when sal.h is not available.
|
| +#define _Printf_format_string_
|
| +#endif
|
|
|
| namespace base {
|
|
|
| // Return a C++ string given printf-like input.
|
| -BASE_EXPORT std::string StringPrintf(const char* format, ...)
|
| +BASE_EXPORT std::string StringPrintf(_Printf_format_string_ const char* format,
|
| + ...)
|
| PRINTF_FORMAT(1, 2) WARN_UNUSED_RESULT;
|
| #if defined(OS_WIN)
|
| -BASE_EXPORT std::wstring StringPrintf(const wchar_t* format, ...)
|
| - WPRINTF_FORMAT(1, 2) WARN_UNUSED_RESULT;
|
| +BASE_EXPORT std::wstring StringPrintf(
|
| + _Printf_format_string_ const wchar_t* format,
|
| + ...) WPRINTF_FORMAT(1, 2) WARN_UNUSED_RESULT;
|
| #endif
|
|
|
| // Return a C++ string given vprintf-like input.
|
| @@ -27,21 +38,25 @@ BASE_EXPORT std::string StringPrintV(const char* format, va_list ap)
|
| PRINTF_FORMAT(1, 0) WARN_UNUSED_RESULT;
|
|
|
| // Store result into a supplied string and return it.
|
| -BASE_EXPORT const std::string& SStringPrintf(std::string* dst,
|
| - const char* format, ...)
|
| - PRINTF_FORMAT(2, 3);
|
| +BASE_EXPORT const std::string& SStringPrintf(
|
| + std::string* dst,
|
| + _Printf_format_string_ const char* format,
|
| + ...) PRINTF_FORMAT(2, 3);
|
| #if defined(OS_WIN)
|
| -BASE_EXPORT const std::wstring& SStringPrintf(std::wstring* dst,
|
| - const wchar_t* format, ...)
|
| - WPRINTF_FORMAT(2, 3);
|
| +BASE_EXPORT const std::wstring& SStringPrintf(
|
| + std::wstring* dst,
|
| + _Printf_format_string_ const wchar_t* format,
|
| + ...) WPRINTF_FORMAT(2, 3);
|
| #endif
|
|
|
| // Append result to a supplied string.
|
| -BASE_EXPORT void StringAppendF(std::string* dst, const char* format, ...)
|
| - PRINTF_FORMAT(2, 3);
|
| +BASE_EXPORT void StringAppendF(std::string* dst,
|
| + _Printf_format_string_ const char* format,
|
| + ...) PRINTF_FORMAT(2, 3);
|
| #if defined(OS_WIN)
|
| -BASE_EXPORT void StringAppendF(std::wstring* dst, const wchar_t* format, ...)
|
| - WPRINTF_FORMAT(2, 3);
|
| +BASE_EXPORT void StringAppendF(std::wstring* dst,
|
| + _Printf_format_string_ const wchar_t* format,
|
| + ...) WPRINTF_FORMAT(2, 3);
|
| #endif
|
|
|
| // Lower-level routine that takes a va_list and appends to a specified
|
|
|