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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fxcrt/include/fx_string.h ('k') | pdfium.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/include/fx_system.h
diff --git a/core/fxcrt/include/fx_system.h b/core/fxcrt/include/fx_system.h
index b4659d14e442b7811b54bf948a0509952f0ac3a8..205976fb15fdb8baff7005cda74cc91595246be5 100644
--- a/core/fxcrt/include/fx_system.h
+++ b/core/fxcrt/include/fx_system.h
@@ -158,6 +158,31 @@ FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode);
#define FXSYS_strlen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(strlen(ptr))
#define FXSYS_wcslen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(wcslen(ptr))
+// Overloaded functions for C++ templates
+inline FX_STRSIZE FXSYS_len(const FX_CHAR* ptr) {
+ return FXSYS_strlen(ptr);
+}
+
+inline FX_STRSIZE FXSYS_len(const FX_WCHAR* ptr) {
+ return FXSYS_wcslen(ptr);
+}
+
+inline int FXSYS_cmp(const FX_CHAR* ptr1, const FX_CHAR* ptr2, size_t len) {
+ return memcmp(ptr1, ptr2, len);
+}
+
+inline int FXSYS_cmp(const FX_WCHAR* ptr1, const FX_WCHAR* ptr2, size_t len) {
+ return wmemcmp(ptr1, ptr2, len);
+}
+
+inline const FX_CHAR* FXSYS_chr(const FX_CHAR* ptr, FX_CHAR ch, size_t len) {
+ return reinterpret_cast<const FX_CHAR*>(memchr(ptr, ch, len));
+}
+
+inline const FX_WCHAR* FXSYS_chr(const FX_WCHAR* ptr, FX_WCHAR ch, size_t len) {
+ return wmemchr(ptr, ch, len);
+}
+
extern "C" {
#else
#define FXSYS_strlen(ptr) ((FX_STRSIZE)strlen(ptr))
« 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