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