summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_utils.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-14 21:29:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-14 21:29:35 +0000
commit4011677aed8b258fcf87cf52b0d541ef04c832ff (patch)
treedc5f8124fc0e81c15213e4b0ebeecc83c96049d7 /xfa/fxfa/parser/xfa_utils.cpp
parentaee28693976cc246eea8230a999906802e52cab7 (diff)
downloadpdfium-4011677aed8b258fcf87cf52b0d541ef04c832ff.tar.xz
Move code out of xfa_utilschromium/3271chromium/3270chromium/3269
This CL splits the node template out of xfa_utils into its own file. The XFA_ByteStringToDouble method was moved to the only calling file. Change-Id: I85fb2dfa3afc4a675ec69574e32d643c0dca731f Reviewed-on: https://pdfium-review.googlesource.com/18490 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/xfa_utils.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_utils.cpp84
1 files changed, 0 insertions, 84 deletions
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index 5bdfe5853b..588246fc55 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -39,85 +39,6 @@ const double fraction_scales[] = {0.1,
0.000000000000001,
0.0000000000000001};
-double WideStringToDouble(const WideString& wsStringVal) {
- WideString wsValue = wsStringVal;
- wsValue.TrimLeft();
- wsValue.TrimRight();
- int64_t nIntegral = 0;
- uint32_t dwFractional = 0;
- int32_t nExponent = 0;
- int32_t cc = 0;
- bool bNegative = false;
- bool bExpSign = false;
- const wchar_t* str = wsValue.c_str();
- int32_t len = wsValue.GetLength();
- if (str[0] == '+') {
- cc++;
- } else if (str[0] == '-') {
- bNegative = true;
- cc++;
- }
- int32_t nIntegralLen = 0;
- while (cc < len) {
- if (str[cc] == '.' || str[cc] == 'E' || str[cc] == 'e' ||
- nIntegralLen > 17) {
- break;
- }
- if (!FXSYS_isDecimalDigit(str[cc])) {
- return 0;
- }
- nIntegral = nIntegral * 10 + str[cc] - '0';
- cc++;
- nIntegralLen++;
- }
- nIntegral = bNegative ? -nIntegral : nIntegral;
- int32_t scale = 0;
- double fraction = 0.0;
- if (cc < len && str[cc] == '.') {
- cc++;
- while (cc < len) {
- fraction += XFA_GetFractionalScale(scale) * (str[cc] - '0');
- scale++;
- cc++;
- if (cc == len)
- break;
- if (scale == XFA_GetMaxFractionalScale() || str[cc] == 'E' ||
- str[cc] == 'e') {
- break;
- }
- if (!FXSYS_isDecimalDigit(str[cc]))
- return 0;
- }
- dwFractional = static_cast<uint32_t>(fraction * 4294967296.0);
- }
- if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) {
- cc++;
- if (cc < len) {
- if (str[cc] == '+') {
- cc++;
- } else if (str[cc] == '-') {
- bExpSign = true;
- cc++;
- }
- }
- while (cc < len) {
- if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]))
- return 0;
-
- nExponent = nExponent * 10 + str[cc] - '0';
- cc++;
- }
- nExponent = bExpSign ? -nExponent : nExponent;
- }
-
- double dValue = dwFractional / 4294967296.0;
- dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue);
- if (nExponent != 0)
- dValue *= FXSYS_pow(10, static_cast<float>(nExponent));
-
- return dValue;
-}
-
} // namespace
double XFA_GetFractionalScale(uint32_t idx) {
@@ -228,11 +149,6 @@ bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) {
return bRet;
}
-double XFA_ByteStringToDouble(const ByteStringView& szStringVal) {
- WideString wsValue = WideString::FromUTF8(szStringVal);
- return WideStringToDouble(wsValue);
-}
-
int32_t XFA_MapRotation(int32_t nRotation) {
nRotation = nRotation % 360;
nRotation = nRotation < 0 ? nRotation + 360 : nRotation;