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;
*
* @returns Number of elements.
*/
-long Dictionary::GetLength(void) const
+size_t Dictionary::GetLength(void) const
{
return m_Data.size();
}
Iterator Begin(void);
Iterator End(void);
- long GetLength(void) const;
+ size_t GetLength(void) const;
void Remove(const String& key);
void Remove(Iterator it);
};
#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&>)
}
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());
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());
/* 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);
*/
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));
}
};
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()));
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);
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;
}