mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 04:40:37 +00:00
Change encoding/decoding to protect against differences in integer size.
This commit is contained in:
parent
05572b2d01
commit
35698d41b6
12 changed files with 233 additions and 163 deletions
|
@ -386,7 +386,10 @@ static Class controlClass;
|
|||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeValueOfObjCType: @encode(NSInteger) at: &_tag];
|
||||
int32_t tmp;
|
||||
|
||||
tmp = _tag;
|
||||
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
|
||||
[aCoder encodeConditionalObject: _target];
|
||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
// This is only encoded for backward compatibility and won't be decoded.
|
||||
|
@ -419,12 +422,15 @@ static Class controlClass;
|
|||
else
|
||||
{
|
||||
id dummy;
|
||||
int32_t tmp;
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(NSInteger) at: &_tag];
|
||||
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
|
||||
_tag = tmp;
|
||||
_target = [aDecoder decodeObject];
|
||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
// Don't decode _control_view, as this may no longer be valid.
|
||||
dummy = [aDecoder decodeObject];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &dummy];
|
||||
RELEASE(dummy);
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue