Fixed some more compiler warnings.

This commit is contained in:
Gunnar Beutner 2012-08-08 08:34:15 +02:00
parent 60f5ded83a
commit 0e674a7a70
10 changed files with 15 additions and 15 deletions

View File

@ -59,15 +59,15 @@ Component::Component(const Dictionary::Ptr& properties)
CreateComponentFunction pCreateComponent;
#ifdef _WIN32
pCreateComponent = (CreateComponentFunction)GetProcAddress(hModule,
"CreateComponent");
pCreateComponent = reinterpret_cast<CreateComponentFunction>(GetProcAddress(hModule,
"CreateComponent"));
#else /* _WIN32 */
# ifdef __GNUC__
/* suppress compiler warning for void * cast */
__extension__
# endif
pCreateComponent = (CreateComponentFunction)lt_dlsym(hModule,
"CreateComponent");
pCreateComponent = reinterpret_cast<CreateComponentFunction>(lt_dlsym(hModule,
"CreateComponent"));
#endif /* _WIN32 */
IComponent::Ptr impl;

View File

@ -132,7 +132,7 @@ Dictionary::Iterator Dictionary::End(void)
*
* @returns Number of elements.
*/
long Dictionary::GetLength(void) const
size_t Dictionary::GetLength(void) const
{
return m_Data.size();
}

View File

@ -45,7 +45,7 @@ public:
Iterator Begin(void);
Iterator End(void);
long GetLength(void) const;
size_t GetLength(void) const;
void Remove(const String& key);
void Remove(Iterator it);

View File

@ -156,7 +156,7 @@ public:
};
#define REGISTER_CLASS(klass) \
static RegisterClassHelper g_Register ## klass(#klass, boost::make_shared<klass, const Dictionary::Ptr&>);
static RegisterClassHelper g_Register ## klass(#klass, boost::make_shared<klass, const Dictionary::Ptr&>)
}

View File

@ -50,7 +50,7 @@ void FIFO::ResizeBuffer(size_t newSize)
newSize = (newSize / FIFO::BlockSize + 1) * FIFO::BlockSize;
char *newBuffer = (char *)realloc(m_Buffer, newSize);
char *newBuffer = static_cast<char *>(realloc(m_Buffer, newSize));
if (newBuffer == NULL)
throw_exception(bad_alloc());

View File

@ -42,7 +42,7 @@ bool NetString::ReadStringFromIOQueue(IOQueue *queue, String *str)
if (buffer_length > 16)
buffer_length = 16;
char *buffer = (char *)malloc(buffer_length);
char *buffer = static_cast<char *>(malloc(buffer_length));
if (buffer == NULL && buffer_length > 0)
throw_exception(bad_alloc());
@ -77,7 +77,7 @@ bool NetString::ReadStringFromIOQueue(IOQueue *queue, String *str)
/* limit the number of bytes we're reading to this message */
buffer_length = i + 1 + len + 1;
char *new_buffer = (char *)realloc(buffer, buffer_length);
char *new_buffer = static_cast<char *>(realloc(buffer, buffer_length));
if (new_buffer == NULL) {
free(buffer);

View File

@ -115,7 +115,7 @@ public:
*/
bool operator()(const weak_ptr<T>& wref) const
{
return (wref.lock().get() == (const T *)m_Ref);
return (wref.lock().get() == static_cast<const T *>(m_Ref));
}
};

View File

@ -128,7 +128,7 @@ void TcpClient::HandleWritable(void)
m_SendQueue->Peek(data, count);
}
rc = send(GetFD(), (const char *)data, count, 0);
rc = send(GetFD(), data, count, 0);
if (rc <= 0)
throw_exception(SocketException("send() failed", GetError()));

View File

@ -82,11 +82,11 @@ void TcpSocket::Bind(String node, String service, int family)
SetFD(fd);
const int optFalse = 0;
setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&optFalse, sizeof(optFalse));
setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, reinterpret_cast<const char *>(&optFalse), sizeof(optFalse));
#ifndef _WIN32
const int optTrue = 1;
setsockopt(GetFD(), SOL_SOCKET, SO_REUSEADDR, (char *)&optTrue, sizeof(optTrue));
setsockopt(GetFD(), SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<const char *>(&optTrue), sizeof(optTrue));
#endif /* _WIN32 */
int rc = bind(fd, info->ai_addr, info->ai_addrlen);

View File

@ -48,7 +48,7 @@ void TlsClient::Start(void)
throw_exception(logic_error("No X509 client certificate was specified."));
if (!m_SSLIndexInitialized) {
m_SSLIndex = SSL_get_ex_new_index(0, (void *)"TlsClient", NULL, NULL, NULL);
m_SSLIndex = SSL_get_ex_new_index(0, const_cast<char *>("TlsClient"), NULL, NULL, NULL);
m_SSLIndexInitialized = true;
}