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