OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_INSTALLER_MINI_INSTALLER_MINI_STRING_H_ | 5 #ifndef CHROME_INSTALLER_MINI_INSTALLER_MINI_STRING_H_ |
6 #define CHROME_INSTALLER_MINI_INSTALLER_MINI_STRING_H_ | 6 #define CHROME_INSTALLER_MINI_INSTALLER_MINI_STRING_H_ |
7 | 7 |
8 #ifndef COMPILE_ASSERT | 8 #ifndef COMPILE_ASSERT |
9 // COMPILE_ASSERT macro borrowed from macros.h | 9 // Some bots that build mini_installer don't know static_assert. |
| 10 #if __cplusplus >= 201103L |
10 #define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg) | 11 #define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg) |
| 12 #else |
| 13 template <bool> |
| 14 struct CompileAssert {}; |
| 15 #define COMPILE_ASSERT(expr, msg) \ |
| 16 typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] |
| 17 #endif |
11 #endif | 18 #endif |
12 | 19 |
13 namespace mini_installer { | 20 namespace mini_installer { |
14 | 21 |
15 // NOTE: Do not assume that these string functions support UTF encoding. | 22 // NOTE: Do not assume that these string functions support UTF encoding. |
16 // This is fine for the purposes of the mini_installer, but you have | 23 // This is fine for the purposes of the mini_installer, but you have |
17 // been warned! | 24 // been warned! |
18 | 25 |
19 // Formats a sequence of |bytes| as hex. The |str| buffer must have room for | 26 // Formats a sequence of |bytes| as hex. The |str| buffer must have room for |
20 // at least 2*|size| + 1. | 27 // at least 2*|size| + 1. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 wchar_t buffer_[kCapacity + 1]; | 143 wchar_t buffer_[kCapacity + 1]; |
137 | 144 |
138 private: | 145 private: |
139 StackString(const StackString&); | 146 StackString(const StackString&); |
140 StackString& operator=(const StackString&); | 147 StackString& operator=(const StackString&); |
141 }; | 148 }; |
142 | 149 |
143 } // namespace mini_installer | 150 } // namespace mini_installer |
144 | 151 |
145 #endif // CHROME_INSTALLER_MINI_INSTALLER_MINI_STRING_H_ | 152 #endif // CHROME_INSTALLER_MINI_INSTALLER_MINI_STRING_H_ |
OLD | NEW |