diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-09-11 13:30:49 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-09-11 13:30:49 +0000 |
commit | cae6c066b736c1b582991e5496a54c9a85b5832d (patch) | |
tree | a47bad45a37b9cf820376fe6177b3043a0f68745 /src | |
parent | b67f104498393f60f701a6bef219d0f34ece6f51 (diff) |
XPath: Minor lang() fix (use ASCII lowercase because language names are ASCII-only anyway)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@716 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src')
-rw-r--r-- | src/pugixml.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index a8ed526..0e9b99c 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -21,7 +21,6 @@ #include <wchar.h> #ifndef PUGIXML_NO_XPATH -# include <ctype.h> # include <math.h> # include <float.h> #endif @@ -4903,6 +4902,12 @@ namespace #endif } + // Converts symbol to lower case, if it is an ASCII one + char_t tolower_ascii(char_t ch) + { + return static_cast<unsigned int>(ch - 'A') < 26 ? (ch | ' ') : ch; + } + xpath_string string_value(const xpath_node& na) { if (na.attribute()) @@ -7127,7 +7132,7 @@ namespace pugi // strnicmp / strncasecmp is not portable for (const char_t* lit = lang.c_str(); *lit; ++lit) { - if (tolower(*lit) != tolower(*value)) return false; + if (tolower_ascii(*lit) != tolower_ascii(*value)) return false; ++value; } |