aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src/std/xml.d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gcc.gnu.org>2019-04-22 13:46:25 +0000
committerIain Buclaw <ibuclaw@gcc.gnu.org>2019-04-22 13:46:25 +0000
commit105d4c85f3c0591d0f67e84df23c3518c9a313e3 (patch)
treeb6beb42c9cb6dcfabd7f57846c7d9fc4f157055e /libphobos/src/std/xml.d
parenteb5f748a81eafb8014de39e60884c1617d60eb79 (diff)
downloadgcc-105d4c85f3c0591d0f67e84df23c3518c9a313e3.zip
gcc-105d4c85f3c0591d0f67e84df23c3518c9a313e3.tar.gz
gcc-105d4c85f3c0591d0f67e84df23c3518c9a313e3.tar.bz2
libphobos: Merge upstream phobos b538f758a
Fixes endian bugs in std.uni, and corrects unit-tests that failed on version(BigEndian) targets. Initial patch by Robin Dapp. Reviewed-on: https://github.com/dlang/phobos/pull/6975 From-SVN: r270491
Diffstat (limited to 'libphobos/src/std/xml.d')
-rw-r--r--libphobos/src/std/xml.d12
1 files changed, 8 insertions, 4 deletions
diff --git a/libphobos/src/std/xml.d b/libphobos/src/std/xml.d
index 770c56f..13241f5 100644
--- a/libphobos/src/std/xml.d
+++ b/libphobos/src/std/xml.d
@@ -2201,8 +2201,10 @@ private
mixin Check!("Chars");
dchar c;
- int n = -1;
- foreach (int i,dchar d; s)
+ ptrdiff_t n = -1;
+ // 'i' must not be smaller than size_t because size_t is used internally in
+ // aApply.d and it will be cast e.g to (int *) which fails on BigEndian targets.
+ foreach (size_t i, dchar d; s)
{
if (!isChar(d))
{
@@ -2238,8 +2240,10 @@ private
mixin Check!("Name");
if (s.length == 0) fail();
- int n;
- foreach (int i,dchar c;s)
+ ptrdiff_t n;
+ // 'i' must not be smaller than size_t because size_t is used internally in
+ // aApply.d and it will be cast e.g to (int *) which fails on BigEndian targets.
+ foreach (size_t i, dchar c; s)
{
if (c == '_' || c == ':' || isLetter(c)) continue;
if (i == 0) fail();