Issue #126: more warnings fixed.

This commit is contained in:
Vincent Richard 2016-03-13 20:15:22 +01:00
parent b68ca06e46
commit 4fd8976515
8 changed files with 21 additions and 17 deletions

View File

@ -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;

View File

@ -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)
);
}

View File

@ -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];

View File

@ -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());

View File

@ -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";

View File

@ -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;

View File

@ -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;
}

View File

@ -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));