made escape_string build without exception support
This commit is contained in:
parent
eb8ea0f461
commit
588d59b9f2
|
@ -63,23 +63,41 @@ namespace libtorrent
|
|||
{
|
||||
++i;
|
||||
if (i == s.end())
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
return ret;
|
||||
#else
|
||||
throw std::runtime_error("invalid escaped string");
|
||||
#endif
|
||||
|
||||
int high;
|
||||
if(*i >= '0' && *i <= '9') high = *i - '0';
|
||||
else if(*i >= 'A' && *i <= 'F') high = *i + 10 - 'A';
|
||||
else if(*i >= 'a' && *i <= 'f') high = *i + 10 - 'a';
|
||||
else throw std::runtime_error("invalid escaped string");
|
||||
else
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
return ret;
|
||||
#else
|
||||
throw std::runtime_error("invalid escaped string");
|
||||
#endif
|
||||
|
||||
++i;
|
||||
if (i == s.end())
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
return ret;
|
||||
#else
|
||||
throw std::runtime_error("invalid escaped string");
|
||||
#endif
|
||||
|
||||
int low;
|
||||
if(*i >= '0' && *i <= '9') low = *i - '0';
|
||||
else if(*i >= 'A' && *i <= 'F') low = *i + 10 - 'A';
|
||||
else if(*i >= 'a' && *i <= 'f') low = *i + 10 - 'a';
|
||||
else throw std::runtime_error("invalid escaped string");
|
||||
else
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
return ret;
|
||||
#else
|
||||
throw std::runtime_error("invalid escaped string");
|
||||
#endif
|
||||
|
||||
ret += char(high * 16 + low);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue