| 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 2286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2297 ccf++; | 2297 ccf++; |
| 2298 continue; | 2298 continue; |
| 2299 } else if (wsDateSymbols.Find(strf[ccf]) == -1) { | 2299 } else if (wsDateSymbols.Find(strf[ccf]) == -1) { |
| 2300 if (strf[ccf] != str[cc]) | 2300 if (strf[ccf] != str[cc]) |
| 2301 return FALSE; | 2301 return FALSE; |
| 2302 cc++; | 2302 cc++; |
| 2303 ccf++; | 2303 ccf++; |
| 2304 continue; | 2304 continue; |
| 2305 } | 2305 } |
| 2306 uint32_t dwSymbolNum = 1; | 2306 uint32_t dwSymbolNum = 1; |
| 2307 uint32_t dwSymbol = strf[ccf++]; | 2307 FX_WCHAR dwCharSymbol = strf[ccf++]; |
| 2308 while (ccf < lenf && strf[ccf] == dwSymbol) { | 2308 while (ccf < lenf && strf[ccf] == dwCharSymbol) { |
| 2309 ccf++; | 2309 ccf++; |
| 2310 dwSymbolNum++; | 2310 dwSymbolNum++; |
| 2311 } | 2311 } |
| 2312 dwSymbol = (dwSymbol << 8) | (dwSymbolNum + '0'); | 2312 uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0'); |
| 2313 if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) { | 2313 if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) { |
| 2314 if (!FX_IsDigit(str[cc])) { | 2314 if (!FX_IsDigit(str[cc])) { |
| 2315 return FALSE; | 2315 return FALSE; |
| 2316 } | 2316 } |
| 2317 day = str[cc++] - '0'; | 2317 day = str[cc++] - '0'; |
| 2318 if (cc < len && FX_IsDigit(str[cc])) { | 2318 if (cc < len && FX_IsDigit(str[cc])) { |
| 2319 day = day * 10 + str[cc++] - '0'; | 2319 day = day * 10 + str[cc++] - '0'; |
| 2320 } | 2320 } |
| 2321 } else if (dwSymbol == FXBSTR_ID(0, 0, 'D', '2')) { | 2321 } else if (dwSymbol == FXBSTR_ID(0, 0, 'D', '2')) { |
| 2322 if (!FX_IsDigit(str[cc])) { | 2322 if (!FX_IsDigit(str[cc])) { |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2516 ccf++; | 2516 ccf++; |
| 2517 continue; | 2517 continue; |
| 2518 } else if (wsTimeSymbols.Find(strf[ccf]) == -1) { | 2518 } else if (wsTimeSymbols.Find(strf[ccf]) == -1) { |
| 2519 if (strf[ccf] != str[cc]) | 2519 if (strf[ccf] != str[cc]) |
| 2520 return FALSE; | 2520 return FALSE; |
| 2521 cc++; | 2521 cc++; |
| 2522 ccf++; | 2522 ccf++; |
| 2523 continue; | 2523 continue; |
| 2524 } | 2524 } |
| 2525 uint32_t dwSymbolNum = 1; | 2525 uint32_t dwSymbolNum = 1; |
| 2526 uint32_t dwSymbol = strf[ccf++]; | 2526 FX_WCHAR dwCharSymbol = strf[ccf++]; |
| 2527 while (ccf < lenf && strf[ccf] == dwSymbol) { | 2527 while (ccf < lenf && strf[ccf] == dwCharSymbol) { |
| 2528 ccf++; | 2528 ccf++; |
| 2529 dwSymbolNum++; | 2529 dwSymbolNum++; |
| 2530 } | 2530 } |
| 2531 dwSymbol = (dwSymbol << 8) | (dwSymbolNum + '0'); | 2531 uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0'); |
| 2532 if (dwSymbol == FXBSTR_ID(0, 0, 'k', '1') || | 2532 if (dwSymbol == FXBSTR_ID(0, 0, 'k', '1') || |
| 2533 dwSymbol == FXBSTR_ID(0, 0, 'H', '1') || | 2533 dwSymbol == FXBSTR_ID(0, 0, 'H', '1') || |
| 2534 dwSymbol == FXBSTR_ID(0, 0, 'h', '1') || | 2534 dwSymbol == FXBSTR_ID(0, 0, 'h', '1') || |
| 2535 dwSymbol == FXBSTR_ID(0, 0, 'K', '1')) { | 2535 dwSymbol == FXBSTR_ID(0, 0, 'K', '1')) { |
| 2536 if (!FX_IsDigit(str[cc])) { | 2536 if (!FX_IsDigit(str[cc])) { |
| 2537 return FALSE; | 2537 return FALSE; |
| 2538 } | 2538 } |
| 2539 hour = str[cc++] - '0'; | 2539 hour = str[cc++] - '0'; |
| 2540 if (cc < len && FX_IsDigit(str[cc])) { | 2540 if (cc < len && FX_IsDigit(str[cc])) { |
| 2541 hour = hour * 10 + str[cc++] - '0'; | 2541 hour = hour * 10 + str[cc++] - '0'; |
| (...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3945 while (ccf < lenf) { | 3945 while (ccf < lenf) { |
| 3946 if (strf[ccf] == '\'') { | 3946 if (strf[ccf] == '\'') { |
| 3947 wsResult += FX_GetLiteralText(strf, ccf, lenf); | 3947 wsResult += FX_GetLiteralText(strf, ccf, lenf); |
| 3948 ccf++; | 3948 ccf++; |
| 3949 continue; | 3949 continue; |
| 3950 } else if (wsDateSymbols.Find(strf[ccf]) == -1) { | 3950 } else if (wsDateSymbols.Find(strf[ccf]) == -1) { |
| 3951 wsResult += strf[ccf++]; | 3951 wsResult += strf[ccf++]; |
| 3952 continue; | 3952 continue; |
| 3953 } | 3953 } |
| 3954 uint32_t dwSymbolNum = 1; | 3954 uint32_t dwSymbolNum = 1; |
| 3955 uint32_t dwSymbol = strf[ccf++]; | 3955 FX_WCHAR dwCharSymbol = strf[ccf++]; |
| 3956 while (ccf < lenf && strf[ccf] == dwSymbol) { | 3956 while (ccf < lenf && strf[ccf] == dwCharSymbol) { |
| 3957 ccf++; | 3957 ccf++; |
| 3958 dwSymbolNum++; | 3958 dwSymbolNum++; |
| 3959 } | 3959 } |
| 3960 dwSymbol = (dwSymbol << 8) | (dwSymbolNum + '0'); | 3960 uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0'); |
| 3961 if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) { | 3961 if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) { |
| 3962 CFX_WideString wsDay; | 3962 CFX_WideString wsDay; |
| 3963 wsDay.Format(L"%d", day); | 3963 wsDay.Format(L"%d", day); |
| 3964 wsResult += wsDay; | 3964 wsResult += wsDay; |
| 3965 } else if (dwSymbol == FXBSTR_ID(0, 0, 'D', '2')) { | 3965 } else if (dwSymbol == FXBSTR_ID(0, 0, 'D', '2')) { |
| 3966 CFX_WideString wsDay; | 3966 CFX_WideString wsDay; |
| 3967 wsDay.Format(L"%02d", day); | 3967 wsDay.Format(L"%02d", day); |
| 3968 wsResult += wsDay; | 3968 wsResult += wsDay; |
| 3969 } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '1')) { | 3969 } else if (dwSymbol == FXBSTR_ID(0, 0, 'J', '1')) { |
| 3970 uint16_t nDays = 0; | 3970 uint16_t nDays = 0; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4072 while (ccf < lenf) { | 4072 while (ccf < lenf) { |
| 4073 if (strf[ccf] == '\'') { | 4073 if (strf[ccf] == '\'') { |
| 4074 wsResult += FX_GetLiteralText(strf, ccf, lenf); | 4074 wsResult += FX_GetLiteralText(strf, ccf, lenf); |
| 4075 ccf++; | 4075 ccf++; |
| 4076 continue; | 4076 continue; |
| 4077 } else if (wsTimeSymbols.Find(strf[ccf]) == -1) { | 4077 } else if (wsTimeSymbols.Find(strf[ccf]) == -1) { |
| 4078 wsResult += strf[ccf++]; | 4078 wsResult += strf[ccf++]; |
| 4079 continue; | 4079 continue; |
| 4080 } | 4080 } |
| 4081 uint32_t dwSymbolNum = 1; | 4081 uint32_t dwSymbolNum = 1; |
| 4082 uint32_t dwSymbol = strf[ccf++]; | 4082 FX_WCHAR dwCharSymbol = strf[ccf++]; |
| 4083 while (ccf < lenf && strf[ccf] == dwSymbol) { | 4083 while (ccf < lenf && strf[ccf] == dwCharSymbol) { |
| 4084 ccf++; | 4084 ccf++; |
| 4085 dwSymbolNum++; | 4085 dwSymbolNum++; |
| 4086 } | 4086 } |
| 4087 dwSymbol = (dwSymbol << 8) | (dwSymbolNum + '0'); | 4087 uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0'); |
| 4088 if (dwSymbol == FXBSTR_ID(0, 0, 'h', '1')) { | 4088 if (dwSymbol == FXBSTR_ID(0, 0, 'h', '1')) { |
| 4089 if (wHour > 12) { | 4089 if (wHour > 12) { |
| 4090 wHour -= 12; | 4090 wHour -= 12; |
| 4091 } | 4091 } |
| 4092 CFX_WideString wsHour; | 4092 CFX_WideString wsHour; |
| 4093 wsHour.Format(L"%d", wHour == 0 ? 12 : wHour); | 4093 wsHour.Format(L"%d", wHour == 0 ? 12 : wHour); |
| 4094 wsResult += wsHour; | 4094 wsResult += wsHour; |
| 4095 } else if (dwSymbol == FXBSTR_ID(0, 0, 'h', '2')) { | 4095 } else if (dwSymbol == FXBSTR_ID(0, 0, 'h', '2')) { |
| 4096 if (wHour > 12) { | 4096 if (wHour > 12) { |
| 4097 wHour -= 12; | 4097 wHour -= 12; |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4985 } | 4985 } |
| 4986 CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const { | 4986 CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const { |
| 4987 return Multiply(val); | 4987 return Multiply(val); |
| 4988 } | 4988 } |
| 4989 CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const { | 4989 CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const { |
| 4990 return Divide(val); | 4990 return Divide(val); |
| 4991 } | 4991 } |
| 4992 CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const { | 4992 CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const { |
| 4993 return Modulus(val); | 4993 return Modulus(val); |
| 4994 } | 4994 } |
| OLD | NEW |