On 28.10.2011 14:13, Richard Frith-Macdonald wrote:
On 28 Oct 2011, at 12:21, Fred Kiefer wrote:Yesterday I noticed that I have a few additional failing tests for base. Most of these come from the test for NSJSONSerialization. After a closer look I was able to restrict the issue down to the following code, which hasn't anything to do with JSON any more. In the JSON test code we had a string that contained the character " and the unicode value 1 and the serialisation tries to deal with these value by replacing them. NSMutableString *str1, *str2; unichar chars[3]; chars[0] = '\"'; chars[1] = 1; str1 = [NSMutableString stringWithCharacters: chars length: 2]; [str1 replaceOccurrencesOfString: @"\"" withString: @"\\\"" options: 0 range: NSMakeRange(0, [str1 length])]; chars[0] = '\\'; chars[1] = '\"'; chars[2] = 1; str2 = [NSMutableString stringWithCharacters: chars length: 3]; NSLog(@"string 1 %@ string 2 %@", str1, str2); PASS([str1 isEqual: str2], "string occurrences replacement works"); To me this looks like a bug in the code of replaceOccurrencesOfString:... I tried to understand that code but completely failed inside the GSeq.h functions. At least I noticed a few things, first we end of using the function strRangeCsNs, this is because the searched string is an NSConstantString and all the optimisations don't kick in for that case. The second is that this function returns twice the range {0, 1} although the second time the search range is {2, 1}. Could somebody please explain this to me? If this is an actual problem I would like to add the above code into the NSMutableString tests.Please add it to the tests ... I'll have a look at it.
Done.
I couldn't reproduce the problem on my main system, but on my 64bit test system where I'm experimenting with clang it shows up ... so it's probably a 64bit related issue.
If it only shows up on 64bit machines (I am using on) then maybe replacing all the occurrences of unsigned with NSUInteger in GSSeq.h may resolve the issue? I'll give that a try. _______________________________________________ Gnustep-dev mailing list [email protected] https://lists.gnu.org/mailman/listinfo/gnustep-dev
