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 (8 files): msg#00052

db.carob.cvs

Subject: CVS update of carob (8 files)

Date: Wednesday, February 15, 2006 @ 11:03:42
Author: gilles
Path: /cvsroot/carob/carob

Modified: include/Connection.hpp (1.56 -> 1.57) src/BigDecimal.cpp (1.15
-> 1.16) src/Connection.cpp (1.64 -> 1.65)
src/ConnectionParameters.cpp (1.16 -> 1.17)
src/ControllerConnectPolicy.cpp (1.8 -> 1.9)
src/DriverResultSet.cpp (1.36 -> 1.37) src/DriverSocket.cpp
(1.15 -> 1.16) src/ParameterStatement.cpp (1.21 -> 1.22)

Replaced C-style casts by static_casts (fixes CAROB-57)


---------------------------------+
include/Connection.hpp | 5 +++--
src/BigDecimal.cpp | 12 ++++++------
src/Connection.cpp | 8 +++++---
src/ConnectionParameters.cpp | 3 ++-
src/ControllerConnectPolicy.cpp | 6 +++---
src/DriverResultSet.cpp | 14 +++++++-------
src/DriverSocket.cpp | 4 ++--
src/ParameterStatement.cpp | 2 +-
8 files changed, 29 insertions(+), 25 deletions(-)


Index: carob/include/Connection.hpp
diff -u carob/include/Connection.hpp:1.56 carob/include/Connection.hpp:1.57
--- carob/include/Connection.hpp:1.56 Mon Feb 13 15:42:09 2006
+++ carob/include/Connection.hpp Wed Feb 15 11:03:42 2006
@@ -31,7 +31,8 @@
#include <list>

namespace {
-const int32_t ProtocolVersion = ((int32_t) 0/* major */ << 16) + 38/* minor */;
+const int32_t ProtocolVersion = (static_cast<int32_t>(0) /* major */ << 16)
+ + 38 /* minor */;
}

namespace CarobNS {
@@ -113,7 +114,7 @@
*/
class Connection
{
-// For now, DriverResultSet must access getDriverSocketPtr() function
+// For now, DriverResultSet must access getDriverSocket() function
// TODO: change this to remove the friendship
friend class DriverResultSet;

Index: carob/src/BigDecimal.cpp
diff -u carob/src/BigDecimal.cpp:1.15 carob/src/BigDecimal.cpp:1.16
--- carob/src/BigDecimal.cpp:1.15 Wed Jan 25 23:05:25 2006
+++ carob/src/BigDecimal.cpp Wed Feb 15 11:03:42 2006
@@ -73,7 +73,7 @@
input>>wordRead;
for (idx=0; idx<padding; idx++)
{
- this->byteArray[idx] =
(java_byte)((wordRead>>(8*(padding-idx-1)))&0xFF);
+ this->byteArray[idx] =
static_cast<java_byte>((wordRead>>(8*(padding-idx-1)))&0xFF);
}
}
//1.3 Read the byte array from integers
@@ -81,10 +81,10 @@
for (; idx<this->byteArrayLength; idx+=4)
{
input>>wordRead;
- this->byteArray[idx] = (java_byte)((wordRead>>24)&0xFF);
- this->byteArray[idx+1] = (java_byte)((wordRead>>16)&0xFF);
- this->byteArray[idx+2] = (java_byte)((wordRead>> 8)&0xFF);
- this->byteArray[idx+3] = (java_byte) (wordRead &0xFF);
+ this->byteArray[idx] = static_cast<java_byte>((wordRead>>24)&0xFF);
+ this->byteArray[idx+1] = static_cast<java_byte>((wordRead>>16)&0xFF);
+ this->byteArray[idx+2] = static_cast<java_byte>((wordRead>> 8)&0xFF);
+ this->byteArray[idx+3] = static_cast<java_byte> (wordRead &0xFF);
}
}

@@ -160,7 +160,7 @@
for (int i = intArrayLength-1; i >= 0; i--)
{
result[i] = byteArray[b--] & 0xff;
- unsigned int numBytesToTransfer = std::min(3, (int)(b-keep+1));
+ unsigned int numBytesToTransfer = std::min(3, static_cast<int>(b-keep+1));
if (numBytesToTransfer < 0)
numBytesToTransfer = 0;
for (unsigned int j=8; j <= 8*numBytesToTransfer; j += 8)
Index: carob/src/Connection.cpp
diff -u carob/src/Connection.cpp:1.64 carob/src/Connection.cpp:1.65
--- carob/src/Connection.cpp:1.64 Tue Feb 14 18:35:47 2006
+++ carob/src/Connection.cpp Wed Feb 15 11:03:42 2006
@@ -120,7 +120,7 @@
L"Protocol corruption while trying to send command: "
+ toWString(command) + L". Check the previous command");
socket<<CommandPrefix;
- socket<<(int32_t)command;
+ socket<<static_cast<int32_t>(command);
}

bool Connection::initConnection()
@@ -610,7 +610,8 @@
request.sendToStream(*driverSocketPtr);

if (isDebugEnabled())
- logDebug(fctName, L"Executing read request " + (wstring)request);
+ logDebug(fctName, L"Executing read request "
+ + static_cast<wstring>(request));

TypeTag tag(*driverSocketPtr);
switch(tag)
@@ -682,7 +683,8 @@
sendCommand(*driverSocketPtr, StatementExecute);
request.sendToStream(*driverSocketPtr);
if (isDebugEnabled())
- logDebug(fctName, L"Executing Statement.execute(" + (wstring)request +
L")");
+ logDebug(fctName, L"Executing Statement.execute("
+ + static_cast<wstring>(request) + L")");
request.setId(receiveLongOrException());
FO_CATCH_NTIMES
try
Index: carob/src/ConnectionParameters.cpp
diff -u carob/src/ConnectionParameters.cpp:1.16
carob/src/ConnectionParameters.cpp:1.17
--- carob/src/ConnectionParameters.cpp:1.16 Wed Feb 1 15:58:58 2006
+++ carob/src/ConnectionParameters.cpp Wed Feb 15 11:03:42 2006
@@ -103,7 +103,8 @@
wchar_t pbChar;
if (!isValidHostName(hostNamePrm, pbChar))
{
- wstring msg = L"Invalid hostname "+hostNamePrm+L" at character
'"+(wchar_t)pbChar+L"'.";
+ wstring msg = L"Invalid hostname " + hostNamePrm + L" at character '"
+ + static_cast<wchar_t>(pbChar) + L"'.";
throw ConnectionException(msg);
}
return hostNamePrm;
Index: carob/src/ControllerConnectPolicy.cpp
diff -u carob/src/ControllerConnectPolicy.cpp:1.8
carob/src/ControllerConnectPolicy.cpp:1.9
--- carob/src/ControllerConnectPolicy.cpp:1.8 Tue Feb 14 18:35:47 2006
+++ carob/src/ControllerConnectPolicy.cpp Wed Feb 15 11:03:42 2006
@@ -212,7 +212,7 @@
suspected_controllers.erase(iter);
if (isDebugEnabled())
{
- logDebug(fctName, L"Controller " + (wstring)controllerInfo
+ logDebug(fctName, L"Controller " + static_cast<wstring>(controllerInfo)
+ L" has been removed from suspect list (list size="
+ toWString(suspected_controllers.size())+L")");
}
@@ -221,7 +221,7 @@
}
if (isWarnEnabled())
{
- logWarn(fctName, L"Controller " + (wstring)controllerInfo
+ logWarn(fctName, L"Controller " + static_cast<wstring>(controllerInfo)
+ L" is not (anymore?) in the suspect list");
}
}
@@ -270,7 +270,7 @@
}
if (isDebugEnabled())
logDebug(fctName, L"Selected controller[" + toWString(index) + L"]:"
- + (wstring)controller_list[index]);
+ + static_cast<wstring>(controller_list[index]));
return controller_list[index];
}

Index: carob/src/DriverResultSet.cpp
diff -u carob/src/DriverResultSet.cpp:1.36 carob/src/DriverResultSet.cpp:1.37
--- carob/src/DriverResultSet.cpp:1.36 Wed Feb 1 13:39:24 2006
+++ carob/src/DriverResultSet.cpp Wed Feb 15 11:03:42 2006
@@ -354,19 +354,19 @@
ret = ((data[currentRow])[columnIndex - 1]).as_int;
break;
case TT_LONG:
- ret = (int)(((data[currentRow])[columnIndex - 1]).as_long);
+ ret = static_cast<int>(((data[currentRow])[columnIndex - 1]).as_long);
break;
case TT_FLOAT:
- ret = (int)(((data[currentRow])[columnIndex - 1]).as_float);
+ ret = static_cast<int>(((data[currentRow])[columnIndex - 1]).as_float);
break;
case TT_DOUBLE:
- ret = (int)(((data[currentRow])[columnIndex - 1]).as_double);
+ ret = static_cast<int>(((data[currentRow])[columnIndex - 1]).as_double);
break;
case TT_BYTE_ARRAY:
throw NotImplementedException(L"ByteArray to int conversion not
implemented yet.");
break;
case TT_SQL_DATE:
- ret = (int)(((data[currentRow])[columnIndex - 1]).as_long);
+ ret = static_cast<int>(((data[currentRow])[columnIndex - 1]).as_long);
break;
case TT_SQL_TIME:
ret = ((data[currentRow])[columnIndex - 1]).as_int;
@@ -457,10 +457,10 @@
ret = (((data[currentRow])[columnIndex - 1]).as_long);
break;
case TT_FLOAT:
- ret = (int64_t)(((data[currentRow])[columnIndex - 1]).as_float);
+ ret = static_cast<int64_t>(((data[currentRow])[columnIndex -
1]).as_float);
break;
case TT_DOUBLE:
- ret = (int64_t)(((data[currentRow])[columnIndex - 1]).as_double);
+ ret = static_cast<int64_t>(((data[currentRow])[columnIndex -
1]).as_double);
break;
case TT_BYTE_ARRAY:
throw NotImplementedException(L"ByteArray to int conversion not
implemented yet.");
@@ -662,7 +662,7 @@
throw DriverException(L"Column Index out of range ( "
+ toWString(columnIndex) + L" > " + toWString(nbOfColumns) + L").");

- if ((int)data[currentRow].size()<columnIndex-1)
+ if (static_cast<int>(data[currentRow].size())<columnIndex-1)
answer = true;
else
answer = nulls[currentRow][columnIndex - 1];
Index: carob/src/DriverSocket.cpp
diff -u carob/src/DriverSocket.cpp:1.15 carob/src/DriverSocket.cpp:1.16
--- carob/src/DriverSocket.cpp:1.15 Tue Feb 14 18:35:47 2006
+++ carob/src/DriverSocket.cpp Wed Feb 15 11:03:42 2006
@@ -43,7 +43,7 @@
// string, then the string itself
*this<<true;
size_t strLen = s.size();
- *this<<(int32_t)strLen;
+ *this<<static_cast<int32_t>(strLen);
size_t totalWritten = 0;
// FIXME: catch CodecException here
while (totalWritten < strLen)
@@ -77,7 +77,7 @@
size_t sizeRead = 0;
//We must read strSize character, which can be done in several passes
std::wstring chunk;
- while ((int)sizeRead<strSize)
+ while (static_cast<int>(sizeRead)<strSize)
{
// FIXME: catch CodecException here
sizeRead += readJavaUTF(chunk);
Index: carob/src/ParameterStatement.cpp
diff -u carob/src/ParameterStatement.cpp:1.21
carob/src/ParameterStatement.cpp:1.22
--- carob/src/ParameterStatement.cpp:1.21 Tue Feb 14 12:05:05 2006
+++ carob/src/ParameterStatement.cpp Wed Feb 15 11:03:42 2006
@@ -332,7 +332,7 @@
const T& value)
throw (DriverException, UnexpectedException)
{
- if (paramIndex < 1 || paramIndex > (int)inStrings.size())
+ if (paramIndex < 1 || paramIndex > static_cast<int>(inStrings.size()))
throw DriverException(L"Parameter index out of range.");

// As an optimization, we could make this stream a member.


<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