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 "fpdfsdk/src/javascript/PublicMethods.h" | 7 #include "fpdfsdk/src/javascript/PublicMethods.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 int nRet = 0; | 235 int nRet = 0; |
236 nSkip = 0; | 236 nSkip = 0; |
237 for (int i = nStart, sz = string.GetLength(); i < sz; i++) { | 237 for (int i = nStart, sz = string.GetLength(); i < sz; i++) { |
238 if (i - nStart > 10) | 238 if (i - nStart > 10) |
239 break; | 239 break; |
240 | 240 |
241 FX_WCHAR c = string.GetAt(i); | 241 FX_WCHAR c = string.GetAt(i); |
242 if (!FXSYS_iswdigit(c)) | 242 if (!FXSYS_iswdigit(c)) |
243 break; | 243 break; |
244 | 244 |
245 nRet = nRet * 10 + FXSYS_toDecimalDigitWide(c); | 245 nRet = nRet * 10 + FXSYS_toDecimalDigit(c); |
246 nSkip = i - nStart + 1; | 246 nSkip = i - nStart + 1; |
247 if (nSkip >= nMaxStep) | 247 if (nSkip >= nMaxStep) |
248 break; | 248 break; |
249 } | 249 } |
250 | 250 |
251 return nRet; | 251 return nRet; |
252 } | 252 } |
253 | 253 |
254 CFX_WideString CJS_PublicMethods::ParseStringString( | 254 CFX_WideString CJS_PublicMethods::ParseStringString( |
255 const CFX_WideString& string, | 255 const CFX_WideString& string, |
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); | 1906 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); |
1907 } | 1907 } |
1908 | 1908 |
1909 if (nums.GetLength() > 0) | 1909 if (nums.GetLength() > 0) |
1910 vRet = nums; | 1910 vRet = nums; |
1911 else | 1911 else |
1912 vRet.SetNull(); | 1912 vRet.SetNull(); |
1913 | 1913 |
1914 return TRUE; | 1914 return TRUE; |
1915 } | 1915 } |
OLD | NEW |