summaryrefslogtreecommitdiff
path: root/fofi
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2018-01-08 18:07:38 +0100
committerAlbert Astals Cid <aacid@kde.org>2018-01-08 18:37:33 +0100
commit8794789a72f845b009656e6d7ae6a00b709e09bc (patch)
tree82220f5640d4abcf726f6e83e59cd6bb59cc4d67 /fofi
parent4c7814342806b61fedbb2d45ce74462f9dbc20bc (diff)
Delete lots of copy constructors and copy assignment operators
Fixes rule-of-three and copyable-polymorphic warnings reported by clazy. The default copy constructor and copy assignment operator are only valid for simple classes so we delete them (i.e. make then not exist) when we have either a virtual class or a destructor, the code still compiles so this doesn't fix any bug, it is more a protection for when you think you can copy a class and don't realize the default copy constrcutor is not doing what you want and you get crashes. Hopefully this helps us in the future :)
Diffstat (limited to 'fofi')
-rw-r--r--fofi/FoFiBase.h16
-rw-r--r--fofi/FoFiIdentifier.cc4
2 files changed, 20 insertions, 0 deletions
diff --git a/fofi/FoFiBase.h b/fofi/FoFiBase.h
index d613acd2..be4e7025 100644
--- a/fofi/FoFiBase.h
+++ b/fofi/FoFiBase.h
@@ -6,6 +6,20 @@
//
//========================================================================
+//========================================================================
+//
+// Modified under the Poppler project - http://poppler.freedesktop.org
+//
+// All changes made under the Poppler project to this file are licensed
+// under GPL version 2 or later
+//
+// Copyright (C) 2018 Albert Astals Cid <aacid@kde.org>
+//
+// To see a description of the changes please see the Changelog file that
+// came with your tarball or type make ChangeLog if you are building from git
+//
+//========================================================================
+
#ifndef FOFIBASE_H
#define FOFIBASE_H
@@ -25,6 +39,8 @@ typedef void (*FoFiOutputFunc)(void *stream, const char *data, int len);
class FoFiBase {
public:
+ FoFiBase(const FoFiBase &) = delete;
+ FoFiBase& operator=(const FoFiBase &other) = delete;
virtual ~FoFiBase();
diff --git a/fofi/FoFiIdentifier.cc b/fofi/FoFiIdentifier.cc
index 00b240fd..1e657ef2 100644
--- a/fofi/FoFiIdentifier.cc
+++ b/fofi/FoFiIdentifier.cc
@@ -14,6 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2013 Christoph Duelli <duelli@melosgmbh.de>
+// Copyright (C) 2018 Albert Astals Cid <aacid@kde.org>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -36,6 +37,9 @@ namespace { // do not pollute global namespace
class Reader {
public:
+ Reader() = default;
+ Reader(const Reader &) = delete;
+ Reader& operator=(const Reader &other) = delete;
virtual ~Reader() {}