fix alignment error

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34108 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-11-02 15:46:02 +00:00
parent de6e9cf7fc
commit 70f63cc91a
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2011-11-02 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSNumber.m: Fix alignment error when encoding/decoding ...
buffer must be aligned so that any datatype can go in it.
2011-11-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSString.m: Partial restructuring suggested by Fred, plus

View file

@ -771,7 +771,7 @@ if (aValue >= -1 && aValue <= 12)\
- (void) encodeWithCoder: (NSCoder *) coder
{
const char *type = [self objCType];
char buffer[16];
char buffer[16] __attribute__ ((aligned (16)));
[coder encodeValueOfObjCType: @encode (char) at: type];
/* The most we currently store in an NSNumber is 8 bytes (double or long
@ -792,7 +792,7 @@ if (aValue >= -1 && aValue <= 12)\
- (id) initWithCoder: (NSCoder *) coder
{
char type[2] = { 0 };
char buffer[16];
char buffer[16] __attribute__ ((aligned (16)));
[coder decodeValueOfObjCType: @encode (char) at: type];
[coder decodeValueOfObjCType: type at: buffer];