Hi Fred,

good catch ! Glad this one was spotted, it could impact many apps.

Fred Kiefer wrote:
The scanner in NSRangeFromString uses the method scanInt:, this is wrong
for 64bit systems. You could try to use scanInteger: instead and report
back. Just leave the method caching out while trying this if you have
problems with it.

you are right: the computer where it works is a 32bit system, the one where it fails is a 64bit one.

Do you intended a "quick patch" like the one below?

It appears to fix my issue.
Index: Source/NSRange.m
===================================================================
--- Source/NSRange.m    (revision 39168)
+++ Source/NSRange.m    (working copy)
@@ -73,11 +73,13 @@
   if ((*scanStringImp)(scanner, scanStringSel, @"{", NULL)
     && (*scanStringImp)(scanner, scanStringSel, @"location", NULL)
     && (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
-    && (*scanIntImp)(scanner, scanIntSel, (int*)&range.location)
+      && [scanner scanInteger: (NSInteger *)&range.location]
+      //    && (*scanIntImp)(scanner, scanIntSel, (int*)&range.location)
     && (*scanStringImp)(scanner, scanStringSel, @",", NULL)
     && (*scanStringImp)(scanner, scanStringSel, @"length", NULL)
     && (*scanStringImp)(scanner, scanStringSel, @"=", NULL)
-    && (*scanIntImp)(scanner, scanIntSel, (int*)&range.length)
+      && [scanner scanInteger: (NSInteger *)&range.length]
+      //    && (*scanIntImp)(scanner, scanIntSel, (int*)&range.length)
     && (*scanStringImp)(scanner, scanStringSel, @"}", NULL))
     return range;
   else

I see if i can fix the Imp caching myself, test it also on a 32bit machine and in case commit everything.

Riccardo


_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to