From 8aa2b21fe596ddfe9de250190ede78ee34f19d2d Mon Sep 17 00:00:00 2001
From: Jos van den Oever <jos@vandenoever.info>
Date: Fri, 12 Jul 2013 13:04:44 +0200
Subject: [PATCH 4/5] Fix Krazy issues.
---
.krazy | 3 +++
cmake/FindIconv.cmake | 19 +++++++++++++++++++
include/strigi/archivereader.h | 6 +++---
include/strigi/bz2inputstream.h | 2 +-
include/strigi/dataeventinputstream.h | 2 +-
include/strigi/kmpsearcher.h | 2 +-
include/strigi/lzmainputstream.h | 2 +-
include/strigi/stringterminatedsubstream.h | 2 +-
include/strigi/substreamprovider.h | 2 +-
lib/libstreams.pc.cmake | 19 +++++++++++++++++++
lib/signatureinputstream.h | 2 +-
lib/strigiconfig.cpp | 2 +-
lib/stringreader.h | 2 --
tests/api/ArchiveReaderTest.cpp | 4 ++--
tests/sharedtestcode/unknownsizestream.h | 4 ++--
15 files changed, 56 insertions(+), 17 deletions(-)
create mode 100644 .krazy
diff --git a/.krazy b/.krazy
new file mode 100644
index 0000000..4822bdd
--- /dev/null
+++ b/.krazy
@@ -0,0 +1,3 @@
+# see http://techbase.kde.org/Development/Tutorials/Code_Checking#Controlling_Krazy_on_the_EBN for an explanation of this file
+EXCLUDE syscalls,typedefs
+IGNORESUBS tests/data
diff --git a/cmake/FindIconv.cmake b/cmake/FindIconv.cmake
index ce40ab2..fd5a3af 100644
--- a/cmake/FindIconv.cmake
+++ b/cmake/FindIconv.cmake
@@ -1,3 +1,22 @@
+# This file is part of Strigi Desktop Search
+#
+# Copyright (C) 2006 Jos van den Oever <jos@vandenoever.info>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
# - Try to find Iconv
# Once done this will define
#
diff --git a/include/strigi/archivereader.h b/include/strigi/archivereader.h
index 823a432..ffe3f22 100644
--- a/include/strigi/archivereader.h
+++ b/include/strigi/archivereader.h
@@ -38,7 +38,7 @@ public:
* @brief Opens a stream for the given url.
*
* What is meant by @p url will depend on context. In the context of an
- * archive with a file system-like directory stucture, it will be the path
+ * archive with a file system-like directory structure, it will be the path
* to the file relative the root of the archive (eg: /foo/bar).
*
* @param url unique name of or path to an item
@@ -49,7 +49,7 @@ public:
* @brief Gets information about a given url
*
* What is meant by @p url will depend on context. In the context of an
- * archive with a file system-like directory stucture, it will be the path
+ * archive with a file system-like directory structure, it will be the path
* to the file relative the root of the archive (eg: /foo/bar).
*
* @param url unique name of or path to an item
@@ -89,7 +89,7 @@ public:
* @param e a vector containing information about each
* item in the directory
*/
- DirLister(Private* p);
+ explicit DirLister(Private* p);
/**
* @brief Copy constructor
*/
diff --git a/include/strigi/bz2inputstream.h b/include/strigi/bz2inputstream.h
index aa40e88..09e566a 100644
--- a/include/strigi/bz2inputstream.h
+++ b/include/strigi/bz2inputstream.h
@@ -30,7 +30,7 @@ private:
Private* const p;
int32_t fillBuffer(char* start, int32_t space);
public:
- BZ2InputStream(InputStream* input);
+ explicit BZ2InputStream(InputStream* input);
~BZ2InputStream();
static bool checkHeader(const char* data, int32_t datasize);
};
diff --git a/include/strigi/dataeventinputstream.h b/include/strigi/dataeventinputstream.h
index 05368e2..c8205c4 100644
--- a/include/strigi/dataeventinputstream.h
+++ b/include/strigi/dataeventinputstream.h
@@ -48,7 +48,7 @@ public:
* When handleEnd is called, it is guaranteed that each
* element in the input stream has been passed in exactly
* one call to this function, and that the calls happened
- * in the same order as the the data occurred in the
+ * in the same order as the data occurred in the
* InputStream.
*
* You should not call this function yourself. It forms
diff --git a/include/strigi/kmpsearcher.h b/include/strigi/kmpsearcher.h
index e3ec19d..28d049b 100644
--- a/include/strigi/kmpsearcher.h
+++ b/include/strigi/kmpsearcher.h
@@ -39,7 +39,7 @@ private:
int32_t maxlen;
public:
KmpSearcher() :table(0) { }
- KmpSearcher(const std::string& query);
+ explicit KmpSearcher(const std::string& query);
~KmpSearcher() {
if (table) {
free(table);
diff --git a/include/strigi/lzmainputstream.h b/include/strigi/lzmainputstream.h
index fa7cf87..530edc3 100644
--- a/include/strigi/lzmainputstream.h
+++ b/include/strigi/lzmainputstream.h
@@ -30,7 +30,7 @@ private:
Private* const p;
int32_t fillBuffer(char* start, int32_t space);
public:
- LZMAInputStream(InputStream* input);
+ explicit LZMAInputStream(InputStream* input);
~LZMAInputStream();
static bool checkHeader(const char* data, int32_t datasize);
};
diff --git a/include/strigi/stringterminatedsubstream.h b/include/strigi/stringterminatedsubstream.h
index 9f96bcc..fabb40d 100644
--- a/include/strigi/stringterminatedsubstream.h
+++ b/include/strigi/stringterminatedsubstream.h
@@ -30,7 +30,7 @@ namespace Strigi {
*
* This class stops reading data when either the end of the
* underlying stream is reacher, or a given terminator is encountered
- * in the the stream.
+ * in the stream.
*/
class STREAMS_EXPORT StringTerminatedSubStream : public InputStream {
private:
diff --git a/include/strigi/substreamprovider.h b/include/strigi/substreamprovider.h
index 21ce324..3036d32 100644
--- a/include/strigi/substreamprovider.h
+++ b/include/strigi/substreamprovider.h
@@ -88,7 +88,7 @@ public:
*
* @param input the inputstream that will be split into substreams
*/
- SubStreamProvider(InputStream *input)
+ explicit SubStreamProvider(InputStream *input)
: m_status(Ok)
, m_input(input)
, m_entrystream(0)
diff --git a/lib/libstreams.pc.cmake b/lib/libstreams.pc.cmake
index 8259b46..ce1205d 100644
--- a/lib/libstreams.pc.cmake
+++ b/lib/libstreams.pc.cmake
@@ -1,3 +1,22 @@
+# This file is part of Strigi Desktop Search
+#
+# Copyright (C) 2007 Jos van den Oever <jos@vandenoever.info>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
prefix=${CMAKE_INSTALL_PREFIX}
exec_prefix=${CMAKE_INSTALL_PREFIX}/bin
libdir=${LIB_DESTINATION}
diff --git a/lib/signatureinputstream.h b/lib/signatureinputstream.h
index 7302c75..63a2f0d 100644
--- a/lib/signatureinputstream.h
+++ b/lib/signatureinputstream.h
@@ -30,7 +30,7 @@ namespace Strigi {
*
* This class stops reading data when either the end of the
* underlying stream is reacher, or a given terminator is encountered
- * in the the stream.
+ * in the stream.
*/
class SignatureInputStream : public InputStream {
private:
diff --git a/lib/strigiconfig.cpp b/lib/strigiconfig.cpp
index 6607ebd..9d9d8f9 100644
--- a/lib/strigiconfig.cpp
+++ b/lib/strigiconfig.cpp
@@ -32,4 +32,4 @@ namespace Strigi {
const char* versionString() {
return STRIGI_VERSION_STRING;
}
-}
\ No newline at end of file
+}
diff --git a/lib/stringreader.h b/lib/stringreader.h
index 4d60b67..1a57c5c 100644
--- a/lib/stringreader.h
+++ b/lib/stringreader.h
@@ -20,11 +20,9 @@
#ifndef STRINGREADER_H
#define STRINGREADER_H
-#ifdef __GNUC__
#error stringreader.h is deprecated. Include stringstream.h instead.
#error StringReader has been renamed to StringStream
#error Use StringInputStream for StringStream<char>
#error Use StringReader for StringStream<wchar_t>
-#endif
#endif
diff --git a/tests/api/ArchiveReaderTest.cpp b/tests/api/ArchiveReaderTest.cpp
index ffb7cd7..6d38050 100644
--- a/tests/api/ArchiveReaderTest.cpp
+++ b/tests/api/ArchiveReaderTest.cpp
@@ -50,7 +50,7 @@ test2(const char* path) {
EntryInfo e;
while (dl.nextEntry(e)) {
string filepath(path);
- filepath += "/";
+ filepath += '/';
filepath += e.filename;
if (e.type == EntryInfo::File) {
test1(filepath.c_str());
@@ -83,7 +83,7 @@ walkdirectories(const char* path, void (*callback)(const char*)) {
if (S_ISREG(dirstat.st_mode)) {
callback(filepath.c_str());
} else if (S_ISDIR(dirstat.st_mode)) {
- filepath += "/";
+ filepath += '/';
walkdirectories(filepath.c_str(), callback);
}
}
diff --git a/tests/sharedtestcode/unknownsizestream.h b/tests/sharedtestcode/unknownsizestream.h
index bde063e..73d3d49 100644
--- a/tests/sharedtestcode/unknownsizestream.h
+++ b/tests/sharedtestcode/unknownsizestream.h
@@ -17,8 +17,8 @@
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
-#ifndef STRIGI_UNKNOWNSIZEINPUTSTREAM
-#define STRIGI_UNKNOWNSIZEINPUTSTREAM
+#ifndef STRIGI_UNKNOWNSIZEINPUTSTREAM_H
+#define STRIGI_UNKNOWNSIZEINPUTSTREAM_H
#include <strigi/strigiconfig.h>
#include <strigi/streambase.h>
--
1.8.4.2