summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-01 14:45:20 -0500
committerDan Sinclair <dsinclair@chromium.org>2016-03-01 14:45:20 -0500
commit738b08ce6b9f80d93b815411b47c2b11c2f090f6 (patch)
treeec648b9bdf6d9597043bfe657d56f98dc3cdef30 /fpdfsdk/src/javascript
parent50dfc4a7068e8e08105f7b9a3945136e7246e677 (diff)
downloadpdfium-738b08ce6b9f80d93b815411b47c2b11c2f090f6.tar.xz
Fix and enable lint checks.
This CL fixes and enables: * readability/namespace * readability/multiline_string * readability/multiline_comment * readability/inheritance * readability/function * readability/braces R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1747123002 .
Diffstat (limited to 'fpdfsdk/src/javascript')
-rw-r--r--fpdfsdk/src/javascript/Consts.cpp30
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime_Stub.cpp6
-rw-r--r--fpdfsdk/src/javascript/JS_Value.cpp3
-rw-r--r--fpdfsdk/src/javascript/JS_Value.h20
4 files changed, 29 insertions, 30 deletions
diff --git a/fpdfsdk/src/javascript/Consts.cpp b/fpdfsdk/src/javascript/Consts.cpp
index 261f8257a8..132f214d2d 100644
--- a/fpdfsdk/src/javascript/Consts.cpp
+++ b/fpdfsdk/src/javascript/Consts.cpp
@@ -249,17 +249,17 @@ void CJS_GlobalArrays::DefineJSObjects(CJS_Runtime* pRuntime) {
{
const FX_WCHAR* ArrayName = L"RE_PHONE_ENTRY";
const FX_WCHAR* ArrayContent[] = {
- L"\\d{0,3}(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", /* 555-1234 or 408
- 555-1234 */
- L"\\(\\d{0,3}", /* (408 */
- L"\\(\\d{0,3}\\)(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", /* (408)
- 555-1234 */
- /* (allow the addition of parens as an afterthought) */
- L"\\(\\d{0,3}(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", /* (408 555-1234
- */
- L"\\d{0,3}\\)(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", /* 408) 555-1234
- */
- L"011(\\.|[- \\d])*" /* international */
+ L"\\d{0,3}(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", // 555-1234 or 408
+ // 555-1234
+ L"\\(\\d{0,3}", // (408
+ L"\\(\\d{0,3}\\)(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", // (408)
+ // 555-1234
+ // (allow the addition of parens as an afterthought)
+ L"\\(\\d{0,3}(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", // (408 555-1234
+
+ L"\\d{0,3}\\)(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", // 408) 555-1234
+
+ L"011(\\.|[- \\d])*" // international
};
DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent,
FX_ArraySize(ArrayContent));
@@ -268,10 +268,10 @@ void CJS_GlobalArrays::DefineJSObjects(CJS_Runtime* pRuntime) {
{
const FX_WCHAR* ArrayName = L"RE_PHONE_COMMIT";
const FX_WCHAR* ArrayContent[] = {
- L"\\d{3}(\\.|[- ])?\\d{4}", /* 555-1234 */
- L"\\d{3}(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", /* 408 555-1234 */
- L"\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", /* (408) 555-1234 */
- L"011(\\.|[- \\d])*" /* international */
+ L"\\d{3}(\\.|[- ])?\\d{4}", // 555-1234
+ L"\\d{3}(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // 408 555-1234
+ L"\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // (408) 555-1234
+ L"011(\\.|[- \\d])*" // international
};
DefineGlobalConstStringArray(pRuntime, ArrayName, ArrayContent,
FX_ArraySize(ArrayContent));
diff --git a/fpdfsdk/src/javascript/JS_Runtime_Stub.cpp b/fpdfsdk/src/javascript/JS_Runtime_Stub.cpp
index e9d5a221f7..ab20e0e365 100644
--- a/fpdfsdk/src/javascript/JS_Runtime_Stub.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime_Stub.cpp
@@ -138,13 +138,11 @@ class CJS_RuntimeStub final : public IJS_Runtime {
CPDFSDK_Document* GetReaderDocument() override { return m_pDoc; }
#ifdef PDF_ENABLE_XFA
- virtual FX_BOOL GetHValueByName(const CFX_ByteStringC&,
- FXJSE_HVALUE) override {
+ FX_BOOL GetHValueByName(const CFX_ByteStringC&, FXJSE_HVALUE) override {
return FALSE;
}
- virtual FX_BOOL SetHValueByName(const CFX_ByteStringC&,
- FXJSE_HVALUE) override {
+ FX_BOOL SetHValueByName(const CFX_ByteStringC&, FXJSE_HVALUE) override {
return FALSE;
}
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/src/javascript/JS_Value.cpp b/fpdfsdk/src/javascript/JS_Value.cpp
index 9f27387d1d..cd5f2518cf 100644
--- a/fpdfsdk/src/javascript/JS_Value.cpp
+++ b/fpdfsdk/src/javascript/JS_Value.cpp
@@ -678,9 +678,10 @@ int _YearFromTime(double t) {
if (_TimeFromYear(y) <= t) {
while (_TimeFromYear(y + 1) <= t)
y++;
- } else
+ } else {
while (_TimeFromYear(y) > t)
y--;
+ }
return y;
}
diff --git a/fpdfsdk/src/javascript/JS_Value.h b/fpdfsdk/src/javascript/JS_Value.h
index c33a973a12..6c6a03d265 100644
--- a/fpdfsdk/src/javascript/JS_Value.h
+++ b/fpdfsdk/src/javascript/JS_Value.h
@@ -69,13 +69,13 @@ class CJS_Value {
void operator=(int iValue);
void operator=(bool bValue);
- void operator=(double);
- void operator=(float);
- void operator=(CJS_Object*);
- void operator=(CJS_Document*);
- void operator=(v8::Local<v8::Object>);
- void operator=(CJS_Array&);
- void operator=(CJS_Date&);
+ void operator=(double val);
+ void operator=(float val);
+ void operator=(CJS_Object* val);
+ void operator=(CJS_Document* val);
+ void operator=(v8::Local<v8::Object> val);
+ void operator=(CJS_Array& val);
+ void operator=(CJS_Date& val);
void operator=(const FX_WCHAR* pWstr);
void operator=(const FX_CHAR* pStr);
void operator=(CJS_Value value);
@@ -102,11 +102,11 @@ class CJS_PropValue : public CJS_Value {
FX_BOOL IsSetting() const { return m_bIsSetting; }
FX_BOOL IsGetting() const { return !m_bIsSetting; }
- void operator<<(int);
+ void operator<<(int val);
void operator>>(int&) const;
- void operator<<(bool);
+ void operator<<(bool val);
void operator>>(bool&) const;
- void operator<<(double);
+ void operator<<(double val);
void operator>>(double&) const;
void operator<<(CJS_Object* pObj);
void operator>>(CJS_Object*& ppObj) const;