Explicitly encode/decode enumerated types as 'int' which is what all

the existing archives use (even if it is incorrect as in many cases
the types are actually 'unsigned int')


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31785 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
nicola 2010-12-27 11:57:04 +00:00
parent 74c604cbb0
commit b854f2da8a
12 changed files with 59 additions and 36 deletions

View file

@ -1,3 +1,30 @@
2010-12-27 Nicola Pero <nicola.pero@meta-innovation.com>
* Source/NSBezierPath.m ([-encodeWithCoder:], [-initWithCoder:]):
Explicitly encode/decode NSBezierPathElement as 'int' to work
across compiler versions.
* Source/NSBox.m ([-encodeWithCoder:], [-initWithCoder:]): Same
for NSBorderType and NSTitlePosition.
* Source/NSEvent.m ([-encodeWithCoder:], [-initWithCoder:]): Same
for NSEventType.
* Source/NSFileWrapper.m ([-encodeWithCoder:], [-initWithCoder:]):
Same for GSFileWrapperType.
* Source/NSImageCell.m ([-encodeWithCoder:], [-initWithCoder:]):
Same for NSImageAlignment, NSImageFrameStyle, NSImageScaling,
* Source/NSParagraphStyle.m ([-initWithCoder:],
[-encodeWithCoder:]): Same for NSTextAlignment, NSLineBreakMode
and NSTextTabType.
* Source/NSResponder.m ([-encodeWithCoder:], [-initWithCoder:]):
Same for NSInterfaceStyle.
* Source/NSScrollView.m ([-encodeWithCoder:], [-initWithCoder:]):
Same for NSBorderType.
* Source/NSTabView.m ([-encodeWithCoder:], [-initWithCoder:]):
Same for NSTabViewType.
* Source/NSTabViewItem.m ([-encodeWithCoder:], [-initWithCoder:]):
Same for NSTabState.
* Source/NSWindow.m ([-encodeWithCoder:], [-initWithCoder:]): Same
for NSBackingStoreType.
2010-12-27 02:12-EST Gregory John Casamento <greg.casamento@gmail.com> 2010-12-27 02:12-EST Gregory John Casamento <greg.casamento@gmail.com>
* Source/GSThemeMenu.m: Added implementation for * Source/GSThemeMenu.m: Added implementation for

View file

@ -1628,7 +1628,7 @@ static int winding_curve(double_point from, double_point to, double_point c1,
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
type = [self elementAtIndex: i associatedPoints: pts]; type = [self elementAtIndex: i associatedPoints: pts];
[aCoder encodeValueOfObjCType: @encode(NSBezierPathElement) at: &type]; [aCoder encodeValueOfObjCType: @encode(int) at: &type];
switch(type) switch(type)
{ {
case NSMoveToBezierPathElement: case NSMoveToBezierPathElement:
@ -1674,7 +1674,7 @@ static int winding_curve(double_point from, double_point to, double_point c1,
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
[aCoder decodeValueOfObjCType: @encode(NSBezierPathElement) at: &type]; [aCoder decodeValueOfObjCType: @encode(int) at: &type];
switch(type) switch(type)
{ {
case NSMoveToBezierPathElement: case NSMoveToBezierPathElement:

View file

@ -514,8 +514,8 @@
{ {
[aCoder encodeObject: _cell]; [aCoder encodeObject: _cell];
[aCoder encodeSize: _offsets]; [aCoder encodeSize: _offsets];
[aCoder encodeValueOfObjCType: @encode(NSBorderType) at: &_border_type]; [aCoder encodeValueOfObjCType: @encode(int) at: &_border_type];
[aCoder encodeValueOfObjCType: @encode(NSTitlePosition) at: &_title_position]; [aCoder encodeValueOfObjCType: @encode(int) at: &_title_position];
// NB: the content view is our (only) subview, so it is already // NB: the content view is our (only) subview, so it is already
// encoded by NSView. // encoded by NSView.
} }
@ -564,9 +564,9 @@
{ {
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cell]; [aDecoder decodeValueOfObjCType: @encode(id) at: &_cell];
_offsets = [aDecoder decodeSize]; _offsets = [aDecoder decodeSize];
[aDecoder decodeValueOfObjCType: @encode(NSBorderType) [aDecoder decodeValueOfObjCType: @encode(int)
at: &_border_type]; at: &_border_type];
[aDecoder decodeValueOfObjCType: @encode(NSTitlePosition) [aDecoder decodeValueOfObjCType: @encode(int)
at: &_title_position]; at: &_title_position];
// The content view is our only sub_view // The content view is our only sub_view

View file

@ -696,7 +696,7 @@ static const char *eventTypes[] = {
- (void) encodeWithCoder: (NSCoder*)aCoder - (void) encodeWithCoder: (NSCoder*)aCoder
{ {
[aCoder encodeValueOfObjCType: @encode(NSEventType) at: &event_type]; [aCoder encodeValueOfObjCType: @encode(int) at: &event_type];
[aCoder encodePoint: location_point]; [aCoder encodePoint: location_point];
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &modifier_flags]; [aCoder encodeValueOfObjCType: @encode(unsigned) at: &modifier_flags];
[aCoder encodeValueOfObjCType: @encode(NSTimeInterval) at: &event_time]; [aCoder encodeValueOfObjCType: @encode(NSTimeInterval) at: &event_time];
@ -779,7 +779,7 @@ static const char *eventTypes[] = {
{ {
int version = [aDecoder versionForClassName: @"NSEvent"]; int version = [aDecoder versionForClassName: @"NSEvent"];
[aDecoder decodeValueOfObjCType: @encode(NSEventType) at: &event_type]; [aDecoder decodeValueOfObjCType: @encode(int) at: &event_type];
location_point = [aDecoder decodePoint]; location_point = [aDecoder decodePoint];
[aDecoder decodeValueOfObjCType: @encode(unsigned) at: &modifier_flags]; [aDecoder decodeValueOfObjCType: @encode(unsigned) at: &modifier_flags];
[aDecoder decodeValueOfObjCType: @encode(NSTimeInterval) at: &event_time]; [aDecoder decodeValueOfObjCType: @encode(NSTimeInterval) at: &event_time];

View file

@ -579,7 +579,7 @@
- (void) encodeWithCoder: (NSCoder*)aCoder - (void) encodeWithCoder: (NSCoder*)aCoder
{ {
[aCoder encodeValueOfObjCType: @encode(GSFileWrapperType) at: &_wrapperType]; [aCoder encodeValueOfObjCType: @encode(int) at: &_wrapperType];
// Dont store the file name // Dont store the file name
[aCoder encodeObject: _preferredFilename]; [aCoder encodeObject: _preferredFilename];
[aCoder encodeObject: _fileAttributes]; [aCoder encodeObject: _fileAttributes];
@ -595,7 +595,7 @@
id wrapperData; id wrapperData;
NSImage *iconImage; NSImage *iconImage;
[aDecoder decodeValueOfObjCType: @encode(GSFileWrapperType) at: &wrapperType]; [aDecoder decodeValueOfObjCType: @encode(int) at: &wrapperType];
// Dont restore the file name // Dont restore the file name
preferredFilename = [aDecoder decodeObject]; preferredFilename = [aDecoder decodeObject];
fileAttributes = [aDecoder decodeObject]; fileAttributes = [aDecoder decodeObject];

View file

@ -340,9 +340,9 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
} }
else else
{ {
[aCoder encodeValueOfObjCType: @encode(NSImageAlignment) at: &_imageAlignment]; [aCoder encodeValueOfObjCType: @encode(int) at: &_imageAlignment];
[aCoder encodeValueOfObjCType: @encode(NSImageFrameStyle) at: &_frameStyle]; [aCoder encodeValueOfObjCType: @encode(int) at: &_frameStyle];
[aCoder encodeValueOfObjCType: @encode(NSImageScaling) at: &_imageScaling]; [aCoder encodeValueOfObjCType: @encode(int) at: &_imageScaling];
[aCoder encodeSize: _original_image_size]; [aCoder encodeSize: _original_image_size];
} }
} }
@ -372,9 +372,9 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
} }
else else
{ {
[aDecoder decodeValueOfObjCType: @encode(NSImageAlignment) at: &_imageAlignment]; [aDecoder decodeValueOfObjCType: @encode(int) at: &_imageAlignment];
[aDecoder decodeValueOfObjCType: @encode(NSImageFrameStyle) at: &_frameStyle]; [aDecoder decodeValueOfObjCType: @encode(int) at: &_frameStyle];
[aDecoder decodeValueOfObjCType: @encode(NSImageScaling) at: &_imageScaling]; [aDecoder decodeValueOfObjCType: @encode(int) at: &_imageScaling];
_original_image_size = [aDecoder decodeSize]; _original_image_size = [aDecoder decodeSize];
} }
} }

View file

@ -473,9 +473,8 @@ static NSParagraphStyle *defaultStyle = nil;
{ {
unsigned count; unsigned count;
[aCoder decodeValueOfObjCType: @encode(NSTextAlignment) at: &_alignment]; [aCoder decodeValueOfObjCType: @encode(int) at: &_alignment];
[aCoder decodeValueOfObjCType: @encode(NSLineBreakMode) [aCoder decodeValueOfObjCType: @encode(int) at: &_lineBreakMode];
at: &_lineBreakMode];
[aCoder decodeValueOfObjCType: @encode(float) at: &_firstLineHeadIndent]; [aCoder decodeValueOfObjCType: @encode(float) at: &_firstLineHeadIndent];
[aCoder decodeValueOfObjCType: @encode(float) at: &_headIndent]; [aCoder decodeValueOfObjCType: @encode(float) at: &_headIndent];
[aCoder decodeValueOfObjCType: @encode(float) at: &_lineSpacing]; [aCoder decodeValueOfObjCType: @encode(float) at: &_lineSpacing];
@ -498,7 +497,7 @@ static NSParagraphStyle *defaultStyle = nil;
[aCoder decodeArrayOfObjCType: @encode(float) [aCoder decodeArrayOfObjCType: @encode(float)
count: count count: count
at: locations]; at: locations];
[aCoder decodeArrayOfObjCType: @encode(NSTextTabType) [aCoder decodeArrayOfObjCType: @encode(int)
count: count count: count
at: types]; at: types];
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
@ -531,9 +530,8 @@ static NSParagraphStyle *defaultStyle = nil;
{ {
unsigned count; unsigned count;
[aCoder encodeValueOfObjCType: @encode(NSTextAlignment) at: &_alignment]; [aCoder encodeValueOfObjCType: @encode(int) at: &_alignment];
[aCoder encodeValueOfObjCType: @encode(NSLineBreakMode) [aCoder encodeValueOfObjCType: @encode(int) at: &_lineBreakMode];
at: &_lineBreakMode];
[aCoder encodeValueOfObjCType: @encode(float) at: &_firstLineHeadIndent]; [aCoder encodeValueOfObjCType: @encode(float) at: &_firstLineHeadIndent];
[aCoder encodeValueOfObjCType: @encode(float) at: &_headIndent]; [aCoder encodeValueOfObjCType: @encode(float) at: &_headIndent];
[aCoder encodeValueOfObjCType: @encode(float) at: &_lineSpacing]; [aCoder encodeValueOfObjCType: @encode(float) at: &_lineSpacing];
@ -563,7 +561,7 @@ static NSParagraphStyle *defaultStyle = nil;
[aCoder encodeArrayOfObjCType: @encode(float) [aCoder encodeArrayOfObjCType: @encode(float)
count: count count: count
at: locations]; at: locations];
[aCoder encodeArrayOfObjCType: @encode(NSTextTabType) [aCoder encodeArrayOfObjCType: @encode(int)
count: count count: count
at: types]; at: types];
} }

View file

@ -357,8 +357,7 @@
} }
else else
{ {
[aCoder encodeValueOfObjCType: @encode(NSInterfaceStyle) [aCoder encodeValueOfObjCType: @encode(int) at: &_interface_style];
at: &_interface_style];
[aCoder encodeObject: _menu]; [aCoder encodeObject: _menu];
} }
} }
@ -386,8 +385,7 @@
} }
else else
{ {
[aDecoder decodeValueOfObjCType: @encode(NSInterfaceStyle) [aDecoder decodeValueOfObjCType: @encode(int) at: &_interface_style];
at: &_interface_style];
obj = [aDecoder decodeObject]; obj = [aDecoder decodeObject];
} }

View file

@ -1478,7 +1478,7 @@ static float scrollerWidth;
else else
{ {
[aCoder encodeObject: _contentView]; [aCoder encodeObject: _contentView];
[aCoder encodeValueOfObjCType: @encode(NSBorderType) at: &_borderType]; [aCoder encodeValueOfObjCType: @encode(int) at: &_borderType];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible];
[aCoder encodeValueOfObjCType: @encode(float) at: &_hLineScroll]; [aCoder encodeValueOfObjCType: @encode(float) at: &_hLineScroll];
@ -1609,7 +1609,7 @@ static float scrollerWidth;
int version = [aDecoder versionForClassName: @"NSScrollView"]; int version = [aDecoder versionForClassName: @"NSScrollView"];
NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n"); NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n");
_contentView = [aDecoder decodeObject]; _contentView = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: @encode(NSBorderType) at: &_borderType]; [aDecoder decodeValueOfObjCType: @encode(int) at: &_borderType];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_scrollsDynamically];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_rulersVisible];
[aDecoder decodeValueOfObjCType: @encode(float) at: &_hLineScroll]; [aDecoder decodeValueOfObjCType: @encode(float) at: &_hLineScroll];

View file

@ -529,7 +529,7 @@
{ {
[aCoder encodeObject: _items]; [aCoder encodeObject: _items];
[aCoder encodeObject: _font]; [aCoder encodeObject: _font];
[aCoder encodeValueOfObjCType: @encode(NSTabViewType) at: &_type]; [aCoder encodeValueOfObjCType: @encode(int) at: &_type];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_draws_background]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &_draws_background];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_truncated_label]; [aCoder encodeValueOfObjCType: @encode(BOOL) at: &_truncated_label];
[aCoder encodeConditionalObject: _delegate]; [aCoder encodeConditionalObject: _delegate];
@ -582,7 +582,7 @@
[aDecoder decodeValueOfObjCType: @encode(id) at: &_items]; [aDecoder decodeValueOfObjCType: @encode(id) at: &_items];
[aDecoder decodeValueOfObjCType: @encode(id) at: &_font]; [aDecoder decodeValueOfObjCType: @encode(id) at: &_font];
[aDecoder decodeValueOfObjCType: @encode(NSTabViewType) at: &_type]; [aDecoder decodeValueOfObjCType: @encode(int) at: &_type];
if (version < 2) if (version < 2)
{ {
switch(_type) switch(_type)

View file

@ -210,7 +210,7 @@
[aCoder encodeObject:_label]; [aCoder encodeObject:_label];
[aCoder encodeObject:_view]; [aCoder encodeObject:_view];
[aCoder encodeObject:_color]; [aCoder encodeObject:_color];
[aCoder encodeValueOfObjCType: @encode(NSTabState) at: &_state]; [aCoder encodeValueOfObjCType: @encode(int) at: &_state];
[aCoder encodeObject:_first_responder]; [aCoder encodeObject:_first_responder];
[aCoder encodeObject:_tabview]; [aCoder encodeObject:_tabview];
} }
@ -234,7 +234,7 @@
[aDecoder decodeValueOfObjCType: @encode(id) at: &_label]; [aDecoder decodeValueOfObjCType: @encode(id) at: &_label];
[aDecoder decodeValueOfObjCType: @encode(id) at: &_view]; [aDecoder decodeValueOfObjCType: @encode(id) at: &_view];
[aDecoder decodeValueOfObjCType: @encode(id) at: &_color]; [aDecoder decodeValueOfObjCType: @encode(id) at: &_color];
[aDecoder decodeValueOfObjCType: @encode(NSTabState) at:&_state]; [aDecoder decodeValueOfObjCType: @encode(int) at:&_state];
[aDecoder decodeValueOfObjCType: @encode(id) at: &_first_responder]; [aDecoder decodeValueOfObjCType: @encode(id) at: &_first_responder];
AUTORELEASE(_first_responder); AUTORELEASE(_first_responder);
[aDecoder decodeValueOfObjCType: @encode(id) at: &_tabview]; [aDecoder decodeValueOfObjCType: @encode(id) at: &_tabview];

View file

@ -5124,7 +5124,7 @@ current key view.<br />
[aCoder encodeRect: [[self contentView] frame]]; [aCoder encodeRect: [[self contentView] frame]];
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &_styleMask]; [aCoder encodeValueOfObjCType: @encode(unsigned) at: &_styleMask];
[aCoder encodeValueOfObjCType: @encode(NSBackingStoreType) at: &_backingType]; [aCoder encodeValueOfObjCType: @encode(int) at: &_backingType];
[aCoder encodePoint: NSMakePoint(NSMinX([self frame]), NSMaxY([self frame]))]; [aCoder encodePoint: NSMakePoint(NSMinX([self frame]), NSMaxY([self frame]))];
[aCoder encodeObject: _contentView]; [aCoder encodeObject: _contentView];
@ -5191,7 +5191,7 @@ current key view.<br />
aRect = [aDecoder decodeRect]; aRect = [aDecoder decodeRect];
[aDecoder decodeValueOfObjCType: @encode(unsigned) [aDecoder decodeValueOfObjCType: @encode(unsigned)
at: &aStyle]; at: &aStyle];
[aDecoder decodeValueOfObjCType: @encode(NSBackingStoreType) [aDecoder decodeValueOfObjCType: @encode(int)
at: &aBacking]; at: &aBacking];
// call the designated initializer.... // call the designated initializer....