diff options
author | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-14 01:25:32 +0000 |
---|---|---|
committer | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-14 01:25:32 +0000 |
commit | 44cd16fcc85697b5094250a89decaab5c692b392 (patch) | |
tree | 37e4fb0dbee34f2cc673c287b54515a71b1f9629 /base/string_util_win.h | |
parent | 5f800edb90578f08b3462e1dc96b78bf0ec56d36 (diff) | |
download | chromium_src-44cd16fcc85697b5094250a89decaab5c692b392.zip chromium_src-44cd16fcc85697b5094250a89decaab5c692b392.tar.gz chromium_src-44cd16fcc85697b5094250a89decaab5c692b392.tar.bz2 |
DCHECK vswprintf format string cross-platform portability. Use %ls, not %s, for wchar_t* fields.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@849 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util_win.h')
-rw-r--r-- | base/string_util_win.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/base/string_util_win.h b/base/string_util_win.h index bec84042..80ebd38 100644 --- a/base/string_util_win.h +++ b/base/string_util_win.h @@ -27,14 +27,16 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef BASE_STRING_UTIL_WIN_H__ -#define BASE_STRING_UTIL_WIN_H__ +#ifndef BASE_STRING_UTIL_WIN_H_ +#define BASE_STRING_UTIL_WIN_H_ #include <stdarg.h> #include <stdio.h> #include <string.h> #include <wchar.h> +#include "base/logging.h" + namespace base { inline int strncasecmp(const char* s1, const char* s2, size_t count) { @@ -51,6 +53,8 @@ inline int vsnprintf(char* buffer, size_t size, inline int vswprintf(wchar_t* buffer, size_t size, const wchar_t* format, va_list arguments) { + DCHECK(IsWprintfFormatPortable(format)); + int length = _vsnwprintf_s(buffer, size, size - 1, format, arguments); if (length < 0) return _vscwprintf(format, arguments); @@ -59,4 +63,4 @@ inline int vswprintf(wchar_t* buffer, size_t size, } // namespace base -#endif // BASE_STRING_UTIL_WIN_H__ +#endif // BASE_STRING_UTIL_WIN_H_ |