Fixed warnings and 64-bit issues.
This commit is contained in:
parent
9328bf07a5
commit
21945be4c4
@ -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 <int>(ret));
|
||||
}
|
||||
|
||||
return static_cast <size_type>(ret);
|
||||
|
@ -34,7 +34,7 @@ parsingContext::parsingContext()
|
||||
|
||||
|
||||
parsingContext::parsingContext(const parsingContext& ctx)
|
||||
: context()
|
||||
: context(ctx)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -123,9 +123,9 @@ posixHandler::~posixHandler()
|
||||
}
|
||||
|
||||
|
||||
unsigned int posixHandler::getUnixTime() const
|
||||
unsigned long posixHandler::getUnixTime() const
|
||||
{
|
||||
return ::time(NULL);
|
||||
return static_cast <unsigned long>(::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,
|
||||
|
@ -71,9 +71,9 @@ windowsHandler::~windowsHandler()
|
||||
}
|
||||
|
||||
|
||||
unsigned int windowsHandler::getUnixTime() const
|
||||
unsigned long windowsHandler::getUnixTime() const
|
||||
{
|
||||
return static_cast <unsigned int>(::time(NULL));
|
||||
return static_cast <unsigned long>(::time(NULL));
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,7 +96,7 @@ ref <X509Certificate> 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> X509Certificate::import(utility::inputStream& is)
|
||||
|
||||
// static
|
||||
ref <X509Certificate> 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 <byte_t*>(data);
|
||||
buffer.size = length;
|
||||
buffer.size = static_cast <unsigned int>(length);
|
||||
|
||||
// Try DER format
|
||||
ref <X509Certificate_GnuTLS> derCert = vmime::create <X509Certificate_GnuTLS>();
|
||||
|
@ -185,7 +185,7 @@ ref <X509Certificate> X509Certificate::import(utility::inputStream& is)
|
||||
|
||||
// static
|
||||
ref <X509Certificate> X509Certificate::import
|
||||
(const byte_t* data, const unsigned int length)
|
||||
(const byte_t* data, const size_t length)
|
||||
{
|
||||
ref <X509Certificate_OpenSSL> cert = vmime::create <X509Certificate_OpenSSL>();
|
||||
|
||||
|
@ -46,7 +46,7 @@ unsigned int random::getNext()
|
||||
|
||||
unsigned int random::getTime()
|
||||
{
|
||||
return (platform::getHandler()->getUnixTime());
|
||||
return static_cast <unsigned int>((platform::getHandler()->getUnixTime()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 <size_t>(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";
|
||||
|
@ -5056,7 +5056,6 @@ private:
|
||||
|
||||
|
||||
string m_buffer;
|
||||
int m_pos;
|
||||
|
||||
string m_lastLine;
|
||||
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
posixHandler();
|
||||
~posixHandler();
|
||||
|
||||
unsigned int getUnixTime() const;
|
||||
unsigned long getUnixTime() const;
|
||||
|
||||
const vmime::datetime getCurrentLocalTime() const;
|
||||
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
windowsHandler();
|
||||
~windowsHandler();
|
||||
|
||||
unsigned int getUnixTime() const;
|
||||
unsigned long getUnixTime() const;
|
||||
|
||||
const vmime::datetime getCurrentLocalTime() const;
|
||||
|
||||
|
@ -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 <X509Certificate> import(const byte_t* data, const unsigned int length);
|
||||
static ref <X509Certificate> import(const byte_t* data, const size_t length);
|
||||
|
||||
/** Exports this X.509 certificate to the specified format.
|
||||
*
|
||||
|
@ -128,7 +128,11 @@ class null_ref
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wunused-private-field"
|
||||
int foo;
|
||||
#pragma GCC diagnostic warning "-Wunused-private-field"
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user