From 85eeae90e87c1c2a5216140fe6ed45c9aacbf53a Mon Sep 17 00:00:00 2001 From: CaS Date: Fri, 31 Jan 2003 17:23:15 +0000 Subject: [PATCH] Tidied git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@15820 72102866-910b-0410-8b05-ffd578937521 --- Source/Additions/GSXML.m | 19 +++++++++++++++++++ Source/GSString.m | 9 +++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Source/Additions/GSXML.m b/Source/Additions/GSXML.m index 1b17975a8..29bb0ef08 100644 --- a/Source/Additions/GSXML.m +++ b/Source/Additions/GSXML.m @@ -1982,6 +1982,25 @@ static NSString *endMarker = @"At end of incremental parse"; (void*)&newVal) < 0) [NSException raise: NSInternalInconsistencyException format: @"Unable to set substituteEntities"]; + + newVal = -1; + if (xmlGetFeature((xmlParserCtxtPtr)lib, "substitute entities", + (void*)&newVal) < 0) + [NSException raise: NSInternalInconsistencyException + format: @"Unable to get substituteEntities"]; + if (yesno == YES) + { + if (newVal != 1) + [NSException raise: NSInternalInconsistencyException + format: @"Unable to set substituteEntities to 1"]; + } + else + { + if (newVal != 0) + [NSException raise: NSInternalInconsistencyException + format: @"Unable to set substituteEntities to 0"]; + } + xmlSubstituteEntitiesDefault(newVal); // Set default too. return (oldVal == 1) ? YES : NO; } diff --git a/Source/GSString.m b/Source/GSString.m index ed1797a01..c557140ad 100644 --- a/Source/GSString.m +++ b/Source/GSString.m @@ -539,13 +539,14 @@ UTF8String_c(ivars self) { return ""; } - if (intEnc == NSISOLatin1StringEncoding || intEnc == NSASCIIStringEncoding) + if (intEnc == NSASCIIStringEncoding) { - r = (unsigned char*)_fastMallocBuffer(self->_count+1); + unsigned i = self->_count; - if (self->_count > 0) + r = (unsigned char*)_fastMallocBuffer(self->_count+1); + while (i-- > 0) { - memcpy(r, self->_contents.c, self->_count); + r[i] = self->_contents.c[i] & 0x7f; } r[self->_count] = '\0'; }