gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: some (un)signed int to NS(U)Integer changes in Gorm


From: Gregory Casamento
Subject: Re: some (un)signed int to NS(U)Integer changes in Gorm
Date: Wed, 11 Apr 2012 00:48:34 -0400

I will review these.   I've been developing gorm on my 64bit machine for quite some time.  Horribly broken is hardly the term off would use.


On Tuesday, April 10, 2012, Sebastian Reitenbach wrote:
Hi,

compiling Gorm on amd64 against latest release of -base and -gui, I get _lots_ of compilation warnings with regard to comparisons against NSNotFound. So far, Gorm seems to be horribly broken on 64Bit archs.
See below a first batch of patches to fix the majority of those. One of those warnings is still left, but I think that would need a fix in -gui. There are also still a lot of other warnings that make me worry.

If someone could review the patch, and commit or let me know if its fine, then I'd go on.

cheers,
Sebastian

Index: Plugins/Gorm/GormGormWrapperLoader.m
===================================================================
--- Plugins/Gorm/GormGormWrapperLoader.m        (revision 35049)
+++ Plugins/Gorm/GormGormWrapperLoader.m        (working copy)
@@ -345,7 +345,7 @@
      NSDictionary              *substituteClasses = [palettesManager substituteClasses];
      NSEnumerator              *en = [substituteClasses keyEnumerator];
      NSString                  *subClassName = nil;
-      unsigned int             version = NSNotFound;
+      NSUInteger               version = NSNotFound;
      NSDictionary              *fileWrappers = nil;
      GSNibContainer            *container;
      NSArray                   *visible;
Index: Plugins/Nib/GormNibWrapperLoader.m
===================================================================
--- Plugins/Nib/GormNibWrapperLoader.m  (revision 35049)
+++ Plugins/Nib/GormNibWrapperLoader.m  (working copy)
@@ -264,7 +264,7 @@
                       {
                         NSString *tag = [o label];
                         NSRange colonRange = [tag rangeOfString: @":"];
-                         unsigned int location = colonRange.location;
+                         NSUInteger location = colonRange.location;

                         if(location == NSNotFound)
                           {
Index: GormCore/GormGenericEditor.m
===================================================================
--- GormCore/GormGenericEditor.m        (revision 35049)
+++ GormCore/GormGenericEditor.m        (working copy)
@@ -245,10 +245,10 @@
 */
 - (NSRect) rectForObject: (id)anObject
 {
-  unsigned     pos = [objects indexOfObjectIdenticalTo: anObject];
+  NSUInteger   pos = [objects indexOfObjectIdenticalTo: anObject];
  NSRect       rect;
-  int          r;
-  int          c;
+  NSUInteger   r;
+  NSUInteger   c;

  if (pos == NSNotFound)
    return NSZeroRect;
@@ -317,7 +317,7 @@

 - (void) removeObject: (id)anObject
 {
-  unsigned     pos;
+  NSUInteger   pos;

  pos = [objects indexOfObjectIdenticalTo: anObject];
  if (pos == NSNotFound)
Index: GormCore/GormClassManager.m
===================================================================
--- GormCore/GormClassManager.m (revision 35049)
+++ GormCore/GormClassManager.m (working copy)
@@ -1117,7 +1117,7 @@

  if (classInfo != nil && [classInformation objectForKey: name] == nil)
    {
-      int index = 0;
+      NSUInteger index = 0;
      NSArray *subclasses = [self subClassesOf: oldName];

      RETAIN(classInfo); // prevent loss of the information...
Index: GormCore/GormObjectInspector.m
===================================================================
--- GormCore/GormObjectInspector.m      (revision 35049)
+++ GormCore/GormObjectInspector.m      (working copy)
@@ -103,7 +103,7 @@
 - (void) ok: (id)sender
 {
  NSString     *name = [[browser selectedCell] stringValue];
-  unsigned     pos;
+  NSUInteger   pos;

  if (name == nil || (pos = [sets indexOfObject: name]) == NSNotFound)
    {
@@ -331,7 +331,7 @@
 - (void) update: (id)sender
 {
  NSString     *name = [[browser selectedCell] stringValue];
-  unsigned     pos;
+  NSUInteger   pos;

  isString = NO;
  if (name == nil || (pos = [sets indexOfObject: name]) == NSNotFound)
Index: GormCore/GormPrivate.h
===================================================================
--- GormCore/GormPrivate.h      (revision 35049)
+++ GormCore/GormPrivate.h      (working copy)
@@ -99,7 +99,7 @@

 + (int) formatCount;
 + (NSString *) formatAtIndex: (int)index;
-+ (int) indexOfFormat: (NSString *) format;
++ (NSInteger) indexOfFormat: (NSString *) format;
 + (NSString *) defaultFormat;
 + (id) defaultFormatValue;

@@ -114,7 +114,7 @@
 + (NSString *) negativeFormatAtIndex: (int)index;
 + (NSDecimalNumber *) positiveValueAtIndex: (int)index;
 + (NSDecimalNumber *) negativeValueAtIndex: (int)index;
-+ (int) indexOfFormat: (NSString *)format;
++ (NSInteger) indexOfFormat: (NSString *)format;
 + (NSString *) defaultFormat;
 + (id) defaultFormatValue;
 - (NSString *) zeroFormat;
Index: GormCore/GormPrivate.m
===================================================================
--- GormCore/GormPrivate.m      (revision 35049)
+++ GormCore/GormPrivate.m      (working copy)
@@ -130,7 +130,7 @@
    }
  else
    {
-      int version = [aCoder versionForClassName:
+      NSInteger version = [aCoder versionForClassName:
                             NSStringFromClass([GSNibItem class])];
      int cv = [aCoder versionForClassName:
                        NSStringFromClass([GSNibContainer class])];
Index: GormCore/GormDocument.m
===================================================================
--- GormCore/GormDocument.m     (revision 35049)
+++ GormCore/GormDocument.m     (working copy)
@@ -2490,7 +2490,7 @@
    {
      NSTableView *tv = (NSTableView *)[[(NSTableColumn*)object dataCell] controlView];
      NSTableHeaderView *th =  [tv headerView];
-      int index;
+      NSUInteger index;

      if (th == nil || tv == nil)
       {
Index: GormCore/GormClassInspector.m
===================================================================
--- GormCore/GormClassInspector.m       (revision 35049)
+++ GormCore/GormClassInspector.m       (working copy)
@@ -508,7 +508,7 @@
 {
  NSArray *list = [classManager allClassNames];
  NSString *stringValue = [searchText stringValue];
-  int index = [list indexOfObject: stringValue];
+  NSUInteger index = [list indexOfObject: stringValue];

  NSLog(@"Search... %@",[searchText stringValue]);
  if(index != NSNotFound && list != nil &&
Index: GormCore/GormOutlineView.m
===================================================================
--- GormCore/GormOutlineView.m  (revision 35049)
+++ GormCore/GormOutlineView.m  (working copy)
@@ -227,7 +227,7 @@
 {
  int numchildren = 0;
  int i = 0;
-  int insertionPoint = 0;
+  NSUInteger insertionPoint = 0;
  id object = nil;
  id sitem = (item == nil)?((id)[NSNull null]):((id)item);

@@ -269,7 +269,7 @@
 {
  int numchildren = 0;
  int i = 0;
-  int insertionPoint = 0;
+  NSUInteger insertionPoint = 0;
  id object = nil;
  id sitem = (item == nil)?((id)[NSNull null]):((id)item);

Index: Palettes/0Menus/GormMenuEditor.m
===================================================================
--- Palettes/0Menus/GormMenuEditor.m    (revision 35049)
+++ Palettes/0Menus/GormMenuEditor.m    (working copy)
@@ -895,7 +895,7 @@
 {
  if ([anArray isEqual: selection] == NO)
    {
-      unsigned         count;
+      NSUInteger       count;
      NSMenuItem       *item;

      [selection removeAllObjects];
Index: Palettes/3Containers/GormTableViewEditor.m
===================================================================
--- Palettes/3Containers/GormTableViewEditor.m  (revision 35049)
+++ Palettes/3Containers/GormTableViewEditor.m  (working copy)
@@ -363,7 +363,7 @@
  NSTableColumn *tc;
  NSRect drawingRect;

-  int columnIndex = [th columnAtPoint:
+  NSInteger columnIndex = [th columnAtPoint:
                         [th convertPoint:[theEvent locationInWindow]
                             fromView: nil]];

Index: Palettes/3Containers/GormTableColumnAttributesInspector.m
===================================================================
--- Palettes/3Containers/GormTableColumnAttributesInspector.m   (revision 35049)
+++ Palettes/3Containers/GormTableColumnAttributesInspector.m   (working copy)
@@ -232,7 +232,7 @@
 {
  NSArray *list;
  NSString *cellClassName;
-  int index;
+  NSUInteger index;

  if ( object == nil )
    return;
@@ -241,7 +241,7 @@
  cellClassName = [self _getCellClassName];
  index =  [list indexOfObject: cellClassName];

-  if(index != NSNotFound && index != -1)
+  if(index != NSNotFound)
    {
      [cellTable selectRow: index byExtendingSelection: NO];
      [cellTable scrollRowToVisible: index];
Index: Palettes/1Windows/GormDrawerAttributesInspector.m
===================================================================
--- Palettes/1Windows/GormDrawerAttributesInspector.m   (revision 35049)
+++ Palettes/1Windows/GormDrawerAttributesInspector.m   (working copy)
@@ -52,7 +52,7 @@
 - (void) revert: (id) sender
 {
  id drawer = [self object];
-  int i = [preferredEdge indexOfItemWithTag: [drawer preferredEdge]];
+  NSInteger i = [preferredEdge indexOfItemWithTag: [drawer preferredEdge]];
  if(i != NSNotFound)
    {
      [preferredEdge selectItemAtIndex: i];
Index: Palettes/4Data/GormNumberFormatterAttributesInspector.m
===================================================================
--- Palettes/4Data/GormNumberFormatterAttributesInspector.m     (revision 35049)
+++ Palettes/4Data/GormNumberFormatterAttributesInspector.m     (working copy)
@@ -113,7 +113,7 @@
         }
      else if (sender == formatForm)
        {
-          int idx;
+          NSInteger idx;

          positiveFmt = [[sender cellAtIndex:0] stringValue];
          zeroFmt = [[sender cellAtIndex:1] stringValue];
@@ -181,7 +181,7 @@

 - (void) revert: (id)sender
 {
-  int idx;
+  NSInteger idx;
  NSNumberFormatter *fmtr = [[object cell] formatter];

  // Format form
Index: Palettes/4Data/GormDateFormatterAttributesInspector.m
===================================================================
--- Palettes/4Data/GormDateFormatterAttributesInspector.m       (revision 35049)
+++ Palettes/4Data/GormDateFormatterAttributesInspector.m       (working copy)
@@ -81,7 +81,7 @@
        }
      else if (sender == formatField)
        {
-          int idx;
+          NSInteger idx;

          dateFmt = [sender stringValue];

@@ -118,7 +118,7 @@

 - (void) revert: (id)sender
 {
-  int idx;
+  NSInteger idx;
  NSDateFormatter *fmtr = [[object cell] formatter];

  // If the string typed is a predefined one then highligh it in
Index: Palettes/4Data/DataPalette.m
===================================================================
--- Palettes/4Data/DataPalette.m        (revision 35049)
+++ Palettes/4Data/DataPalette.m        (working copy)
@@ -89,7 +89,7 @@
                [[predefinedNumberFormats objectAtIndex:i] objectAtIndex:2] ];
 }

-+ (int) indexOfFormat: (NSString *) format
++ (NSInteger) indexOfFormat: (NSString *) format
 {
  int i;
  NSString *fmt;
@@ -148,7 +148,7 @@
  return [predefinedDateFormats objectAtIndex: index];
 }

-+ (int) indexOfFormat: (NSString *) format
++ (NSInteger) indexOfFormat: (NSString *) format
 {
  return [predefinedDateFormats indexOfObject: format];
 }


--
Gregory Casamento
Open Logic Corporation, Principal Consultant
yahoo/skype: greg_casamento, aol: gjcasa
(240)274-9630 (Cell)
http://www.gnustep.org
http://heronsperch.blogspot.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]