| 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_localevalue.h" | 7 #include "xfa/fxfa/parser/xfa_localevalue.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" |
| 9 #include "xfa/fgas/localization/fgas_localeimp.h" | 10 #include "xfa/fgas/localization/fgas_localeimp.h" |
| 10 #include "xfa/fxfa/parser/xfa_doclayout.h" | 11 #include "xfa/fxfa/parser/xfa_doclayout.h" |
| 11 #include "xfa/fxfa/parser/xfa_document.h" | 12 #include "xfa/fxfa/parser/xfa_document.h" |
| 12 #include "xfa/fxfa/parser/xfa_localemgr.h" | 13 #include "xfa/fxfa/parser/xfa_localemgr.h" |
| 13 #include "xfa/fxfa/parser/xfa_object.h" | 14 #include "xfa/fxfa/parser/xfa_object.h" |
| 14 #include "xfa/fxfa/parser/xfa_parser.h" | 15 #include "xfa/fxfa/parser/xfa_parser.h" |
| 15 #include "xfa/fxfa/parser/xfa_script.h" | 16 #include "xfa/fxfa/parser/xfa_script.h" |
| 16 #include "xfa/fxfa/parser/xfa_utils.h" | 17 #include "xfa/fxfa/parser/xfa_utils.h" |
| 17 | 18 |
| 18 static const FX_DOUBLE fraction_scales[] = {0.1, | 19 static const FX_DOUBLE fraction_scales[] = {0.1, |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 FX_FLOAT CXFA_LocaleValue::GetNum() const { | 213 FX_FLOAT CXFA_LocaleValue::GetNum() const { |
| 213 if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER || | 214 if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER || |
| 214 m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) { | 215 m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) { |
| 215 int64_t nIntegral = 0; | 216 int64_t nIntegral = 0; |
| 216 uint32_t dwFractional = 0; | 217 uint32_t dwFractional = 0; |
| 217 int32_t nExponent = 0; | 218 int32_t nExponent = 0; |
| 218 int cc = 0; | 219 int cc = 0; |
| 219 FX_BOOL bNegative = FALSE, bExpSign = FALSE; | 220 FX_BOOL bNegative = FALSE, bExpSign = FALSE; |
| 220 const FX_WCHAR* str = m_wsValue.c_str(); | 221 const FX_WCHAR* str = m_wsValue.c_str(); |
| 221 int len = m_wsValue.GetLength(); | 222 int len = m_wsValue.GetLength(); |
| 222 while (XFA_IsSpace(str[cc]) && cc < len) { | 223 while (FXSYS_iswspace(str[cc]) && cc < len) { |
| 223 cc++; | 224 cc++; |
| 224 } | 225 } |
| 225 if (cc >= len) { | 226 if (cc >= len) { |
| 226 return 0; | 227 return 0; |
| 227 } | 228 } |
| 228 if (str[0] == '+') { | 229 if (str[0] == '+') { |
| 229 cc++; | 230 cc++; |
| 230 } else if (str[0] == '-') { | 231 } else if (str[0] == '-') { |
| 231 bNegative = TRUE; | 232 bNegative = TRUE; |
| 232 cc++; | 233 cc++; |
| 233 } | 234 } |
| 234 int nIntegralLen = 0; | 235 int nIntegralLen = 0; |
| 235 while (cc < len) { | 236 while (cc < len) { |
| 236 if (str[cc] == '.' || !XFA_IsDigit(str[cc]) || nIntegralLen > 17) { | 237 if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]) || |
| 238 nIntegralLen > 17) { |
| 237 break; | 239 break; |
| 238 } | 240 } |
| 239 nIntegral = nIntegral * 10 + str[cc] - '0'; | 241 nIntegral = nIntegral * 10 + str[cc] - '0'; |
| 240 cc++; | 242 cc++; |
| 241 nIntegralLen++; | 243 nIntegralLen++; |
| 242 } | 244 } |
| 243 nIntegral = bNegative ? -nIntegral : nIntegral; | 245 nIntegral = bNegative ? -nIntegral : nIntegral; |
| 244 int scale = 0; | 246 int scale = 0; |
| 245 double fraction = 0.0; | 247 double fraction = 0.0; |
| 246 if (cc < len && str[cc] == '.') { | 248 if (cc < len && str[cc] == '.') { |
| 247 cc++; | 249 cc++; |
| 248 while (cc < len) { | 250 while (cc < len) { |
| 249 fraction += fraction_scales[scale] * (str[cc] - '0'); | 251 fraction += fraction_scales[scale] * (str[cc] - '0'); |
| 250 scale++; | 252 scale++; |
| 251 cc++; | 253 cc++; |
| 252 if (scale == sizeof fraction_scales / sizeof(double) || | 254 if (scale == sizeof fraction_scales / sizeof(double) || |
| 253 !XFA_IsDigit(str[cc])) { | 255 !FXSYS_isDecimalDigit(str[cc])) { |
| 254 break; | 256 break; |
| 255 } | 257 } |
| 256 } | 258 } |
| 257 dwFractional = (uint32_t)(fraction * 4294967296.0); | 259 dwFractional = (uint32_t)(fraction * 4294967296.0); |
| 258 } | 260 } |
| 259 if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { | 261 if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { |
| 260 cc++; | 262 cc++; |
| 261 if (cc < len) { | 263 if (cc < len) { |
| 262 if (str[cc] == '+') { | 264 if (str[cc] == '+') { |
| 263 cc++; | 265 cc++; |
| 264 } else if (str[cc] == '-') { | 266 } else if (str[cc] == '-') { |
| 265 bExpSign = TRUE; | 267 bExpSign = TRUE; |
| 266 cc++; | 268 cc++; |
| 267 } | 269 } |
| 268 } | 270 } |
| 269 while (cc < len) { | 271 while (cc < len) { |
| 270 if (str[cc] == '.' || !XFA_IsDigit(str[cc])) { | 272 if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) { |
| 271 break; | 273 break; |
| 272 } | 274 } |
| 273 nExponent = nExponent * 10 + str[cc] - '0'; | 275 nExponent = nExponent * 10 + str[cc] - '0'; |
| 274 cc++; | 276 cc++; |
| 275 } | 277 } |
| 276 nExponent = bExpSign ? -nExponent : nExponent; | 278 nExponent = bExpSign ? -nExponent : nExponent; |
| 277 } | 279 } |
| 278 FX_FLOAT fValue = (FX_FLOAT)(dwFractional / 4294967296.0); | 280 FX_FLOAT fValue = (FX_FLOAT)(dwFractional / 4294967296.0); |
| 279 fValue = nIntegral + (nIntegral >= 0 ? fValue : -fValue); | 281 fValue = nIntegral + (nIntegral >= 0 ? fValue : -fValue); |
| 280 if (nExponent != 0) { | 282 if (nExponent != 0) { |
| 281 fValue *= FXSYS_pow(10, (FX_FLOAT)nExponent); | 283 fValue *= FXSYS_pow(10, (FX_FLOAT)nExponent); |
| 282 } | 284 } |
| 283 return fValue; | 285 return fValue; |
| 284 } | 286 } |
| 285 return 0; | 287 return 0; |
| 286 } | 288 } |
| 287 FX_DOUBLE CXFA_LocaleValue::GetDoubleNum() const { | 289 FX_DOUBLE CXFA_LocaleValue::GetDoubleNum() const { |
| 288 if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER || | 290 if (m_bValid && (m_dwType == XFA_VT_BOOLEAN || m_dwType == XFA_VT_INTEGER || |
| 289 m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) { | 291 m_dwType == XFA_VT_DECIMAL || m_dwType == XFA_VT_FLOAT)) { |
| 290 int64_t nIntegral = 0; | 292 int64_t nIntegral = 0; |
| 291 uint32_t dwFractional = 0; | 293 uint32_t dwFractional = 0; |
| 292 int32_t nExponent = 0; | 294 int32_t nExponent = 0; |
| 293 int32_t cc = 0; | 295 int32_t cc = 0; |
| 294 FX_BOOL bNegative = FALSE, bExpSign = FALSE; | 296 FX_BOOL bNegative = FALSE, bExpSign = FALSE; |
| 295 const FX_WCHAR* str = m_wsValue.c_str(); | 297 const FX_WCHAR* str = m_wsValue.c_str(); |
| 296 int len = m_wsValue.GetLength(); | 298 int len = m_wsValue.GetLength(); |
| 297 while (XFA_IsSpace(str[cc]) && cc < len) { | 299 while (FXSYS_iswspace(str[cc]) && cc < len) { |
| 298 cc++; | 300 cc++; |
| 299 } | 301 } |
| 300 if (cc >= len) { | 302 if (cc >= len) { |
| 301 return 0; | 303 return 0; |
| 302 } | 304 } |
| 303 if (str[0] == '+') { | 305 if (str[0] == '+') { |
| 304 cc++; | 306 cc++; |
| 305 } else if (str[0] == '-') { | 307 } else if (str[0] == '-') { |
| 306 bNegative = TRUE; | 308 bNegative = TRUE; |
| 307 cc++; | 309 cc++; |
| 308 } | 310 } |
| 309 int32_t nIntegralLen = 0; | 311 int32_t nIntegralLen = 0; |
| 310 while (cc < len) { | 312 while (cc < len) { |
| 311 if (str[cc] == '.' || !XFA_IsDigit(str[cc]) || nIntegralLen > 17) { | 313 if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc]) || |
| 314 nIntegralLen > 17) { |
| 312 break; | 315 break; |
| 313 } | 316 } |
| 314 nIntegral = nIntegral * 10 + str[cc] - '0'; | 317 nIntegral = nIntegral * 10 + str[cc] - '0'; |
| 315 cc++; | 318 cc++; |
| 316 nIntegralLen++; | 319 nIntegralLen++; |
| 317 } | 320 } |
| 318 nIntegral = bNegative ? -nIntegral : nIntegral; | 321 nIntegral = bNegative ? -nIntegral : nIntegral; |
| 319 int32_t scale = 0; | 322 int32_t scale = 0; |
| 320 FX_DOUBLE fraction = 0.0; | 323 FX_DOUBLE fraction = 0.0; |
| 321 if (cc < len && str[cc] == '.') { | 324 if (cc < len && str[cc] == '.') { |
| 322 cc++; | 325 cc++; |
| 323 while (cc < len) { | 326 while (cc < len) { |
| 324 fraction += fraction_scales[scale] * (str[cc] - '0'); | 327 fraction += fraction_scales[scale] * (str[cc] - '0'); |
| 325 scale++; | 328 scale++; |
| 326 cc++; | 329 cc++; |
| 327 if (scale == sizeof fraction_scales / sizeof(FX_DOUBLE) || | 330 if (scale == sizeof fraction_scales / sizeof(FX_DOUBLE) || |
| 328 !XFA_IsDigit(str[cc])) { | 331 !FXSYS_isDecimalDigit(str[cc])) { |
| 329 break; | 332 break; |
| 330 } | 333 } |
| 331 } | 334 } |
| 332 dwFractional = (uint32_t)(fraction * 4294967296.0); | 335 dwFractional = (uint32_t)(fraction * 4294967296.0); |
| 333 } | 336 } |
| 334 if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { | 337 if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { |
| 335 cc++; | 338 cc++; |
| 336 if (cc < len) { | 339 if (cc < len) { |
| 337 if (str[cc] == '+') { | 340 if (str[cc] == '+') { |
| 338 cc++; | 341 cc++; |
| 339 } else if (str[cc] == '-') { | 342 } else if (str[cc] == '-') { |
| 340 bExpSign = TRUE; | 343 bExpSign = TRUE; |
| 341 cc++; | 344 cc++; |
| 342 } | 345 } |
| 343 } | 346 } |
| 344 while (cc < len) { | 347 while (cc < len) { |
| 345 if (str[cc] == '.' || !XFA_IsDigit(str[cc])) { | 348 if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) { |
| 346 break; | 349 break; |
| 347 } | 350 } |
| 348 nExponent = nExponent * 10 + str[cc] - '0'; | 351 nExponent = nExponent * 10 + str[cc] - '0'; |
| 349 cc++; | 352 cc++; |
| 350 } | 353 } |
| 351 nExponent = bExpSign ? -nExponent : nExponent; | 354 nExponent = bExpSign ? -nExponent : nExponent; |
| 352 } | 355 } |
| 353 FX_DOUBLE dValue = (dwFractional / 4294967296.0); | 356 FX_DOUBLE dValue = (dwFractional / 4294967296.0); |
| 354 dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue); | 357 dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue); |
| 355 if (nExponent != 0) { | 358 if (nExponent != 0) { |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 if (nLen < wCountY || nLen > wCountY + wCountM + wCountD + 2) { | 612 if (nLen < wCountY || nLen > wCountY + wCountM + wCountD + 2) { |
| 610 return FALSE; | 613 return FALSE; |
| 611 } | 614 } |
| 612 const bool bSymbol = wsDate.Find(0x2D) != -1; | 615 const bool bSymbol = wsDate.Find(0x2D) != -1; |
| 613 uint16_t wYear = 0; | 616 uint16_t wYear = 0; |
| 614 uint16_t wMonth = 0; | 617 uint16_t wMonth = 0; |
| 615 uint16_t wDay = 0; | 618 uint16_t wDay = 0; |
| 616 const FX_WCHAR* pDate = wsDate.c_str(); | 619 const FX_WCHAR* pDate = wsDate.c_str(); |
| 617 int nIndex = 0, nStart = 0; | 620 int nIndex = 0, nStart = 0; |
| 618 while (pDate[nIndex] != '\0' && nIndex < wCountY) { | 621 while (pDate[nIndex] != '\0' && nIndex < wCountY) { |
| 619 if (!XFA_IsDigit(pDate[nIndex])) { | 622 if (!FXSYS_isDecimalDigit(pDate[nIndex])) { |
| 620 return FALSE; | 623 return FALSE; |
| 621 } | 624 } |
| 622 wYear = (pDate[nIndex] - '0') + wYear * 10; | 625 wYear = (pDate[nIndex] - '0') + wYear * 10; |
| 623 nIndex++; | 626 nIndex++; |
| 624 } | 627 } |
| 625 if (bSymbol) { | 628 if (bSymbol) { |
| 626 if (pDate[nIndex] != 0x2D) { | 629 if (pDate[nIndex] != 0x2D) { |
| 627 return FALSE; | 630 return FALSE; |
| 628 } | 631 } |
| 629 nIndex++; | 632 nIndex++; |
| 630 } | 633 } |
| 631 nStart = nIndex; | 634 nStart = nIndex; |
| 632 while (pDate[nIndex] != '\0' && nIndex - nStart < wCountM && nIndex < nLen) { | 635 while (pDate[nIndex] != '\0' && nIndex - nStart < wCountM && nIndex < nLen) { |
| 633 if (!XFA_IsDigit(pDate[nIndex])) { | 636 if (!FXSYS_isDecimalDigit(pDate[nIndex])) { |
| 634 return FALSE; | 637 return FALSE; |
| 635 } | 638 } |
| 636 wMonth = (pDate[nIndex] - '0') + wMonth * 10; | 639 wMonth = (pDate[nIndex] - '0') + wMonth * 10; |
| 637 nIndex++; | 640 nIndex++; |
| 638 } | 641 } |
| 639 if (bSymbol) { | 642 if (bSymbol) { |
| 640 if (pDate[nIndex] != 0x2D) { | 643 if (pDate[nIndex] != 0x2D) { |
| 641 return FALSE; | 644 return FALSE; |
| 642 } | 645 } |
| 643 nIndex++; | 646 nIndex++; |
| 644 } | 647 } |
| 645 nStart = nIndex; | 648 nStart = nIndex; |
| 646 while (pDate[nIndex] != '\0' && nIndex - nStart < wCountD && nIndex < nLen) { | 649 while (pDate[nIndex] != '\0' && nIndex - nStart < wCountD && nIndex < nLen) { |
| 647 if (!XFA_IsDigit(pDate[nIndex])) { | 650 if (!FXSYS_isDecimalDigit(pDate[nIndex])) { |
| 648 return FALSE; | 651 return FALSE; |
| 649 } | 652 } |
| 650 wDay = (pDate[nIndex] - '0') + wDay * 10; | 653 wDay = (pDate[nIndex] - '0') + wDay * 10; |
| 651 nIndex++; | 654 nIndex++; |
| 652 } | 655 } |
| 653 if (nIndex != nLen) { | 656 if (nIndex != nLen) { |
| 654 return FALSE; | 657 return FALSE; |
| 655 } | 658 } |
| 656 if (wYear < 1900 || wYear > 2029) { | 659 if (wYear < 1900 || wYear > 2029) { |
| 657 return FALSE; | 660 return FALSE; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 const uint16_t wCountF = 3; | 699 const uint16_t wCountF = 3; |
| 697 const bool bSymbol = wsTime.Find(':') != -1; | 700 const bool bSymbol = wsTime.Find(':') != -1; |
| 698 uint16_t wHour = 0; | 701 uint16_t wHour = 0; |
| 699 uint16_t wMinute = 0; | 702 uint16_t wMinute = 0; |
| 700 uint16_t wSecond = 0; | 703 uint16_t wSecond = 0; |
| 701 uint16_t wFraction = 0; | 704 uint16_t wFraction = 0; |
| 702 const FX_WCHAR* pTime = wsTime.c_str(); | 705 const FX_WCHAR* pTime = wsTime.c_str(); |
| 703 int nIndex = 0; | 706 int nIndex = 0; |
| 704 int nStart = 0; | 707 int nStart = 0; |
| 705 while (nIndex - nStart < wCountH && pTime[nIndex]) { | 708 while (nIndex - nStart < wCountH && pTime[nIndex]) { |
| 706 if (!XFA_IsDigit(pTime[nIndex])) | 709 if (!FXSYS_isDecimalDigit(pTime[nIndex])) |
| 707 return FALSE; | 710 return FALSE; |
| 708 wHour = pTime[nIndex] - '0' + wHour * 10; | 711 wHour = pTime[nIndex] - '0' + wHour * 10; |
| 709 nIndex++; | 712 nIndex++; |
| 710 } | 713 } |
| 711 if (bSymbol) { | 714 if (bSymbol) { |
| 712 if (nIndex < nLen && pTime[nIndex] != ':') | 715 if (nIndex < nLen && pTime[nIndex] != ':') |
| 713 return FALSE; | 716 return FALSE; |
| 714 nIndex++; | 717 nIndex++; |
| 715 } | 718 } |
| 716 nStart = nIndex; | 719 nStart = nIndex; |
| 717 while (nIndex - nStart < wCountM && nIndex < nLen && pTime[nIndex]) { | 720 while (nIndex - nStart < wCountM && nIndex < nLen && pTime[nIndex]) { |
| 718 if (!XFA_IsDigit(pTime[nIndex])) | 721 if (!FXSYS_isDecimalDigit(pTime[nIndex])) |
| 719 return FALSE; | 722 return FALSE; |
| 720 wMinute = pTime[nIndex] - '0' + wMinute * 10; | 723 wMinute = pTime[nIndex] - '0' + wMinute * 10; |
| 721 nIndex++; | 724 nIndex++; |
| 722 } | 725 } |
| 723 if (bSymbol) { | 726 if (bSymbol) { |
| 724 if (nIndex < nLen && pTime[nIndex] != ':') | 727 if (nIndex < nLen && pTime[nIndex] != ':') |
| 725 return FALSE; | 728 return FALSE; |
| 726 nIndex++; | 729 nIndex++; |
| 727 } | 730 } |
| 728 nStart = nIndex; | 731 nStart = nIndex; |
| 729 while (nIndex - nStart < wCountS && nIndex < nLen && pTime[nIndex]) { | 732 while (nIndex - nStart < wCountS && nIndex < nLen && pTime[nIndex]) { |
| 730 if (!XFA_IsDigit(pTime[nIndex])) | 733 if (!FXSYS_isDecimalDigit(pTime[nIndex])) |
| 731 return FALSE; | 734 return FALSE; |
| 732 wSecond = pTime[nIndex] - '0' + wSecond * 10; | 735 wSecond = pTime[nIndex] - '0' + wSecond * 10; |
| 733 nIndex++; | 736 nIndex++; |
| 734 } | 737 } |
| 735 if (wsTime.Find('.') > 0) { | 738 if (wsTime.Find('.') > 0) { |
| 736 if (pTime[nIndex] != '.') | 739 if (pTime[nIndex] != '.') |
| 737 return FALSE; | 740 return FALSE; |
| 738 nIndex++; | 741 nIndex++; |
| 739 nStart = nIndex; | 742 nStart = nIndex; |
| 740 while (nIndex - nStart < wCountF && nIndex < nLen && pTime[nIndex]) { | 743 while (nIndex - nStart < wCountF && nIndex < nLen && pTime[nIndex]) { |
| 741 if (!XFA_IsDigit(pTime[nIndex])) | 744 if (!FXSYS_isDecimalDigit(pTime[nIndex])) |
| 742 return FALSE; | 745 return FALSE; |
| 743 wFraction = pTime[nIndex] - '0' + wFraction * 10; | 746 wFraction = pTime[nIndex] - '0' + wFraction * 10; |
| 744 nIndex++; | 747 nIndex++; |
| 745 } | 748 } |
| 746 } | 749 } |
| 747 if (nIndex < nLen) { | 750 if (nIndex < nLen) { |
| 748 if (pTime[nIndex] == 'Z') { | 751 if (pTime[nIndex] == 'Z') { |
| 749 nIndex++; | 752 nIndex++; |
| 750 } else if (pTime[nIndex] == '-' || pTime[nIndex] == '+') { | 753 } else if (pTime[nIndex] == '-' || pTime[nIndex] == '+') { |
| 751 int16_t nOffsetH = 0; | 754 int16_t nOffsetH = 0; |
| 752 int16_t nOffsetM = 0; | 755 int16_t nOffsetM = 0; |
| 753 nIndex++; | 756 nIndex++; |
| 754 nStart = nIndex; | 757 nStart = nIndex; |
| 755 while (nIndex - nStart < wCountH && nIndex < nLen && pTime[nIndex]) { | 758 while (nIndex - nStart < wCountH && nIndex < nLen && pTime[nIndex]) { |
| 756 if (!XFA_IsDigit(pTime[nIndex])) | 759 if (!FXSYS_isDecimalDigit(pTime[nIndex])) |
| 757 return FALSE; | 760 return FALSE; |
| 758 nOffsetH = pTime[nIndex] - '0' + nOffsetH * 10; | 761 nOffsetH = pTime[nIndex] - '0' + nOffsetH * 10; |
| 759 nIndex++; | 762 nIndex++; |
| 760 } | 763 } |
| 761 if (bSymbol) { | 764 if (bSymbol) { |
| 762 if (nIndex < nLen && pTime[nIndex] != ':') | 765 if (nIndex < nLen && pTime[nIndex] != ':') |
| 763 return FALSE; | 766 return FALSE; |
| 764 nIndex++; | 767 nIndex++; |
| 765 } | 768 } |
| 766 nStart = nIndex; | 769 nStart = nIndex; |
| 767 while (nIndex - nStart < wCountM && nIndex < nLen && pTime[nIndex]) { | 770 while (nIndex - nStart < wCountM && nIndex < nLen && pTime[nIndex]) { |
| 768 if (!XFA_IsDigit(pTime[nIndex])) | 771 if (!FXSYS_isDecimalDigit(pTime[nIndex])) |
| 769 return FALSE; | 772 return FALSE; |
| 770 nOffsetM = pTime[nIndex] - '0' + nOffsetM * 10; | 773 nOffsetM = pTime[nIndex] - '0' + nOffsetM * 10; |
| 771 nIndex++; | 774 nIndex++; |
| 772 } | 775 } |
| 773 if (nOffsetH > 12 || nOffsetM >= 60) | 776 if (nOffsetH > 12 || nOffsetM >= 60) |
| 774 return FALSE; | 777 return FALSE; |
| 775 } | 778 } |
| 776 } | 779 } |
| 777 return nIndex == nLen && wHour < 24 && wMinute < 60 && wSecond < 60 && | 780 return nIndex == nLen && wHour < 24 && wMinute < 60 && wSecond < 60 && |
| 778 wFraction <= 999; | 781 wFraction <= 999; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 if (cf == L's') { | 939 if (cf == L's') { |
| 937 if (c == L'-' || c == L'+') { | 940 if (c == L'-' || c == L'+') { |
| 938 ++n; | 941 ++n; |
| 939 } | 942 } |
| 940 ++nf; | 943 ++nf; |
| 941 } | 944 } |
| 942 FX_BOOL bLimit = TRUE; | 945 FX_BOOL bLimit = TRUE; |
| 943 int32_t nCount = wsNumeric.GetLength(); | 946 int32_t nCount = wsNumeric.GetLength(); |
| 944 int32_t nCountFmt = wsFormat.GetLength(); | 947 int32_t nCountFmt = wsFormat.GetLength(); |
| 945 while (n < nCount && (bLimit ? nf < nCountFmt : TRUE) && | 948 while (n < nCount && (bLimit ? nf < nCountFmt : TRUE) && |
| 946 XFA_IsDigit(c = pNum[n])) { | 949 FXSYS_isDecimalDigit(c = pNum[n])) { |
| 947 if (bLimit == TRUE) { | 950 if (bLimit == TRUE) { |
| 948 if ((cf = pFmt[nf]) == L'*') { | 951 if ((cf = pFmt[nf]) == L'*') { |
| 949 bLimit = FALSE; | 952 bLimit = FALSE; |
| 950 } else if (cf == L'z') { | 953 } else if (cf == L'z') { |
| 951 nf++; | 954 nf++; |
| 952 } else { | 955 } else { |
| 953 return FALSE; | 956 return FALSE; |
| 954 } | 957 } |
| 955 } | 958 } |
| 956 n++; | 959 n++; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 974 if (pFmt[nf] != L'.') { | 977 if (pFmt[nf] != L'.') { |
| 975 return FALSE; | 978 return FALSE; |
| 976 } | 979 } |
| 977 if (wsDecimalSymbol != CFX_WideStringC(c) && c != L'.') { | 980 if (wsDecimalSymbol != CFX_WideStringC(c) && c != L'.') { |
| 978 return FALSE; | 981 return FALSE; |
| 979 } | 982 } |
| 980 ++nf; | 983 ++nf; |
| 981 ++n; | 984 ++n; |
| 982 bLimit = TRUE; | 985 bLimit = TRUE; |
| 983 while (n < nCount && (bLimit ? nf < nCountFmt : TRUE) && | 986 while (n < nCount && (bLimit ? nf < nCountFmt : TRUE) && |
| 984 XFA_IsDigit(c = pNum[n])) { | 987 FXSYS_isDecimalDigit(c = pNum[n])) { |
| 985 if (bLimit == TRUE) { | 988 if (bLimit == TRUE) { |
| 986 if ((cf = pFmt[nf]) == L'*') { | 989 if ((cf = pFmt[nf]) == L'*') { |
| 987 bLimit = FALSE; | 990 bLimit = FALSE; |
| 988 } else if (cf == L'z') { | 991 } else if (cf == L'z') { |
| 989 nf++; | 992 nf++; |
| 990 } else { | 993 } else { |
| 991 return FALSE; | 994 return FALSE; |
| 992 } | 995 } |
| 993 } | 996 } |
| 994 n++; | 997 n++; |
| 995 } | 998 } |
| 996 return n == nCount; | 999 return n == nCount; |
| 997 } | 1000 } |
| OLD | NEW |