mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +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
|
@ -2582,6 +2582,7 @@ transmute(ivars self, NSString *aString)
|
|||
- (void) replaceCharactersInRange: (NSRange)aRange
|
||||
withString: (NSString*)aString
|
||||
{
|
||||
ivars other = 0;
|
||||
int offset;
|
||||
unsigned length = 0;
|
||||
|
||||
|
@ -2600,6 +2601,16 @@ transmute(ivars self, NSString *aString)
|
|||
}
|
||||
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)
|
||||
{
|
||||
fillHole((ivars)self, NSMaxRange(aRange) + offset, -offset);
|
||||
|
@ -2611,8 +2622,6 @@ transmute(ivars self, NSString *aString)
|
|||
|
||||
if (length > 0)
|
||||
{
|
||||
ivars other = transmute((ivars)self, aString);
|
||||
|
||||
if (_flags.wide == 1)
|
||||
{
|
||||
if (other == 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue