Chromium Code Reviews| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "core/fxcrt/include/fx_xml.h" | 10 #include "core/fxcrt/include/fx_xml.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 iEnd = iStart + 2; | 79 iEnd = iStart + 2; |
| 80 while (iStart < iLen && iStart < iEnd) { | 80 while (iStart < iLen && iStart < iEnd) { |
| 81 tz.tzMinute = tz.tzMinute * 10 + pStr[iStart++] - '0'; | 81 tz.tzMinute = tz.tzMinute * 10 + pStr[iStart++] - '0'; |
| 82 } | 82 } |
| 83 if (pStr[0] == '-') { | 83 if (pStr[0] == '-') { |
| 84 tz.tzHour = -tz.tzHour; | 84 tz.tzHour = -tz.tzHour; |
| 85 } | 85 } |
| 86 return iStart; | 86 return iStart; |
| 87 } | 87 } |
| 88 | 88 |
| 89 static FX_BOOL FX_IsDigit(FX_WCHAR c) { | |
| 90 return c >= '0' && c <= '9'; | |
| 91 } | |
| 92 static FX_BOOL FX_IsAlpha(FX_WCHAR c) { | |
| 93 return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); | |
| 94 } | |
| 95 static FX_BOOL FX_IsSpace(FX_WCHAR c) { | |
| 96 return (c == 0x20) || (c == 0x0d) || (c == 0x0a) || (c == 0x09); | |
| 97 } | |
| 98 static const FX_FLOAT gs_fraction_scales[] = { | |
| 99 0.1f, 0.01f, 0.001f, 0.0001f, | |
| 100 0.00001f, 0.000001f, 0.0000001f, 0.00000001f, | |
| 101 0.000000001f, 0.0000000001f, 0.00000000001f}; | |
| 102 static const int32_t gs_fraction_count = | |
| 103 sizeof(gs_fraction_scales) / sizeof(FX_FLOAT); | |
| 104 | |
| 105 class CFX_LCNumeric { | 89 class CFX_LCNumeric { |
| 106 public: | 90 public: |
| 107 CFX_LCNumeric(); | 91 CFX_LCNumeric(); |
| 108 CFX_LCNumeric(int64_t integral, | 92 CFX_LCNumeric(int64_t integral, |
| 109 uint32_t fractional = 0, | 93 uint32_t fractional = 0, |
| 110 int32_t exponent = 0); | 94 int32_t exponent = 0); |
| 111 CFX_LCNumeric(FX_FLOAT dbRetValue); | 95 CFX_LCNumeric(FX_FLOAT dbRetValue); |
| 112 CFX_LCNumeric(double dbvalue); | 96 CFX_LCNumeric(double dbvalue); |
| 113 CFX_LCNumeric(CFX_WideString& wsNumeric); | 97 CFX_LCNumeric(CFX_WideString& wsNumeric); |
| 114 | 98 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 130 | 114 |
| 131 if (wsValue.IsEmpty()) | 115 if (wsValue.IsEmpty()) |
| 132 return FALSE; | 116 return FALSE; |
| 133 | 117 |
| 134 const int32_t nIntegralMaxLen = 17; | 118 const int32_t nIntegralMaxLen = 17; |
| 135 int32_t cc = 0; | 119 int32_t cc = 0; |
| 136 bool bNegative = false; | 120 bool bNegative = false; |
| 137 bool bExpSign = false; | 121 bool bExpSign = false; |
| 138 const FX_WCHAR* str = wsValue.c_str(); | 122 const FX_WCHAR* str = wsValue.c_str(); |
| 139 int32_t len = wsValue.GetLength(); | 123 int32_t len = wsValue.GetLength(); |
| 140 while (cc < len && FX_IsSpace(str[cc])) | 124 while (cc < len && FXSYS_iswspace(str[cc])) |
| 141 cc++; | 125 cc++; |
| 142 | 126 |
| 143 if (cc >= len) | 127 if (cc >= len) |
| 144 return FALSE; | 128 return FALSE; |
| 145 | 129 |
| 146 if (str[cc] == '+') { | 130 if (str[cc] == '+') { |
| 147 cc++; | 131 cc++; |
| 148 } else if (str[cc] == '-') { | 132 } else if (str[cc] == '-') { |
| 149 bNegative = true; | 133 bNegative = true; |
| 150 cc++; | 134 cc++; |
| 151 } | 135 } |
| 152 int32_t nIntegralLen = 0; | 136 int32_t nIntegralLen = 0; |
| 153 while (cc < len) { | 137 while (cc < len) { |
| 154 if (str[cc] == '.') | 138 if (str[cc] == '.') |
| 155 break; | 139 break; |
| 156 | 140 |
| 157 if (!FX_IsDigit(str[cc])) { | 141 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 158 if ((str[cc] == 'E' || str[cc] == 'e')) | 142 if ((str[cc] == 'E' || str[cc] == 'e')) |
| 159 break; | 143 break; |
| 160 else | 144 else |
|
Lei Zhang
2016/06/23 20:42:08
no need, ditto for line 170
dsinclair
2016/06/23 20:45:48
Done.
| |
| 161 return FALSE; | 145 return FALSE; |
| 162 } | 146 } |
| 163 if (nIntegralLen < nIntegralMaxLen) { | 147 if (nIntegralLen < nIntegralMaxLen) { |
| 164 lcnum.m_Integral = lcnum.m_Integral * 10 + str[cc] - '0'; | 148 lcnum.m_Integral = lcnum.m_Integral * 10 + str[cc] - '0'; |
| 165 nIntegralLen++; | 149 nIntegralLen++; |
| 166 } | 150 } |
| 167 cc++; | 151 cc++; |
| 168 } | 152 } |
| 169 | 153 |
| 170 lcnum.m_Integral = bNegative ? -lcnum.m_Integral : lcnum.m_Integral; | 154 lcnum.m_Integral = bNegative ? -lcnum.m_Integral : lcnum.m_Integral; |
| 171 if (cc < len && str[cc] == '.') { | 155 if (cc < len && str[cc] == '.') { |
| 172 int scale = 0; | 156 int scale = 0; |
| 173 double fraction = 0.0; | 157 double fraction = 0.0; |
| 174 cc++; | 158 cc++; |
| 175 while (cc < len) { | 159 while (cc < len) { |
| 176 if (scale >= gs_fraction_count) { | 160 if (scale >= FXSYS_FractionalScaleCount()) { |
| 177 while (cc < len) { | 161 while (cc < len) { |
| 178 if (!FX_IsDigit(str[cc])) | 162 if (!FXSYS_isDecimalDigit(str[cc])) |
| 179 break; | 163 break; |
| 180 cc++; | 164 cc++; |
| 181 } | 165 } |
| 182 } | 166 } |
| 183 if (!FX_IsDigit(str[cc])) { | 167 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 184 if ((str[cc] == 'E' || str[cc] == 'e')) | 168 if ((str[cc] == 'E' || str[cc] == 'e')) |
| 185 break; | 169 break; |
| 186 else | 170 else |
| 187 return FALSE; | 171 return FALSE; |
| 188 } | 172 } |
| 189 fraction += gs_fraction_scales[scale] * (str[cc] - '0'); | 173 fraction += FXSYS_FractionalScale(scale, FXSYS_toDecimalDigit(str[cc])); |
| 190 scale++; | 174 scale++; |
| 191 cc++; | 175 cc++; |
| 192 } | 176 } |
| 193 lcnum.m_Fractional = (uint32_t)(fraction * 4294967296.0); | 177 lcnum.m_Fractional = (uint32_t)(fraction * 4294967296.0); |
| 194 } | 178 } |
| 195 if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { | 179 if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { |
| 196 cc++; | 180 cc++; |
| 197 if (cc < len) { | 181 if (cc < len) { |
| 198 if (str[cc] == '+') { | 182 if (str[cc] == '+') { |
| 199 cc++; | 183 cc++; |
| 200 } else if (str[cc] == '-') { | 184 } else if (str[cc] == '-') { |
| 201 bExpSign = true; | 185 bExpSign = true; |
| 202 cc++; | 186 cc++; |
| 203 } | 187 } |
| 204 } | 188 } |
| 205 while (cc < len) { | 189 while (cc < len) { |
| 206 if (FX_IsDigit(str[cc])) | 190 if (FXSYS_isDecimalDigit(str[cc])) |
| 207 return FALSE; | 191 return FALSE; |
| 208 lcnum.m_Exponent = lcnum.m_Exponent * 10 + str[cc] - '0'; | 192 lcnum.m_Exponent = lcnum.m_Exponent * 10 + str[cc] - '0'; |
| 209 cc++; | 193 cc++; |
| 210 } | 194 } |
| 211 lcnum.m_Exponent = bExpSign ? -lcnum.m_Exponent : lcnum.m_Exponent; | 195 lcnum.m_Exponent = bExpSign ? -lcnum.m_Exponent : lcnum.m_Exponent; |
| 212 } | 196 } |
| 213 return TRUE; | 197 return TRUE; |
| 214 } | 198 } |
| 215 | 199 |
| 216 CFX_LCNumeric::CFX_LCNumeric() { | 200 CFX_LCNumeric::CFX_LCNumeric() { |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 683 if (iText + iLiteralLen > iLenText || | 667 if (iText + iLiteralLen > iLenText || |
| 684 FXSYS_wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) { | 668 FXSYS_wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) { |
| 685 wsValue = wsSrcText; | 669 wsValue = wsSrcText; |
| 686 return FALSE; | 670 return FALSE; |
| 687 } | 671 } |
| 688 iText += iLiteralLen; | 672 iText += iLiteralLen; |
| 689 iPattern++; | 673 iPattern++; |
| 690 break; | 674 break; |
| 691 } | 675 } |
| 692 case 'A': | 676 case 'A': |
| 693 if (FX_IsAlpha(pStrText[iText])) { | 677 if (FXSYS_iswalpha(pStrText[iText])) { |
| 694 wsValue += pStrText[iText]; | 678 wsValue += pStrText[iText]; |
| 695 iText++; | 679 iText++; |
| 696 } | 680 } |
| 697 iPattern++; | 681 iPattern++; |
| 698 break; | 682 break; |
| 699 case 'X': | 683 case 'X': |
| 700 wsValue += pStrText[iText]; | 684 wsValue += pStrText[iText]; |
| 701 iText++; | 685 iText++; |
| 702 iPattern++; | 686 iPattern++; |
| 703 break; | 687 break; |
| 704 case 'O': | 688 case 'O': |
| 705 case '0': | 689 case '0': |
| 706 if (FX_IsDigit(pStrText[iText]) || FX_IsAlpha(pStrText[iText])) { | 690 if (FXSYS_isDecimalDigit(pStrText[iText]) || |
| 691 FXSYS_iswalpha(pStrText[iText])) { | |
| 707 wsValue += pStrText[iText]; | 692 wsValue += pStrText[iText]; |
| 708 iText++; | 693 iText++; |
| 709 } | 694 } |
| 710 iPattern++; | 695 iPattern++; |
| 711 break; | 696 break; |
| 712 case '9': | 697 case '9': |
| 713 if (FX_IsDigit(pStrText[iText])) { | 698 if (FXSYS_isDecimalDigit(pStrText[iText])) { |
| 714 wsValue += pStrText[iText]; | 699 wsValue += pStrText[iText]; |
| 715 iText++; | 700 iText++; |
| 716 } | 701 } |
| 717 iPattern++; | 702 iPattern++; |
| 718 break; | 703 break; |
| 719 default: | 704 default: |
| 720 if (pStrPattern[iPattern] != pStrText[iText]) { | 705 if (pStrPattern[iPattern] != pStrText[iText]) { |
| 721 wsValue = wsSrcText; | 706 wsValue = wsSrcText; |
| 722 return FALSE; | 707 return FALSE; |
| 723 } | 708 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 779 cc -= iLiteralLen - 1; | 764 cc -= iLiteralLen - 1; |
| 780 if (cc < 0 || | 765 if (cc < 0 || |
| 781 FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { | 766 FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { |
| 782 return FALSE; | 767 return FALSE; |
| 783 } | 768 } |
| 784 cc--; | 769 cc--; |
| 785 ccf--; | 770 ccf--; |
| 786 break; | 771 break; |
| 787 } | 772 } |
| 788 case '9': | 773 case '9': |
| 789 if (!FX_IsDigit(str[cc])) { | 774 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 790 return FALSE; | 775 return FALSE; |
| 791 } | 776 } |
| 792 dbRetValue = dbRetValue * coeff + (str[cc] - '0') * 0.1; | 777 dbRetValue = dbRetValue * coeff + (str[cc] - '0') * 0.1; |
| 793 coeff *= 0.1; | 778 coeff *= 0.1; |
| 794 cc--; | 779 cc--; |
| 795 ccf--; | 780 ccf--; |
| 796 break; | 781 break; |
| 797 case 'z': | 782 case 'z': |
| 798 if (cc >= 0) { | 783 if (cc >= 0) { |
| 799 dbRetValue = dbRetValue * coeff + (str[cc] - '0') * 0.1; | 784 dbRetValue = dbRetValue * coeff + (str[cc] - '0') * 0.1; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 838 break; | 823 break; |
| 839 case 'E': { | 824 case 'E': { |
| 840 if (cc >= dot_index) { | 825 if (cc >= dot_index) { |
| 841 return FALSE; | 826 return FALSE; |
| 842 } | 827 } |
| 843 FX_BOOL bExpSign = FALSE; | 828 FX_BOOL bExpSign = FALSE; |
| 844 while (cc >= 0) { | 829 while (cc >= 0) { |
| 845 if (str[cc] == 'E' || str[cc] == 'e') { | 830 if (str[cc] == 'E' || str[cc] == 'e') { |
| 846 break; | 831 break; |
| 847 } | 832 } |
| 848 if (FX_IsDigit(str[cc])) { | 833 if (FXSYS_isDecimalDigit(str[cc])) { |
| 849 iExponent = iExponent + (str[cc] - '0') * 10; | 834 iExponent = iExponent + (str[cc] - '0') * 10; |
| 850 cc--; | 835 cc--; |
| 851 continue; | 836 continue; |
| 852 } else if (str[cc] == '+') { | 837 } else if (str[cc] == '+') { |
| 853 cc--; | 838 cc--; |
| 854 continue; | 839 continue; |
| 855 } else if (cc - iMinusLen + 1 > 0 && | 840 } else if (cc - iMinusLen + 1 > 0 && |
| 856 !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), | 841 !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), |
| 857 wsMinus.c_str(), iMinusLen)) { | 842 wsMinus.c_str(), iMinusLen)) { |
| 858 bExpSign = TRUE; | 843 bExpSign = TRUE; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 939 return FALSE; | 924 return FALSE; |
| 940 } | 925 } |
| 941 cc--; | 926 cc--; |
| 942 ccf--; | 927 ccf--; |
| 943 bHavePercentSymbol = TRUE; | 928 bHavePercentSymbol = TRUE; |
| 944 } break; | 929 } break; |
| 945 case '8': | 930 case '8': |
| 946 while (ccf < lenf && strf[ccf] == '8') { | 931 while (ccf < lenf && strf[ccf] == '8') { |
| 947 ccf++; | 932 ccf++; |
| 948 } | 933 } |
| 949 while (cc < len && FX_IsDigit(str[cc])) { | 934 while (cc < len && FXSYS_isDecimalDigit(str[cc])) { |
| 950 dbRetValue = (str[cc] - '0') * coeff + dbRetValue; | 935 dbRetValue = (str[cc] - '0') * coeff + dbRetValue; |
| 951 coeff *= 0.1; | 936 coeff *= 0.1; |
| 952 cc++; | 937 cc++; |
| 953 } | 938 } |
| 954 break; | 939 break; |
| 955 case ',': { | 940 case ',': { |
| 956 if (cc >= 0) { | 941 if (cc >= 0) { |
| 957 cc -= iGroupLen - 1; | 942 cc -= iGroupLen - 1; |
| 958 if (cc >= 0 && | 943 if (cc >= 0 && |
| 959 FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == | 944 FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1003 int32_t iLiteralLen = wsLiteral.GetLength(); | 988 int32_t iLiteralLen = wsLiteral.GetLength(); |
| 1004 cc -= iLiteralLen - 1; | 989 cc -= iLiteralLen - 1; |
| 1005 if (cc < 0 || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { | 990 if (cc < 0 || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { |
| 1006 return FALSE; | 991 return FALSE; |
| 1007 } | 992 } |
| 1008 cc--; | 993 cc--; |
| 1009 ccf--; | 994 ccf--; |
| 1010 break; | 995 break; |
| 1011 } | 996 } |
| 1012 case '9': | 997 case '9': |
| 1013 if (!FX_IsDigit(str[cc])) { | 998 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 1014 return FALSE; | 999 return FALSE; |
| 1015 } | 1000 } |
| 1016 dbRetValue = dbRetValue + (str[cc] - '0') * coeff; | 1001 dbRetValue = dbRetValue + (str[cc] - '0') * coeff; |
| 1017 coeff *= 10; | 1002 coeff *= 10; |
| 1018 cc--; | 1003 cc--; |
| 1019 ccf--; | 1004 ccf--; |
| 1020 break; | 1005 break; |
| 1021 case 'z': | 1006 case 'z': |
| 1022 if (FX_IsDigit(str[cc])) { | 1007 if (FXSYS_isDecimalDigit(str[cc])) { |
| 1023 dbRetValue = dbRetValue + (str[cc] - '0') * coeff; | 1008 dbRetValue = dbRetValue + (str[cc] - '0') * coeff; |
| 1024 coeff *= 10; | 1009 coeff *= 10; |
| 1025 cc--; | 1010 cc--; |
| 1026 } | 1011 } |
| 1027 ccf--; | 1012 ccf--; |
| 1028 break; | 1013 break; |
| 1029 case 'Z': | 1014 case 'Z': |
| 1030 if (str[cc] != ' ') { | 1015 if (str[cc] != ' ') { |
| 1031 if (FX_IsDigit(str[cc])) { | 1016 if (FXSYS_isDecimalDigit(str[cc])) { |
| 1032 dbRetValue = dbRetValue + (str[cc] - '0') * coeff; | 1017 dbRetValue = dbRetValue + (str[cc] - '0') * coeff; |
| 1033 coeff *= 10; | 1018 coeff *= 10; |
| 1034 cc--; | 1019 cc--; |
| 1035 } | 1020 } |
| 1036 } else { | 1021 } else { |
| 1037 cc--; | 1022 cc--; |
| 1038 } | 1023 } |
| 1039 ccf--; | 1024 ccf--; |
| 1040 break; | 1025 break; |
| 1041 case 'S': | 1026 case 'S': |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1066 break; | 1051 break; |
| 1067 case 'E': { | 1052 case 'E': { |
| 1068 if (cc >= dot_index) { | 1053 if (cc >= dot_index) { |
| 1069 return FALSE; | 1054 return FALSE; |
| 1070 } | 1055 } |
| 1071 FX_BOOL bExpSign = FALSE; | 1056 FX_BOOL bExpSign = FALSE; |
| 1072 while (cc >= 0) { | 1057 while (cc >= 0) { |
| 1073 if (str[cc] == 'E' || str[cc] == 'e') { | 1058 if (str[cc] == 'E' || str[cc] == 'e') { |
| 1074 break; | 1059 break; |
| 1075 } | 1060 } |
| 1076 if (FX_IsDigit(str[cc])) { | 1061 if (FXSYS_isDecimalDigit(str[cc])) { |
| 1077 iExponent = iExponent + (str[cc] - '0') * 10; | 1062 iExponent = iExponent + (str[cc] - '0') * 10; |
| 1078 cc--; | 1063 cc--; |
| 1079 continue; | 1064 continue; |
| 1080 } else if (str[cc] == '+') { | 1065 } else if (str[cc] == '+') { |
| 1081 cc--; | 1066 cc--; |
| 1082 continue; | 1067 continue; |
| 1083 } else if (cc - iMinusLen + 1 > 0 && | 1068 } else if (cc - iMinusLen + 1 > 0 && |
| 1084 !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), wsMinus.c_str(), | 1069 !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), wsMinus.c_str(), |
| 1085 iMinusLen)) { | 1070 iMinusLen)) { |
| 1086 bExpSign = TRUE; | 1071 bExpSign = TRUE; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1222 int32_t iLiteralLen = wsLiteral.GetLength(); | 1207 int32_t iLiteralLen = wsLiteral.GetLength(); |
| 1223 if (cc + iLiteralLen > len || | 1208 if (cc + iLiteralLen > len || |
| 1224 FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { | 1209 FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { |
| 1225 return FALSE; | 1210 return FALSE; |
| 1226 } | 1211 } |
| 1227 cc += iLiteralLen; | 1212 cc += iLiteralLen; |
| 1228 ccf++; | 1213 ccf++; |
| 1229 break; | 1214 break; |
| 1230 } | 1215 } |
| 1231 case '9': | 1216 case '9': |
| 1232 if (!FX_IsDigit(str[cc])) { | 1217 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 1233 return FALSE; | 1218 return FALSE; |
| 1234 } | 1219 } |
| 1235 { | 1220 { |
| 1236 dbRetValue = dbRetValue + (str[cc] - '0') * coeff; | 1221 dbRetValue = dbRetValue + (str[cc] - '0') * coeff; |
| 1237 coeff *= 0.1; | 1222 coeff *= 0.1; |
| 1238 } | 1223 } |
| 1239 cc++; | 1224 cc++; |
| 1240 ccf++; | 1225 ccf++; |
| 1241 break; | 1226 break; |
| 1242 case 'z': | 1227 case 'z': |
| 1243 if (FX_IsDigit(str[cc])) { | 1228 if (FXSYS_isDecimalDigit(str[cc])) { |
| 1244 dbRetValue = dbRetValue + (str[cc] - '0') * coeff; | 1229 dbRetValue = dbRetValue + (str[cc] - '0') * coeff; |
| 1245 coeff *= 0.1; | 1230 coeff *= 0.1; |
| 1246 cc++; | 1231 cc++; |
| 1247 } | 1232 } |
| 1248 ccf++; | 1233 ccf++; |
| 1249 break; | 1234 break; |
| 1250 case 'Z': | 1235 case 'Z': |
| 1251 if (str[cc] != ' ') { | 1236 if (str[cc] != ' ') { |
| 1252 if (FX_IsDigit(str[cc])) { | 1237 if (FXSYS_isDecimalDigit(str[cc])) { |
| 1253 dbRetValue = dbRetValue + (str[cc] - '0') * coeff; | 1238 dbRetValue = dbRetValue + (str[cc] - '0') * coeff; |
| 1254 coeff *= 0.1; | 1239 coeff *= 0.1; |
| 1255 cc++; | 1240 cc++; |
| 1256 } | 1241 } |
| 1257 } else { | 1242 } else { |
| 1258 cc++; | 1243 cc++; |
| 1259 } | 1244 } |
| 1260 ccf++; | 1245 ccf++; |
| 1261 break; | 1246 break; |
| 1262 case 'S': | 1247 case 'S': |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 1293 cc++; | 1278 cc++; |
| 1294 if (cc < len) { | 1279 if (cc < len) { |
| 1295 if (str[cc] == '+') { | 1280 if (str[cc] == '+') { |
| 1296 cc++; | 1281 cc++; |
| 1297 } else if (str[cc] == '-') { | 1282 } else if (str[cc] == '-') { |
| 1298 bExpSign = TRUE; | 1283 bExpSign = TRUE; |
| 1299 cc++; | 1284 cc++; |
| 1300 } | 1285 } |
| 1301 } | 1286 } |
| 1302 while (cc < len) { | 1287 while (cc < len) { |
| 1303 if (!FX_IsDigit(str[cc])) { | 1288 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 1304 break; | 1289 break; |
| 1305 } | 1290 } |
| 1306 iExponent = iExponent * 10 + str[cc] - '0'; | 1291 iExponent = iExponent * 10 + str[cc] - '0'; |
| 1307 cc++; | 1292 cc++; |
| 1308 } | 1293 } |
| 1309 iExponent = bExpSign ? -iExponent : iExponent; | 1294 iExponent = bExpSign ? -iExponent : iExponent; |
| 1310 ccf++; | 1295 ccf++; |
| 1311 } break; | 1296 } break; |
| 1312 case '$': { | 1297 case '$': { |
| 1313 CFX_WideString wsSymbol; | 1298 CFX_WideString wsSymbol; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1373 !FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) { | 1358 !FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) { |
| 1374 cc += iSysmbolLen; | 1359 cc += iSysmbolLen; |
| 1375 } | 1360 } |
| 1376 ccf++; | 1361 ccf++; |
| 1377 bHavePercentSymbol = TRUE; | 1362 bHavePercentSymbol = TRUE; |
| 1378 } break; | 1363 } break; |
| 1379 case '8': { | 1364 case '8': { |
| 1380 while (ccf < lenf && strf[ccf] == '8') { | 1365 while (ccf < lenf && strf[ccf] == '8') { |
| 1381 ccf++; | 1366 ccf++; |
| 1382 } | 1367 } |
| 1383 while (cc < len && FX_IsDigit(str[cc])) { | 1368 while (cc < len && FXSYS_isDecimalDigit(str[cc])) { |
| 1384 dbRetValue = (str[cc] - '0') * coeff + dbRetValue; | 1369 dbRetValue = (str[cc] - '0') * coeff + dbRetValue; |
| 1385 coeff *= 0.1; | 1370 coeff *= 0.1; |
| 1386 cc++; | 1371 cc++; |
| 1387 } | 1372 } |
| 1388 } break; | 1373 } break; |
| 1389 case ',': { | 1374 case ',': { |
| 1390 if (cc + iGroupLen <= len && | 1375 if (cc + iGroupLen <= len && |
| 1391 FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) { | 1376 FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) { |
| 1392 cc += iGroupLen; | 1377 cc += iGroupLen; |
| 1393 } | 1378 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1483 int32_t iLiteralLen = wsLiteral.GetLength(); | 1468 int32_t iLiteralLen = wsLiteral.GetLength(); |
| 1484 cc -= iLiteralLen - 1; | 1469 cc -= iLiteralLen - 1; |
| 1485 if (cc < 0 || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { | 1470 if (cc < 0 || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { |
| 1486 return FALSE; | 1471 return FALSE; |
| 1487 } | 1472 } |
| 1488 cc--; | 1473 cc--; |
| 1489 ccf--; | 1474 ccf--; |
| 1490 break; | 1475 break; |
| 1491 } | 1476 } |
| 1492 case '9': | 1477 case '9': |
| 1493 if (!FX_IsDigit(str[cc])) { | 1478 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 1494 return FALSE; | 1479 return FALSE; |
| 1495 } | 1480 } |
| 1496 wsValue = str[cc] + wsValue; | 1481 wsValue = str[cc] + wsValue; |
| 1497 cc--; | 1482 cc--; |
| 1498 ccf--; | 1483 ccf--; |
| 1499 break; | 1484 break; |
| 1500 case 'z': | 1485 case 'z': |
| 1501 if (FX_IsDigit(str[cc])) { | 1486 if (FXSYS_isDecimalDigit(str[cc])) { |
| 1502 wsValue = str[cc] + wsValue; | 1487 wsValue = str[cc] + wsValue; |
| 1503 cc--; | 1488 cc--; |
| 1504 } | 1489 } |
| 1505 ccf--; | 1490 ccf--; |
| 1506 break; | 1491 break; |
| 1507 case 'Z': | 1492 case 'Z': |
| 1508 if (str[cc] != ' ') { | 1493 if (str[cc] != ' ') { |
| 1509 if (FX_IsDigit(str[cc])) { | 1494 if (FXSYS_isDecimalDigit(str[cc])) { |
| 1510 wsValue = str[cc] + wsValue; | 1495 wsValue = str[cc] + wsValue; |
| 1511 cc--; | 1496 cc--; |
| 1512 } | 1497 } |
| 1513 } else { | 1498 } else { |
| 1514 cc--; | 1499 cc--; |
| 1515 } | 1500 } |
| 1516 ccf--; | 1501 ccf--; |
| 1517 break; | 1502 break; |
| 1518 case 'S': | 1503 case 'S': |
| 1519 if (str[cc] == '+' || str[cc] == ' ') { | 1504 if (str[cc] == '+' || str[cc] == ' ') { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1543 break; | 1528 break; |
| 1544 case 'E': { | 1529 case 'E': { |
| 1545 if (cc >= dot_index) { | 1530 if (cc >= dot_index) { |
| 1546 return FALSE; | 1531 return FALSE; |
| 1547 } | 1532 } |
| 1548 FX_BOOL bExpSign = FALSE; | 1533 FX_BOOL bExpSign = FALSE; |
| 1549 while (cc >= 0) { | 1534 while (cc >= 0) { |
| 1550 if (str[cc] == 'E' || str[cc] == 'e') { | 1535 if (str[cc] == 'E' || str[cc] == 'e') { |
| 1551 break; | 1536 break; |
| 1552 } | 1537 } |
| 1553 if (FX_IsDigit(str[cc])) { | 1538 if (FXSYS_isDecimalDigit(str[cc])) { |
| 1554 iExponent = iExponent + (str[cc] - '0') * 10; | 1539 iExponent = iExponent + (str[cc] - '0') * 10; |
| 1555 cc--; | 1540 cc--; |
| 1556 continue; | 1541 continue; |
| 1557 } else if (str[cc] == '+') { | 1542 } else if (str[cc] == '+') { |
| 1558 cc--; | 1543 cc--; |
| 1559 continue; | 1544 continue; |
| 1560 } else if (cc - iMinusLen + 1 > 0 && | 1545 } else if (cc - iMinusLen + 1 > 0 && |
| 1561 !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), wsMinus.c_str(), | 1546 !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), wsMinus.c_str(), |
| 1562 iMinusLen)) { | 1547 iMinusLen)) { |
| 1563 bExpSign = TRUE; | 1548 bExpSign = TRUE; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1707 int32_t iLiteralLen = wsLiteral.GetLength(); | 1692 int32_t iLiteralLen = wsLiteral.GetLength(); |
| 1708 if (cc + iLiteralLen > len || | 1693 if (cc + iLiteralLen > len || |
| 1709 FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { | 1694 FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { |
| 1710 return FALSE; | 1695 return FALSE; |
| 1711 } | 1696 } |
| 1712 cc += iLiteralLen; | 1697 cc += iLiteralLen; |
| 1713 ccf++; | 1698 ccf++; |
| 1714 break; | 1699 break; |
| 1715 } | 1700 } |
| 1716 case '9': | 1701 case '9': |
| 1717 if (!FX_IsDigit(str[cc])) { | 1702 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 1718 return FALSE; | 1703 return FALSE; |
| 1719 } | 1704 } |
| 1720 { wsValue += str[cc]; } | 1705 { wsValue += str[cc]; } |
| 1721 cc++; | 1706 cc++; |
| 1722 ccf++; | 1707 ccf++; |
| 1723 break; | 1708 break; |
| 1724 case 'z': | 1709 case 'z': |
| 1725 if (FX_IsDigit(str[cc])) { | 1710 if (FXSYS_isDecimalDigit(str[cc])) { |
| 1726 wsValue += str[cc]; | 1711 wsValue += str[cc]; |
| 1727 cc++; | 1712 cc++; |
| 1728 } | 1713 } |
| 1729 ccf++; | 1714 ccf++; |
| 1730 break; | 1715 break; |
| 1731 case 'Z': | 1716 case 'Z': |
| 1732 if (str[cc] != ' ') { | 1717 if (str[cc] != ' ') { |
| 1733 if (FX_IsDigit(str[cc])) { | 1718 if (FXSYS_isDecimalDigit(str[cc])) { |
| 1734 wsValue += str[cc]; | 1719 wsValue += str[cc]; |
| 1735 cc++; | 1720 cc++; |
| 1736 } | 1721 } |
| 1737 } else { | 1722 } else { |
| 1738 cc++; | 1723 cc++; |
| 1739 } | 1724 } |
| 1740 ccf++; | 1725 ccf++; |
| 1741 break; | 1726 break; |
| 1742 case 'S': | 1727 case 'S': |
| 1743 if (str[cc] == '+' || str[cc] == ' ') { | 1728 if (str[cc] == '+' || str[cc] == ' ') { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1773 cc++; | 1758 cc++; |
| 1774 if (cc < len) { | 1759 if (cc < len) { |
| 1775 if (str[cc] == '+') { | 1760 if (str[cc] == '+') { |
| 1776 cc++; | 1761 cc++; |
| 1777 } else if (str[cc] == '-') { | 1762 } else if (str[cc] == '-') { |
| 1778 bExpSign = TRUE; | 1763 bExpSign = TRUE; |
| 1779 cc++; | 1764 cc++; |
| 1780 } | 1765 } |
| 1781 } | 1766 } |
| 1782 while (cc < len) { | 1767 while (cc < len) { |
| 1783 if (!FX_IsDigit(str[cc])) { | 1768 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 1784 break; | 1769 break; |
| 1785 } | 1770 } |
| 1786 iExponent = iExponent * 10 + str[cc] - '0'; | 1771 iExponent = iExponent * 10 + str[cc] - '0'; |
| 1787 cc++; | 1772 cc++; |
| 1788 } | 1773 } |
| 1789 iExponent = bExpSign ? -iExponent : iExponent; | 1774 iExponent = bExpSign ? -iExponent : iExponent; |
| 1790 ccf++; | 1775 ccf++; |
| 1791 } break; | 1776 } break; |
| 1792 case '$': { | 1777 case '$': { |
| 1793 CFX_WideString wsSymbol; | 1778 CFX_WideString wsSymbol; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1853 !FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) { | 1838 !FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) { |
| 1854 cc += iSysmbolLen; | 1839 cc += iSysmbolLen; |
| 1855 } | 1840 } |
| 1856 ccf++; | 1841 ccf++; |
| 1857 bHavePercentSymbol = TRUE; | 1842 bHavePercentSymbol = TRUE; |
| 1858 } break; | 1843 } break; |
| 1859 case '8': { | 1844 case '8': { |
| 1860 while (ccf < lenf && strf[ccf] == '8') { | 1845 while (ccf < lenf && strf[ccf] == '8') { |
| 1861 ccf++; | 1846 ccf++; |
| 1862 } | 1847 } |
| 1863 while (cc < len && FX_IsDigit(str[cc])) { | 1848 while (cc < len && FXSYS_isDecimalDigit(str[cc])) { |
| 1864 wsValue += str[cc]; | 1849 wsValue += str[cc]; |
| 1865 cc++; | 1850 cc++; |
| 1866 } | 1851 } |
| 1867 } break; | 1852 } break; |
| 1868 case ',': { | 1853 case ',': { |
| 1869 if (cc + iGroupLen <= len && | 1854 if (cc + iGroupLen <= len && |
| 1870 FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) { | 1855 FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) { |
| 1871 cc += iGroupLen; | 1856 cc += iGroupLen; |
| 1872 } | 1857 } |
| 1873 ccf++; | 1858 ccf++; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2088 continue; | 2073 continue; |
| 2089 } | 2074 } |
| 2090 uint32_t dwSymbolNum = 1; | 2075 uint32_t dwSymbolNum = 1; |
| 2091 FX_WCHAR dwCharSymbol = strf[ccf++]; | 2076 FX_WCHAR dwCharSymbol = strf[ccf++]; |
| 2092 while (ccf < lenf && strf[ccf] == dwCharSymbol) { | 2077 while (ccf < lenf && strf[ccf] == dwCharSymbol) { |
| 2093 ccf++; | 2078 ccf++; |
| 2094 dwSymbolNum++; | 2079 dwSymbolNum++; |
| 2095 } | 2080 } |
| 2096 uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0'); | 2081 uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0'); |
| 2097 if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) { | 2082 if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) { |
| 2098 if (!FX_IsDigit(str[cc])) { | 2083 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2099 return FALSE; | 2084 return FALSE; |
| 2100 } | 2085 } |
| 2101 day = str[cc++] - '0'; | 2086 day = str[cc++] - '0'; |
| 2102 if (cc < len && FX_IsDigit(str[cc])) { | 2087 if (cc < len && FXSYS_isDecimalDigit(str[cc])) { |
| 2103 day = day * 10 + str[cc++] - '0'; | 2088 day = day * 10 + str[cc++] - '0'; |
| 2104 } | 2089 } |
| 2105 } else if (dwSymbol == FXBSTR_ID(0, 0, 'D', '2')) { | 2090 } else if (dwSymbol == FXBSTR_ID(0, 0, 'D', '2')) { |
| 2106 if (!FX_IsDigit(str[cc])) { | 2091 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2107 return FALSE; | 2092 return FALSE; |
| 2108 } | 2093 } |
| 2109 day = str[cc++] - '0'; | 2094 day = str[cc++] - '0'; |
| 2110 if (cc < len) { | 2095 if (cc < len) { |
| 2111 day = day * 10 + str[cc++] - '0'; | 2096 day = day * 10 + str[cc++] - '0'; |
| 2112 } | 2097 } |
| 2113 } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '1')) { | 2098 } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '1')) { |
| 2114 int i = 0; | 2099 int i = 0; |
| 2115 while (cc < len && i < 3 && FX_IsDigit(str[cc])) { | 2100 while (cc < len && i < 3 && FXSYS_isDecimalDigit(str[cc])) { |
| 2116 cc++; | 2101 cc++; |
| 2117 i++; | 2102 i++; |
| 2118 } | 2103 } |
| 2119 } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '3')) { | 2104 } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '3')) { |
| 2120 cc += 3; | 2105 cc += 3; |
| 2121 } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) { | 2106 } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) { |
| 2122 if (!FX_IsDigit(str[cc])) { | 2107 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2123 return FALSE; | 2108 return FALSE; |
| 2124 } | 2109 } |
| 2125 month = str[cc++] - '0'; | 2110 month = str[cc++] - '0'; |
| 2126 if (cc < len && FX_IsDigit(str[cc])) { | 2111 if (cc < len && FXSYS_isDecimalDigit(str[cc])) { |
| 2127 month = month * 10 + str[cc++] - '0'; | 2112 month = month * 10 + str[cc++] - '0'; |
| 2128 } | 2113 } |
| 2129 } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) { | 2114 } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) { |
| 2130 if (!FX_IsDigit(str[cc])) { | 2115 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2131 return FALSE; | 2116 return FALSE; |
| 2132 } | 2117 } |
| 2133 month = str[cc++] - '0'; | 2118 month = str[cc++] - '0'; |
| 2134 if (cc < len) { | 2119 if (cc < len) { |
| 2135 month = month * 10 + str[cc++] - '0'; | 2120 month = month * 10 + str[cc++] - '0'; |
| 2136 } | 2121 } |
| 2137 } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '3')) { | 2122 } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '3')) { |
| 2138 CFX_WideString wsMonthNameAbbr; | 2123 CFX_WideString wsMonthNameAbbr; |
| 2139 uint16_t i = 0; | 2124 uint16_t i = 0; |
| 2140 for (; i < 12; i++) { | 2125 for (; i < 12; i++) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2203 cc += wsDayName.GetLength(); | 2188 cc += wsDayName.GetLength(); |
| 2204 } | 2189 } |
| 2205 } else if (dwSymbol == FXBSTR_ID(0, 0, 'e', '1')) { | 2190 } else if (dwSymbol == FXBSTR_ID(0, 0, 'e', '1')) { |
| 2206 cc += 1; | 2191 cc += 1; |
| 2207 } else if (dwSymbol == FXBSTR_ID(0, 0, 'G', '1')) { | 2192 } else if (dwSymbol == FXBSTR_ID(0, 0, 'G', '1')) { |
| 2208 cc += 2; | 2193 cc += 2; |
| 2209 } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '2')) { | 2194 } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '2')) { |
| 2210 if (cc + 2 > len) { | 2195 if (cc + 2 > len) { |
| 2211 return FALSE; | 2196 return FALSE; |
| 2212 } | 2197 } |
| 2213 if (!FX_IsDigit(str[cc])) { | 2198 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2214 return FALSE; | 2199 return FALSE; |
| 2215 } | 2200 } |
| 2216 year = str[cc++] - '0'; | 2201 year = str[cc++] - '0'; |
| 2217 if (cc >= len || !FX_IsDigit(str[cc])) { | 2202 if (cc >= len || !FXSYS_isDecimalDigit(str[cc])) { |
| 2218 return FALSE; | 2203 return FALSE; |
| 2219 } | 2204 } |
| 2220 year = year * 10 + str[cc++] - '0'; | 2205 year = year * 10 + str[cc++] - '0'; |
| 2221 if (year <= 29) { | 2206 if (year <= 29) { |
| 2222 year += 2000; | 2207 year += 2000; |
| 2223 } else { | 2208 } else { |
| 2224 year += 1900; | 2209 year += 1900; |
| 2225 } | 2210 } |
| 2226 } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '4')) { | 2211 } else if (dwSymbol == FXBSTR_ID(0, 0, 'Y', '4')) { |
| 2227 int i = 0; | 2212 int i = 0; |
| 2228 year = 0; | 2213 year = 0; |
| 2229 if (cc + 4 > len) { | 2214 if (cc + 4 > len) { |
| 2230 return FALSE; | 2215 return FALSE; |
| 2231 } | 2216 } |
| 2232 while (i < 4) { | 2217 while (i < 4) { |
| 2233 if (!FX_IsDigit(str[cc])) { | 2218 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2234 return FALSE; | 2219 return FALSE; |
| 2235 } | 2220 } |
| 2236 year = year * 10 + str[cc] - '0'; | 2221 year = year * 10 + str[cc] - '0'; |
| 2237 cc++; | 2222 cc++; |
| 2238 i++; | 2223 i++; |
| 2239 } | 2224 } |
| 2240 } else if (dwSymbol == FXBSTR_ID(0, 0, 'w', '1')) { | 2225 } else if (dwSymbol == FXBSTR_ID(0, 0, 'w', '1')) { |
| 2241 cc += 1; | 2226 cc += 1; |
| 2242 } else if (dwSymbol == FXBSTR_ID(0, 0, 'W', '2')) { | 2227 } else if (dwSymbol == FXBSTR_ID(0, 0, 'W', '2')) { |
| 2243 cc += 2; | 2228 cc += 2; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2310 FX_WCHAR dwCharSymbol = strf[ccf++]; | 2295 FX_WCHAR dwCharSymbol = strf[ccf++]; |
| 2311 while (ccf < lenf && strf[ccf] == dwCharSymbol) { | 2296 while (ccf < lenf && strf[ccf] == dwCharSymbol) { |
| 2312 ccf++; | 2297 ccf++; |
| 2313 dwSymbolNum++; | 2298 dwSymbolNum++; |
| 2314 } | 2299 } |
| 2315 uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0'); | 2300 uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0'); |
| 2316 if (dwSymbol == FXBSTR_ID(0, 0, 'k', '1') || | 2301 if (dwSymbol == FXBSTR_ID(0, 0, 'k', '1') || |
| 2317 dwSymbol == FXBSTR_ID(0, 0, 'H', '1') || | 2302 dwSymbol == FXBSTR_ID(0, 0, 'H', '1') || |
| 2318 dwSymbol == FXBSTR_ID(0, 0, 'h', '1') || | 2303 dwSymbol == FXBSTR_ID(0, 0, 'h', '1') || |
| 2319 dwSymbol == FXBSTR_ID(0, 0, 'K', '1')) { | 2304 dwSymbol == FXBSTR_ID(0, 0, 'K', '1')) { |
| 2320 if (!FX_IsDigit(str[cc])) { | 2305 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2321 return FALSE; | 2306 return FALSE; |
| 2322 } | 2307 } |
| 2323 hour = str[cc++] - '0'; | 2308 hour = str[cc++] - '0'; |
| 2324 if (cc < len && FX_IsDigit(str[cc])) { | 2309 if (cc < len && FXSYS_isDecimalDigit(str[cc])) { |
| 2325 hour = hour * 10 + str[cc++] - '0'; | 2310 hour = hour * 10 + str[cc++] - '0'; |
| 2326 } | 2311 } |
| 2327 if (dwSymbol == FXBSTR_ID(0, 0, 'K', '1') && hour == 24) { | 2312 if (dwSymbol == FXBSTR_ID(0, 0, 'K', '1') && hour == 24) { |
| 2328 hour = 0; | 2313 hour = 0; |
| 2329 } | 2314 } |
| 2330 } else if (dwSymbol == FXBSTR_ID(0, 0, 'k', '2') || | 2315 } else if (dwSymbol == FXBSTR_ID(0, 0, 'k', '2') || |
| 2331 dwSymbol == FXBSTR_ID(0, 0, 'H', '2') || | 2316 dwSymbol == FXBSTR_ID(0, 0, 'H', '2') || |
| 2332 dwSymbol == FXBSTR_ID(0, 0, 'h', '2') || | 2317 dwSymbol == FXBSTR_ID(0, 0, 'h', '2') || |
| 2333 dwSymbol == FXBSTR_ID(0, 0, 'K', '2')) { | 2318 dwSymbol == FXBSTR_ID(0, 0, 'K', '2')) { |
| 2334 if (!FX_IsDigit(str[cc])) { | 2319 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2335 return FALSE; | 2320 return FALSE; |
| 2336 } | 2321 } |
| 2337 hour = str[cc++] - '0'; | 2322 hour = str[cc++] - '0'; |
| 2338 if (cc >= len) { | 2323 if (cc >= len) { |
| 2339 return FALSE; | 2324 return FALSE; |
| 2340 } | 2325 } |
| 2341 if (!FX_IsDigit(str[cc])) { | 2326 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2342 return FALSE; | 2327 return FALSE; |
| 2343 } | 2328 } |
| 2344 hour = hour * 10 + str[cc++] - '0'; | 2329 hour = hour * 10 + str[cc++] - '0'; |
| 2345 if (dwSymbol == FXBSTR_ID(0, 0, 'K', '2') && hour == 24) { | 2330 if (dwSymbol == FXBSTR_ID(0, 0, 'K', '2') && hour == 24) { |
| 2346 hour = 0; | 2331 hour = 0; |
| 2347 } | 2332 } |
| 2348 } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) { | 2333 } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '1')) { |
| 2349 if (!FX_IsDigit(str[cc])) { | 2334 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2350 return FALSE; | 2335 return FALSE; |
| 2351 } | 2336 } |
| 2352 minute = str[cc++] - '0'; | 2337 minute = str[cc++] - '0'; |
| 2353 if (cc < len && FX_IsDigit(str[cc])) { | 2338 if (cc < len && FXSYS_isDecimalDigit(str[cc])) { |
| 2354 minute = minute * 10 + str[cc++] - '0'; | 2339 minute = minute * 10 + str[cc++] - '0'; |
| 2355 } | 2340 } |
| 2356 } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) { | 2341 } else if (dwSymbol == FXBSTR_ID(0, 0, 'M', '2')) { |
| 2357 if (!FX_IsDigit(str[cc])) { | 2342 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2358 return FALSE; | 2343 return FALSE; |
| 2359 } | 2344 } |
| 2360 minute = str[cc++] - '0'; | 2345 minute = str[cc++] - '0'; |
| 2361 if (cc >= len) { | 2346 if (cc >= len) { |
| 2362 return FALSE; | 2347 return FALSE; |
| 2363 } | 2348 } |
| 2364 if (!FX_IsDigit(str[cc])) { | 2349 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2365 return FALSE; | 2350 return FALSE; |
| 2366 } | 2351 } |
| 2367 minute = minute * 10 + str[cc++] - '0'; | 2352 minute = minute * 10 + str[cc++] - '0'; |
| 2368 } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '1')) { | 2353 } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '1')) { |
| 2369 if (!FX_IsDigit(str[cc])) { | 2354 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2370 return FALSE; | 2355 return FALSE; |
| 2371 } | 2356 } |
| 2372 second = str[cc++] - '0'; | 2357 second = str[cc++] - '0'; |
| 2373 if (cc < len && FX_IsDigit(str[cc])) { | 2358 if (cc < len && FXSYS_isDecimalDigit(str[cc])) { |
| 2374 second = second * 10 + str[cc++] - '0'; | 2359 second = second * 10 + str[cc++] - '0'; |
| 2375 } | 2360 } |
| 2376 } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '2')) { | 2361 } else if (dwSymbol == FXBSTR_ID(0, 0, 'S', '2')) { |
| 2377 if (!FX_IsDigit(str[cc])) { | 2362 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2378 return FALSE; | 2363 return FALSE; |
| 2379 } | 2364 } |
| 2380 second = str[cc++] - '0'; | 2365 second = str[cc++] - '0'; |
| 2381 if (cc >= len) { | 2366 if (cc >= len) { |
| 2382 return FALSE; | 2367 return FALSE; |
| 2383 } | 2368 } |
| 2384 if (!FX_IsDigit(str[cc])) { | 2369 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2385 return FALSE; | 2370 return FALSE; |
| 2386 } | 2371 } |
| 2387 second = second * 10 + str[cc++] - '0'; | 2372 second = second * 10 + str[cc++] - '0'; |
| 2388 } else if (dwSymbol == FXBSTR_ID(0, 0, 'F', '3')) { | 2373 } else if (dwSymbol == FXBSTR_ID(0, 0, 'F', '3')) { |
| 2389 if (cc + 3 >= len) { | 2374 if (cc + 3 >= len) { |
| 2390 return FALSE; | 2375 return FALSE; |
| 2391 } | 2376 } |
| 2392 int i = 0; | 2377 int i = 0; |
| 2393 while (i < 3) { | 2378 while (i < 3) { |
| 2394 if (!FX_IsDigit(str[cc])) { | 2379 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2395 return FALSE; | 2380 return FALSE; |
| 2396 } | 2381 } |
| 2397 millisecond = millisecond * 10 + str[cc++] - '0'; | 2382 millisecond = millisecond * 10 + str[cc++] - '0'; |
| 2398 i++; | 2383 i++; |
| 2399 } | 2384 } |
| 2400 } else if (dwSymbol == FXBSTR_ID(0, 0, 'A', '1')) { | 2385 } else if (dwSymbol == FXBSTR_ID(0, 0, 'A', '1')) { |
| 2401 CFX_WideString wsAM; | 2386 CFX_WideString wsAM; |
| 2402 pLocale->GetMeridiemName(wsAM, TRUE); | 2387 pLocale->GetMeridiemName(wsAM, TRUE); |
| 2403 CFX_WideString wsPM; | 2388 CFX_WideString wsPM; |
| 2404 pLocale->GetMeridiemName(wsPM, FALSE); | 2389 pLocale->GetMeridiemName(wsPM, FALSE); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2590 const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); | 2575 const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); |
| 2591 int32_t iLenPattern = wsTextFormat.GetLength(); | 2576 int32_t iLenPattern = wsTextFormat.GetLength(); |
| 2592 while (iPattern < iLenPattern) { | 2577 while (iPattern < iLenPattern) { |
| 2593 switch (pStrPattern[iPattern]) { | 2578 switch (pStrPattern[iPattern]) { |
| 2594 case '\'': { | 2579 case '\'': { |
| 2595 wsOutput += FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); | 2580 wsOutput += FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); |
| 2596 iPattern++; | 2581 iPattern++; |
| 2597 break; | 2582 break; |
| 2598 } | 2583 } |
| 2599 case 'A': | 2584 case 'A': |
| 2600 if (iText >= iLenText || !FX_IsAlpha(pStrText[iText])) { | 2585 if (iText >= iLenText || !FXSYS_iswalpha(pStrText[iText])) { |
| 2601 return FALSE; | 2586 return FALSE; |
| 2602 } | 2587 } |
| 2603 wsOutput += pStrText[iText++]; | 2588 wsOutput += pStrText[iText++]; |
| 2604 iPattern++; | 2589 iPattern++; |
| 2605 break; | 2590 break; |
| 2606 case 'X': | 2591 case 'X': |
| 2607 if (iText >= iLenText) { | 2592 if (iText >= iLenText) { |
| 2608 return FALSE; | 2593 return FALSE; |
| 2609 } | 2594 } |
| 2610 wsOutput += pStrText[iText++]; | 2595 wsOutput += pStrText[iText++]; |
| 2611 iPattern++; | 2596 iPattern++; |
| 2612 break; | 2597 break; |
| 2613 case 'O': | 2598 case 'O': |
| 2614 case '0': | 2599 case '0': |
| 2615 if (iText >= iLenText || | 2600 if (iText >= iLenText || (!FXSYS_isDecimalDigit(pStrText[iText]) && |
| 2616 (!FX_IsDigit(pStrText[iText]) && !FX_IsAlpha(pStrText[iText]))) { | 2601 !FXSYS_iswalpha(pStrText[iText]))) { |
| 2617 return FALSE; | 2602 return FALSE; |
| 2618 } | 2603 } |
| 2619 wsOutput += pStrText[iText++]; | 2604 wsOutput += pStrText[iText++]; |
| 2620 iPattern++; | 2605 iPattern++; |
| 2621 break; | 2606 break; |
| 2622 case '9': | 2607 case '9': |
| 2623 if (iText >= iLenText || !FX_IsDigit(pStrText[iText])) { | 2608 if (iText >= iLenText || !FXSYS_isDecimalDigit(pStrText[iText])) { |
| 2624 return FALSE; | 2609 return FALSE; |
| 2625 } | 2610 } |
| 2626 wsOutput += pStrText[iText++]; | 2611 wsOutput += pStrText[iText++]; |
| 2627 iPattern++; | 2612 iPattern++; |
| 2628 break; | 2613 break; |
| 2629 default: | 2614 default: |
| 2630 wsOutput += pStrPattern[iPattern++]; | 2615 wsOutput += pStrPattern[iPattern++]; |
| 2631 break; | 2616 break; |
| 2632 } | 2617 } |
| 2633 } | 2618 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2740 int dot_index = wsSrcNum.Find('.'); | 2725 int dot_index = wsSrcNum.Find('.'); |
| 2741 if (dot_index == -1) { | 2726 if (dot_index == -1) { |
| 2742 dot_index = len; | 2727 dot_index = len; |
| 2743 } | 2728 } |
| 2744 ccf = dot_index_f - 1; | 2729 ccf = dot_index_f - 1; |
| 2745 cc = dot_index - 1; | 2730 cc = dot_index - 1; |
| 2746 while (ccf >= 0) { | 2731 while (ccf >= 0) { |
| 2747 switch (strf[ccf]) { | 2732 switch (strf[ccf]) { |
| 2748 case '9': | 2733 case '9': |
| 2749 if (cc >= 0) { | 2734 if (cc >= 0) { |
| 2750 if (!FX_IsDigit(str[cc])) { | 2735 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2751 return FALSE; | 2736 return FALSE; |
| 2752 } | 2737 } |
| 2753 wsOutput = str[cc] + wsOutput; | 2738 wsOutput = str[cc] + wsOutput; |
| 2754 cc--; | 2739 cc--; |
| 2755 } else { | 2740 } else { |
| 2756 wsOutput = L'0' + wsOutput; | 2741 wsOutput = L'0' + wsOutput; |
| 2757 } | 2742 } |
| 2758 ccf--; | 2743 ccf--; |
| 2759 break; | 2744 break; |
| 2760 case 'z': | 2745 case 'z': |
| 2761 if (cc >= 0) { | 2746 if (cc >= 0) { |
| 2762 if (!FX_IsDigit(str[cc])) { | 2747 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2763 return FALSE; | 2748 return FALSE; |
| 2764 } | 2749 } |
| 2765 if (str[0] != '0') { | 2750 if (str[0] != '0') { |
| 2766 wsOutput = str[cc] + wsOutput; | 2751 wsOutput = str[cc] + wsOutput; |
| 2767 } | 2752 } |
| 2768 cc--; | 2753 cc--; |
| 2769 } | 2754 } |
| 2770 ccf--; | 2755 ccf--; |
| 2771 break; | 2756 break; |
| 2772 case 'Z': | 2757 case 'Z': |
| 2773 if (cc >= 0) { | 2758 if (cc >= 0) { |
| 2774 if (!FX_IsDigit(str[cc])) { | 2759 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2775 return FALSE; | 2760 return FALSE; |
| 2776 } | 2761 } |
| 2777 if (str[0] == '0') { | 2762 if (str[0] == '0') { |
| 2778 wsOutput = L' ' + wsOutput; | 2763 wsOutput = L' ' + wsOutput; |
| 2779 } else { | 2764 } else { |
| 2780 wsOutput = str[cc] + wsOutput; | 2765 wsOutput = str[cc] + wsOutput; |
| 2781 } | 2766 } |
| 2782 cc--; | 2767 cc--; |
| 2783 } else { | 2768 } else { |
| 2784 wsOutput = L' ' + wsOutput; | 2769 wsOutput = L' ' + wsOutput; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2944 ccf = dot_index_f + 1; | 2929 ccf = dot_index_f + 1; |
| 2945 cc = dot_index + 1; | 2930 cc = dot_index + 1; |
| 2946 while (ccf < lenf) { | 2931 while (ccf < lenf) { |
| 2947 switch (strf[ccf]) { | 2932 switch (strf[ccf]) { |
| 2948 case '\'': | 2933 case '\'': |
| 2949 wsOutput += FX_GetLiteralText(strf, ccf, lenf); | 2934 wsOutput += FX_GetLiteralText(strf, ccf, lenf); |
| 2950 ccf++; | 2935 ccf++; |
| 2951 break; | 2936 break; |
| 2952 case '9': | 2937 case '9': |
| 2953 if (cc < len) { | 2938 if (cc < len) { |
| 2954 if (!FX_IsDigit(str[cc])) { | 2939 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2955 return FALSE; | 2940 return FALSE; |
| 2956 } | 2941 } |
| 2957 wsOutput += str[cc]; | 2942 wsOutput += str[cc]; |
| 2958 cc++; | 2943 cc++; |
| 2959 } else { | 2944 } else { |
| 2960 wsOutput += L'0'; | 2945 wsOutput += L'0'; |
| 2961 } | 2946 } |
| 2962 ccf++; | 2947 ccf++; |
| 2963 break; | 2948 break; |
| 2964 case 'z': | 2949 case 'z': |
| 2965 if (cc < len) { | 2950 if (cc < len) { |
| 2966 if (!FX_IsDigit(str[cc])) { | 2951 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2967 return FALSE; | 2952 return FALSE; |
| 2968 } | 2953 } |
| 2969 wsOutput += str[cc]; | 2954 wsOutput += str[cc]; |
| 2970 cc++; | 2955 cc++; |
| 2971 } | 2956 } |
| 2972 ccf++; | 2957 ccf++; |
| 2973 break; | 2958 break; |
| 2974 case 'Z': | 2959 case 'Z': |
| 2975 if (cc < len) { | 2960 if (cc < len) { |
| 2976 if (!FX_IsDigit(str[cc])) { | 2961 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 2977 return FALSE; | 2962 return FALSE; |
| 2978 } | 2963 } |
| 2979 wsOutput += str[cc]; | 2964 wsOutput += str[cc]; |
| 2980 cc++; | 2965 cc++; |
| 2981 } else { | 2966 } else { |
| 2982 wsOutput += L'0'; | 2967 wsOutput += L'0'; |
| 2983 } | 2968 } |
| 2984 ccf++; | 2969 ccf++; |
| 2985 break; | 2970 break; |
| 2986 case 'E': { | 2971 case 'E': { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3041 CFX_WideString wsSymbol; | 3026 CFX_WideString wsSymbol; |
| 3042 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); | 3027 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); |
| 3043 wsOutput += wsSymbol; | 3028 wsOutput += wsSymbol; |
| 3044 } | 3029 } |
| 3045 ccf++; | 3030 ccf++; |
| 3046 break; | 3031 break; |
| 3047 case '8': { | 3032 case '8': { |
| 3048 while (ccf < lenf && strf[ccf] == '8') { | 3033 while (ccf < lenf && strf[ccf] == '8') { |
| 3049 ccf++; | 3034 ccf++; |
| 3050 } | 3035 } |
| 3051 while (cc < len && FX_IsDigit(str[cc])) { | 3036 while (cc < len && FXSYS_isDecimalDigit(str[cc])) { |
| 3052 wsOutput += str[cc]; | 3037 wsOutput += str[cc]; |
| 3053 cc++; | 3038 cc++; |
| 3054 } | 3039 } |
| 3055 } break; | 3040 } break; |
| 3056 case ',': | 3041 case ',': |
| 3057 wsOutput += wsGroupSymbol; | 3042 wsOutput += wsGroupSymbol; |
| 3058 ccf++; | 3043 ccf++; |
| 3059 break; | 3044 break; |
| 3060 case '(': | 3045 case '(': |
| 3061 if (bNeg) { | 3046 if (bNeg) { |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3449 CFX_WideString wsSymbol; | 3434 CFX_WideString wsSymbol; |
| 3450 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); | 3435 pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); |
| 3451 wsOutput += wsSymbol; | 3436 wsOutput += wsSymbol; |
| 3452 } | 3437 } |
| 3453 ccf++; | 3438 ccf++; |
| 3454 break; | 3439 break; |
| 3455 case '8': { | 3440 case '8': { |
| 3456 while (ccf < lenf && strf[ccf] == '8') { | 3441 while (ccf < lenf && strf[ccf] == '8') { |
| 3457 ccf++; | 3442 ccf++; |
| 3458 } | 3443 } |
| 3459 while (cc < len && FX_IsDigit(str[cc])) { | 3444 while (cc < len && FXSYS_isDecimalDigit(str[cc])) { |
| 3460 wsOutput += str[cc]; | 3445 wsOutput += str[cc]; |
| 3461 cc++; | 3446 cc++; |
| 3462 } | 3447 } |
| 3463 } break; | 3448 } break; |
| 3464 case ',': | 3449 case ',': |
| 3465 wsOutput += wsGroupSymbol; | 3450 wsOutput += wsGroupSymbol; |
| 3466 ccf++; | 3451 ccf++; |
| 3467 break; | 3452 break; |
| 3468 case '(': | 3453 case '(': |
| 3469 if (bNeg) { | 3454 if (bNeg) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3517 int32_t month = 1; | 3502 int32_t month = 1; |
| 3518 int32_t day = 1; | 3503 int32_t day = 1; |
| 3519 uint16_t wYear = 0; | 3504 uint16_t wYear = 0; |
| 3520 int cc_start = 0, cc = 0; | 3505 int cc_start = 0, cc = 0; |
| 3521 const FX_WCHAR* str = wsDate.c_str(); | 3506 const FX_WCHAR* str = wsDate.c_str(); |
| 3522 int len = wsDate.GetLength(); | 3507 int len = wsDate.GetLength(); |
| 3523 if (len > 10) { | 3508 if (len > 10) { |
| 3524 return FALSE; | 3509 return FALSE; |
| 3525 } | 3510 } |
| 3526 while (cc < len && cc < 4) { | 3511 while (cc < len && cc < 4) { |
| 3527 if (!FX_IsDigit(str[cc])) { | 3512 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 3528 return FALSE; | 3513 return FALSE; |
| 3529 } | 3514 } |
| 3530 wYear = wYear * 10 + str[cc++] - '0'; | 3515 wYear = wYear * 10 + str[cc++] - '0'; |
| 3531 } | 3516 } |
| 3532 year = wYear; | 3517 year = wYear; |
| 3533 if (cc < 4 || wYear < 1900) { | 3518 if (cc < 4 || wYear < 1900) { |
| 3534 return FALSE; | 3519 return FALSE; |
| 3535 } | 3520 } |
| 3536 if (cc < len) { | 3521 if (cc < len) { |
| 3537 if (str[cc] == '-') { | 3522 if (str[cc] == '-') { |
| 3538 cc++; | 3523 cc++; |
| 3539 } | 3524 } |
| 3540 cc_start = cc; | 3525 cc_start = cc; |
| 3541 uint8_t tmpM = 0; | 3526 uint8_t tmpM = 0; |
| 3542 while (cc < len && cc < cc_start + 2) { | 3527 while (cc < len && cc < cc_start + 2) { |
| 3543 if (!FX_IsDigit(str[cc])) { | 3528 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 3544 return FALSE; | 3529 return FALSE; |
| 3545 } | 3530 } |
| 3546 tmpM = tmpM * 10 + str[cc++] - '0'; | 3531 tmpM = tmpM * 10 + str[cc++] - '0'; |
| 3547 } | 3532 } |
| 3548 month = tmpM; | 3533 month = tmpM; |
| 3549 if (cc == cc_start + 1 || tmpM > 12 || tmpM < 1) { | 3534 if (cc == cc_start + 1 || tmpM > 12 || tmpM < 1) { |
| 3550 return FALSE; | 3535 return FALSE; |
| 3551 } | 3536 } |
| 3552 if (cc < len) { | 3537 if (cc < len) { |
| 3553 if (str[cc] == '-') { | 3538 if (str[cc] == '-') { |
| 3554 cc++; | 3539 cc++; |
| 3555 } | 3540 } |
| 3556 uint8_t tmpD = 0; | 3541 uint8_t tmpD = 0; |
| 3557 cc_start = cc; | 3542 cc_start = cc; |
| 3558 while (cc < len && cc < cc_start + 2) { | 3543 while (cc < len && cc < cc_start + 2) { |
| 3559 if (!FX_IsDigit(str[cc])) { | 3544 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 3560 return FALSE; | 3545 return FALSE; |
| 3561 } | 3546 } |
| 3562 tmpD = tmpD * 10 + str[cc++] - '0'; | 3547 tmpD = tmpD * 10 + str[cc++] - '0'; |
| 3563 } | 3548 } |
| 3564 day = tmpD; | 3549 day = tmpD; |
| 3565 if (tmpD < 1) { | 3550 if (tmpD < 1) { |
| 3566 return FALSE; | 3551 return FALSE; |
| 3567 } | 3552 } |
| 3568 if ((tmpM == 1 || tmpM == 3 || tmpM == 5 || tmpM == 7 || tmpM == 8 || | 3553 if ((tmpM == 1 || tmpM == 3 || tmpM == 5 || tmpM == 7 || tmpM == 8 || |
| 3569 tmpM == 10 || tmpM == 12) && | 3554 tmpM == 10 || tmpM == 12) && |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 3597 return FALSE; | 3582 return FALSE; |
| 3598 } | 3583 } |
| 3599 uint8_t hour = 0; | 3584 uint8_t hour = 0; |
| 3600 uint8_t minute = 0; | 3585 uint8_t minute = 0; |
| 3601 uint8_t second = 0; | 3586 uint8_t second = 0; |
| 3602 uint16_t millisecond = 0; | 3587 uint16_t millisecond = 0; |
| 3603 int cc_start = 0, cc = cc_start; | 3588 int cc_start = 0, cc = cc_start; |
| 3604 const FX_WCHAR* str = wsTime.c_str(); | 3589 const FX_WCHAR* str = wsTime.c_str(); |
| 3605 int len = wsTime.GetLength(); | 3590 int len = wsTime.GetLength(); |
| 3606 while (cc < len && cc < 2) { | 3591 while (cc < len && cc < 2) { |
| 3607 if (!FX_IsDigit(str[cc])) { | 3592 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 3608 return FALSE; | 3593 return FALSE; |
| 3609 } | 3594 } |
| 3610 hour = hour * 10 + str[cc++] - '0'; | 3595 hour = hour * 10 + str[cc++] - '0'; |
| 3611 } | 3596 } |
| 3612 if (cc < 2 || hour >= 24) { | 3597 if (cc < 2 || hour >= 24) { |
| 3613 return FALSE; | 3598 return FALSE; |
| 3614 } | 3599 } |
| 3615 if (cc < len) { | 3600 if (cc < len) { |
| 3616 if (str[cc] == ':') { | 3601 if (str[cc] == ':') { |
| 3617 cc++; | 3602 cc++; |
| 3618 } | 3603 } |
| 3619 cc_start = cc; | 3604 cc_start = cc; |
| 3620 while (cc < len && cc < cc_start + 2) { | 3605 while (cc < len && cc < cc_start + 2) { |
| 3621 if (!FX_IsDigit(str[cc])) { | 3606 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 3622 return FALSE; | 3607 return FALSE; |
| 3623 } | 3608 } |
| 3624 minute = minute * 10 + str[cc++] - '0'; | 3609 minute = minute * 10 + str[cc++] - '0'; |
| 3625 } | 3610 } |
| 3626 if (cc == cc_start + 1 || minute >= 60) { | 3611 if (cc == cc_start + 1 || minute >= 60) { |
| 3627 return FALSE; | 3612 return FALSE; |
| 3628 } | 3613 } |
| 3629 if (cc < len) { | 3614 if (cc < len) { |
| 3630 if (str[cc] == ':') { | 3615 if (str[cc] == ':') { |
| 3631 cc++; | 3616 cc++; |
| 3632 } | 3617 } |
| 3633 cc_start = cc; | 3618 cc_start = cc; |
| 3634 while (cc < len && cc < cc_start + 2) { | 3619 while (cc < len && cc < cc_start + 2) { |
| 3635 if (!FX_IsDigit(str[cc])) { | 3620 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 3636 return FALSE; | 3621 return FALSE; |
| 3637 } | 3622 } |
| 3638 second = second * 10 + str[cc++] - '0'; | 3623 second = second * 10 + str[cc++] - '0'; |
| 3639 } | 3624 } |
| 3640 if (cc == cc_start + 1 || second >= 60) { | 3625 if (cc == cc_start + 1 || second >= 60) { |
| 3641 return FALSE; | 3626 return FALSE; |
| 3642 } | 3627 } |
| 3643 if (cc < len) { | 3628 if (cc < len) { |
| 3644 if (str[cc] == '.') { | 3629 if (str[cc] == '.') { |
| 3645 cc++; | 3630 cc++; |
| 3646 cc_start = cc; | 3631 cc_start = cc; |
| 3647 while (cc < len && cc < cc_start + 3) { | 3632 while (cc < len && cc < cc_start + 3) { |
| 3648 if (!FX_IsDigit(str[cc])) { | 3633 if (!FXSYS_isDecimalDigit(str[cc])) { |
| 3649 return FALSE; | 3634 return FALSE; |
| 3650 } | 3635 } |
| 3651 millisecond = millisecond * 10 + str[cc++] - '0'; | 3636 millisecond = millisecond * 10 + str[cc++] - '0'; |
| 3652 } | 3637 } |
| 3653 if (cc < cc_start + 3) | 3638 if (cc < cc_start + 3) |
| 3654 return FALSE; | 3639 return FALSE; |
| 3655 } | 3640 } |
| 3656 if (cc < len) { | 3641 if (cc < len) { |
| 3657 FX_TIMEZONE tzDiff; | 3642 FX_TIMEZONE tzDiff; |
| 3658 tzDiff.tzHour = 0; | 3643 tzDiff.tzHour = 0; |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4768 } | 4753 } |
| 4769 CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const { | 4754 CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const { |
| 4770 return Multiply(val); | 4755 return Multiply(val); |
| 4771 } | 4756 } |
| 4772 CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const { | 4757 CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const { |
| 4773 return Divide(val); | 4758 return Divide(val); |
| 4774 } | 4759 } |
| 4775 CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const { | 4760 CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const { |
| 4776 return Modulus(val); | 4761 return Modulus(val); |
| 4777 } | 4762 } |
| OLD | NEW |