| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_STRINGS_SAFE_SPRINTF_H_ | 5 #ifndef BASE_STRINGS_SAFE_SPRINTF_H_ |
| 6 #define BASE_STRINGS_SAFE_SPRINTF_H_ | 6 #define BASE_STRINGS_SAFE_SPRINTF_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| 11 #include <stdint.h> | 11 #include <stdint.h> |
| 12 #include <stdlib.h> | 12 #include <stdlib.h> |
| 13 | 13 |
| 14 #if defined(OS_POSIX) | 14 #if defined(OS_POSIX) |
| 15 // For ssize_t | 15 // For ssize_t |
| 16 #include <unistd.h> | 16 #include <unistd.h> |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 #include "base/base_export.h" | 19 #include "base/base_export.h" |
| 20 #include "base/basictypes.h" | |
| 21 | 20 |
| 22 namespace base { | 21 namespace base { |
| 23 namespace strings { | 22 namespace strings { |
| 24 | 23 |
| 25 #if defined(_MSC_VER) | 24 #if defined(_MSC_VER) |
| 26 // Define ssize_t inside of our namespace. | 25 // Define ssize_t inside of our namespace. |
| 27 #if defined(_WIN64) | 26 #if defined(_WIN64) |
| 28 typedef __int64 ssize_t; | 27 typedef __int64 ssize_t; |
| 29 #else | 28 #else |
| 30 typedef long ssize_t; | 29 typedef long ssize_t; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 BASE_EXPORT ssize_t SafeSNPrintf(char* buf, size_t N, const char* fmt); | 237 BASE_EXPORT ssize_t SafeSNPrintf(char* buf, size_t N, const char* fmt); |
| 239 template<size_t N> | 238 template<size_t N> |
| 240 inline ssize_t SafeSPrintf(char (&buf)[N], const char* fmt) { | 239 inline ssize_t SafeSPrintf(char (&buf)[N], const char* fmt) { |
| 241 return SafeSNPrintf(buf, N, fmt); | 240 return SafeSNPrintf(buf, N, fmt); |
| 242 } | 241 } |
| 243 | 242 |
| 244 } // namespace strings | 243 } // namespace strings |
| 245 } // namespace base | 244 } // namespace base |
| 246 | 245 |
| 247 #endif // BASE_STRINGS_SAFE_SPRINTF_H_ | 246 #endif // BASE_STRINGS_SAFE_SPRINTF_H_ |
| OLD | NEW |