From 738b08ce6b9f80d93b815411b47c2b11c2f090f6 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 1 Mar 2016 14:45:20 -0500 Subject: 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 . --- fpdfsdk/src/fpdf_transformpage.cpp | 4 ++-- fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp | 9 ++++----- fpdfsdk/src/fsdk_baseform.cpp | 3 ++- fpdfsdk/src/javascript/Consts.cpp | 30 +++++++++++++++--------------- fpdfsdk/src/javascript/JS_Runtime_Stub.cpp | 6 ++---- fpdfsdk/src/javascript/JS_Value.cpp | 3 ++- fpdfsdk/src/javascript/JS_Value.h | 20 ++++++++++---------- 7 files changed, 37 insertions(+), 38 deletions(-) (limited to 'fpdfsdk/src') diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp index 9f500b2768..3d2f6511cd 100644 --- a/fpdfsdk/src/fpdf_transformpage.cpp +++ b/fpdfsdk/src/fpdf_transformpage.cpp @@ -240,9 +240,9 @@ void OutputPath(CFX_ByteTextBuf& buf, CPDF_Path path) { for (int i = 0; i < pPathData->GetPointCount(); i++) { buf << (pPoints[i].m_PointX) << " " << (pPoints[i].m_PointY); int point_type = pPoints[i].m_Flag & FXPT_TYPE; - if (point_type == FXPT_MOVETO) + if (point_type == FXPT_MOVETO) { buf << " m\n"; - else if (point_type == FXPT_BEZIERTO) { + } else if (point_type == FXPT_BEZIERTO) { buf << " " << (pPoints[i + 1].m_PointX) << " " << (pPoints[i + 1].m_PointY) << " " << (pPoints[i + 2].m_PointX) << " " << (pPoints[i + 2].m_PointY); diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp index f9bf170554..aaeb4d6c3f 100644 --- a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp @@ -1048,11 +1048,10 @@ FX_BOOL CPDFXFA_Document::_MailToInfo(CFX_WideString& csURL, pos = srcURL.Find(L'@', 0); if (pos == -1) return FALSE; - else { - tmp = srcURL.Right(csURL.GetLength() - 7); - tmp.TrimLeft(); - tmp.TrimRight(); - } + + tmp = srcURL.Right(csURL.GetLength() - 7); + tmp.TrimLeft(); + tmp.TrimRight(); } else { tmp = srcURL.Left(pos); tmp = tmp.Right(tmp.GetLength() - 7); diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index 79180324f7..8245980fbb 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -56,8 +56,9 @@ IXFA_Widget* CPDFSDK_Widget::GetMixXFAWidget() const { sName = GetAnnotName(); if (sName.IsEmpty()) sName = GetName(); - } else + } else { sName = GetName(); + } if (!sName.IsEmpty()) m_hMixXFAWidget = pDocView->GetWidgetByName(sName); 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); - 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 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; -- cgit v1.2.3