David Ayers schrieb:
> Richard Frith-Macdonald schrieb:
> 
> 
>>Interesting ... your idea that the problems are language related  sounds
>>a good one ... I run the testsuite quite frequently and they  all work
>>for me (in an english environment).  I'd love to know what  progress you
>>can make into sorting out why things don't work for you.
> 
> 

These Failures:

base/NSMutableString/NSMutableString_string.m:
FAIL: -getCString: maxLength: 2 range: remainingRange: failed
FAIL: -getCString: maxLength: 3 range: remainingRange: failed
FAIL: -getCString:maxLength:range:remainingRange: works

Seem to be a combination of buggy tests and potentially real issues.
The test_getCString_maxLength_range_remainingRange tests are only run in
a UTF-8 locale.

I've committed the fix for the test, yet the test is still failing because:
[referenceString getCString: buffer
                maxLength: i
                range: NSMakeRange(0, [referenceString length])
                remainingRange: &remainingRange];

Seems to be returning unichar values in the buffer instead of their
UTF-8 encoding.  I originally though that was due to some of my local
patches wrt alignment warnings in my local tree, but I've just reverted
them and I get the same failures.

Debugging this in gdb shows that the string @"AåB" is internally
represented as:
 $3 = {isa = 0x4031ff80, _contents = {u = 0x807bd48, c = 0x807bd48
"A\345B"},
  _count = 3, _flags = {wide = 0, free = 1, unused = 0, hash = 0},
  _zone = 0x4034c400, _capacity = 0}

Please note the c = 0x807bd48 "A\345B" and the wide = 0.
\345 = 0xe5 = the unichar and the NSISOLatin1StringEncoding value of å.
 I suppose this has to do with the fact that internally GNUstep encodes
the values in NSISOLatin1StringEncoding when the default encoding is
multibyte encoding.

Yet getCString:... should still return the UTF-8 string in a UTF-8
locale, so this seems like a real bug to me.

- (void) getCString: (char*)buffer
          maxLength: (unsigned int)maxLength
              range: (NSRange)aRange
     remainingRange: (NSRange*)leftoverRange
{
  GS_RANGE_CHECK(aRange, _count);
  if (_flags.wide == 1)
    {
      getCString_u((GSStr)self, buffer, maxLength, aRange, leftoverRange);
    }
  else
    {
/* Note that we have _flags.wide but default encoding != internal
encoding.  I'm not sure whether this shoulr be fixed here or in
getCString_c. */
      getCString_c((GSStr)self, buffer, maxLength, aRange, leftoverRange);
    }
}


Sorry, I don't have time to investigate further right now.

Cheers,
David

_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to