• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_STRINGS_STRING_UTIL_WIN_H_
6 #define BASE_STRINGS_STRING_UTIL_WIN_H_
7 
8 #include <stdarg.h>
9 #include <stddef.h>
10 #include <stdio.h>
11 #include <string.h>
12 
13 #include "base/logging.h"
14 
15 namespace base {
16 
vsnprintf(char * buffer,size_t size,const char * format,va_list arguments)17 inline int vsnprintf(char* buffer,
18                      size_t size,
19                      const char* format,
20                      va_list arguments) {
21   int length = vsnprintf_s(buffer, size, size - 1, format, arguments);
22   if (length < 0)
23     return _vscprintf(format, arguments);
24   return length;
25 }
26 
27 }  // namespace base
28 
29 #endif  // BASE_STRINGS_STRING_UTIL_WIN_H_
30