Fixed XXX has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit in Exception and derived classes

Enabled -Wall and -Wextra
This commit is contained in:
Alexander Stillich 2018-11-05 14:50:45 +01:00
parent 83e1075792
commit d2242ac24a
27 changed files with 231 additions and 51 deletions

View File

@ -2,6 +2,8 @@ QT += qml quick
CONFIG += c++11 qzxing_qml
gcc:QMAKE_CXXFLAGS += -Wall -Wextra
SOURCES += main.cpp
RESOURCES += qml.qrc

View File

@ -4,6 +4,8 @@ VERSION = 1.1.0
QT += declarative network
gcc:QMAKE_CXXFLAGS += -Wall -Wextra
!maemo5 {
contains(QT_CONFIG, opengl) {
# QT += opengl

View File

@ -7,6 +7,8 @@ QT += widgets
CONFIG += qzxing_qml
gcc:QMAKE_CXXFLAGS += -Wall -Wextra
# Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =

View File

@ -2,6 +2,8 @@ TEMPLATE = app
CONFIG += c++11 qzxing_multimedia
gcc:QMAKE_CXXFLAGS += -Wall -Wextra
CONFIG(debug, debug|release) {
CONFIG+=qml_debug
} else {

View File

@ -166,6 +166,11 @@ SOURCES += $$PWD/CameraImageWrapper.cpp \
$$PWD/zxing/zxing/BinaryBitmap.cpp \
$$PWD/zxing/zxing/Binarizer.cpp \
$$PWD/zxing/zxing/BarcodeFormat.cpp \
$$PWD/zxing/zxing/ReaderException.cpp \
$$PWD/zxing/zxing/IllegalStateException.cpp \
$$PWD/zxing/zxing/NotFoundException.cpp \
$$PWD/zxing/zxing/UnsupportedEncodingException.cpp \
$$PWD/zxing/zxing/WriterException.cpp \
$$PWD/zxing/zxing/aztec/AztecReader.cpp \
$$PWD/zxing/zxing/aztec/AztecDetectorResult.cpp \
$$PWD/zxing/zxing/common/StringUtils.cpp \

View File

@ -22,6 +22,7 @@ TARGET = QZXing
TEMPLATE = lib
# CONFIG += staticlib
gcc:QMAKE_CXXFLAGS += -Wall -Wextra
DEFINES -= DISABLE_LIBRARY_FEATURES
symbian {
@ -66,5 +67,3 @@ OTHER_FILES += \
qtc_packaging/debian_fremantle/control \
qtc_packaging/debian_fremantle/compat \
qtc_packaging/debian_fremantle/changelog

View File

@ -23,6 +23,6 @@
using zxing::ChecksumException;
ChecksumException::ChecksumException() throw() {}
ChecksumException::ChecksumException(const char *msg) throw() : ReaderException(msg) {}
ChecksumException::~ChecksumException() throw() {}
ChecksumException::ChecksumException() noexcept {}
ChecksumException::ChecksumException(const char *msg) noexcept : ReaderException(msg) {}
ChecksumException::~ChecksumException() noexcept {}

View File

@ -23,11 +23,10 @@
namespace zxing {
class ChecksumException : public ReaderException {
typedef ReaderException Base;
public:
ChecksumException() throw();
ChecksumException(const char *msg) throw();
~ChecksumException() throw();
ChecksumException() noexcept;
ChecksumException(const char *msg) noexcept;
~ChecksumException() noexcept;
};
}

View File

@ -26,18 +26,41 @@
using zxing::Exception;
Exception::Exception() noexcept
: message(nullptr) {
}
Exception::Exception(const char *msg) noexcept
: message(copy(msg)) {
}
Exception::Exception(const zxing::Exception &that) noexcept
: std::exception(that),
message(copy(that.message)) {
}
Exception::~Exception() noexcept {
if(message) {
deleteMessage();
}
}
const char *Exception::what() const noexcept {
return message ? message : "";
}
void Exception::deleteMessage() {
delete [] message;
delete [] message;
}
char const* Exception::copy(char const* msg) {
char* message = 0;
if (msg) {
int l = strlen(msg)+1;
if (l) {
message = new char[l];
strcpy(message, msg);
char* message = nullptr;
if (msg) {
auto l = strlen(msg)+1;
if (l) {
message = new char[l];
strcpy(message, msg);
}
}
}
return message;
return message;
}

View File

@ -31,15 +31,11 @@ private:
char const* const message;
public:
Exception() throw() : message(0) {}
Exception(const char* msg) throw() : message(copy(msg)) {}
Exception(Exception const& that) throw() : std::exception(that), message(copy(that.message)) {}
~Exception() throw() {
if(message) {
deleteMessage();
}
}
char const* what() const throw() {return message ? message : "";}
Exception() noexcept;
Exception(const char* msg) noexcept;
Exception(Exception const& that) noexcept;
~Exception() noexcept;
char const* what() const noexcept;
private:
static char const* copy(char const*);

View File

@ -29,7 +29,7 @@ FormatException::FormatException(const char *msg) :
ReaderException(msg) {
}
FormatException::~FormatException() throw() {
FormatException::~FormatException() noexcept {
}
FormatException const&

View File

@ -28,7 +28,7 @@ class FormatException : public ReaderException {
public:
FormatException();
FormatException(const char *msg);
~FormatException() throw();
~FormatException() noexcept;
static FormatException const& getFormatInstance();
};

View File

@ -0,0 +1,30 @@
/*
* IllegalStateException.cpp
* zxing
*
* Created by Alexander Stillich on 05/11/2018.
* Copyright 2008 ZXing authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <zxing/IllegalStateException.h>
zxing::IllegalStateException::IllegalStateException() noexcept {
}
zxing::IllegalStateException::IllegalStateException(const char *msg) noexcept
: ReaderException(msg) {
}
zxing::IllegalStateException::~IllegalStateException() noexcept {
}

View File

@ -25,9 +25,9 @@ namespace zxing {
class IllegalStateException : public ReaderException {
public:
IllegalStateException() throw() {}
IllegalStateException(const char *msg) throw() : ReaderException(msg) {}
~IllegalStateException() throw() {}
IllegalStateException() noexcept;
IllegalStateException(const char *msg) noexcept;
~IllegalStateException() noexcept;
};
}

View File

@ -0,0 +1,30 @@
/*
* IllegalStateException.cpp
* zxing
*
* Created by Alexander Stillich on 05/11/2018.
* Copyright 2008 ZXing authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <zxing/NotFoundException.h>
zxing::NotFoundException::NotFoundException() noexcept {
}
zxing::NotFoundException::NotFoundException(const char *msg) noexcept
: ReaderException(msg) {
}
zxing::NotFoundException::~NotFoundException() noexcept {
}

View File

@ -25,9 +25,9 @@ namespace zxing {
class NotFoundException : public ReaderException {
public:
NotFoundException() throw() {}
NotFoundException(const char *msg) throw() : ReaderException(msg) {}
~NotFoundException() throw() {}
NotFoundException() noexcept;
NotFoundException(const char *msg) noexcept;
~NotFoundException() noexcept;
};
}

View File

@ -0,0 +1,30 @@
/*
* ReaderException.cpp
* zxing
*
* Created by Alexander Stillich on 05/11/2018.
* Copyright 2008 ZXing authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <zxing/ReaderException.h>
zxing::ReaderException::ReaderException() noexcept {
}
zxing::ReaderException::ReaderException(const char *msg) noexcept
: Exception(msg) {
}
zxing::ReaderException::~ReaderException() noexcept {
}

View File

@ -27,9 +27,9 @@ namespace zxing {
class ReaderException : public Exception {
public:
ReaderException() throw() {}
ReaderException(char const* msg) throw() : Exception(msg) {}
~ReaderException() throw() {}
ReaderException() noexcept;
ReaderException(char const* msg) noexcept;
~ReaderException() noexcept;
};
}

View File

@ -0,0 +1,30 @@
/*
* UnsupportedEncodingException.cpp
* zxing
*
* Created by Alexander Stillich on 05/11/2018.
* Copyright 2008 ZXing authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <zxing/UnsupportedEncodingException.h>
zxing::UnsupportedEncodingException::UnsupportedEncodingException() noexcept {
}
zxing::UnsupportedEncodingException::UnsupportedEncodingException(const char *msg) noexcept
: Exception(msg) {
}
zxing::UnsupportedEncodingException::~UnsupportedEncodingException() noexcept {
}

View File

@ -7,9 +7,9 @@ namespace zxing {
class UnsupportedEncodingException : public Exception {
public:
UnsupportedEncodingException() throw() {}
UnsupportedEncodingException(char const* msg) throw() : Exception(msg) {}
~UnsupportedEncodingException() throw() {}
UnsupportedEncodingException() noexcept;
UnsupportedEncodingException(char const* msg) noexcept;
~UnsupportedEncodingException() noexcept;
};
}

View File

@ -0,0 +1,30 @@
/*
* UnsupportedEncodingException.cpp
* zxing
*
* Created by Alexander Stillich on 05/11/2018.
* Copyright 2008 ZXing authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <zxing/WriterException.h>
zxing::WriterException::WriterException() noexcept {
}
zxing::WriterException::WriterException(const char *msg) noexcept
: Exception(msg) {
}
zxing::WriterException::~WriterException() noexcept {
}

View File

@ -7,9 +7,9 @@ namespace zxing {
class WriterException : public Exception {
public:
WriterException() throw() {}
WriterException(char const* msg) throw() : Exception(msg) {}
~WriterException() throw() {}
WriterException() noexcept;
WriterException(char const* msg) noexcept;
~WriterException() noexcept;
};
}

View File

@ -24,4 +24,4 @@ using zxing::IllegalArgumentException;
IllegalArgumentException::IllegalArgumentException() : Exception() {}
IllegalArgumentException::IllegalArgumentException(const char *msg) : Exception(msg) {}
IllegalArgumentException::~IllegalArgumentException() throw() {}
IllegalArgumentException::~IllegalArgumentException() noexcept {}

View File

@ -28,7 +28,7 @@ class IllegalArgumentException : public Exception {
public:
IllegalArgumentException();
IllegalArgumentException(const char *msg);
~IllegalArgumentException() throw();
~IllegalArgumentException() noexcept;
};
}

View File

@ -21,10 +21,10 @@
#include <zxing/common/reedsolomon/ReedSolomonException.h>
namespace zxing {
ReedSolomonException::ReedSolomonException(const char *msg) throw() :
ReedSolomonException::ReedSolomonException(const char *msg) noexcept :
Exception(msg) {
}
ReedSolomonException::~ReedSolomonException() throw() {
ReedSolomonException::~ReedSolomonException() noexcept {
}
}

View File

@ -25,8 +25,8 @@
namespace zxing {
class ReedSolomonException : public Exception {
public:
ReedSolomonException(const char *msg) throw();
~ReedSolomonException() throw();
ReedSolomonException(const char *msg) noexcept;
~ReedSolomonException() noexcept;
};
}

View File

@ -16,7 +16,7 @@ namespace datamatrix {
class DetectorException : public Exception {
public:
DetectorException(const char *msg);
virtual ~DetectorException() throw();
virtual ~DetectorException() noexcept;
};
} /* namespace nexxera */
} /* namespace zxing */