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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 static const FX_WCHAR gs_wsConstChars[] = L",-:/. "; | 61 static const FX_WCHAR gs_wsConstChars[] = L",-:/. "; |
62 | 62 |
63 static FX_STRSIZE FX_Local_Find(const CFX_WideStringC& wsSymbols, | 63 static FX_STRSIZE FX_Local_Find(const CFX_WideStringC& wsSymbols, |
64 FX_WCHAR ch, | 64 FX_WCHAR ch, |
65 FX_STRSIZE nStart = 0) { | 65 FX_STRSIZE nStart = 0) { |
66 FX_STRSIZE nLength = wsSymbols.GetLength(); | 66 FX_STRSIZE nLength = wsSymbols.GetLength(); |
67 if (nLength < 1 || nStart > nLength) { | 67 if (nLength < 1 || nStart > nLength) { |
68 return -1; | 68 return -1; |
69 } | 69 } |
70 const FX_WCHAR* lpsz = | 70 const FX_WCHAR* lpsz = |
71 (const FX_WCHAR*)FXSYS_wcschr(wsSymbols.GetPtr() + nStart, ch); | 71 (const FX_WCHAR*)FXSYS_wcschr(wsSymbols.raw_str() + nStart, ch); |
72 return (lpsz == NULL) ? -1 : (FX_STRSIZE)(lpsz - wsSymbols.GetPtr()); | 72 return (lpsz == NULL) ? -1 : (FX_STRSIZE)(lpsz - wsSymbols.raw_str()); |
73 } | 73 } |
74 static const FX_WCHAR* const gs_LocalNumberSymbols[] = { | 74 static const FX_WCHAR* const gs_LocalNumberSymbols[] = { |
75 L"decimal", L"grouping", L"percent", L"minus", | 75 L"decimal", L"grouping", L"percent", L"minus", |
76 L"zero", L"currencySymbol", L"currencyName", | 76 L"zero", L"currencySymbol", L"currencyName", |
77 }; | 77 }; |
78 IFX_Locale* IFX_Locale::Create(CXML_Element* pLocaleData) { | 78 IFX_Locale* IFX_Locale::Create(CXML_Element* pLocaleData) { |
79 return new CFX_Locale(pLocaleData); | 79 return new CFX_Locale(pLocaleData); |
80 } | 80 } |
81 CFX_Locale::CFX_Locale(CXML_Element* pLocaleData) { | 81 CFX_Locale::CFX_Locale(CXML_Element* pLocaleData) { |
82 m_pElement = pLocaleData; | 82 m_pElement = pLocaleData; |
(...skipping 3765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3848 CFX_Unitime& datetime, | 3848 CFX_Unitime& datetime, |
3849 IFX_Locale* pLocale) { | 3849 IFX_Locale* pLocale) { |
3850 if (wsTime.GetLength() == 0) { | 3850 if (wsTime.GetLength() == 0) { |
3851 return FALSE; | 3851 return FALSE; |
3852 } | 3852 } |
3853 uint8_t hour = 0; | 3853 uint8_t hour = 0; |
3854 uint8_t minute = 0; | 3854 uint8_t minute = 0; |
3855 uint8_t second = 0; | 3855 uint8_t second = 0; |
3856 uint16_t millisecond = 0; | 3856 uint16_t millisecond = 0; |
3857 int cc_start = 0, cc = cc_start; | 3857 int cc_start = 0, cc = cc_start; |
3858 const FX_WCHAR* str = (const FX_WCHAR*)wsTime.GetPtr(); | 3858 const FX_WCHAR* str = (const FX_WCHAR*)wsTime.raw_str(); |
3859 int len = wsTime.GetLength(); | 3859 int len = wsTime.GetLength(); |
3860 while (cc < len && cc < 2) { | 3860 while (cc < len && cc < 2) { |
3861 if (!FX_IsDigit(str[cc])) { | 3861 if (!FX_IsDigit(str[cc])) { |
3862 return FALSE; | 3862 return FALSE; |
3863 } | 3863 } |
3864 hour = hour * 10 + str[cc++] - '0'; | 3864 hour = hour * 10 + str[cc++] - '0'; |
3865 } | 3865 } |
3866 if (cc < 2 || hour >= 24) { | 3866 if (cc < 2 || hour >= 24) { |
3867 return FALSE; | 3867 return FALSE; |
3868 } | 3868 } |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4692 newval = FXSYS_fmod(newval, 1.0f); | 4692 newval = FXSYS_fmod(newval, 1.0f); |
4693 } | 4693 } |
4694 plo += FXSYS_round(newval); | 4694 plo += FXSYS_round(newval); |
4695 fxmath_decimal_helper_normalize(phi, pmid, plo); | 4695 fxmath_decimal_helper_normalize(phi, pmid, plo); |
4696 m_uHi = (uint32_t)phi; | 4696 m_uHi = (uint32_t)phi; |
4697 m_uMid = (uint32_t)pmid; | 4697 m_uMid = (uint32_t)pmid; |
4698 m_uLo = (uint32_t)plo; | 4698 m_uLo = (uint32_t)plo; |
4699 m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(val < 0 && IsNotZero(), scale); | 4699 m_uFlags = FXMATH_DECIMAL_MAKEFLAGS(val < 0 && IsNotZero(), scale); |
4700 } | 4700 } |
4701 CFX_Decimal::CFX_Decimal(const CFX_WideStringC& strObj) { | 4701 CFX_Decimal::CFX_Decimal(const CFX_WideStringC& strObj) { |
4702 const FX_WCHAR* str = strObj.GetPtr(); | 4702 const FX_WCHAR* str = strObj.raw_str(); |
4703 const FX_WCHAR* strBound = str + strObj.GetLength(); | 4703 const FX_WCHAR* strBound = str + strObj.GetLength(); |
4704 FX_BOOL pointmet = 0; | 4704 FX_BOOL pointmet = 0; |
4705 FX_BOOL negmet = 0; | 4705 FX_BOOL negmet = 0; |
4706 uint8_t scale = 0; | 4706 uint8_t scale = 0; |
4707 m_uHi = m_uMid = m_uLo = 0; | 4707 m_uHi = m_uMid = m_uLo = 0; |
4708 while (str != strBound && *str == ' ') { | 4708 while (str != strBound && *str == ' ') { |
4709 str++; | 4709 str++; |
4710 } | 4710 } |
4711 if (str != strBound && *str == '-') { | 4711 if (str != strBound && *str == '-') { |
4712 negmet = 1; | 4712 negmet = 1; |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5023 } | 5023 } |
5024 CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const { | 5024 CFX_Decimal CFX_Decimal::operator*(const CFX_Decimal& val) const { |
5025 return Multiply(val); | 5025 return Multiply(val); |
5026 } | 5026 } |
5027 CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const { | 5027 CFX_Decimal CFX_Decimal::operator/(const CFX_Decimal& val) const { |
5028 return Divide(val); | 5028 return Divide(val); |
5029 } | 5029 } |
5030 CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const { | 5030 CFX_Decimal CFX_Decimal::operator%(const CFX_Decimal& val) const { |
5031 return Modulus(val); | 5031 return Modulus(val); |
5032 } | 5032 } |
OLD | NEW |