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

Unified Diff: core/src/fxcrt/fx_basic_util.cpp

Issue 1077903002: Better fix for snprintf non-termination on windows. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix #endif // comment Created 5 years, 8 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/include/fxcrt/fx_system.h ('k') | core/src/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcrt/fx_basic_util.cpp
diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp
index 5a40c2b4be6e34bd4bffb0dfd2ef13556a58d1d1..c3df07fef5389a72496d63d4aa02e889a409c1bd 100644
--- a/core/src/fxcrt/fx_basic_util.cpp
+++ b/core/src/fxcrt/fx_basic_util.cpp
@@ -169,6 +169,24 @@ FX_FLOAT FX_atof(FX_BSTR strc)
}
return bNegative ? -value : value;
}
+
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900
+void FXSYS_snprintf(char *str, size_t size, _Printf_format_string_ const char* fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ FXSYS_vsnprintf(str, size, fmt, ap);
+ va_end(ap);
+}
+void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap)
+{
+ (void) _vsnprintf(str, size, fmt, ap);
+ if (size) {
+ str[size - 1] = 0;
+ }
+}
+#endif // _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900
+
static FX_BOOL FX_IsDigit(FX_BYTE ch)
{
return (ch >= '0' && ch <= '9') ? TRUE : FALSE;
« no previous file with comments | « core/include/fxcrt/fx_system.h ('k') | core/src/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698