git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@15820 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-01-31 17:23:15 +00:00
parent bc561e02e8
commit 5069165647
2 changed files with 24 additions and 4 deletions

View file

@ -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;
}

View file

@ -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';
}