Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

CVS update of carob/src (4 files): msg#00148

db.carob.cvs

Subject: CVS update of carob/src (4 files)

Date: Tuesday, January 24, 2006 @ 11:39:05
Author: gilles
Path: /cvsroot/carob/carob/src

Modified: BigDecimal.cpp (1.12 -> 1.13) DriverResultSet.cpp (1.32 -> 1.33)
JavaSocket.cpp (1.35 -> 1.36) SQLDataSerialization.cpp (1.14 ->
1.15)

Removed (hopefully) all old-C-style casts to use recommanded static_cast and
reinterpret_cast
Updated copyright


--------------------------+
BigDecimal.cpp | 4 ++--
DriverResultSet.cpp | 12 ++++++------
JavaSocket.cpp | 16 ++++++++++------
SQLDataSerialization.cpp | 6 +++---
4 files changed, 21 insertions(+), 17 deletions(-)


Index: carob/src/BigDecimal.cpp
diff -u carob/src/BigDecimal.cpp:1.12 carob/src/BigDecimal.cpp:1.13
--- carob/src/BigDecimal.cpp:1.12 Mon Dec 19 19:34:26 2005
+++ carob/src/BigDecimal.cpp Tue Jan 24 11:39:05 2006
@@ -1,6 +1,6 @@
/*
* Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
+ * Copyright (C) 2005-2006 Continuent, Inc.
* Contact: sequoia-NAAfj4rwCWAYtQj7fl1lsA@xxxxxxxxxxxxxxxx
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -98,7 +98,7 @@
input>>retVal->scale;


- res.as_other = (void*)retVal;
+ res.as_other = static_cast<void*>(retVal);
return res;
}

Index: carob/src/DriverResultSet.cpp
diff -u carob/src/DriverResultSet.cpp:1.32 carob/src/DriverResultSet.cpp:1.33
--- carob/src/DriverResultSet.cpp:1.32 Wed Jan 18 12:46:14 2006
+++ carob/src/DriverResultSet.cpp Tue Jan 24 11:39:05 2006
@@ -1,6 +1,6 @@
/*
* Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
+ * Copyright (C) 2005-2006 Continuent, Inc.
* Contact: sequoia-NAAfj4rwCWAYtQj7fl1lsA@xxxxxxxxxxxxxxxx
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -69,7 +69,7 @@
{
if (!nulls[cnt][col])
{
- delete ((wstring*)(data[cnt][col]).as_other);
+ delete (static_cast<wstring*>((data[cnt][col]).as_other));
}
}
break;
@@ -211,7 +211,7 @@
throw (DriverException(L"getString: value at row " + toWString(currentRow)
+ L" column " + toWString(columnIndex) + L" is not of type string"));
}
- return (*((wstring*)(data[currentRow][columnIndex - 1].as_other)));
+ return (*(static_cast<wstring*>((data[currentRow][columnIndex -
1].as_other))));
}

wstring DriverResultSet::getAsString(int columnIndex) throw (DriverException,
@@ -230,7 +230,7 @@
switch (columnTypeTags[columnIndex - 1])
{
case TT_STRING:
- buffer << *((wstring*)(data[currentRow][columnIndex - 1].as_other));
+ buffer << *(static_cast<wstring*>((data[currentRow][columnIndex -
1].as_other)));
break;
case TT_BIGDECIMAL:
throw NotImplementedException(L"BigDecimal to string conversion not
implemented yet.");
@@ -311,7 +311,7 @@
{
case TT_STRING:
{ //these bracket to be able to declare loc var without warns
- wstring valAsString = trim(*(wstring*)(data[currentRow][columnIndex -
1].as_other));
+ wstring valAsString =
trim(*static_cast<wstring*>((data[currentRow][columnIndex - 1].as_other)));
//Tries to parse the string as an integer
if(!wstringTo<int>(ret, valAsString))
{
@@ -411,7 +411,7 @@
{
case TT_STRING:
{ //these bracket to be able to declare loc var without warns
- wstring valAsString = trim(*(wstring*)(data[currentRow][columnIndex -
1].as_other));
+ wstring valAsString =
trim(*static_cast<wstring*>((data[currentRow][columnIndex - 1].as_other)));
//Tries to parse the string as an integer
if(!wstringTo<int64_t>(ret, valAsString))
{
Index: carob/src/JavaSocket.cpp
diff -u carob/src/JavaSocket.cpp:1.35 carob/src/JavaSocket.cpp:1.36
--- carob/src/JavaSocket.cpp:1.35 Wed Jan 18 18:02:25 2006
+++ carob/src/JavaSocket.cpp Tue Jan 24 11:39:05 2006
@@ -65,10 +65,10 @@

int opt_value = 1;
if (setsockopt(socketFd, IPPROTO_TCP, TCP_NODELAY,
- (const char*) &opt_value, sizeof opt_value) == -1
+ reinterpret_cast<char*>(&opt_value), sizeof opt_value) == -1
#if (defined(__MACH__) && defined(__APPLE__)) // quick & dirty fix for MacOSX
|| setsockopt(socketFd, SOL_SOCKET, SO_NOSIGPIPE,
- (const char*) &opt_value, sizeof (opt_value) == -1)
+ reinterpret_cast<char*>(&opt_value), sizeof (opt_value) ==
-1)
#endif
)
{
@@ -137,10 +137,10 @@
addressInfoPtr = addressInfoList;
while (addressInfoPtr != NULL)
{
- addr = *((struct sockaddr_in*)addressInfoList->ai_addr);
+ addr = *(reinterpret_cast<struct
sockaddr_in*>(addressInfoList->ai_addr));
addr.sin_port = htons(port);

- int resp = ::connect(socketFd, (sockaddr*)&addr, sizeof(addr));
+ int resp = ::connect(socketFd, reinterpret_cast<sockaddr*>(&addr),
sizeof(addr));
if (resp==0)
{
if (isInfoEnabled())
@@ -226,7 +226,7 @@
uint8_t* utfStr = new uint8_t[lenRec];
if (receiveFromSocket(fctName, L"UTF string", utfStr, lenRec, 0))
{
- const std::string received((const char*)utfStr, lenRec);
+ const std::string received(reinterpret_cast<char*>(utfStr), lenRec);

try {
s = fromUTF8(received);
@@ -313,7 +313,11 @@
int readThisTime = 0; //The size read at each receive
while (alreadyRead < len)
{
- readThisTime = recv(socketFd, (uint8_t*)(((uint8_t*)buf)+alreadyRead),
len-alreadyRead, flags);
+ readThisTime = recv(socketFd,
+ static_cast<uint8_t*>(
+ ((static_cast<uint8_t*>(buf))+alreadyRead)),
+ len-alreadyRead,
+ flags);
if (readThisTime < 0)
{
//this is an error
Index: carob/src/SQLDataSerialization.cpp
diff -u carob/src/SQLDataSerialization.cpp:1.14
carob/src/SQLDataSerialization.cpp:1.15
--- carob/src/SQLDataSerialization.cpp:1.14 Sat Jan 21 00:54:06 2006
+++ carob/src/SQLDataSerialization.cpp Tue Jan 24 11:39:05 2006
@@ -1,6 +1,6 @@
/*
* Sequoia: Database clustering technology.
- * Copyright (C) 2005 Emic Networks
+ * Copyright (C) 2005-2006 Emic Networks
* Contact: sequoia-NAAfj4rwCWAYtQj7fl1lsA@xxxxxxxxxxxxxxxx
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -50,7 +50,7 @@
wstring* strRead = new wstring;
input>>*strRead;
ResultSetDataType res;
- res.as_other = (void*)strRead;
+ res.as_other = static_cast<void*>(strRead);
return res;
}
// Big Decimal => see BigDecimal class
@@ -163,7 +163,7 @@
input>>byteRead;
byteArrayRead[i] = byteRead&0xFF;
}
- res.as_other = (void*) byteArrayRead;
+ res.as_other = static_cast<void*>(byteArrayRead);
return res;
}


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo