summaryrefslogtreecommitdiff
path: root/core/include/fxcrt/fx_system.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-05-12 14:49:29 -0700
committerTom Sepez <tsepez@chromium.org>2015-05-12 14:49:29 -0700
commitfeb10c58777949ea3d300b7554204edde422d1f2 (patch)
tree7f336f249fc77ea62f5ff14ea340bfb3703dedb3 /core/include/fxcrt/fx_system.h
parent8f6445b83139349fa31a137496d54b1847a66d7c (diff)
downloadpdfium-feb10c58777949ea3d300b7554204edde422d1f2.tar.xz
Restore checked strlen conversions.
The checked conversion can be re-enabled now that there is a public API free of private headers like this one. This reverts commit 6661fd4c26106cd530d187b36f29be7e5c98b70f. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1133323003
Diffstat (limited to 'core/include/fxcrt/fx_system.h')
-rw-r--r--core/include/fxcrt/fx_system.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h
index 37af19c769..9cc165f7a5 100644
--- a/core/include/fxcrt/fx_system.h
+++ b/core/include/fxcrt/fx_system.h
@@ -192,8 +192,16 @@ void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap);
FXSYS_FILE* FXSYS_wfopen(FX_LPCWSTR filename, FX_LPCWSTR mode);
#endif
+#ifdef __cplusplus
+} // extern "C"
+#include "../../../third_party/base/numerics/safe_conversions.h"
+#define FXSYS_strlen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(strlen(ptr))
+#define FXSYS_wcslen(ptr) pdfium::base::checked_cast<FX_STRSIZE>(wcslen(ptr))
+extern "C" {
+#else
#define FXSYS_strlen(ptr) ((FX_STRSIZE)strlen(ptr))
#define FXSYS_wcslen(ptr) ((FX_STRSIZE)wcslen(ptr))
+#endif
#define FXSYS_wcscmp wcscmp
#define FXSYS_wcschr wcschr