forked from premiere/premiere-libtorrent
replaced dependency on locale dependent isspace
This commit is contained in:
parent
2c68654994
commit
0b1a0c5132
|
@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define TORRENT_XML_PARSE_HPP
|
#define TORRENT_XML_PARSE_HPP
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
@ -49,6 +50,12 @@ namespace libtorrent
|
||||||
xml_parse_error
|
xml_parse_error
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline bool isspace(char c)
|
||||||
|
{
|
||||||
|
const static char* ws = " \t\n\r\f\v";
|
||||||
|
return std::strchr(ws, c);
|
||||||
|
}
|
||||||
|
|
||||||
// callback(int type, char const* name, char const* val)
|
// callback(int type, char const* name, char const* val)
|
||||||
// str2 is only used for attributes. name is element or attribute
|
// str2 is only used for attributes. name is element or attribute
|
||||||
// name and val is attribute value
|
// name and val is attribute value
|
||||||
|
@ -82,7 +89,7 @@ namespace libtorrent
|
||||||
++p;
|
++p;
|
||||||
|
|
||||||
// parse the name of the tag.
|
// parse the name of the tag.
|
||||||
for (start = p; p != end && *p != '>' && !std::isspace(*p); ++p);
|
for (start = p; p != end && *p != '>' && !isspace(*p); ++p);
|
||||||
|
|
||||||
char* tag_name_end = p;
|
char* tag_name_end = p;
|
||||||
|
|
||||||
|
@ -149,11 +156,11 @@ namespace libtorrent
|
||||||
for (char* i = tag_name_end; i < tag_end; ++i)
|
for (char* i = tag_name_end; i < tag_end; ++i)
|
||||||
{
|
{
|
||||||
// find start of attribute name
|
// find start of attribute name
|
||||||
for (; i != tag_end && std::isspace(*i); ++i);
|
for (; i != tag_end && isspace(*i); ++i);
|
||||||
if (i == tag_end) break;
|
if (i == tag_end) break;
|
||||||
start = i;
|
start = i;
|
||||||
// find end of attribute name
|
// find end of attribute name
|
||||||
for (; i != tag_end && *i != '=' && !std::isspace(*i); ++i);
|
for (; i != tag_end && *i != '=' && !isspace(*i); ++i);
|
||||||
char* name_end = i;
|
char* name_end = i;
|
||||||
|
|
||||||
// look for equality sign
|
// look for equality sign
|
||||||
|
@ -169,7 +176,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
for (; i != tag_end && std::isspace(*i); ++i);
|
for (; i != tag_end && isspace(*i); ++i);
|
||||||
// check for parse error (values must be quoted)
|
// check for parse error (values must be quoted)
|
||||||
if (i == tag_end || (*i != '\'' && *i != '\"'))
|
if (i == tag_end || (*i != '\'' && *i != '\"'))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue