mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Patch to permit null selectors
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@15995 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6901d681dc
commit
690ce58ebe
2 changed files with 28 additions and 11 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-02-18 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* NSObject.m: ([+instancesRespondToSelector:]),([-respondsToSelector])
|
||||
Return NO when given a null selector unless in MacOS-X compatibility
|
||||
mode. rewritten from patch by Willem Rein Oudshoorn.
|
||||
|
||||
2003-02-16 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Version 1.5.2
|
||||
|
|
|
@ -1124,18 +1124,22 @@ static BOOL double_release_check_enabled = NO;
|
|||
* where a subclass implements -forwardInvocation: to respond to
|
||||
* selectors not normally handled ... in these cases the subclass
|
||||
* may override this method to handle it.
|
||||
* <br />Raises NSInvalidArgumentException if given a null selector.
|
||||
* <br />If given a null selector, raises NSInvalidArgumentException when
|
||||
* in MacOS-X compatibility more, or returns NO otherwise.
|
||||
*/
|
||||
+ (BOOL) instancesRespondToSelector: (SEL)aSelector
|
||||
{
|
||||
if (aSelector == 0)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
|
||||
#if 0
|
||||
return (class_get_instance_method(self, aSelector) != METHOD_NULL);
|
||||
#else
|
||||
{
|
||||
if (GSUserDefaultsFlag(GSMacOSXCompatible))
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given",
|
||||
NSStringFromSelector(_cmd)];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
return __objc_responds_to((id)&self, aSelector);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1659,14 +1663,21 @@ static BOOL double_release_check_enabled = NO;
|
|||
* where a subclass implements -forwardInvocation: to respond to
|
||||
* selectors not normally handled ... in these cases the subclass
|
||||
* may override this method to handle it.
|
||||
* <br />Raises NSInvalidArgumentException if given a null selector.
|
||||
* <br />If given a null selector, raises NSInvalidArgumentException when
|
||||
* in MacOS-X compatibility more, or returns NO otherwise.
|
||||
*/
|
||||
- (BOOL) respondsToSelector: (SEL)aSelector
|
||||
{
|
||||
if (aSelector == 0)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given", NSStringFromSelector(_cmd)];
|
||||
|
||||
{
|
||||
if (GSUserDefaultsFlag(GSMacOSXCompatible))
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"%@ null selector given",
|
||||
NSStringFromSelector(_cmd)];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
return __objc_responds_to(self, aSelector);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue