aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2016-03-13 19:15:22 +0000
committerVincent Richard <[email protected]>2016-03-13 19:15:22 +0000
commit4fd8976515a7e0a4aa34bad9611e9b67df5a186a (patch)
treee0553b5613009e20ba08be370754bb6d2a2bda99
parentIssue #126: fixed some warnings. (diff)
downloadvmime-4fd8976515a7e0a4aa34bad9611e9b67df5a186a.tar.gz
vmime-4fd8976515a7e0a4aa34bad9611e9b67df5a186a.zip
Issue #126: more warnings fixed.
-rw-r--r--src/vmime/platforms/posix/posixFile.cpp4
-rw-r--r--src/vmime/platforms/posix/posixHandler.cpp8
-rw-r--r--tests/net/maildir/maildirStoreTest.cpp2
-rw-r--r--tests/net/smtp/SMTPTransportTestUtils.hpp4
-rw-r--r--tests/parser/bodyPartTest.cpp2
-rw-r--r--tests/testRunner.cpp6
-rw-r--r--tests/testUtils.cpp6
-rw-r--r--tests/utility/seekableInputStreamRegionAdapterTest.cpp6
8 files changed, 21 insertions, 17 deletions
diff --git a/src/vmime/platforms/posix/posixFile.cpp b/src/vmime/platforms/posix/posixFile.cpp
index 9093b52e..ea699ac4 100644
--- a/src/vmime/platforms/posix/posixFile.cpp
+++ b/src/vmime/platforms/posix/posixFile.cpp
@@ -562,7 +562,7 @@ const vmime::string posixFileSystemFactory::pathToStringImpl(const vmime::utilit
{
vmime::string native = "/";
- for (int i = 0 ; i < path.getSize() ; ++i)
+ for (size_t i = 0 ; i < path.getSize() ; ++i)
{
if (i > 0)
native += "/";
@@ -582,7 +582,7 @@ bool posixFileSystemFactory::isValidPathComponent(const vmime::utility::file::pa
bool posixFileSystemFactory::isValidPath(const vmime::utility::file::path& path) const
{
- for (int i = 0 ; i < path.getSize() ; ++i)
+ for (size_t i = 0 ; i < path.getSize() ; ++i)
{
if (!isValidPathComponent(path[i]))
return false;
diff --git a/src/vmime/platforms/posix/posixHandler.cpp b/src/vmime/platforms/posix/posixHandler.cpp
index 1bbd039a..c0ba6cca 100644
--- a/src/vmime/platforms/posix/posixHandler.cpp
+++ b/src/vmime/platforms/posix/posixHandler.cpp
@@ -156,11 +156,13 @@ const vmime::datetime posixHandler::getCurrentLocalTime() const
gmt.tm_isdst = -1;
// Calculate the difference (in seconds)
- const long diff = ::mktime(&local) - ::mktime(&gmt);
+ const time_t diff = ::mktime(&local) - ::mktime(&gmt);
// Return the date
- return vmime::datetime(local.tm_year + 1900, local.tm_mon + 1, local.tm_mday,
- local.tm_hour, local.tm_min, local.tm_sec, diff / 60); // minutes needed
+ return vmime::datetime(
+ local.tm_year + 1900, local.tm_mon + 1, local.tm_mday,
+ local.tm_hour, local.tm_min, local.tm_sec, static_cast <int>(diff / 60)
+ );
}
diff --git a/tests/net/maildir/maildirStoreTest.cpp b/tests/net/maildir/maildirStoreTest.cpp
index 7e0ee39a..9911c484 100644
--- a/tests/net/maildir/maildirStoreTest.cpp
+++ b/tests/net/maildir/maildirStoreTest.cpp
@@ -488,7 +488,7 @@ private:
(const std::vector <vmime::shared_ptr <vmime::net::folder> >& folders,
const vmime::net::folder::path& path)
{
- for (unsigned int i = 0, n = folders.size() ; i < n ; ++i)
+ for (size_t i = 0, n = folders.size() ; i < n ; ++i)
{
if (folders[i]->getFullPath() == path)
return folders[i];
diff --git a/tests/net/smtp/SMTPTransportTestUtils.hpp b/tests/net/smtp/SMTPTransportTestUtils.hpp
index 108d32d1..c1224216 100644
--- a/tests/net/smtp/SMTPTransportTestUtils.hpp
+++ b/tests/net/smtp/SMTPTransportTestUtils.hpp
@@ -398,7 +398,7 @@ private:
int m_state;
int m_bdatChunkCount;
- int m_bdatChunkSize, m_bdatChunkReceived;
+ size_t m_bdatChunkSize, m_bdatChunkReceived;
bool m_ehloSent, m_mailSent, m_rcptSent, m_quitSent;
};
@@ -433,7 +433,7 @@ public:
(const vmime::generationContext& /* ctx */, vmime::utility::outputStream& outputStream,
const size_t /* curLinePos */ = 0, size_t* /* newLinePos */ = NULL) const
{
- for (unsigned int i = 0, n = getChunks().size() ; i < n ; ++i)
+ for (size_t i = 0, n = getChunks().size() ; i < n ; ++i)
{
const vmime::string& chunk = getChunks()[i];
outputStream.write(chunk.data(), chunk.size());
diff --git a/tests/parser/bodyPartTest.cpp b/tests/parser/bodyPartTest.cpp
index f6f82f75..4dc5d670 100644
--- a/tests/parser/bodyPartTest.cpp
+++ b/tests/parser/bodyPartTest.cpp
@@ -308,7 +308,7 @@ VMIME_TEST_SUITE_BEGIN(bodyPartTest)
static const std::string BODY1_LINE = "BODY1BODY1BODY1BODY1BODY1BODY1BODY1BODY1BODY1BODY1BODY1BODY1BODY1";
static const std::string BODY1_END = "END1END1";
static const unsigned int BODY1_REPEAT = 35000;
- static const unsigned int BODY1_LENGTH =
+ static const size_t BODY1_LENGTH =
BODY1_BEGIN.length() + BODY1_LINE.length() * BODY1_REPEAT + BODY1_END.length();
static const std::string BODY2_LINE = "BODY2BODY2BODY2BODY2BODY2BODY2BODY2BODY2BODY2BODY2BODY2BODY2BODY2";
diff --git a/tests/testRunner.cpp b/tests/testRunner.cpp
index 84f217a0..08a06930 100644
--- a/tests/testRunner.cpp
+++ b/tests/testRunner.cpp
@@ -269,17 +269,17 @@ int main(int argc, char* argv[])
getRegistry(getTestModules()[i]).makeTest());
}
- std::auto_ptr <XmlTestListener> xmlListener(new XmlTestListener);
+ XmlTestListener xmlListener;
CppUnit::TestResult controller;
- controller.addListener(xmlListener.get());
+ controller.addListener(&xmlListener);
CppUnit::TestResultCollector result;
controller.addListener(&result);
runner.run(controller);
- xmlListener->output(std::cout);
+ xmlListener.output(std::cout);
// Return error code 1 if a test failed
return result.wasSuccessful() ? 0 : 1;
diff --git a/tests/testUtils.cpp b/tests/testUtils.cpp
index dcdb2a03..0eb2bfd4 100644
--- a/tests/testUtils.cpp
+++ b/tests/testUtils.cpp
@@ -85,7 +85,7 @@ vmime::shared_ptr <vmime::net::timeoutHandler> testSocket::getTimeoutHandler()
}
-void testSocket::setTracer(vmime::shared_ptr <vmime::net::tracer> tracer)
+void testSocket::setTracer(vmime::shared_ptr <vmime::net::tracer> /* tracer */)
{
}
@@ -96,13 +96,13 @@ vmime::shared_ptr <vmime::net::tracer> testSocket::getTracer()
}
-bool testSocket::waitForRead(const int msecs)
+bool testSocket::waitForRead(const int /* msecs */)
{
return true;
}
-bool testSocket::waitForWrite(const int msecs)
+bool testSocket::waitForWrite(const int /* msecs */)
{
return true;
}
diff --git a/tests/utility/seekableInputStreamRegionAdapterTest.cpp b/tests/utility/seekableInputStreamRegionAdapterTest.cpp
index d62e062f..e703051b 100644
--- a/tests/utility/seekableInputStreamRegionAdapterTest.cpp
+++ b/tests/utility/seekableInputStreamRegionAdapterTest.cpp
@@ -148,11 +148,13 @@ VMIME_TEST_SUITE_BEGIN(seekableInputStreamRegionAdapterTest)
vmime::byte_t buffer1[100];
std::fill(vmime::begin(buffer1), vmime::end(buffer1), 0);
- vmime::size_t read = ustream->read(buffer1, 7);
+
+ VASSERT_EQ("Read 1", 7, ustream->read(buffer1, 7));
vmime::byte_t buffer2[100];
std::fill(vmime::begin(buffer2), vmime::end(buffer2), 0);
- vmime::size_t read2 = stream->read(buffer2, 6);
+
+ VASSERT_EQ("Read 2", 6, stream->read(buffer2, 6));
VASSERT_EQ("Buffer 1", "THIS IS",
vmime::utility::stringUtils::makeStringFromBytes(buffer1, 7));