summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-14 13:54:22 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-14 13:54:22 -0700
commiteca866c64ec0319d4723798290a3155957fa733e (patch)
tree59c7bb72df8d4df62934ab4002108a57bf2df37e /fpdfsdk/src/javascript
parentae2d47b22d213cb36a66326c3167cfbbae90b9d4 (diff)
downloadpdfium-eca866c64ec0319d4723798290a3155957fa733e.tar.xz
Next round of master changes to match XFA
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1401423004 .
Diffstat (limited to 'fpdfsdk/src/javascript')
-rw-r--r--fpdfsdk/src/javascript/JS_Define.h18
-rw-r--r--fpdfsdk/src/javascript/PublicMethods.cpp43
-rw-r--r--fpdfsdk/src/javascript/app.cpp9
3 files changed, 39 insertions, 31 deletions
diff --git a/fpdfsdk/src/javascript/JS_Define.h b/fpdfsdk/src/javascript/JS_Define.h
index 3e5b797d07..b21f894ec8 100644
--- a/fpdfsdk/src/javascript/JS_Define.h
+++ b/fpdfsdk/src/javascript/JS_Define.h
@@ -71,9 +71,8 @@ struct JSMethodSpec {
} \
;
-template <
- class C,
- FX_BOOL (C::*M)(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)>
+template <class C,
+ FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)>
void JSPropGetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -97,9 +96,8 @@ void JSPropGetter(const char* prop_name_string,
info.GetReturnValue().Set((v8::Local<v8::Value>)value);
}
-template <
- class C,
- FX_BOOL (C::*M)(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)>
+template <class C,
+ FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)>
void JSPropSetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -137,10 +135,10 @@ void JSPropSetter(const char* prop_name_string,
}
template <class C,
- FX_BOOL (C::*M)(IJS_Context* cc,
- const CJS_Parameters& params,
- CJS_Value& vRet,
- CFX_WideString& sError)>
+ FX_BOOL (C::*M)(IJS_Context*,
+ const CJS_Parameters&,
+ CJS_Value&,
+ CFX_WideString&)>
void JSMethod(const char* method_name_string,
const char* class_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp
index 4743d3dff3..e898214cd8 100644
--- a/fpdfsdk/src/javascript/PublicMethods.cpp
+++ b/fpdfsdk/src/javascript/PublicMethods.cpp
@@ -48,14 +48,31 @@ END_JS_STATIC_GLOBAL_FUN()
IMPLEMENT_JS_STATIC_GLOBAL_FUN(CJS_PublicMethods)
-static const FX_WCHAR* months[] = {L"Jan", L"Feb", L"Mar", L"Apr",
- L"May", L"Jun", L"Jul", L"Aug",
- L"Sep", L"Oct", L"Nov", L"Dec"};
-
-static const FX_WCHAR* fullmonths[] = {L"January", L"February", L"March",
- L"April", L"May", L"June",
- L"July", L"August", L"September",
- L"October", L"November", L"December"};
+static const FX_WCHAR* const months[] = {L"Jan",
+ L"Feb",
+ L"Mar",
+ L"Apr",
+ L"May",
+ L"Jun",
+ L"Jul",
+ L"Aug",
+ L"Sep",
+ L"Oct",
+ L"Nov",
+ L"Dec"};
+
+static const FX_WCHAR* const fullmonths[] = {L"January",
+ L"February",
+ L"March",
+ L"April",
+ L"May",
+ L"June",
+ L"July",
+ L"August",
+ L"September",
+ L"October",
+ L"November",
+ L"December"};
FX_BOOL CJS_PublicMethods::IsNumber(const FX_WCHAR* string) {
CFX_WideString sTrim = StrTrim(string);
@@ -984,10 +1001,7 @@ FX_BOOL CJS_PublicMethods::AFNumber_Format(IJS_Context* cc,
else
cSeperator = '.';
- int iDecPositive;
- iDecPositive = iDec2;
-
- for (iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) {
+ for (int iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) {
strValue.Insert(iDecPositive, cSeperator);
iMax++;
}
@@ -1273,10 +1287,7 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format(IJS_Context* cc,
else
cSeperator = '.';
- int iDecPositive;
- iDecPositive = iDec2;
-
- for (iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) {
+ for (int iDecPositive = iDec2 - 3; iDecPositive > 0; iDecPositive -= 3) {
strValue.Insert(iDecPositive, cSeperator);
iMax++;
}
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp
index 3db1e5b956..1bd089a431 100644
--- a/fpdfsdk/src/javascript/app.cpp
+++ b/fpdfsdk/src/javascript/app.cpp
@@ -194,12 +194,11 @@ FX_BOOL app::viewerVariation(IJS_Context* cc,
FX_BOOL app::viewerVersion(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- if (vp.IsGetting()) {
- vp << JS_NUM_VIEWERVERSION;
- return TRUE;
- }
+ if (!vp.IsGetting())
+ return FALSE;
- return FALSE;
+ vp << JS_NUM_VIEWERVERSION;
+ return TRUE;
}
FX_BOOL app::platform(IJS_Context* cc,