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
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 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 @@
} // namespace base
-#endif // BASE_STRING_UTIL_WIN_H__
+#endif // BASE_STRING_UTIL_WIN_H_