bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSScanner bug fixed


From: Tom Koelman
Subject: NSScanner bug fixed
Date: Wed, 6 Jun 2001 16:02:43 +0200

Hi,

I think I found a bug in NSScanner.m in core20010606/base/Source.

When calling scanHexInt on a string containing just "0", scanning fails. I  
suggest changing

 if (_scanLocation < myLength())
    {
      switch (myCharacter(_scanLocation))
        {
          case '+':
            _scanLocation++;
            break;
          case '-':
            negative = YES;
            _scanLocation++;
            break;
        }
    }

to

 if (_scanLocation < myLength())
    {
      switch (myCharacter(_scanLocation))
        {
          case '+':
            _scanLocation++;
            break;
          case '-':
            negative = YES;
            _scanLocation++;
            break;
        }
    }
    else
        scanLocation--;

or, more formally:

--- ../Source/NSScanner.m       Fri Nov  3 11:11:52 2000
+++ ../../../core.20010529/base/Source/NSScanner.m      Tue Jun  5 08:35:20 2001
@@ -442,6 +442,8 @@
                break;
            }
        }
+      else
+       _scanLocation--;
     }
   if ([self scanUnsignedInt_: value radix: 16 gotDigits: NO])
     return YES;


Tom



reply via email to

[Prev in Thread] Current Thread [Next in Thread]