Change encoding/decoding to protect against differences in integer size.

This commit is contained in:
fredkiefer 2021-01-08 17:18:36 +01:00
parent 05572b2d01
commit 35698d41b6
12 changed files with 233 additions and 163 deletions

View file

@ -306,9 +306,14 @@ yBottomInRect(NSSize innerSize, NSRect outerRect, BOOL flipped)
}
else
{
[aCoder encodeValueOfObjCType: @encode(int) at: &_imageAlignment];
[aCoder encodeValueOfObjCType: @encode(int) at: &_frameStyle];
[aCoder encodeValueOfObjCType: @encode(int) at: &_imageScaling];
int32_t tmp;
tmp = _imageAlignment;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
tmp = _frameStyle;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
tmp = _imageScaling;
[aCoder encodeValueOfObjCType: @encode(int32_t) at: &tmp];
[aCoder encodeSize: _original_image_size];
}
}
@ -338,9 +343,14 @@ yBottomInRect(NSSize innerSize, NSRect outerRect, BOOL flipped)
}
else
{
[aDecoder decodeValueOfObjCType: @encode(int) at: &_imageAlignment];
[aDecoder decodeValueOfObjCType: @encode(int) at: &_frameStyle];
[aDecoder decodeValueOfObjCType: @encode(int) at: &_imageScaling];
int32_t tmp;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
_imageAlignment = tmp;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
_frameStyle = tmp;
[aDecoder decodeValueOfObjCType: @encode(int32_t) at: &tmp];
_imageScaling = tmp;
_original_image_size = [aDecoder decodeSize];
}
}