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 Pero 2010-12-27 11:57:04 +00:00
parent cc3ce8896e
commit f80e259048
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>
* 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++)
{
type = [self elementAtIndex: i associatedPoints: pts];
[aCoder encodeValueOfObjCType: @encode(NSBezierPathElement) at: &type];
[aCoder encodeValueOfObjCType: @encode(int) at: &type];
switch(type)
{
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++)
{
[aCoder decodeValueOfObjCType: @encode(NSBezierPathElement) at: &type];
[aCoder decodeValueOfObjCType: @encode(int) at: &type];
switch(type)
{
case NSMoveToBezierPathElement:

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1478,7 +1478,7 @@ static float scrollerWidth;
else
{
[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: &_rulersVisible];
[aCoder encodeValueOfObjCType: @encode(float) at: &_hLineScroll];
@ -1609,7 +1609,7 @@ static float scrollerWidth;
int version = [aDecoder versionForClassName: @"NSScrollView"];
NSDebugLLog(@"NSScrollView", @"NSScrollView: start decoding\n");
_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: &_rulersVisible];
[aDecoder decodeValueOfObjCType: @encode(float) at: &_hLineScroll];

View file

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

View file

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

View file

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