summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-09-20 12:56:04 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-20 12:56:04 +0000
commitdd92aa5946259b3252beec2b4760adbfa9f985a4 (patch)
tree0b069943bcfb437ea35bc0da0abf771cda80a14e
parent109aa6d0f673aee11a398aae478fb758fc73a33f (diff)
downloadpdfium-dd92aa5946259b3252beec2b4760adbfa9f985a4.tar.xz
Fix misc lint errors and other cleanups.
Change-Id: I00ce0109251d1231858e87ffc3889abe6937fa26 Reviewed-on: https://pdfium-review.googlesource.com/42811 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r--core/fpdfapi/page/cpdf_streamparser.cpp1
-rw-r--r--core/fpdfapi/parser/cpdf_cross_ref_avail.cpp1
-rw-r--r--core/fpdfapi/parser/cpdf_object_avail_unittest.cpp1
-rw-r--r--core/fxcodec/bmp/cfx_bmpdecompressor.h3
-rw-r--r--core/fxcrt/css/cfx_cssdeclaration.cpp2
-rw-r--r--core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp2
-rw-r--r--core/fxge/apple/apple_int.h4
-rw-r--r--core/fxge/dib/cfx_dibitmap.cpp12
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp2
-rw-r--r--xfa/fgas/layout/cfx_txtbreak_unittest.cpp1
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp3
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp7
12 files changed, 22 insertions, 17 deletions
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp
index a64e14d741..a083c93618 100644
--- a/core/fpdfapi/page/cpdf_streamparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamparser.cpp
@@ -56,7 +56,6 @@ uint32_t DecodeAllScanlines(std::unique_ptr<CCodec_ScanlineDecoder> pDecoder) {
for (int row = 0; row < height; ++row) {
if (!pDecoder->GetScanline(row))
break;
-
}
return pDecoder->GetSrcOffset();
}
diff --git a/core/fpdfapi/parser/cpdf_cross_ref_avail.cpp b/core/fpdfapi/parser/cpdf_cross_ref_avail.cpp
index 2ab530e00a..e5cdb70319 100644
--- a/core/fpdfapi/parser/cpdf_cross_ref_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_cross_ref_avail.cpp
@@ -5,6 +5,7 @@
#include "core/fpdfapi/parser/cpdf_cross_ref_avail.h"
#include <algorithm>
+#include <memory>
#include <vector>
#include "core/fpdfapi/parser/cpdf_dictionary.h"
diff --git a/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp b/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp
index 7dc1dcc050..fb29d6f75c 100644
--- a/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_object_avail_unittest.cpp
@@ -5,6 +5,7 @@
#include "core/fpdfapi/parser/cpdf_object_avail.h"
#include <map>
+#include <memory>
#include <utility>
#include "core/fpdfapi/parser/cpdf_array.h"
diff --git a/core/fxcodec/bmp/cfx_bmpdecompressor.h b/core/fxcodec/bmp/cfx_bmpdecompressor.h
index fbe7e1feee..beaf9bf78a 100644
--- a/core/fxcodec/bmp/cfx_bmpdecompressor.h
+++ b/core/fxcodec/bmp/cfx_bmpdecompressor.h
@@ -7,12 +7,11 @@
#ifndef CORE_FXCODEC_BMP_CFX_BMPDECOMPRESSOR_H_
#define CORE_FXCODEC_BMP_CFX_BMPDECOMPRESSOR_H_
-#include "core/fxcodec/bmp/fx_bmp.h"
-
#include <setjmp.h>
#include <vector>
+#include "core/fxcodec/bmp/fx_bmp.h"
#include "core/fxcodec/codec/cfx_codec_memory.h"
#include "third_party/base/span.h"
diff --git a/core/fxcrt/css/cfx_cssdeclaration.cpp b/core/fxcrt/css/cfx_cssdeclaration.cpp
index ba92be3b96..db2ec35c36 100644
--- a/core/fxcrt/css/cfx_cssdeclaration.cpp
+++ b/core/fxcrt/css/cfx_cssdeclaration.cpp
@@ -6,6 +6,8 @@
#include "core/fxcrt/css/cfx_cssdeclaration.h"
+#include <utility>
+
#include "core/fxcrt/css/cfx_csscolorvalue.h"
#include "core/fxcrt/css/cfx_csscustomproperty.h"
#include "core/fxcrt/css/cfx_cssenumvalue.h"
diff --git a/core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp b/core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp
index c1fbad5f0f..cfa7fb3162 100644
--- a/core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp
+++ b/core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp
@@ -4,6 +4,8 @@
#include "core/fxcrt/xml/cfx_xmlinstruction.h"
+#include <memory>
+
#include "core/fxcrt/cfx_readonlymemorystream.h"
#include "core/fxcrt/xml/cfx_xmldocument.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h
index e84387a3c8..a53b91b00b 100644
--- a/core/fxge/apple/apple_int.h
+++ b/core/fxge/apple/apple_int.h
@@ -9,14 +9,14 @@
#include "core/fxcrt/fx_system.h"
+#include <Carbon/Carbon.h>
+
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/fx_dib.h"
#include "core/fxge/renderdevicedriver_iface.h"
-#include <Carbon/Carbon.h>
-
class CQuartz2D {
public:
void* createGraphics(const RetainPtr<CFX_DIBitmap>& bitmap);
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp
index 89cfbb68d3..0dbf47cbf8 100644
--- a/core/fxge/dib/cfx_dibitmap.cpp
+++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -15,11 +15,10 @@
#include "core/fxge/dib/cfx_scanlinecompositor.h"
#include "third_party/base/ptr_util.h"
-#define MAX_OOM_LIMIT 12000000
-
namespace {
-const int8_t kChannelOffset[] = {0, 2, 1, 0, 0, 1, 2, 3, 3};
+constexpr size_t kMaxOOMLimit = 12000000;
+constexpr int8_t kChannelOffset[] = {0, 2, 1, 0, 0, 1, 2, 3, 3};
} // namespace
@@ -47,16 +46,14 @@ bool CFX_DIBitmap::Create(int width,
m_Pitch = 0;
uint32_t calculatedSize;
- if (!CFX_DIBitmap::CalculatePitchAndSize(height, width, format, &pitch,
- &calculatedSize))
+ if (!CalculatePitchAndSize(height, width, format, &pitch, &calculatedSize))
return false;
if (pBuffer) {
m_pBuffer.Reset(pBuffer);
} else {
size_t bufferSize = calculatedSize + 4;
- size_t oomlimit = MAX_OOM_LIMIT;
- if (bufferSize >= oomlimit) {
+ if (bufferSize >= kMaxOOMLimit) {
m_pBuffer = std::unique_ptr<uint8_t, FxFreeDeleter>(
FX_TryAlloc(uint8_t, bufferSize));
if (!m_pBuffer)
@@ -852,6 +849,7 @@ bool CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, uint32_t backcolor) {
return true;
}
+// static
bool CFX_DIBitmap::CalculatePitchAndSize(int height,
int width,
FXDIB_Format format,
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 85f53469e3..4b94bde271 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -535,7 +535,7 @@ bool CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag) {
if (!pObserved)
return false;
- SaveData(pPageView); // may invoking JS to delete this widget.
+ SaveData(pPageView); // may invoking JS to delete this widget.
if (!pObserved)
return false;
diff --git a/xfa/fgas/layout/cfx_txtbreak_unittest.cpp b/xfa/fgas/layout/cfx_txtbreak_unittest.cpp
index 8cac2fa036..2deadf4193 100644
--- a/xfa/fgas/layout/cfx_txtbreak_unittest.cpp
+++ b/xfa/fgas/layout/cfx_txtbreak_unittest.cpp
@@ -4,6 +4,7 @@
#include "xfa/fgas/layout/cfx_txtbreak.h"
+#include <memory>
#include <utility>
#include "core/fxcrt/fx_bidi.h"
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index 72bba2aeb0..c9369894a6 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -1648,7 +1648,8 @@ void CXFA_Document::DoDataMerge() {
pDatasetsRoot->SetXMLMappingNode(pDatasetsXMLNode);
}
- CXFA_Node *pDataRoot = nullptr, *pDDRoot = nullptr;
+ CXFA_Node* pDataRoot = nullptr;
+ CXFA_Node* pDDRoot = nullptr;
WideString wsDatasetsURI =
pDatasetsRoot->JSObject()->TryNamespace().value_or(WideString());
for (CXFA_Node* pChildNode = pDatasetsRoot->GetFirstChild(); pChildNode;
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index e603d91002..a7cbe42389 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -1718,7 +1718,8 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
}
int32_t iIndex = 0;
- for (; pRootLayout; pRootLayout = ToContainerLayoutItem(pRootLayout->m_pNextSibling)) {
+ for (; pRootLayout;
+ pRootLayout = ToContainerLayoutItem(pRootLayout->m_pNextSibling)) {
CXFA_Node* pPendingPageSet = nullptr;
CXFA_NodeIteratorTemplate<
CXFA_ContainerLayoutItem,
@@ -1972,9 +1973,9 @@ void CXFA_LayoutPageMgr::SyncLayoutData() {
}
void XFA_ReleaseLayoutItem_NoPageArea(CXFA_LayoutItem* pLayoutItem) {
- CXFA_LayoutItem *pNext, *pNode = pLayoutItem->m_pFirstChild;
+ CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild;
while (pNode) {
- pNext = pNode->m_pNextSibling;
+ CXFA_LayoutItem* pNext = pNode->m_pNextSibling;
pNode->m_pParent = nullptr;
XFA_ReleaseLayoutItem_NoPageArea(pNode);
pNode = pNext;