diff --git a/src/net/tls/gnutls/TLSSocket_GnuTLS.cpp b/src/net/tls/gnutls/TLSSocket_GnuTLS.cpp index 4c789381..0a24b720 100644 --- a/src/net/tls/gnutls/TLSSocket_GnuTLS.cpp +++ b/src/net/tls/gnutls/TLSSocket_GnuTLS.cpp @@ -206,7 +206,7 @@ TLSSocket::size_type TLSSocket_GnuTLS::sendRawNonBlocking(const char* buffer, co return 0; } - TLSSession_GnuTLS::throwTLSException("gnutls_record_send", ret); + TLSSession_GnuTLS::throwTLSException("gnutls_record_send", static_cast (ret)); } return static_cast (ret); diff --git a/src/parsingContext.cpp b/src/parsingContext.cpp index b440ef1e..527f4705 100644 --- a/src/parsingContext.cpp +++ b/src/parsingContext.cpp @@ -34,7 +34,7 @@ parsingContext::parsingContext() parsingContext::parsingContext(const parsingContext& ctx) - : context() + : context(ctx) { } diff --git a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHandler.cpp index f06c865f..73005d7e 100644 --- a/src/platforms/posix/posixHandler.cpp +++ b/src/platforms/posix/posixHandler.cpp @@ -123,9 +123,9 @@ posixHandler::~posixHandler() } -unsigned int posixHandler::getUnixTime() const +unsigned long posixHandler::getUnixTime() const { - return ::time(NULL); + return static_cast (::time(NULL)); } @@ -156,7 +156,7 @@ const vmime::datetime posixHandler::getCurrentLocalTime() const gmt.tm_isdst = -1; // Calculate the difference (in seconds) - const int diff = ::mktime(&local) - ::mktime(&gmt); + const long diff = ::mktime(&local) - ::mktime(&gmt); // Return the date return vmime::datetime(local.tm_year + 1900, local.tm_mon + 1, local.tm_mday, diff --git a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp index 99b52cdf..f306710f 100644 --- a/src/platforms/windows/windowsHandler.cpp +++ b/src/platforms/windows/windowsHandler.cpp @@ -71,9 +71,9 @@ windowsHandler::~windowsHandler() } -unsigned int windowsHandler::getUnixTime() const +unsigned long windowsHandler::getUnixTime() const { - return static_cast (::time(NULL)); + return static_cast (::time(NULL)); } diff --git a/src/security/cert/gnutls/X509Certificate_GnuTLS.cpp b/src/security/cert/gnutls/X509Certificate_GnuTLS.cpp index fd1343dd..96137844 100644 --- a/src/security/cert/gnutls/X509Certificate_GnuTLS.cpp +++ b/src/security/cert/gnutls/X509Certificate_GnuTLS.cpp @@ -96,7 +96,7 @@ ref X509Certificate::import(utility::inputStream& is) while (!is.eof()) { - const int len = is.read(chunk, sizeof(chunk)); + const utility::stream::size_type len = is.read(chunk, sizeof(chunk)); bytes.insert(bytes.end(), chunk, chunk + len); } @@ -106,11 +106,11 @@ ref X509Certificate::import(utility::inputStream& is) // static ref X509Certificate::import - (const byte_t* data, const unsigned int length) + (const byte_t* data, const size_t length) { gnutls_datum buffer; buffer.data = const_cast (data); - buffer.size = length; + buffer.size = static_cast (length); // Try DER format ref derCert = vmime::create (); diff --git a/src/security/cert/openssl/X509Certificate_OpenSSL.cpp b/src/security/cert/openssl/X509Certificate_OpenSSL.cpp index ff2062c1..61be0d6d 100755 --- a/src/security/cert/openssl/X509Certificate_OpenSSL.cpp +++ b/src/security/cert/openssl/X509Certificate_OpenSSL.cpp @@ -185,7 +185,7 @@ ref X509Certificate::import(utility::inputStream& is) // static ref X509Certificate::import - (const byte_t* data, const unsigned int length) + (const byte_t* data, const size_t length) { ref cert = vmime::create (); diff --git a/src/utility/random.cpp b/src/utility/random.cpp index 5dda639d..6e96ed4e 100644 --- a/src/utility/random.cpp +++ b/src/utility/random.cpp @@ -46,7 +46,7 @@ unsigned int random::getNext() unsigned int random::getTime() { - return (platform::getHandler()->getUnixTime()); + return static_cast ((platform::getHandler()->getUnixTime())); } diff --git a/tests/parser/charsetFilteredOutputStreamTest.cpp b/tests/parser/charsetFilteredOutputStreamTest.cpp index fdfed2c6..08eeb63c 100644 --- a/tests/parser/charsetFilteredOutputStreamTest.cpp +++ b/tests/parser/charsetFilteredOutputStreamTest.cpp @@ -101,10 +101,10 @@ VMIME_TEST_SUITE_BEGIN(charsetFilteredOutputStreamTest) std::ostringstream testName; testName << i << ": " << entry.fromCharset << " -> " << entry.toCharset; - const unsigned int inLength = (entry.fromLength == 0 ? strlen(entry.fromBytes) : entry.fromLength); + const unsigned long inLength = (entry.fromLength == 0 ? strlen(entry.fromBytes) : entry.fromLength); vmime::string in(entry.fromBytes, entry.fromBytes + inLength); - const unsigned int outLength = (entry.toLength == 0 ? strlen(entry.toBytes) : entry.toLength); + const unsigned long outLength = (entry.toLength == 0 ? strlen(entry.toBytes) : entry.toLength); vmime::string expectedOut(entry.toBytes, entry.toBytes + outLength); vmime::string actualOut; @@ -136,10 +136,10 @@ VMIME_TEST_SUITE_BEGIN(charsetFilteredOutputStreamTest) std::ostringstream testName; testName << i << ": " << entry.fromCharset << " -> " << entry.toCharset; - const unsigned int inLength = (entry.fromLength == 0 ? strlen(entry.fromBytes) : entry.fromLength); + const unsigned long inLength = (entry.fromLength == 0 ? strlen(entry.fromBytes) : entry.fromLength); vmime::string in(entry.fromBytes, entry.fromBytes + inLength); - const unsigned int outLength = (entry.toLength == 0 ? strlen(entry.toBytes) : entry.toLength); + const unsigned long outLength = (entry.toLength == 0 ? strlen(entry.toBytes) : entry.toLength); vmime::string expectedOut(entry.toBytes, entry.toBytes + outLength); vmime::string actualOut; @@ -174,10 +174,10 @@ VMIME_TEST_SUITE_BEGIN(charsetFilteredOutputStreamTest) std::ostringstream testName; testName << i << ": " << entry.fromCharset << " -> " << entry.toCharset; - const unsigned int inLength = (entry.fromLength == 0 ? strlen(entry.fromBytes) : entry.fromLength); + const unsigned long inLength = (entry.fromLength == 0 ? strlen(entry.fromBytes) : entry.fromLength); vmime::string in(entry.fromBytes, entry.fromBytes + inLength); - const unsigned int outLength = (entry.toLength == 0 ? strlen(entry.toBytes) : entry.toLength); + const unsigned long outLength = (entry.toLength == 0 ? strlen(entry.toBytes) : entry.toLength); vmime::string expectedOut(entry.toBytes, entry.toBytes + outLength); vmime::string actualOut; diff --git a/tests/parser/charsetTest.cpp b/tests/parser/charsetTest.cpp index 8725c530..2aab7550 100644 --- a/tests/parser/charsetTest.cpp +++ b/tests/parser/charsetTest.cpp @@ -51,10 +51,10 @@ VMIME_TEST_SUITE_BEGIN(charsetTest) std::ostringstream testName; testName << i << ": " << entry.fromCharset << " -> " << entry.toCharset; - const unsigned int inLength = (entry.fromLength == 0 ? strlen(entry.fromBytes) : entry.fromLength); + const unsigned long inLength = (entry.fromLength == 0 ? strlen(entry.fromBytes) : entry.fromLength); vmime::string in(entry.fromBytes, entry.fromBytes + inLength); - const unsigned int outLength = (entry.toLength == 0 ? strlen(entry.toBytes) : entry.toLength); + const unsigned long outLength = (entry.toLength == 0 ? strlen(entry.toBytes) : entry.toLength); vmime::string expectedOut(entry.toBytes, entry.toBytes + outLength); vmime::string actualOut; @@ -75,10 +75,10 @@ VMIME_TEST_SUITE_BEGIN(charsetTest) std::ostringstream testName; testName << i << ": " << entry.fromCharset << " -> " << entry.toCharset; - const unsigned int inLength = (entry.fromLength == 0 ? strlen(entry.fromBytes) : entry.fromLength); + const unsigned long inLength = (entry.fromLength == 0 ? strlen(entry.fromBytes) : entry.fromLength); vmime::string in(entry.fromBytes, entry.fromBytes + inLength); - const unsigned int outLength = (entry.toLength == 0 ? strlen(entry.toBytes) : entry.toLength); + const unsigned long outLength = (entry.toLength == 0 ? strlen(entry.toBytes) : entry.toLength); vmime::string expectedOut(entry.toBytes, entry.toBytes + outLength); vmime::string actualOut; diff --git a/tests/testUtils.cpp b/tests/testUtils.cpp index d008ed94..cb6df133 100644 --- a/tests/testUtils.cpp +++ b/tests/testUtils.cpp @@ -276,15 +276,15 @@ const vmime::string toHex(const vmime::string str) vmime::string res = "\n"; - for (unsigned int i = 0 ; i < str.length() ; i += 16) + for (size_t i = 0 ; i < str.length() ; i += 16) { - unsigned int r = std::min + size_t r = std::min (static_cast (16), str.length() - i); vmime::string hex; vmime::string chr; - for (unsigned int j = 0 ; j < r ; ++j) + for (size_t j = 0 ; j < r ; ++j) { const unsigned char c = str[i + j]; @@ -298,7 +298,7 @@ const vmime::string toHex(const vmime::string str) chr += '.'; } - for (unsigned int j = r ; j < 16 ; ++j) + for (size_t j = r ; j < 16 ; ++j) hex += " "; res += hex + " " + chr + "\n"; diff --git a/vmime/net/imap/IMAPParser.hpp b/vmime/net/imap/IMAPParser.hpp index 2e6f7cc8..c8300122 100644 --- a/vmime/net/imap/IMAPParser.hpp +++ b/vmime/net/imap/IMAPParser.hpp @@ -5056,7 +5056,6 @@ private: string m_buffer; - int m_pos; string m_lastLine; diff --git a/vmime/platform.hpp b/vmime/platform.hpp index cb86dfd8..1d6c059e 100644 --- a/vmime/platform.hpp +++ b/vmime/platform.hpp @@ -69,7 +69,7 @@ public: * * @return UNIX Epoch time */ - virtual unsigned int getUnixTime() const = 0; + virtual unsigned long getUnixTime() const = 0; /** Return the current date and time, in the local time zone. * diff --git a/vmime/platforms/posix/posixHandler.hpp b/vmime/platforms/posix/posixHandler.hpp index 4bf3a220..e7bdea4a 100644 --- a/vmime/platforms/posix/posixHandler.hpp +++ b/vmime/platforms/posix/posixHandler.hpp @@ -55,7 +55,7 @@ public: posixHandler(); ~posixHandler(); - unsigned int getUnixTime() const; + unsigned long getUnixTime() const; const vmime::datetime getCurrentLocalTime() const; diff --git a/vmime/platforms/windows/windowsHandler.hpp b/vmime/platforms/windows/windowsHandler.hpp index 5e95d65b..2ca8b7dc 100644 --- a/vmime/platforms/windows/windowsHandler.hpp +++ b/vmime/platforms/windows/windowsHandler.hpp @@ -54,7 +54,7 @@ public: windowsHandler(); ~windowsHandler(); - unsigned int getUnixTime() const; + unsigned long getUnixTime() const; const vmime::datetime getCurrentLocalTime() const; diff --git a/vmime/security/cert/X509Certificate.hpp b/vmime/security/cert/X509Certificate.hpp index 7e45dafb..4b9145f2 100644 --- a/vmime/security/cert/X509Certificate.hpp +++ b/vmime/security/cert/X509Certificate.hpp @@ -36,6 +36,7 @@ #include "vmime/utility/stream.hpp" #include "vmime/base.hpp" +#include "vmime/types.hpp" #include "vmime/dateTime.hpp" @@ -82,7 +83,7 @@ public: * @return a X.509 certificate, or NULL if the given data does not * represent a valid certificate */ - static ref import(const byte_t* data, const unsigned int length); + static ref import(const byte_t* data, const size_t length); /** Exports this X.509 certificate to the specified format. * diff --git a/vmime/utility/smartPtr.hpp b/vmime/utility/smartPtr.hpp index acfdaa88..c7e7c33e 100644 --- a/vmime/utility/smartPtr.hpp +++ b/vmime/utility/smartPtr.hpp @@ -128,7 +128,11 @@ class null_ref { private: + +#pragma GCC diagnostic ignored "-Wunused-private-field" int foo; +#pragma GCC diagnostic warning "-Wunused-private-field" + };