| 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 "PublicMethods.h" |     7 #include "PublicMethods.h" | 
|     8  |     8  | 
 |     9 #include "../../../core/include/fxcrt/fx_ext.h" | 
|     9 #include "../../include/fsdk_mgr.h"  // For CPDFDoc_Environment. |    10 #include "../../include/fsdk_mgr.h"  // For CPDFDoc_Environment. | 
|    10 #include "../../include/javascript/IJavaScript.h" |    11 #include "../../include/javascript/IJavaScript.h" | 
|    11 #include "Field.h" |    12 #include "Field.h" | 
|    12 #include "JS_Context.h" |    13 #include "JS_Context.h" | 
|    13 #include "JS_Define.h" |    14 #include "JS_Define.h" | 
|    14 #include "JS_EventHandler.h" |    15 #include "JS_EventHandler.h" | 
|    15 #include "JS_Object.h" |    16 #include "JS_Object.h" | 
|    16 #include "JS_Runtime.h" |    17 #include "JS_Runtime.h" | 
|    17 #include "JS_Value.h" |    18 #include "JS_Value.h" | 
|    18 #include "color.h" |    19 #include "color.h" | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   109   } |   110   } | 
|   110  |   111  | 
|   111   return TRUE; |   112   return TRUE; | 
|   112 } |   113 } | 
|   113  |   114  | 
|   114 FX_BOOL CJS_PublicMethods::IsDigit(wchar_t ch) { |   115 FX_BOOL CJS_PublicMethods::IsDigit(wchar_t ch) { | 
|   115   return (ch >= L'0' && ch <= L'9'); |   116   return (ch >= L'0' && ch <= L'9'); | 
|   116 } |   117 } | 
|   117  |   118  | 
|   118 FX_BOOL CJS_PublicMethods::IsDigit(char ch) { |   119 FX_BOOL CJS_PublicMethods::IsDigit(char ch) { | 
|   119   return (ch >= '0' && ch <= '9'); |   120   return std::isdigit(ch); | 
|   120 } |   121 } | 
|   121  |   122  | 
|   122 FX_BOOL CJS_PublicMethods::IsAlphabetic(wchar_t ch) { |   123 FX_BOOL CJS_PublicMethods::IsAlphabetic(wchar_t ch) { | 
|   123   return ((ch >= L'a' && ch <= L'z') || (ch >= L'A' && ch <= L'Z')); |   124   return ((ch >= L'a' && ch <= L'z') || (ch >= L'A' && ch <= L'Z')); | 
|   124 } |   125 } | 
|   125  |   126  | 
|   126 FX_BOOL CJS_PublicMethods::IsAlphaNumeric(wchar_t ch) { |   127 FX_BOOL CJS_PublicMethods::IsAlphaNumeric(wchar_t ch) { | 
|   127   return (IsDigit(ch) || IsAlphabetic(ch)); |   128   return (IsDigit(ch) || IsAlphabetic(ch)); | 
|   128 } |   129 } | 
|   129  |   130  | 
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   389                                           int& nSkip, |   390                                           int& nSkip, | 
|   390                                           int nMaxStep) { |   391                                           int nMaxStep) { | 
|   391   int nRet = 0; |   392   int nRet = 0; | 
|   392   nSkip = 0; |   393   nSkip = 0; | 
|   393   for (int i = nStart, sz = string.GetLength(); i < sz; i++) { |   394   for (int i = nStart, sz = string.GetLength(); i < sz; i++) { | 
|   394     if (i - nStart > 10) |   395     if (i - nStart > 10) | 
|   395       break; |   396       break; | 
|   396  |   397  | 
|   397     FX_WCHAR c = string.GetAt(i); |   398     FX_WCHAR c = string.GetAt(i); | 
|   398     if (IsDigit((wchar_t)c)) { |   399     if (IsDigit((wchar_t)c)) { | 
|   399       nRet = nRet * 10 + (c - '0'); |   400       nRet = nRet * 10 + FXSYS_toDecimalDigit(c); | 
|   400       nSkip = i - nStart + 1; |   401       nSkip = i - nStart + 1; | 
|   401       if (nSkip >= nMaxStep) |   402       if (nSkip >= nMaxStep) | 
|   402         break; |   403         break; | 
|   403     } else |   404     } else | 
|   404       break; |   405       break; | 
|   405   } |   406   } | 
|   406  |   407  | 
|   407   return nRet; |   408   return nRet; | 
|   408 } |   409 } | 
|   409  |   410  | 
| (...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2077     nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); |  2078     nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); | 
|  2078   } |  2079   } | 
|  2079  |  2080  | 
|  2080   if (nums.GetLength() > 0) |  2081   if (nums.GetLength() > 0) | 
|  2081     vRet = nums; |  2082     vRet = nums; | 
|  2082   else |  2083   else | 
|  2083     vRet.SetNull(); |  2084     vRet.SetNull(); | 
|  2084  |  2085  | 
|  2085   return TRUE; |  2086   return TRUE; | 
|  2086 } |  2087 } | 
| OLD | NEW |