diff --git a/examples/BarcodeEncoder/BarcodeEncoder.pro b/examples/BarcodeEncoder/BarcodeEncoder.pro index fecd2ff..7bc3c1e 100644 --- a/examples/BarcodeEncoder/BarcodeEncoder.pro +++ b/examples/BarcodeEncoder/BarcodeEncoder.pro @@ -2,6 +2,8 @@ QT += qml quick CONFIG += c++11 qzxing_qml +gcc:QMAKE_CXXFLAGS += -Wall -Wextra + SOURCES += main.cpp RESOURCES += qml.qrc diff --git a/examples/QMLBarcodeScanner/QMLBarcodeReader.pro b/examples/QMLBarcodeScanner/QMLBarcodeReader.pro index e14e7e1..9a394d7 100644 --- a/examples/QMLBarcodeScanner/QMLBarcodeReader.pro +++ b/examples/QMLBarcodeScanner/QMLBarcodeReader.pro @@ -4,6 +4,8 @@ VERSION = 1.1.0 QT += declarative network +gcc:QMAKE_CXXFLAGS += -Wall -Wextra + !maemo5 { contains(QT_CONFIG, opengl) { # QT += opengl diff --git a/examples/QZXingDragNDropTest/QZXingDragNDropTest.pro b/examples/QZXingDragNDropTest/QZXingDragNDropTest.pro index 7bc5223..ab47305 100644 --- a/examples/QZXingDragNDropTest/QZXingDragNDropTest.pro +++ b/examples/QZXingDragNDropTest/QZXingDragNDropTest.pro @@ -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 = diff --git a/examples/QZXingLive/QZXingLive.pro b/examples/QZXingLive/QZXingLive.pro index 2493c24..26c0054 100644 --- a/examples/QZXingLive/QZXingLive.pro +++ b/examples/QZXingLive/QZXingLive.pro @@ -2,6 +2,8 @@ TEMPLATE = app CONFIG += c++11 qzxing_multimedia +gcc:QMAKE_CXXFLAGS += -Wall -Wextra + CONFIG(debug, debug|release) { CONFIG+=qml_debug } else { diff --git a/src/QZXing.pri b/src/QZXing.pri index d100738..8a8c975 100644 --- a/src/QZXing.pri +++ b/src/QZXing.pri @@ -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 \ diff --git a/src/QZXing.pro b/src/QZXing.pro index dc1d5f2..8cf5593 100644 --- a/src/QZXing.pro +++ b/src/QZXing.pro @@ -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 - - diff --git a/src/zxing/zxing/ChecksumException.cpp b/src/zxing/zxing/ChecksumException.cpp index 4738185..b9c3c6c 100644 --- a/src/zxing/zxing/ChecksumException.cpp +++ b/src/zxing/zxing/ChecksumException.cpp @@ -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 {} diff --git a/src/zxing/zxing/ChecksumException.h b/src/zxing/zxing/ChecksumException.h index 07e9502..5171248 100644 --- a/src/zxing/zxing/ChecksumException.h +++ b/src/zxing/zxing/ChecksumException.h @@ -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; }; } diff --git a/src/zxing/zxing/Exception.cpp b/src/zxing/zxing/Exception.cpp index 2d912a2..2a71cd7 100644 --- a/src/zxing/zxing/Exception.cpp +++ b/src/zxing/zxing/Exception.cpp @@ -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; } diff --git a/src/zxing/zxing/Exception.h b/src/zxing/zxing/Exception.h index bedc469..52becaf 100644 --- a/src/zxing/zxing/Exception.h +++ b/src/zxing/zxing/Exception.h @@ -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*); diff --git a/src/zxing/zxing/FormatException.cpp b/src/zxing/zxing/FormatException.cpp index 488b3d4..7115abb 100644 --- a/src/zxing/zxing/FormatException.cpp +++ b/src/zxing/zxing/FormatException.cpp @@ -29,7 +29,7 @@ FormatException::FormatException(const char *msg) : ReaderException(msg) { } -FormatException::~FormatException() throw() { +FormatException::~FormatException() noexcept { } FormatException const& diff --git a/src/zxing/zxing/FormatException.h b/src/zxing/zxing/FormatException.h index e0a2f10..61b846e 100644 --- a/src/zxing/zxing/FormatException.h +++ b/src/zxing/zxing/FormatException.h @@ -28,7 +28,7 @@ class FormatException : public ReaderException { public: FormatException(); FormatException(const char *msg); - ~FormatException() throw(); + ~FormatException() noexcept; static FormatException const& getFormatInstance(); }; diff --git a/src/zxing/zxing/IllegalStateException.cpp b/src/zxing/zxing/IllegalStateException.cpp new file mode 100644 index 0000000..83c23a5 --- /dev/null +++ b/src/zxing/zxing/IllegalStateException.cpp @@ -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::IllegalStateException() noexcept { +} + +zxing::IllegalStateException::IllegalStateException(const char *msg) noexcept + : ReaderException(msg) { +} + +zxing::IllegalStateException::~IllegalStateException() noexcept { +} diff --git a/src/zxing/zxing/IllegalStateException.h b/src/zxing/zxing/IllegalStateException.h index dbe50f9..bbe43e2 100644 --- a/src/zxing/zxing/IllegalStateException.h +++ b/src/zxing/zxing/IllegalStateException.h @@ -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; }; } diff --git a/src/zxing/zxing/NotFoundException.cpp b/src/zxing/zxing/NotFoundException.cpp new file mode 100644 index 0000000..f8dcc77 --- /dev/null +++ b/src/zxing/zxing/NotFoundException.cpp @@ -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::NotFoundException() noexcept { +} + +zxing::NotFoundException::NotFoundException(const char *msg) noexcept + : ReaderException(msg) { +} + +zxing::NotFoundException::~NotFoundException() noexcept { +} diff --git a/src/zxing/zxing/NotFoundException.h b/src/zxing/zxing/NotFoundException.h index 695ce94..bb4e923 100644 --- a/src/zxing/zxing/NotFoundException.h +++ b/src/zxing/zxing/NotFoundException.h @@ -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; }; } diff --git a/src/zxing/zxing/ReaderException.cpp b/src/zxing/zxing/ReaderException.cpp new file mode 100644 index 0000000..76a1cd1 --- /dev/null +++ b/src/zxing/zxing/ReaderException.cpp @@ -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::ReaderException() noexcept { +} + +zxing::ReaderException::ReaderException(const char *msg) noexcept + : Exception(msg) { +} + +zxing::ReaderException::~ReaderException() noexcept { +} diff --git a/src/zxing/zxing/ReaderException.h b/src/zxing/zxing/ReaderException.h index 804dde4..64fbfa9 100644 --- a/src/zxing/zxing/ReaderException.h +++ b/src/zxing/zxing/ReaderException.h @@ -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; }; } diff --git a/src/zxing/zxing/UnsupportedEncodingException.cpp b/src/zxing/zxing/UnsupportedEncodingException.cpp new file mode 100644 index 0000000..b60e1fc --- /dev/null +++ b/src/zxing/zxing/UnsupportedEncodingException.cpp @@ -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::UnsupportedEncodingException() noexcept { +} + +zxing::UnsupportedEncodingException::UnsupportedEncodingException(const char *msg) noexcept + : Exception(msg) { +} + +zxing::UnsupportedEncodingException::~UnsupportedEncodingException() noexcept { +} diff --git a/src/zxing/zxing/UnsupportedEncodingException.h b/src/zxing/zxing/UnsupportedEncodingException.h index cde702e..c3a3d14 100644 --- a/src/zxing/zxing/UnsupportedEncodingException.h +++ b/src/zxing/zxing/UnsupportedEncodingException.h @@ -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; }; } diff --git a/src/zxing/zxing/WriterException.cpp b/src/zxing/zxing/WriterException.cpp new file mode 100644 index 0000000..1d6560f --- /dev/null +++ b/src/zxing/zxing/WriterException.cpp @@ -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::WriterException() noexcept { +} + +zxing::WriterException::WriterException(const char *msg) noexcept + : Exception(msg) { +} + +zxing::WriterException::~WriterException() noexcept { +} diff --git a/src/zxing/zxing/WriterException.h b/src/zxing/zxing/WriterException.h index c511c8e..cfd5308 100644 --- a/src/zxing/zxing/WriterException.h +++ b/src/zxing/zxing/WriterException.h @@ -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; }; } diff --git a/src/zxing/zxing/common/IllegalArgumentException.cpp b/src/zxing/zxing/common/IllegalArgumentException.cpp index 45c1fa1..3e372c9 100644 --- a/src/zxing/zxing/common/IllegalArgumentException.cpp +++ b/src/zxing/zxing/common/IllegalArgumentException.cpp @@ -24,4 +24,4 @@ using zxing::IllegalArgumentException; IllegalArgumentException::IllegalArgumentException() : Exception() {} IllegalArgumentException::IllegalArgumentException(const char *msg) : Exception(msg) {} -IllegalArgumentException::~IllegalArgumentException() throw() {} +IllegalArgumentException::~IllegalArgumentException() noexcept {} diff --git a/src/zxing/zxing/common/IllegalArgumentException.h b/src/zxing/zxing/common/IllegalArgumentException.h index 4a74b6b..e6c95df 100644 --- a/src/zxing/zxing/common/IllegalArgumentException.h +++ b/src/zxing/zxing/common/IllegalArgumentException.h @@ -28,7 +28,7 @@ class IllegalArgumentException : public Exception { public: IllegalArgumentException(); IllegalArgumentException(const char *msg); - ~IllegalArgumentException() throw(); + ~IllegalArgumentException() noexcept; }; } diff --git a/src/zxing/zxing/common/reedsolomon/ReedSolomonException.cpp b/src/zxing/zxing/common/reedsolomon/ReedSolomonException.cpp index 20af025..87367c3 100644 --- a/src/zxing/zxing/common/reedsolomon/ReedSolomonException.cpp +++ b/src/zxing/zxing/common/reedsolomon/ReedSolomonException.cpp @@ -21,10 +21,10 @@ #include namespace zxing { -ReedSolomonException::ReedSolomonException(const char *msg) throw() : +ReedSolomonException::ReedSolomonException(const char *msg) noexcept : Exception(msg) { } -ReedSolomonException::~ReedSolomonException() throw() { +ReedSolomonException::~ReedSolomonException() noexcept { } } diff --git a/src/zxing/zxing/common/reedsolomon/ReedSolomonException.h b/src/zxing/zxing/common/reedsolomon/ReedSolomonException.h index b707b6d..b98adbd 100644 --- a/src/zxing/zxing/common/reedsolomon/ReedSolomonException.h +++ b/src/zxing/zxing/common/reedsolomon/ReedSolomonException.h @@ -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; }; } diff --git a/src/zxing/zxing/datamatrix/detector/DetectorException.h b/src/zxing/zxing/datamatrix/detector/DetectorException.h index 8002ac9..ddc5eba 100644 --- a/src/zxing/zxing/datamatrix/detector/DetectorException.h +++ b/src/zxing/zxing/datamatrix/detector/DetectorException.h @@ -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 */