summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/TcpEndpoint.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2002-07-08 22:51:20 +0000
committerBenoit Foucher <benoit@zeroc.com>2002-07-08 22:51:20 +0000
commit475e94627c081e0f28cfe1e5b1d5227aab28de92 (patch)
treedc1607238449e2f2181478b8eb7e881dd2dd5512 /cpp/src/Ice/TcpEndpoint.cpp
parentfixes (diff)
downloadice-475e94627c081e0f28cfe1e5b1d5227aab28de92.tar.bz2
ice-475e94627c081e0f28cfe1e5b1d5227aab28de92.tar.xz
ice-475e94627c081e0f28cfe1e5b1d5227aab28de92.zip
Use istringstream >> operator instead of atoi and check for errors where
needed (to behave like in Java).
Diffstat (limited to 'cpp/src/Ice/TcpEndpoint.cpp')
-rw-r--r--cpp/src/Ice/TcpEndpoint.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/cpp/src/Ice/TcpEndpoint.cpp b/cpp/src/Ice/TcpEndpoint.cpp
index 7ffb353d33f..91d6f7405a7 100644
--- a/cpp/src/Ice/TcpEndpoint.cpp
+++ b/cpp/src/Ice/TcpEndpoint.cpp
@@ -87,21 +87,21 @@ IceInternal::TcpEndpoint::TcpEndpoint(const InstancePtr& instance, const string&
case 'p':
{
- if(argument.empty())
+ istringstream p(argument);
+ if(!(p >> const_cast<Int&>(_port)) || !p.eof())
{
throw EndpointParseException(__FILE__, __LINE__);
}
- const_cast<Int&>(_port) = atoi(argument.c_str());
break;
}
case 't':
{
- if(argument.empty())
+ istringstream t(argument);
+ if(!(t >> const_cast<Int&>(_timeout)) || !t.eof())
{
throw EndpointParseException(__FILE__, __LINE__);
}
- const_cast<Int&>(_timeout) = atoi(argument.c_str());
break;
}