| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fxfa/parser/xfa_utils.h" | 7 #include "xfa/fxfa/parser/xfa_utils.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 0.000000000001, | 309 0.000000000001, |
| 310 0.0000000000001, | 310 0.0000000000001, |
| 311 0.00000000000001, | 311 0.00000000000001, |
| 312 0.000000000000001, | 312 0.000000000000001, |
| 313 0.0000000000000001}; | 313 0.0000000000000001}; |
| 314 FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal) { | 314 FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal) { |
| 315 CFX_WideString wsValue = wsStringVal; | 315 CFX_WideString wsValue = wsStringVal; |
| 316 wsValue.TrimLeft(); | 316 wsValue.TrimLeft(); |
| 317 wsValue.TrimRight(); | 317 wsValue.TrimRight(); |
| 318 int64_t nIntegral = 0; | 318 int64_t nIntegral = 0; |
| 319 FX_DWORD dwFractional = 0; | 319 uint32_t dwFractional = 0; |
| 320 int32_t nExponent = 0; | 320 int32_t nExponent = 0; |
| 321 int32_t cc = 0; | 321 int32_t cc = 0; |
| 322 FX_BOOL bNegative = FALSE, bExpSign = FALSE; | 322 FX_BOOL bNegative = FALSE, bExpSign = FALSE; |
| 323 const FX_WCHAR* str = (const FX_WCHAR*)wsValue; | 323 const FX_WCHAR* str = (const FX_WCHAR*)wsValue; |
| 324 int32_t len = wsValue.GetLength(); | 324 int32_t len = wsValue.GetLength(); |
| 325 if (str[0] == '+') { | 325 if (str[0] == '+') { |
| 326 cc++; | 326 cc++; |
| 327 } else if (str[0] == '-') { | 327 } else if (str[0] == '-') { |
| 328 bNegative = TRUE; | 328 bNegative = TRUE; |
| 329 cc++; | 329 cc++; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 354 break; | 354 break; |
| 355 } | 355 } |
| 356 if (scale == sizeof(fraction_scales) / sizeof(FX_DOUBLE) || | 356 if (scale == sizeof(fraction_scales) / sizeof(FX_DOUBLE) || |
| 357 str[cc] == 'E' || str[cc] == 'e') { | 357 str[cc] == 'E' || str[cc] == 'e') { |
| 358 break; | 358 break; |
| 359 } | 359 } |
| 360 if (!XFA_IsDigit(str[cc])) { | 360 if (!XFA_IsDigit(str[cc])) { |
| 361 return 0; | 361 return 0; |
| 362 } | 362 } |
| 363 } | 363 } |
| 364 dwFractional = (FX_DWORD)(fraction * 4294967296.0); | 364 dwFractional = (uint32_t)(fraction * 4294967296.0); |
| 365 } | 365 } |
| 366 if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { | 366 if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { |
| 367 cc++; | 367 cc++; |
| 368 if (cc < len) { | 368 if (cc < len) { |
| 369 if (str[cc] == '+') { | 369 if (str[cc] == '+') { |
| 370 cc++; | 370 cc++; |
| 371 } else if (str[cc] == '-') { | 371 } else if (str[cc] == '-') { |
| 372 bExpSign = TRUE; | 372 bExpSign = TRUE; |
| 373 cc++; | 373 cc++; |
| 374 } | 374 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 394 CFX_WideString wsValue = | 394 CFX_WideString wsValue = |
| 395 CFX_WideString::FromUTF8(szStringVal.GetCStr(), szStringVal.GetLength()); | 395 CFX_WideString::FromUTF8(szStringVal.GetCStr(), szStringVal.GetLength()); |
| 396 return XFA_WideStringToDouble(wsValue); | 396 return XFA_WideStringToDouble(wsValue); |
| 397 } | 397 } |
| 398 | 398 |
| 399 int32_t XFA_MapRotation(int32_t nRotation) { | 399 int32_t XFA_MapRotation(int32_t nRotation) { |
| 400 nRotation = nRotation % 360; | 400 nRotation = nRotation % 360; |
| 401 nRotation = nRotation < 0 ? nRotation + 360 : nRotation; | 401 nRotation = nRotation < 0 ? nRotation + 360 : nRotation; |
| 402 return nRotation; | 402 return nRotation; |
| 403 } | 403 } |
| OLD | NEW |