On Wed, 27 Feb 2002 09:26:34 +0000 Richard Frith-Macdonald <[EMAIL PROTECTED]> 
wrote:

 >| 
 >| On Wednesday, February 27, 2002, at 08:46 AM, Manuel Guesdon wrote:
 >| 
 >| > Hi,
 >| >
 >| > There's a bug in KVC.
 >| > When constructing setValue:forKey: method name, the method in has 
 >| > garbage at the end (after the ':').
 >| > In NSKeyValueCoding.m, I think there should be a
 >| >       buf[size+5] = '\0';
 >| > after each
 >| >          buf[size+4] = ':';
 >| 
 >| Thanks ... fixed for the initial setup in takeValue:forKey and 
 >| takeStoredValue:forKey:
 >| I don't think there is anywhere else that needs it is there?

Thanks.
I haven't found this problem elsewhere.

 >| 
 >| > BTW, is it possible to use strncpy instead of strcpy each time it's 
 >| > possible to try to minimize buffer overflows, even if
 >| > size seems to be well known ?
 >| 
 >| Well, if size isn't well known the code will fail anyway, so there 
 >| doesn't seem much point.

I was a general comment as many people recommends its general usage.



 >| PS. Also implemented MacOS-X compatible KVC behavior in NSDictionary.m

It makes troubles for me. Please see the code I've sent and WO specifications at
http://developer.apple.com/techpubs/webobjects/Reference/Javadoc/com/webobjects/foundation/NSDictionary.html
"allValues", "allKeys", and "count" are special cases.

Could you make some  tests on MacOSX to see if your code is right or if mine is right 
(just adding an object for key
count and see what valueForKey:@"count" give you)  ?

My code is:
@implementation NSDictionary (EOKeyValueCoding)

- (id)valueForKey:(NSString *)key
{
  //OK
  id value;
  value = [self objectForKey:key];
  if (!value)
    {
      if ([key isEqualToString:@"allValues"])
        value=[self allValues];
      else if ([key isEqualToString:@"allKeys"])
        value=[self allKeys];
      else if ([key isEqualToString:@"count"])
        value=[NSNumber numberWithInt:[self count]];
    };
  return value;
}


If your code is right, we have a big problem: how could we have same foundation but 2 
differents way of processing
depending on what we use (GNUstepWeb/EOF or not)

Manuel
--
______________________________________________________________________
Manuel Guesdon - OXYMIUM <[EMAIL PROTECTED]>
14 rue Jean-Baptiste Clement  -  93200 Saint-Denis  -  France
Tel: +33 1 4940 0999  -  Fax: +33 1 4940 0998


_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to