Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: fpdfsdk/src/javascript/PublicMethods.cpp

Issue 1405253007: Revert "Revert "Cleanup some numeric code."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix mac build Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. 9 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment.
10 #include "../../include/javascript/IJavaScript.h" 10 #include "../../include/javascript/IJavaScript.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 return TRUE; 111 return TRUE;
112 } 112 }
113 113
114 FX_BOOL CJS_PublicMethods::IsDigit(wchar_t ch) { 114 FX_BOOL CJS_PublicMethods::IsDigit(wchar_t ch) {
115 return (ch >= L'0' && ch <= L'9'); 115 return (ch >= L'0' && ch <= L'9');
116 } 116 }
117 117
118 FX_BOOL CJS_PublicMethods::IsDigit(char ch) { 118 FX_BOOL CJS_PublicMethods::IsDigit(char ch) {
119 return (ch >= '0' && ch <= '9'); 119 return std::isdigit(ch);
120 } 120 }
121 121
122 FX_BOOL CJS_PublicMethods::IsAlphabetic(wchar_t ch) { 122 FX_BOOL CJS_PublicMethods::IsAlphabetic(wchar_t ch) {
123 return ((ch >= L'a' && ch <= L'z') || (ch >= L'A' && ch <= L'Z')); 123 return ((ch >= L'a' && ch <= L'z') || (ch >= L'A' && ch <= L'Z'));
124 } 124 }
125 125
126 FX_BOOL CJS_PublicMethods::IsAlphaNumeric(wchar_t ch) { 126 FX_BOOL CJS_PublicMethods::IsAlphaNumeric(wchar_t ch) {
127 return (IsDigit(ch) || IsAlphabetic(ch)); 127 return (IsDigit(ch) || IsAlphabetic(ch));
128 } 128 }
129 129
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str())); 2077 nums.SetElement(nIndex, CJS_Value(pRuntime, sPart.c_str()));
2078 } 2078 }
2079 2079
2080 if (nums.GetLength() > 0) 2080 if (nums.GetLength() > 0)
2081 vRet = nums; 2081 vRet = nums;
2082 else 2082 else
2083 vRet.SetNull(); 2083 vRet.SetNull();
2084 2084
2085 return TRUE; 2085 return TRUE;
2086 } 2086 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698