discuss-gnustep
[Top][All Lists]
Advanced

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

Re: setValue:forKey broken for bool properties


From: David Chisnall
Subject: Re: setValue:forKey broken for bool properties
Date: Wed, 19 Mar 2014 06:03:24 +0000

Looks good to me.

David

On 18 Mar 2014, at 17:46, Mathias Bauer <mathias_bauer@gmx.net> wrote:

> Hi,
> 
> just to get this going: please review and perhaps apply the attached patch.
> 
> Thanks and best regards,
> Mathias
> 
> Am 20.01.14 18:07, schrieb David Chisnall:
>> This looks like a simple omission.  It's fairly uncommon to use the C99 
>> _Bool type (for which bool is a typedef), rather than the Objective-C BOOL 
>> type, in Objective-C code.  It shouldn't be too difficult to fix, I think we 
>> just need an extra case in a couple of switch statements.
>> 
>> David
>> 
>> On 19 Jan 2014, at 11:48, Mathias Bauer <mathias_bauer@gmx.net> wrote:
>> 
>>> Hi,
>>> 
>>> the following simple program crashes because GSObjCSetVal in 
>>> GSObjCRuntime.m does not handle boolean values:
>>> 
>>>> #import <Foundation/Foundation.h>
>>>> 
>>>> @interface TestObject : NSObject
>>>> @property (nonatomic, assign) bool switcher;
>>>> @end
>>>> 
>>>> @implementation TestObject
>>>> @end
>>>> 
>>>> int main(int argc, const char * argv[])
>>>> {
>>>>    TestObject* test = [TestObject new];
>>>> 
>>>>    [test setValue:[NSNumber numberWithBool:YES] forKey:@"switcher"];
>>>>    return 0;
>>>> }
>>>> 
>>> 
>>> compiled with:
>>> clang `gnustep-config --objc-flags` -x objective-c -fobjc-arc -std=gnu99 
>>> -fpascal-strings -fstrict-aliasing -lobjc -lgnustep-base `gnustep-config 
>>> --objc-libs` test.m
>>> 
>>> I think this is a serious defect. On my system the type that needed to be 
>>> handled in GSObjCSetVal would be "B16", but on other system this might be 
>>> different.
>>> 
>>> I'm unsure about how a correct fix should be, so any opinions of people in 
>>> the know would be greatly appreciated.
>>> 
>>> Best regards,
>>> Mathias
>>> 
>>> _______________________________________________
>>> Discuss-gnustep mailing list
>>> Discuss-gnustep@gnu.org
>>> https://lists.gnu.org/mailman/listinfo/discuss-gnustep
>> 
> <GSObjCRuntime.diff>_______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep




-- Sent from my STANTEC-ZEBRA




reply via email to

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