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

Side by Side Diff: fpdfsdk/javascript/Consts.cpp

Issue 2034253003: Fix more code which has shadow variables (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments and style fix Created 4 years, 6 months 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
« no previous file with comments | « fpdfsdk/fsdk_baseannot.cpp ('k') | fpdfsdk/javascript/JS_GlobalData.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "fpdfsdk/javascript/Consts.h" 7 #include "fpdfsdk/javascript/Consts.h"
8 8
9 #include "fpdfsdk/javascript/JS_Define.h" 9 #include "fpdfsdk/javascript/JS_Define.h"
10 #include "fpdfsdk/javascript/JS_Object.h" 10 #include "fpdfsdk/javascript/JS_Object.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 GLOBAL_STRING(pRuntime, L"IDS_MONTH_INFO", 130 GLOBAL_STRING(pRuntime, L"IDS_MONTH_INFO",
131 L"January[1] February[2] March[3] April[4] May[5] " 131 L"January[1] February[2] March[3] April[4] May[5] "
132 L"June[6] July[7] August[8] September[9] October[10] " 132 L"June[6] July[7] August[8] September[9] October[10] "
133 L"November[11] December[12] Sept[9] Jan[1] Feb[2] Mar[3] " 133 L"November[11] December[12] Sept[9] Jan[1] Feb[2] Mar[3] "
134 L"Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] Nov[11] " 134 L"Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] Nov[11] "
135 L"Dec[12]"); 135 L"Dec[12]");
136 136
137 GLOBAL_STRING(pRuntime, L"IDS_STARTUP_CONSOLE_MSG", L"** ^ _ ^ **"); 137 GLOBAL_STRING(pRuntime, L"IDS_STARTUP_CONSOLE_MSG", L"** ^ _ ^ **");
138 } 138 }
139 139
140 #define GLOBAL_ARRAY(rt, name, ...) \ 140 #define GLOBAL_ARRAY(rt, name, ...) \
141 { \ 141 { \
142 const FX_WCHAR* values[] = {__VA_ARGS__}; \ 142 const FX_WCHAR* values[] = {__VA_ARGS__}; \
143 v8::Local<v8::Array> array = FXJS_NewArray((rt)->GetIsolate()); \ 143 v8::Local<v8::Array> array = FXJS_NewArray((rt)->GetIsolate()); \
144 for (size_t i = 0; i < FX_ArraySize(values); ++i) \ 144 for (size_t i = 0; i < FX_ArraySize(values); ++i) \
145 array->Set(i, FXJS_NewString((rt)->GetIsolate(), values[i])); \ 145 array->Set(i, FXJS_NewString((rt)->GetIsolate(), values[i])); \
146 rt->SetConstArray(name, array); \ 146 rt->SetConstArray(name, array); \
147 FXJS_DefineGlobalConst( \ 147 FXJS_DefineGlobalConst( \
148 (rt)->GetIsolate(), (name), \ 148 (rt)->GetIsolate(), (name), \
149 [](const v8::FunctionCallbackInfo<v8::Value>& info) { \ 149 [](const v8::FunctionCallbackInfo<v8::Value>& info) { \
150 CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>( \ 150 CJS_Runtime* pLocalRuntime = static_cast<CJS_Runtime*>( \
151 FXJS_GetRuntimeFromIsolate(info.GetIsolate())); \ 151 FXJS_GetRuntimeFromIsolate(info.GetIsolate())); \
152 if (pRuntime) \ 152 if (pLocalRuntime) \
153 info.GetReturnValue().Set(pRuntime->GetConstArray(name)); \ 153 info.GetReturnValue().Set(pLocalRuntime->GetConstArray(name)); \
154 }); \ 154 }); \
155 } 155 }
156 156
157 void CJS_GlobalArrays::DefineJSObjects(CJS_Runtime* pRuntime) { 157 void CJS_GlobalArrays::DefineJSObjects(CJS_Runtime* pRuntime) {
158 GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_ENTRY_DOT_SEP", L"[+-]?\\d*\\.?\\d*"); 158 GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_ENTRY_DOT_SEP", L"[+-]?\\d*\\.?\\d*");
159 GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_COMMIT_DOT_SEP", 159 GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_COMMIT_DOT_SEP",
160 L"[+-]?\\d+(\\.\\d+)?", // -1.0 or -1 160 L"[+-]?\\d+(\\.\\d+)?", // -1.0 or -1
161 L"[+-]?\\.\\d+", // -.1 161 L"[+-]?\\.\\d+", // -.1
162 L"[+-]?\\d+\\."); // -1. 162 L"[+-]?\\d+\\."); // -1.
163 163
164 GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_ENTRY_COMMA_SEP", L"[+-]?\\d*,?\\d*"); 164 GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_ENTRY_COMMA_SEP", L"[+-]?\\d*,?\\d*");
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 L"\\d{3}(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // 408 555-1234 196 L"\\d{3}(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // 408 555-1234
197 L"\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // (408) 555-1234 197 L"\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // (408) 555-1234
198 L"011(\\.|[- \\d])*"); // international 198 L"011(\\.|[- \\d])*"); // international
199 199
200 GLOBAL_ARRAY(pRuntime, L"RE_SSN_ENTRY", 200 GLOBAL_ARRAY(pRuntime, L"RE_SSN_ENTRY",
201 L"\\d{0,3}(\\.|[- ])?\\d{0,2}(\\.|[- ])?\\d{0,4}"); 201 L"\\d{0,3}(\\.|[- ])?\\d{0,2}(\\.|[- ])?\\d{0,4}");
202 202
203 GLOBAL_ARRAY(pRuntime, L"RE_SSN_COMMIT", 203 GLOBAL_ARRAY(pRuntime, L"RE_SSN_COMMIT",
204 L"\\d{3}(\\.|[- ])?\\d{2}(\\.|[- ])?\\d{4}"); 204 L"\\d{3}(\\.|[- ])?\\d{2}(\\.|[- ])?\\d{4}");
205 } 205 }
OLDNEW
« no previous file with comments | « fpdfsdk/fsdk_baseannot.cpp ('k') | fpdfsdk/javascript/JS_GlobalData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698