summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-05-12 14:58:44 -0700
committerTom Sepez <tsepez@chromium.org>2015-05-12 14:58:44 -0700
commit9b43a43568877282b6a70d3a8da6ef78e6acc4e2 (patch)
treeacb92c3466e5f1cda737102c761666fdb33df9d9 /core/include
parent2a0bb3bcf8db77f9ad39a5a868548ea8465244a4 (diff)
downloadpdfium-9b43a43568877282b6a70d3a8da6ef78e6acc4e2.tar.xz
Merge to XFA: Restore checked strlen conversions.
Original Review URL: https://codereview.chromium.org/1133323003 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1130903005
Diffstat (limited to 'core/include')
-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