From 448a70f889033232a11f5774dd4c0aefaac1162a Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Wed, 27 May 2015 00:07:12 +0300 Subject: [PATCH] Fixed compilation warnings Mostly, by making base class destructors virtual. --- fbreader/fbreader/fbreader/src/bookmodel/BookModel.h | 1 + fbreader/fbreader/fbreader/src/database/booksdb/BooksDB.cpp | 2 +- .../fbreader/fbreader/src/formats/txt/PlainTextFormat.cpp | 2 -- fbreader/fbreader/fbreader/src/network/BookReference.h | 1 + .../fbreader/zlibrary/core/src/application/ZLApplication.h | 2 +- .../fbreader/zlibrary/core/src/dialogs/ZLOpenFileDialog.h | 2 ++ .../zlibrary/core/src/filesystem/zip/ZLZipHeader.cpp | 4 ++-- .../fbreader/zlibrary/core/src/filesystem/zip/ZLZipHeader.h | 4 ++-- .../zlibrary/core/src/language/ZLStatisticsItem.cpp | 6 +++--- 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/fbreader/fbreader/fbreader/src/bookmodel/BookModel.h b/fbreader/fbreader/fbreader/src/bookmodel/BookModel.h index 5b2e269..ea97880 100644 --- a/fbreader/fbreader/fbreader/src/bookmodel/BookModel.h +++ b/fbreader/fbreader/fbreader/src/bookmodel/BookModel.h @@ -55,6 +55,7 @@ public: class HyperlinkMatcher { public: + virtual ~HyperlinkMatcher() {} virtual Label match(const std::map &lMap, const std::string &id) const = 0; }; diff --git a/fbreader/fbreader/fbreader/src/database/booksdb/BooksDB.cpp b/fbreader/fbreader/fbreader/src/database/booksdb/BooksDB.cpp index e33a22e..1b60928 100644 --- a/fbreader/fbreader/fbreader/src/database/booksdb/BooksDB.cpp +++ b/fbreader/fbreader/fbreader/src/database/booksdb/BooksDB.cpp @@ -145,7 +145,7 @@ shared_ptr BooksDB::loadBook(const std::string &fileName) { myFindFileId->setFileName(fileName); if (!myFindFileId->run()) { - return false; + return 0; } ((DBIntValue&)*myLoadBook->parameter("@file_id").value()) = myFindFileId->fileId(); shared_ptr reader = myLoadBook->executeReader(); diff --git a/fbreader/fbreader/fbreader/src/formats/txt/PlainTextFormat.cpp b/fbreader/fbreader/fbreader/src/formats/txt/PlainTextFormat.cpp index 76a6b62..c336bd3 100644 --- a/fbreader/fbreader/fbreader/src/formats/txt/PlainTextFormat.cpp +++ b/fbreader/fbreader/fbreader/src/formats/txt/PlainTextFormat.cpp @@ -95,7 +95,6 @@ void PlainTextFormatDetector::detect(ZLInputStream &stream, PlainTextFormat &for char *buffer = new char[BUFFER_SIZE]; int length; - char previous = 0; do { length = stream.read(buffer, BUFFER_SIZE); const char *end = buffer + length; @@ -135,7 +134,6 @@ void PlainTextFormatDetector::detect(ZLInputStream &stream, PlainTextFormat &for } else { currentLineIsEmpty = false; } - previous = *ptr; } } while (length == BUFFER_SIZE); delete[] buffer; diff --git a/fbreader/fbreader/fbreader/src/network/BookReference.h b/fbreader/fbreader/fbreader/src/network/BookReference.h index ec4e40d..1af3106 100644 --- a/fbreader/fbreader/fbreader/src/network/BookReference.h +++ b/fbreader/fbreader/fbreader/src/network/BookReference.h @@ -44,6 +44,7 @@ public: public: BookReference(const std::string &url, Format format, Type type); + virtual ~BookReference() {} public: const std::string URL; diff --git a/fbreader/fbreader/zlibrary/core/src/application/ZLApplication.h b/fbreader/fbreader/zlibrary/core/src/application/ZLApplication.h index eb83cdf..ffd9b61 100644 --- a/fbreader/fbreader/zlibrary/core/src/application/ZLApplication.h +++ b/fbreader/fbreader/zlibrary/core/src/application/ZLApplication.h @@ -45,7 +45,7 @@ class ZLApplicationBase { protected: ZLApplicationBase(const std::string &name); - ~ZLApplicationBase(); + virtual ~ZLApplicationBase(); }; class ZLApplication : public ZLApplicationBase { diff --git a/fbreader/fbreader/zlibrary/core/src/dialogs/ZLOpenFileDialog.h b/fbreader/fbreader/zlibrary/core/src/dialogs/ZLOpenFileDialog.h index d0e6c7f..3009f9c 100644 --- a/fbreader/fbreader/zlibrary/core/src/dialogs/ZLOpenFileDialog.h +++ b/fbreader/fbreader/zlibrary/core/src/dialogs/ZLOpenFileDialog.h @@ -27,6 +27,8 @@ class ZLFile; class ZLOpenFileDialog { public: + virtual ~ZLOpenFileDialog() {} + class Filter { public: diff --git a/fbreader/fbreader/zlibrary/core/src/filesystem/zip/ZLZipHeader.cpp b/fbreader/fbreader/zlibrary/core/src/filesystem/zip/ZLZipHeader.cpp index 4fed308..e3a351c 100644 --- a/fbreader/fbreader/zlibrary/core/src/filesystem/zip/ZLZipHeader.cpp +++ b/fbreader/fbreader/zlibrary/core/src/filesystem/zip/ZLZipHeader.cpp @@ -23,8 +23,8 @@ #include "ZLZDecompressor.h" #include "../ZLInputStream.h" -const int ZLZipHeader::SignatureLocalFile = 0x04034B50; -const int ZLZipHeader::SignatureData = 0x08074B50; +const unsigned long ZLZipHeader::SignatureLocalFile = 0x04034B50; +const unsigned long ZLZipHeader::SignatureData = 0x08074B50; bool ZLZipHeader::readFrom(ZLInputStream &stream) { size_t startOffset = stream.offset(); diff --git a/fbreader/fbreader/zlibrary/core/src/filesystem/zip/ZLZipHeader.h b/fbreader/fbreader/zlibrary/core/src/filesystem/zip/ZLZipHeader.h index 88f6608..cf53a42 100644 --- a/fbreader/fbreader/zlibrary/core/src/filesystem/zip/ZLZipHeader.h +++ b/fbreader/fbreader/zlibrary/core/src/filesystem/zip/ZLZipHeader.h @@ -23,8 +23,8 @@ class ZLInputStream; struct ZLZipHeader { - static const int SignatureLocalFile; - static const int SignatureData; + static const unsigned long SignatureLocalFile; + static const unsigned long SignatureData; unsigned long Signature; unsigned short Version; diff --git a/fbreader/fbreader/zlibrary/core/src/language/ZLStatisticsItem.cpp b/fbreader/fbreader/zlibrary/core/src/language/ZLStatisticsItem.cpp index ed26f00..24adbe3 100644 --- a/fbreader/fbreader/zlibrary/core/src/language/ZLStatisticsItem.cpp +++ b/fbreader/fbreader/zlibrary/core/src/language/ZLStatisticsItem.cpp @@ -38,9 +38,9 @@ void ZLMapBasedStatisticsItem::next() { ZLArrayBasedStatisticsItem::ZLArrayBasedStatisticsItem(size_t sequenceLength, char* sequencePtr, unsigned short* frequencyPtr, size_t index) : ZLStatisticsItem(index), - mySequenceLength(sequenceLength), - mySequencePtr(sequencePtr), - myFrequencyPtr(frequencyPtr) { + mySequencePtr(sequencePtr), + myFrequencyPtr(frequencyPtr), + mySequenceLength(sequenceLength) { } ZLCharSequence ZLArrayBasedStatisticsItem::sequence() const {