Consistently declare operator=.
Return a reference to the object instead of void. Make the changed
operator= declaration and associated copy ctors public, as they are all
being deleted, and those can be public as of C++11.
Change-Id: I584e1cd870e30c456be4126fb88460fa4a86196c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/60852
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_pageobject.h b/core/fpdfapi/page/cpdf_pageobject.h
index 6aea085..f840214 100644
--- a/core/fpdfapi/page/cpdf_pageobject.h
+++ b/core/fpdfapi/page/cpdf_pageobject.h
@@ -12,11 +12,11 @@
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
-class CPDF_TextObject;
-class CPDF_PathObject;
-class CPDF_ImageObject;
-class CPDF_ShadingObject;
class CPDF_FormObject;
+class CPDF_ImageObject;
+class CPDF_PathObject;
+class CPDF_ShadingObject;
+class CPDF_TextObject;
class CPDF_PageObject : public CPDF_GraphicStates {
public:
@@ -31,6 +31,8 @@
static constexpr int32_t kNoContentStream = -1;
explicit CPDF_PageObject(int32_t content_stream);
+ CPDF_PageObject(const CPDF_PageObject& src) = delete;
+ CPDF_PageObject& operator=(const CPDF_PageObject& src) = delete;
~CPDF_PageObject() override;
virtual Type GetType() const = 0;
@@ -81,9 +83,6 @@
CFX_FloatRect m_Rect;
private:
- CPDF_PageObject(const CPDF_PageObject& src) = delete;
- void operator=(const CPDF_PageObject& src) = delete;
-
bool m_bDirty = false;
int32_t m_ContentStream;
};
diff --git a/core/fxcodec/jbig2/JBig2_BitStream.h b/core/fxcodec/jbig2/JBig2_BitStream.h
index 9e6efc4..8032090 100644
--- a/core/fxcodec/jbig2/JBig2_BitStream.h
+++ b/core/fxcodec/jbig2/JBig2_BitStream.h
@@ -13,6 +13,8 @@
class CJBig2_BitStream {
public:
CJBig2_BitStream(pdfium::span<const uint8_t> pSrcStream, uint32_t dwObjNum);
+ CJBig2_BitStream(const CJBig2_BitStream&) = delete;
+ CJBig2_BitStream& operator=(const CJBig2_BitStream&) = delete;
~CJBig2_BitStream();
// TODO(thestig): readFoo() should return bool.
@@ -48,9 +50,6 @@
uint32_t m_dwByteIdx = 0;
uint32_t m_dwBitIdx = 0;
const uint32_t m_dwObjNum;
-
- CJBig2_BitStream(const CJBig2_BitStream&) = delete;
- void operator=(const CJBig2_BitStream&) = delete;
};
#endif // CORE_FXCODEC_JBIG2_JBIG2_BITSTREAM_H_
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index be80e83..2f56790 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -32,6 +32,9 @@
m_hFont = SelectObject(m_hDC, hFont);
}
+ ScopedState(const ScopedState&) = delete;
+ ScopedState& operator=(const ScopedState&) = delete;
+
~ScopedState() {
HGDIOBJ hFont = SelectObject(m_hDC, m_hFont);
DeleteObject(hFont);
@@ -42,9 +45,6 @@
HDC m_hDC;
HGDIOBJ m_hFont;
int m_iState;
-
- ScopedState(const ScopedState&) = delete;
- void operator=(const ScopedState&) = delete;
};
} // namespace
diff --git a/fxjs/xfa/cfxjse_context.cpp b/fxjs/xfa/cfxjse_context.cpp
index 7a3b593..1ff1417 100644
--- a/fxjs/xfa/cfxjse_context.cpp
+++ b/fxjs/xfa/cfxjse_context.cpp
@@ -115,11 +115,12 @@
public:
explicit CFXJSE_ScopeUtil_IsolateHandleContext(CFXJSE_Context* pContext)
: m_parent(pContext->GetIsolate()), m_cscope(pContext->GetContext()) {}
-
- private:
CFXJSE_ScopeUtil_IsolateHandleContext(
const CFXJSE_ScopeUtil_IsolateHandleContext&) = delete;
- void operator=(const CFXJSE_ScopeUtil_IsolateHandleContext&) = delete;
+ CFXJSE_ScopeUtil_IsolateHandleContext& operator=(
+ const CFXJSE_ScopeUtil_IsolateHandleContext&) = delete;
+
+ private:
void* operator new(size_t size) = delete;
void operator delete(void*, size_t) = delete;
diff --git a/fxjs/xfa/cfxjse_isolatetracker.h b/fxjs/xfa/cfxjse_isolatetracker.h
index 05d9729..020142d 100644
--- a/fxjs/xfa/cfxjse_isolatetracker.h
+++ b/fxjs/xfa/cfxjse_isolatetracker.h
@@ -12,12 +12,13 @@
class CFXJSE_ScopeUtil_IsolateHandle {
public:
explicit CFXJSE_ScopeUtil_IsolateHandle(v8::Isolate* pIsolate);
+ CFXJSE_ScopeUtil_IsolateHandle(const CFXJSE_ScopeUtil_IsolateHandle&) =
+ delete;
+ CFXJSE_ScopeUtil_IsolateHandle& operator=(
+ const CFXJSE_ScopeUtil_IsolateHandle&) = delete;
~CFXJSE_ScopeUtil_IsolateHandle();
private:
- CFXJSE_ScopeUtil_IsolateHandle(const CFXJSE_ScopeUtil_IsolateHandle&) =
- delete;
- void operator=(const CFXJSE_ScopeUtil_IsolateHandle&) = delete;
void* operator new(size_t size) = delete;
void operator delete(void*, size_t) = delete;
@@ -29,12 +30,13 @@
: public CFXJSE_ScopeUtil_IsolateHandle {
public:
explicit CFXJSE_ScopeUtil_IsolateHandleRootContext(v8::Isolate* pIsolate);
+ CFXJSE_ScopeUtil_IsolateHandleRootContext(
+ const CFXJSE_ScopeUtil_IsolateHandleRootContext&) = delete;
+ CFXJSE_ScopeUtil_IsolateHandleRootContext& operator=(
+ const CFXJSE_ScopeUtil_IsolateHandleRootContext&) = delete;
~CFXJSE_ScopeUtil_IsolateHandleRootContext();
private:
- CFXJSE_ScopeUtil_IsolateHandleRootContext(
- const CFXJSE_ScopeUtil_IsolateHandleRootContext&) = delete;
- void operator=(const CFXJSE_ScopeUtil_IsolateHandleRootContext&) = delete;
void* operator new(size_t size) = delete;
void operator delete(void*, size_t) = delete;