Move some fx_system.h replacements into a C++ only section.
Prove that these are only being called from C++ code to facilitate
a future transition to smart pointer argument types which are not
available from plain C code.
Change-Id: I96dd02214ad870d59192e10d330368bed6b2ae47
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/117490
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/fx_system.cpp b/core/fxcrt/fx_system.cpp
index 4eb1864..7661c4d 100644
--- a/core/fxcrt/fx_system.cpp
+++ b/core/fxcrt/fx_system.cpp
@@ -154,6 +154,14 @@
return wcsftime(strDest, maxsize, format, timeptr);
}
+int FXSYS_stricmp(const char* str1, const char* str2) {
+ return _stricmp(str1, str2);
+}
+
+int FXSYS_wcsicmp(const wchar_t* str1, const wchar_t* str2) {
+ return _wcsicmp(str1, str2);
+}
+
#else // BUILDFLAG(IS_WIN)
char* FXSYS_strlwr(char* str) {
diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h
index 19c3449..b7bf8b6 100644
--- a/core/fxcrt/fx_system.h
+++ b/core/fxcrt/fx_system.h
@@ -54,33 +54,25 @@
#define FXSYS_itoa _itoa
#define FXSYS_strlwr _strlwr
#define FXSYS_strupr _strupr
-#define FXSYS_stricmp _stricmp
-#define FXSYS_wcsicmp _wcsicmp
#define FXSYS_wcslwr _wcslwr
#define FXSYS_wcsupr _wcsupr
+#define FXSYS_SetLastError SetLastError
+#define FXSYS_GetLastError GetLastError
size_t FXSYS_wcsftime(wchar_t* strDest,
size_t maxsize,
const wchar_t* format,
const struct tm* timeptr);
-#define FXSYS_SetLastError SetLastError
-#define FXSYS_GetLastError GetLastError
#else // BUILDFLAG(IS_WIN)
char* FXSYS_itoa(int value, char* str, int radix);
char* FXSYS_strlwr(char* str);
char* FXSYS_strupr(char* str);
-int FXSYS_stricmp(const char* str1, const char* str2);
-int FXSYS_wcsicmp(const wchar_t* str1, const wchar_t* str2);
wchar_t* FXSYS_wcslwr(wchar_t* str);
wchar_t* FXSYS_wcsupr(wchar_t* str);
-#define FXSYS_wcsftime wcsftime
void FXSYS_SetLastError(uint32_t err);
uint32_t FXSYS_GetLastError();
+#define FXSYS_wcsftime wcsftime
#endif // BUILDFLAG(IS_WIN)
-int32_t FXSYS_atoi(const char* str);
-uint32_t FXSYS_atoui(const char* str);
-int32_t FXSYS_wtoi(const wchar_t* str);
-int64_t FXSYS_atoi64(const char* str);
const char* FXSYS_i64toa(int64_t value, char* str, int radix);
int FXSYS_roundf(float f);
int FXSYS_round(double d);
@@ -88,6 +80,15 @@
#ifdef __cplusplus
} // extern "C"
+
+// C++-only section to allow future use of TerminatedPtr<>.
+int FXSYS_stricmp(const char* str1, const char* str2);
+int FXSYS_wcsicmp(const wchar_t* str1, const wchar_t* str2);
+int32_t FXSYS_atoi(const char* str);
+int32_t FXSYS_wtoi(const wchar_t* str);
+uint32_t FXSYS_atoui(const char* str);
+int64_t FXSYS_atoi64(const char* str);
+
#endif // __cplusplus
#endif // CORE_FXCRT_FX_SYSTEM_H_