X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FINetAddressing.cc;h=d96bd9302bf02d9c94a43aa4a97a6cfefb1e7d14;hb=245bdb920e5f8fc1150794db8d0b42a15fa2cd15;hp=3081cc59e34256f22c4206a98e991321409f9f39;hpb=032707d24b1059febe83ce56b11fd79df106c6e2;p=senf.git diff --git a/Socket/INetAddressing.cc b/Socket/INetAddressing.cc index 3081cc5..d96bd93 100644 --- a/Socket/INetAddressing.cc +++ b/Socket/INetAddressing.cc @@ -20,7 +20,9 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// Definition of non-inline non-template functions +/** \file + \brief INet[46]Address and INet[46]AddressingPolicy non-inline non-template implementation + */ #include "INetAddressing.hh" //#include "INetAddressing.ih" @@ -61,17 +63,18 @@ prefix_ void senf::INet4Address::clear() prefix_ void senf::INet4Address::assignString(std::string address) { clear(); - /** \todo gethostbyname support */ unsigned i = address.find(':'); if (i == std::string::npos) throw InvalidINetAddressException(); + // The temporary string in the next expr is guaranteed to live + // until end-of-statement if (::inet_aton(std::string(address,0,i).c_str(), &addr_.sin_addr) == 0) throw InvalidINetAddressException(); try { // Replace lexical_cast with strtoul ? addr_.sin_port = htons(boost::lexical_cast< ::u_int16_t >(std::string(address,i+1))); } - catch (boost::bad_lexical_cast const & ex) { + catch (boost::bad_lexical_cast const &) { throw InvalidINetAddressException(); } }