mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
Fix for appending to C string from unicode string.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10075 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
87a8be51ad
commit
3a90e52dac
2 changed files with 16 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2001-06-05 Richard Frith-Macdonald <rfm@gnu.uk>
|
||||||
|
|
||||||
|
* Source/GSString.m: ([replaceCharactersInRange:withString:])
|
||||||
|
Fix error appending unicode string to C string.
|
||||||
|
|
||||||
2001-06-01 Richard Frith-Macdonald <rfm@gnu.uk>
|
2001-06-01 Richard Frith-Macdonald <rfm@gnu.uk>
|
||||||
|
|
||||||
* Source/NSString.m: Patch by David Relson applied
|
* Source/NSString.m: Patch by David Relson applied
|
||||||
|
|
|
@ -2582,6 +2582,7 @@ transmute(ivars self, NSString *aString)
|
||||||
- (void) replaceCharactersInRange: (NSRange)aRange
|
- (void) replaceCharactersInRange: (NSRange)aRange
|
||||||
withString: (NSString*)aString
|
withString: (NSString*)aString
|
||||||
{
|
{
|
||||||
|
ivars other = 0;
|
||||||
int offset;
|
int offset;
|
||||||
unsigned length = 0;
|
unsigned length = 0;
|
||||||
|
|
||||||
|
@ -2600,6 +2601,16 @@ transmute(ivars self, NSString *aString)
|
||||||
}
|
}
|
||||||
offset = length - aRange.length;
|
offset = length - aRange.length;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We must change into a unicode string (if necessary) *before*
|
||||||
|
* adjusting length and capacity, so that the transmute doesn't
|
||||||
|
* mess up due to any hole in the string etc.
|
||||||
|
*/
|
||||||
|
if (length > 0)
|
||||||
|
{
|
||||||
|
other = transmute((ivars)self, aString);
|
||||||
|
}
|
||||||
|
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
{
|
{
|
||||||
fillHole((ivars)self, NSMaxRange(aRange) + offset, -offset);
|
fillHole((ivars)self, NSMaxRange(aRange) + offset, -offset);
|
||||||
|
@ -2611,8 +2622,6 @@ transmute(ivars self, NSString *aString)
|
||||||
|
|
||||||
if (length > 0)
|
if (length > 0)
|
||||||
{
|
{
|
||||||
ivars other = transmute((ivars)self, aString);
|
|
||||||
|
|
||||||
if (_flags.wide == 1)
|
if (_flags.wide == 1)
|
||||||
{
|
{
|
||||||
if (other == 0)
|
if (other == 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue