summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-01-20 11:34:01 -0800
committerTom Sepez <tsepez@chromium.org>2016-01-20 11:34:01 -0800
commitf13d510cf267c27f4c123494de67670ec201cedc (patch)
tree2b5e279bef4fb9eb4a3a7e963cae93c65bc80fba /core/include
parentb196c7bebad66c9938d2705ccf64961bcdd774e2 (diff)
downloadpdfium-f13d510cf267c27f4c123494de67670ec201cedc.tar.xz
Bugs in CJS_PublicMethods::ParseNumber().
Fix the bugs by removing ParseNumber() entirely. For PDFium's JavaScript bindings, we want to get out of the numeric conversion business and inflict that on V8 as possible, avoiding platform-specific issue in strtod(). For other uses, there is a FX_atof() which is similarly buggy, but we can consolidate the use. Add an overloaded FX_atof() to handle wide strings more simply. BUG=pdfium:361 R=jochen@chromium.org Review URL: https://codereview.chromium.org/1586203006 .
Diffstat (limited to 'core/include')
-rw-r--r--core/include/fxcrt/fx_string.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h
index 1c1e237076..6abcf52c76 100644
--- a/core/include/fxcrt/fx_string.h
+++ b/core/include/fxcrt/fx_string.h
@@ -794,9 +794,7 @@ inline bool operator!=(const wchar_t* lhs, const CFX_WideString& rhs) {
inline bool operator!=(const CFX_WideStringC& lhs, const CFX_WideString& rhs) {
return rhs != lhs;
}
-FX_FLOAT FX_atof(const CFX_ByteStringC& str);
-void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData);
-FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf);
+
CFX_ByteString FX_UTF8Encode(const FX_WCHAR* pwsStr, FX_STRSIZE len);
inline CFX_ByteString FX_UTF8Encode(const CFX_WideStringC& wsStr) {
return FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength());
@@ -805,4 +803,11 @@ inline CFX_ByteString FX_UTF8Encode(const CFX_WideString& wsStr) {
return FX_UTF8Encode(wsStr.c_str(), wsStr.GetLength());
}
+FX_FLOAT FX_atof(const CFX_ByteStringC& str);
+inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) {
+ return FX_atof(FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()));
+}
+void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData);
+FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf);
+
#endif // CORE_INCLUDE_FXCRT_FX_STRING_H_