Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(672)

Side by Side Diff: core/fxcrt/include/fx_system.h

Issue 1874773002: Templatize CFX_{Byte,Wide}StringC (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Remove one <type_traits> include. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fxcrt/include/fx_string.h ('k') | pdfium.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_FXCRT_INCLUDE_FX_SYSTEM_H_ 7 #ifndef CORE_FXCRT_INCLUDE_FX_SYSTEM_H_
8 #define CORE_FXCRT_INCLUDE_FX_SYSTEM_H_ 8 #define CORE_FXCRT_INCLUDE_FX_SYSTEM_H_
9 9
10 #include <assert.h> 10 #include <assert.h>
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 151 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
152 152
153 #ifdef __cplusplus 153 #ifdef __cplusplus
154 } // extern "C" 154 } // extern "C"
155 155
156 #include "third_party/base/numerics/safe_conversions.h" 156 #include "third_party/base/numerics/safe_conversions.h"
157 157
158 #define FXSYS_strlen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(strlen(ptr)) 158 #define FXSYS_strlen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(strlen(ptr))
159 #define FXSYS_wcslen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(wcslen(ptr)) 159 #define FXSYS_wcslen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(wcslen(ptr))
160 160
161 // Overloaded functions for C++ templates
162 inline FX_STRSIZE FXSYS_len(const FX_CHAR* ptr) {
163 return FXSYS_strlen(ptr);
164 }
165
166 inline FX_STRSIZE FXSYS_len(const FX_WCHAR* ptr) {
167 return FXSYS_wcslen(ptr);
168 }
169
170 inline int FXSYS_cmp(const FX_CHAR* ptr1, const FX_CHAR* ptr2, size_t len) {
171 return memcmp(ptr1, ptr2, len);
172 }
173
174 inline int FXSYS_cmp(const FX_WCHAR* ptr1, const FX_WCHAR* ptr2, size_t len) {
175 return wmemcmp(ptr1, ptr2, len);
176 }
177
178 inline const FX_CHAR* FXSYS_chr(const FX_CHAR* ptr, FX_CHAR ch, size_t len) {
179 return reinterpret_cast<const FX_CHAR*>(memchr(ptr, ch, len));
180 }
181
182 inline const FX_WCHAR* FXSYS_chr(const FX_WCHAR* ptr, FX_WCHAR ch, size_t len) {
183 return wmemchr(ptr, ch, len);
184 }
185
161 extern "C" { 186 extern "C" {
162 #else 187 #else
163 #define FXSYS_strlen(ptr) ((FX_STRSIZE)strlen(ptr)) 188 #define FXSYS_strlen(ptr) ((FX_STRSIZE)strlen(ptr))
164 #define FXSYS_wcslen(ptr) ((FX_STRSIZE)wcslen(ptr)) 189 #define FXSYS_wcslen(ptr) ((FX_STRSIZE)wcslen(ptr))
165 #endif 190 #endif
166 191
167 #define FXSYS_wcscmp wcscmp 192 #define FXSYS_wcscmp wcscmp
168 #define FXSYS_wcsstr wcsstr 193 #define FXSYS_wcsstr wcsstr
169 #define FXSYS_wcsncmp wcsncmp 194 #define FXSYS_wcsncmp wcsncmp
170 #define FXSYS_vswprintf vswprintf 195 #define FXSYS_vswprintf vswprintf
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 326
302 // Prevent a function from ever being inlined, typically because we'd 327 // Prevent a function from ever being inlined, typically because we'd
303 // like it to appear in stack traces. 328 // like it to appear in stack traces.
304 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 329 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
305 #define NEVER_INLINE __declspec(noinline) 330 #define NEVER_INLINE __declspec(noinline)
306 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 331 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
307 #define NEVER_INLINE __attribute__((__noinline__)) 332 #define NEVER_INLINE __attribute__((__noinline__))
308 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 333 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
309 334
310 #endif // CORE_FXCRT_INCLUDE_FX_SYSTEM_H_ 335 #endif // CORE_FXCRT_INCLUDE_FX_SYSTEM_H_
OLDNEW
« no previous file with comments | « core/fxcrt/include/fx_string.h ('k') | pdfium.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698