summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-06-07 11:28:31 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-07 11:28:31 -0700
commit98963398054a20287cf6b354932ef56ddb4da48c (patch)
treeb9a009dc12f7535e7fc798ee7e416e651272d863 /fpdfsdk
parent4997b22f84307521a62838f874928bf56cd3423c (diff)
downloadpdfium-98963398054a20287cf6b354932ef56ddb4da48c.tar.xz
Fix more code which has shadow variables
The code has local variables that shadow struct or class member variables. Also, when this happens, different variable names should be used instead of namespaces. These were discovered by /Wshadow warning flag in Clang. Review-Url: https://codereview.chromium.org/2034253003
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fsdk_baseannot.cpp14
-rw-r--r--fpdfsdk/javascript/Consts.cpp30
-rw-r--r--fpdfsdk/javascript/JS_GlobalData.cpp12
-rw-r--r--fpdfsdk/javascript/JS_GlobalData.h2
4 files changed, 29 insertions, 29 deletions
diff --git a/fpdfsdk/fsdk_baseannot.cpp b/fpdfsdk/fsdk_baseannot.cpp
index 1345f234b6..7dcb663505 100644
--- a/fpdfsdk/fsdk_baseannot.cpp
+++ b/fpdfsdk/fsdk_baseannot.cpp
@@ -376,8 +376,7 @@ CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() {
}
void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) {
- CPDFSDK_DateTime dt = *this;
- time_t t = (time_t)dt;
+ time_t t = (time_t)(*this);
struct tm* pTime = localtime(&t);
if (pTime) {
st.wYear = (uint16_t)pTime->tm_year + 1900;
@@ -392,11 +391,12 @@ void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) {
}
CPDFSDK_DateTime CPDFSDK_DateTime::ToGMT() const {
- CPDFSDK_DateTime dt = *this;
- dt.AddSeconds(-gAfxGetTimeZoneInSeconds(dt.dt.tzHour, dt.dt.tzMinute));
- dt.dt.tzHour = 0;
- dt.dt.tzMinute = 0;
- return dt;
+ CPDFSDK_DateTime new_dt = *this;
+ new_dt.AddSeconds(
+ -gAfxGetTimeZoneInSeconds(new_dt.dt.tzHour, new_dt.dt.tzMinute));
+ new_dt.dt.tzHour = 0;
+ new_dt.dt.tzMinute = 0;
+ return new_dt;
}
CPDFSDK_DateTime& CPDFSDK_DateTime::AddDays(short days) {
diff --git a/fpdfsdk/javascript/Consts.cpp b/fpdfsdk/javascript/Consts.cpp
index 8aeb0b9239..b71d0a34b3 100644
--- a/fpdfsdk/javascript/Consts.cpp
+++ b/fpdfsdk/javascript/Consts.cpp
@@ -137,21 +137,21 @@ void CJS_GlobalConsts::DefineJSObjects(CJS_Runtime* pRuntime) {
GLOBAL_STRING(pRuntime, L"IDS_STARTUP_CONSOLE_MSG", L"** ^ _ ^ **");
}
-#define GLOBAL_ARRAY(rt, name, ...) \
- { \
- const FX_WCHAR* values[] = {__VA_ARGS__}; \
- v8::Local<v8::Array> array = FXJS_NewArray((rt)->GetIsolate()); \
- for (size_t i = 0; i < FX_ArraySize(values); ++i) \
- array->Set(i, FXJS_NewString((rt)->GetIsolate(), values[i])); \
- rt->SetConstArray(name, array); \
- FXJS_DefineGlobalConst( \
- (rt)->GetIsolate(), (name), \
- [](const v8::FunctionCallbackInfo<v8::Value>& info) { \
- CJS_Runtime* pRuntime = static_cast<CJS_Runtime*>( \
- FXJS_GetRuntimeFromIsolate(info.GetIsolate())); \
- if (pRuntime) \
- info.GetReturnValue().Set(pRuntime->GetConstArray(name)); \
- }); \
+#define GLOBAL_ARRAY(rt, name, ...) \
+ { \
+ const FX_WCHAR* values[] = {__VA_ARGS__}; \
+ v8::Local<v8::Array> array = FXJS_NewArray((rt)->GetIsolate()); \
+ for (size_t i = 0; i < FX_ArraySize(values); ++i) \
+ array->Set(i, FXJS_NewString((rt)->GetIsolate(), values[i])); \
+ rt->SetConstArray(name, array); \
+ FXJS_DefineGlobalConst( \
+ (rt)->GetIsolate(), (name), \
+ [](const v8::FunctionCallbackInfo<v8::Value>& info) { \
+ CJS_Runtime* pLocalRuntime = static_cast<CJS_Runtime*>( \
+ FXJS_GetRuntimeFromIsolate(info.GetIsolate())); \
+ if (pLocalRuntime) \
+ info.GetReturnValue().Set(pLocalRuntime->GetConstArray(name)); \
+ }); \
}
void CJS_GlobalArrays::DefineJSObjects(CJS_Runtime* pRuntime) {
diff --git a/fpdfsdk/javascript/JS_GlobalData.cpp b/fpdfsdk/javascript/JS_GlobalData.cpp
index 8f7810f111..b34bf0907e 100644
--- a/fpdfsdk/javascript/JS_GlobalData.cpp
+++ b/fpdfsdk/javascript/JS_GlobalData.cpp
@@ -61,21 +61,21 @@ void CJS_GlobalVariableArray::Copy(const CJS_GlobalVariableArray& array) {
}
void CJS_GlobalVariableArray::Add(CJS_KeyValue* p) {
- array.Add(p);
+ m_Array.Add(p);
}
int CJS_GlobalVariableArray::Count() const {
- return array.GetSize();
+ return m_Array.GetSize();
}
CJS_KeyValue* CJS_GlobalVariableArray::GetAt(int index) const {
- return array.GetAt(index);
+ return m_Array.GetAt(index);
}
void CJS_GlobalVariableArray::Empty() {
- for (int i = 0, sz = array.GetSize(); i < sz; i++)
- delete array.GetAt(i);
- array.RemoveAll();
+ for (int i = 0, sz = m_Array.GetSize(); i < sz; i++)
+ delete m_Array.GetAt(i);
+ m_Array.RemoveAll();
}
#define READER_JS_GLOBALDATA_FILENAME L"Reader_JsGlobal.Data"
diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h
index 056f26193f..d9f4f0989b 100644
--- a/fpdfsdk/javascript/JS_GlobalData.h
+++ b/fpdfsdk/javascript/JS_GlobalData.h
@@ -34,7 +34,7 @@ class CJS_GlobalVariableArray {
void Empty();
private:
- CFX_ArrayTemplate<CJS_KeyValue*> array;
+ CFX_ArrayTemplate<CJS_KeyValue*> m_Array;
};
class CJS_KeyValue {