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 <stddef.h> // For offsetof(). | 7 #include <stddef.h> // For offsetof(). |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cctype> | 10 #include <cctype> |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 cc++; | 987 cc++; |
988 } else if (str[0] == '-') { | 988 } else if (str[0] == '-') { |
989 bNegative = TRUE; | 989 bNegative = TRUE; |
990 cc++; | 990 cc++; |
991 } | 991 } |
992 int integer = 0; | 992 int integer = 0; |
993 while (cc < len) { | 993 while (cc < len) { |
994 if (str[cc] == '.') { | 994 if (str[cc] == '.') { |
995 break; | 995 break; |
996 } | 996 } |
997 integer = integer * 10 + FXSYS_toDecimalDigitWide(str[cc]); | 997 integer = integer * 10 + FXSYS_toDecimalDigit(str[cc]); |
998 cc++; | 998 cc++; |
999 } | 999 } |
1000 FX_FLOAT fraction = 0; | 1000 FX_FLOAT fraction = 0; |
1001 if (str[cc] == '.') { | 1001 if (str[cc] == '.') { |
1002 cc++; | 1002 cc++; |
1003 FX_FLOAT scale = 0.1f; | 1003 FX_FLOAT scale = 0.1f; |
1004 while (cc < len) { | 1004 while (cc < len) { |
1005 fraction += scale * FXSYS_toDecimalDigitWide(str[cc]); | 1005 fraction += scale * FXSYS_toDecimalDigit(str[cc]); |
1006 scale *= 0.1f; | 1006 scale *= 0.1f; |
1007 cc++; | 1007 cc++; |
1008 } | 1008 } |
1009 } | 1009 } |
1010 fraction += (FX_FLOAT)integer; | 1010 fraction += (FX_FLOAT)integer; |
1011 return bNegative ? -fraction : fraction; | 1011 return bNegative ? -fraction : fraction; |
1012 } | 1012 } |
1013 int CFX_WideString::GetInteger() const { | 1013 int CFX_WideString::GetInteger() const { |
1014 return m_pData ? FXSYS_wtoi(m_pData->m_String) : 0; | 1014 return m_pData ? FXSYS_wtoi(m_pData->m_String) : 0; |
1015 } | 1015 } |
(...skipping 26 matching lines...) Expand all Loading... |
1042 int dest_len = | 1042 int dest_len = |
1043 FXSYS_MultiByteToWideChar(codepage, 0, bstr, src_len, nullptr, 0); | 1043 FXSYS_MultiByteToWideChar(codepage, 0, bstr, src_len, nullptr, 0); |
1044 CFX_WideString wstr; | 1044 CFX_WideString wstr; |
1045 if (dest_len) { | 1045 if (dest_len) { |
1046 FX_WCHAR* dest_buf = wstr.GetBuffer(dest_len); | 1046 FX_WCHAR* dest_buf = wstr.GetBuffer(dest_len); |
1047 FXSYS_MultiByteToWideChar(codepage, 0, bstr, src_len, dest_buf, dest_len); | 1047 FXSYS_MultiByteToWideChar(codepage, 0, bstr, src_len, dest_buf, dest_len); |
1048 wstr.ReleaseBuffer(dest_len); | 1048 wstr.ReleaseBuffer(dest_len); |
1049 } | 1049 } |
1050 return wstr; | 1050 return wstr; |
1051 } | 1051 } |
OLD | NEW |