Hi Sebastian,
On 10 Apr 2012, at 17:27, Sebastian Reitenbach wrote:
> I thought one of the goals is to be more compatible with Coocoa, and there
> its an NSUInteger. therefore I decided to follow your first suggestion,
> bumping the NSTabView class version, and add a check to the decoder method.
> There is already another check for version < 2.
> The patch below now again makes the broken Apps work for me.
>
> Is that OK, or is there more that would need to be fixed?
As someone else said, please consider using @encode(int) instead of "i" and
@encode(NSUInteger) instead of "l". The former is a style thing, the later is
just wrong - NSUInteger is a typedef and may not always be l (long). For the
current version, I had a macro version somewhere that was defined as:
#define DECODE(x) [aDecoder decodeValueOfObjCType: @encode(__typeof__(x)) at:
&(x)]
You then just write:
DECODE(_draws_background);
DECODE(_truncated_label);
DECODE(_selected_item);
and so on.
Your legacy compatibility code is also subtly wrong. If int is 32 bits and
NSInteger is 64 bits then this is broken on big-endian platforms. You should
instead write:
if (version < 3)
{
int tmp;
[aDecoder decodeValueOfObjCType: @encode(int) at: &tmp];
_selected_item = tmp;
}
else
...
David
-- Send from my Jacquard Loom
_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev