gnustep-dev
[Top][All Lists]
Advanced

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

-gui warning cleanups


From: Alexander Malmberg
Subject: -gui warning cleanups
Date: Thu, 20 Jan 2005 16:00:48 +0100
User-agent: Mozilla Thunderbird 0.9 (X11/20041124)

Newer versions of gcc are getting ever pickier, and combined with some sloppy code that's piled up over time, the warning situation in GNUstep has been gotten pretty bad lately. Thus, I've made a pass over -gui and -back fixed warnings and other minor issues.

I've attached the patch for -gui. At lot of it is fairly obvious stuff, but there are also some parts I'm less happy about (e.g. adding tons of initializations to get rid of "might be used uninitialized" warnings: I've checked all these cases, though, and they're ok in the sense that nothing will be used uninitialized on valid input).

I still think this is worth committing; if there are issues with the code, I think it's better to track it by filing bugs or adding TODO comments than to keep a warning around to remind you. However, I'll wait a while before committing to see if anyone objects to any particular cleanup.

(There's also a matching patch for -back, but it doesn't really contain anything interesting, so I'll just commit it when I commit this.)

Many of the warnings only appear on recent versions of gcc (4.0 snapshots, or maybe 3.4). Some big contributors are:

* unsigned/signed pointer differences, e.g. passing a 'char *' to a method that wants an 'unsigned char *'.

* Uninitialized structure fields. E.g. in
""
  struct {int x;} foo;
  printf("%i\n",foo.x);
""
gcc is now clever enough to warn.

* Stricter method signature checking. E.g. before this patch. we had a mix of "-(BOOL) validateMenuItem: (NSMenuItem *)" and "-(BOOL) validateMenuItem: (id<NSMenuItem>)". Most of the remaining warnings are caused by this. In particular, -compare: causes lots of warnings, as does "-initWithIdentifier:", and many NSNotificationCenter methods (which have slightly different declarations in NSDistributedNotificationCenter).

- Alexander Malmberg

ChangeLog:
2005-01-19 15:11  Alexander Malmberg  <address@hidden>

        Various whitespace cleanups, comment type fixes, and changes
        to avoid warnings from recent versions of gcc.

        * Headers/Additions/GNUstepGUI/GSToolbar.h (-_toolbars): Declare.
        * Source/NSWindow+Toolbar.m: Remove conflicting declaration of
        [NSToolbar -_toolbars].

        * Headers/Additions/GNUstepGUI/GSServicesManager.h,
        Source/GSServicesMananger.m (-item2title:, -validateMenuItem:):
        Adjust argument types.
        * Headers/AppKit/NSMenu.h (-validateMenuItem:): Adjust argument
        type.

        * Source/NSTextView.m (-sizeToFit): Don't use size uninitialized
        if neither resizable flags is set.
        (-insertText:): Adjust argument type.
* Headers/AppKit/NSResponder.h, Source/NSResponder.m (-insertText:):
        Adjust argument type. Document.

* Headers/AppKit/NSView.h: Change type of ivar _window to NSWindow *.

        * Source/GSTitleView.m (-mouseDown:): Always initialize
        startWindowOrigin.
        * Source/NSApplication.m (-setApplicationIconImage:): Add casts
        to avoid warnings.
        * Source/NSCell.m (-cellSize): Add default: case.
        * Source/NSPasteboard.m
([GSFiltered -pasteboard:provideDataForType:]): Detect and warn if we
        can't find a filter that will get us the desired type.
* Source/NSProgressIndicator.m: Comment out unused variable 'images'. * Source/NSBezierPath.m: Declare GSBezierPath fully before using it. (-bezierPathByFlatteningPath, -bezierPathByReversingPath): Make sure
        variables are always initialized.

        * Source/NSMenuView.m,
        * Source/NSPrintOperation.m,
        * Source/NSSplitView.m,
        * Source/NSTableHeaderView.m: Make sure variables are always
        initialized.

        * Source/NSBox.m,
        * Source/NSImageview.m,
        * Source/NSText.m,
        * Source/NSTextStorage.m: Add missing includes.

        * Source/GSKeyBindingTable.m,
        * Source/GSLayoutManager.m,
        * Source/NSBitmapImageRep+PNM.m,
        * Source/NSBundleAdditions.m,
        * Source/NSLayoutManager.m,
        * Source/nsimage-tiff.h,
        * Source/tiff.m,
        * Headers/Additions/GNUstepGUI/GSDisplayServer.h,
        * Source/GSDisplayServer.m: Change signedness of various variables.

        * Source/NSPanel.m (-sendEvent:): Remove.
        * Source/NSWindow.m (-becomesKeyOnlyIfNeeded): New method.
        (-_sendEvent:becomesKeyOnlyIfNeeded:): Remove. Move code ...
        (-sendEvent:): ... here. Use -becomesKeyOnlyIfNeeded instead
        of the argument.
Index: Headers/Additions/GNUstepGUI/GSDisplayServer.h
===================================================================
RCS file: 
/cvsroot/gnustep/gnustep/core/gui/Headers/Additions/GNUstepGUI/GSDisplayServer.h,v
retrieving revision 1.4
diff -u -r1.4 GSDisplayServer.h
--- Headers/Additions/GNUstepGUI/GSDisplayServer.h      10 Nov 2004 17:12:57 
-0000      1.4
+++ Headers/Additions/GNUstepGUI/GSDisplayServer.h      20 Jan 2005 13:20:18 
-0000
@@ -150,7 +150,8 @@
 - (void) hidecursor;
 - (void) showcursor;
 - (void) standardcursor: (int) style : (void**) cid;
-- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int) colors : (const 
char*) image : (void**) cid;
+- (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int) colors
+                   : (const unsigned char *) image : (void**) cid;
 - (void) setcursorcolor: (NSColor *)fg : (NSColor *)bg : (void*) cid;
 
 @end
Index: Headers/Additions/GNUstepGUI/GSServicesManager.h
===================================================================
RCS file: 
/cvsroot/gnustep/gnustep/core/gui/Headers/Additions/GNUstepGUI/GSServicesManager.h,v
retrieving revision 1.2
diff -u -r1.2 GSServicesManager.h
--- Headers/Additions/GNUstepGUI/GSServicesManager.h    11 Feb 2004 16:34:17 
-0000      1.2
+++ Headers/Additions/GNUstepGUI/GSServicesManager.h    20 Jan 2005 13:20:18 
-0000
@@ -33,12 +33,12 @@
 @class NSArray;
 @class NSDate;
 @class NSMenu;
address@hidden  NSMenuItem;
 @class NSMutableArray;
 @class NSMutableDictionary;
 @class NSMutableSet;
 @class NSString;
 @class NSTimer;
address@hidden NSMenuItem;
 
 @interface      GSServicesManager : NSObject
 {
@@ -70,7 +70,7 @@
 - (void) doService: (NSMenuItem*)item;
 - (NSArray*) filters;
 - (BOOL) hasRegisteredTypes: (NSDictionary*)service;
-- (NSString*) item2title: (NSMenuItem*)item;
+- (NSString*) item2title: (id<NSMenuItem>)item;
 - (void) loadServices;
 - (NSDictionary*) menuServices;
 - (void) rebuildServices;
@@ -84,7 +84,7 @@
 - (void) setServicesProvider: (id)anObject;
 - (int) setShowsServicesMenuItem: (NSString*)item to: (BOOL)enable;
 - (BOOL) showsServicesMenuItem: (NSString*)item;
-- (BOOL) validateMenuItem: (NSMenuItem*)item;
+- (BOOL) validateMenuItem: (id<NSMenuItem>)item;
 - (void) updateServicesMenu;
 @end
 
Index: Headers/Additions/GNUstepGUI/GSToolbar.h
===================================================================
RCS file: 
/cvsroot/gnustep/gnustep/core/gui/Headers/Additions/GNUstepGUI/GSToolbar.h,v
retrieving revision 1.6
diff -u -r1.6 GSToolbar.h
--- Headers/Additions/GNUstepGUI/GSToolbar.h    7 Jul 2004 21:25:42 -0000       
1.6
+++ Headers/Additions/GNUstepGUI/GSToolbar.h    20 Jan 2005 13:20:18 -0000
@@ -112,6 +112,11 @@
 - (void) setUsesStandardBackgroundColor: (BOOL)standard;
 - (NSToolbarSizeMode) sizeMode;
 
+
+// Private class method
+
++ (NSMutableArray *) _toolbars;
+
 @end /* interface of NSToolbar */
 
 /*
Index: Headers/AppKit/NSEvent.h
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Headers/AppKit/NSEvent.h,v
retrieving revision 1.1
diff -u -r1.1 NSEvent.h
--- Headers/AppKit/NSEvent.h    31 Jul 2003 23:52:08 -0000      1.1
+++ Headers/AppKit/NSEvent.h    20 Jan 2005 13:20:18 -0000
@@ -192,14 +192,14 @@
 
 + (NSPoint)mouseLocation;
 
-+ (NSEvent*) otherEventWithType: (NSEventType)type     
++ (NSEvent*) otherEventWithType: (NSEventType)type
                       location: (NSPoint)location
                  modifierFlags: (unsigned int)flags
                      timestamp: (NSTimeInterval)time
-                  windowNumber: (int)windowNum 
-                       context: (NSGraphicsContext*)context    
-                       subtype: (short)subType 
-                         data1: (int)data1     
+                  windowNumber: (int)windowNum
+                       context: (NSGraphicsContext*)context
+                       subtype: (short)subType
+                         data1: (int)data1
                          data2: (int)data2;
 
 + (void) startPeriodicEventsAfterDelay: (NSTimeInterval)delaySeconds
Index: Headers/AppKit/NSMenu.h
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Headers/AppKit/NSMenu.h,v
retrieving revision 1.2
diff -u -r1.2 NSMenu.h
--- Headers/AppKit/NSMenu.h     11 Nov 2004 19:52:24 -0000      1.2
+++ Headers/AppKit/NSMenu.h     20 Jan 2005 13:20:18 -0000
@@ -564,7 +564,7 @@
 
 #ifndef        NO_GNUSTEP
 @interface NSObject (NSMenuActionResponder)
-- (BOOL) validateMenuItem: (NSMenuItem*)aMenuItem;
+- (BOOL) validateMenuItem: (id<NSMenuItem>)aMenuItem;
 @end
 
 /**
Index: Headers/AppKit/NSResponder.h
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Headers/AppKit/NSResponder.h,v
retrieving revision 1.1
diff -u -r1.1 NSResponder.h
--- Headers/AppKit/NSResponder.h        31 Jul 2003 23:52:08 -0000      1.1
+++ Headers/AppKit/NSResponder.h        20 Jan 2005 13:20:18 -0000
@@ -49,7 +49,7 @@
   NSResponder          *_next_responder;
 
   /*
-  Due to interface brain-damage, but NSResponder and NSMenuView have -menu
+  Due to interface brain-damage, both NSResponder and NSMenuView have -menu
   and -setMenu: methods, but for different menus. Thus, to prevent (future,
   there have already been some) problems and confusion, this ivar is
   private (iow, it can't be accidentally used in NSMenuView).
@@ -144,7 +144,18 @@
 - (BOOL) performMnemonic: (NSString*)aString;
 - (void) flushBufferedKeyEvents;
 - (void) doCommandBySelector: (SEL)aSelector;
-- (void) insertText: (NSString*)aString;
+
+/** <p>Tells the receiver to insert the given string. In a text view
+    the text is typically inserted at the insertion point, and replaces
+    any selection.
+    </p><p>
+    Subclasses should override this method. The implementation in
+    NSResponder just sends the message on to the next responder.
+    </p><p>
+    Normally, aString will be an NSString, but in some cases, it might
+    be an NSAttributedString.
+    </p>  */
+- (void) insertText: (id)aString;
 - (NSUndoManager*) undoManager;
 
 /*
Index: Headers/AppKit/NSView.h
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Headers/AppKit/NSView.h,v
retrieving revision 1.3
diff -u -r1.3 NSView.h
--- Headers/AppKit/NSView.h     8 Mar 2004 13:56:56 -0000       1.3
+++ Headers/AppKit/NSView.h     20 Jan 2005 13:20:18 -0000
@@ -98,7 +98,7 @@
 
   NSView* _super_view;
   NSMutableArray *_sub_views;
-  id _window;
+  NSWindow *_window;
   NSMutableArray *_tracking_rects;
   NSMutableArray *_cursor_rects;
   NSRect _invalidRect;
Index: Source/GSDisplayServer.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/GSDisplayServer.m,v
retrieving revision 1.25
diff -u -r1.25 GSDisplayServer.m
--- Source/GSDisplayServer.m    10 Nov 2004 17:12:57 -0000      1.25
+++ Source/GSDisplayServer.m    20 Jan 2005 13:20:18 -0000
@@ -767,7 +767,7 @@
     device representation that can be used later to make this cursor
     the current one */
 - (void) imagecursor: (NSPoint)hotp : (int)w : (int)h : (int) colors 
-                   : (const char*) image : (void**) cid
+                   : (const unsigned char *) image : (void**) cid
 {
   [self subclassResponsibility: _cmd];
 }
Index: Source/GSKeyBindingTable.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/GSKeyBindingTable.m,v
retrieving revision 1.5
diff -u -r1.5 GSKeyBindingTable.m
--- Source/GSKeyBindingTable.m  13 Jun 2003 15:01:10 -0000      1.5
+++ Source/GSKeyBindingTable.m  20 Jan 2005 13:20:18 -0000
@@ -45,7 +45,7 @@
 - (void) bindKey: (id)key  toAction: (id)action
 {
   unichar character;
-  int modifiers;
+  unsigned int modifiers;
   GSKeyBindingAction *a = nil;
   GSKeyBindingTable *t = nil;
   BOOL isTable = NO;
Index: Source/GSLayoutManager.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/GSLayoutManager.m,v
retrieving revision 1.41
diff -u -r1.41 GSLayoutManager.m
--- Source/GSLayoutManager.m    10 Aug 2004 00:08:42 -0000      1.41
+++ Source/GSLayoutManager.m    20 Jan 2005 13:20:19 -0000
@@ -691,7 +691,7 @@
        isValidIndex: (BOOL *)isValidIndex
 {
   glyph_run_t *r;
-  int pos;
+  unsigned int pos;
 
   *isValidIndex = NO;
 
@@ -803,7 +803,7 @@
 - (unsigned int) characterIndexForGlyphAtIndex: (unsigned int)glyphIndex
 {
   glyph_run_t *r;
-  int pos, cpos;
+  unsigned int pos, cpos;
 
   if (glyphs->glyph_length <= glyphIndex)
     {
@@ -1421,7 +1421,7 @@
 
 #define GET_GLYPH \
        glyph_run_t *r; \
-       int pos, cpos; \
+       unsigned int pos, cpos; \
 \
        if (glyphs->glyph_length <= idx) \
        { \
Index: Source/GSServicesManager.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/GSServicesManager.m,v
retrieving revision 1.57
diff -u -r1.57 GSServicesManager.m
--- Source/GSServicesManager.m  27 Sep 2004 15:53:04 -0000      1.57
+++ Source/GSServicesManager.m  20 Jan 2005 13:20:19 -0000
@@ -672,7 +672,7 @@
  *      contains the full title of the service.
  *      Return nil if this is not one of our service menu items.
  */
-- (NSString*) item2title: (NSMenuItem*)item
+- (NSString*) item2title: (id<NSMenuItem>)item
 {
   unsigned      pos;
 
@@ -1132,7 +1132,7 @@
   return NO;
 }
 
-- (BOOL) validateMenuItem: (NSMenuItem*)item
+- (BOOL) validateMenuItem: (id<NSMenuItem>)item
 {
   NSString      *title = [self item2title: item];
   NSDictionary  *info = [_title2info objectForKey: title];
Index: Source/GSTitleView.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/GSTitleView.m,v
retrieving revision 1.8
diff -u -r1.8 GSTitleView.m
--- Source/GSTitleView.m        7 Jun 2004 23:54:06 -0000       1.8
+++ Source/GSTitleView.m        20 Jan 2005 13:20:19 -0000
@@ -281,10 +281,7 @@
   NSDebugLLog (@"NSMenu", @"Mouse down in title!");
 
   // Remember start position of window
-  if (_ownedByMenu)
-    {
-      startWindowOrigin = [_window frame].origin;
-    }
+  startWindowOrigin = [_window frame].origin;
 
   // Remember start location of cursor in window
   lastLocation = [theEvent locationInWindow];
Index: Source/NSApplication.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSApplication.m,v
retrieving revision 1.271
diff -u -r1.271 NSApplication.m
--- Source/NSApplication.m      18 Jan 2005 14:45:31 -0000      1.271
+++ Source/NSApplication.m      20 Jan 2005 13:20:20 -0000
@@ -1870,7 +1870,7 @@
 
   if (_app_icon_window != nil)
     {
-      [[_app_icon_window contentView] setImage: anImage];
+      [(NSAppIconView *)[_app_icon_window contentView] setImage: anImage];
     }
 
   // Swap the old image for the new one wherever it's used
Index: Source/NSBezierPath.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSBezierPath.m,v
retrieving revision 1.33
diff -u -r1.33 NSBezierPath.m
--- Source/NSBezierPath.m       11 Jan 2005 22:53:08 -0000      1.33
+++ Source/NSBezierPath.m       20 Jan 2005 13:20:20 -0000
@@ -56,13 +56,36 @@
 static float default_miter_limit = 10.0;
 
 @interface NSBezierPath (PrivateMethods)
-
 - (void)_invalidateCache;
 - (void)_recalculateBounds;
address@hidden
+
+
+typedef struct _PathElement
+{
+  NSBezierPathElement type;
+  NSPoint points[3];
+} PathElement;
+
+//#define GSUNION_TYPES GSUNION_OBJ
+#define GSI_ARRAY_TYPES       0
+#define GSI_ARRAY_TYPE PathElement
+
+#define GSI_ARRAY_NO_RETAIN
+#define GSI_ARRAY_NO_RELEASE
+
+#ifdef GSIArray
+#undef GSIArray
+#endif
+#include <GNUstepBase/GSIArray.h>
 
address@hidden GSBezierPath : NSBezierPath
+{
+  GSIArray pathElements;
+  BOOL flat;
+}
 @end
 
address@hidden GSBezierPath;
 
 @implementation NSBezierPath
 
@@ -541,6 +564,10 @@
   int i, count;
   BOOL first = YES;
 
+  /* Silence compiler warnings.  */
+  p = NSZeroPoint;
+  last_p = NSZeroPoint;
+
   count = [self elementCount];
   for(i = 0; i < count; i++) 
     {
@@ -566,10 +593,10 @@
              coeff[1] = pts[0];
              coeff[2] = pts[1];
              coeff[3] = pts[2];
-             flatten(coeff, [self flatness], path);
+             flatten(coeff, [self flatness], path);
              p = pts[2];
              if (first)
-               {
+               {
                  last_p = pts[2];
                  first = NO;
                }
@@ -595,6 +622,9 @@
   int i, j, count;
   BOOL closed = NO;
 
+  /* Silence compiler warnings.  */
+  p = NSZeroPoint;
+
   last_type = NSMoveToBezierPathElement;
   count = [self elementCount];
   for(i = count - 1; i >= 0; i--) 
@@ -1778,32 +1808,6 @@
 @end
 
 
-typedef struct _PathElement
-{
-  NSBezierPathElement type;
-  NSPoint points[3];
-} PathElement;
-
-//#define GSUNION_TYPES GSUNION_OBJ
-#define GSI_ARRAY_TYPES       0
-#define GSI_ARRAY_TYPE PathElement
-
-#define GSI_ARRAY_NO_RETAIN
-#define GSI_ARRAY_NO_RELEASE
-
-#ifdef GSIArray
-#undef GSIArray
-#endif
-#include <GNUstepBase/GSIArray.h>
-
address@hidden GSBezierPath : NSBezierPath
-{
-  GSIArray pathElements;
-  BOOL flat;
-}
-
address@hidden
-
 @implementation GSBezierPath
 
 - (id)init
Index: Source/NSBitmapImageRep+PNM.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSBitmapImageRep+PNM.m,v
retrieving revision 1.1
diff -u -r1.1 NSBitmapImageRep+PNM.m
--- Source/NSBitmapImageRep+PNM.m       7 Jan 2004 23:53:15 -0000       1.1
+++ Source/NSBitmapImageRep+PNM.m       20 Jan 2005 13:20:20 -0000
@@ -76,7 +76,8 @@
 {
   int num, xsize, ysize, levels;
   char ptype;
-  char buffer[256], *pchar;
+  char buffer[256];
+  unsigned char *pchar;
   unsigned length;
   id colorspace;
   const char *ptr;
Index: Source/NSBox.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSBox.m,v
retrieving revision 1.38
diff -u -r1.38 NSBox.m
--- Source/NSBox.m      29 Feb 2004 00:11:51 -0000      1.38
+++ Source/NSBox.m      20 Jan 2005 13:20:21 -0000
@@ -36,6 +36,7 @@
 #include "AppKit/NSColor.h"
 #include "AppKit/NSGraphics.h"
 #include "AppKit/NSTextFieldCell.h"
+#include "AppKit/NSWindow.h"
 #include "GNUstepGUI/GSDrawFunctions.h"
 
 #include <math.h>
Index: Source/NSBundleAdditions.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSBundleAdditions.m,v
retrieving revision 1.62
diff -u -r1.62 NSBundleAdditions.m
--- Source/NSBundleAdditions.m  29 Jun 2004 03:04:28 -0000      1.62
+++ Source/NSBundleAdditions.m  20 Jan 2005 13:20:21 -0000
@@ -168,7 +168,7 @@
          const char    *nam = [_tag cString];
          const char    *type;
          unsigned int  size;
-         unsigned int  offset;
+         int   offset;
 
          /*
           * Use the GNUstep additional function to set the instance
Index: Source/NSCell.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSCell.m,v
retrieving revision 1.166
diff -u -r1.166 NSCell.m
--- Source/NSCell.m     18 Jan 2005 15:48:34 -0000      1.166
+++ Source/NSCell.m     20 Jan 2005 13:20:21 -0000
@@ -1556,6 +1556,7 @@
          }
        break;
 
+      default:
       case NSNullCellType:
        //  macosx instead returns a 'very big size' here; we return NSZeroSize
        s = NSZeroSize;
Index: Source/NSImageView.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSImageView.m,v
retrieving revision 1.13
diff -u -r1.13 NSImageView.m
--- Source/NSImageView.m        2 Feb 2004 21:40:00 -0000       1.13
+++ Source/NSImageView.m        20 Jan 2005 13:20:22 -0000
@@ -30,6 +30,7 @@
 #include "AppKit/NSImageCell.h"
 #include "AppKit/NSImageView.h"
 #include "AppKit/NSPasteboard.h"
+#include "AppKit/NSWindow.h"
 
 /*
  * Class variables
Index: Source/NSLayoutManager.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSLayoutManager.m,v
retrieving revision 1.93
diff -u -r1.93 NSLayoutManager.m
--- Source/NSLayoutManager.m    11 Nov 2004 14:10:08 -0000      1.93
+++ Source/NSLayoutManager.m    20 Jan 2005 13:20:23 -0000
@@ -419,7 +419,7 @@
 {
   NSRect *r;
   NSRect result;
-  int i, c;
+  unsigned int i, c;
 
 /* TODO: This isn't correct. Need to handle glyphs that extend outside the
 line frag rect. */
@@ -1139,7 +1139,7 @@
   unsigned int glyph_pos, char_pos, first_char_pos;
   int i, j;
   NSRect *rects;
-  int count;
+  unsigned int count;
   NSColor *color, *last_color;
 
   NSGraphicsContext *ctxt = GSCurrentContext();
@@ -1303,7 +1303,7 @@
 #define GBUF_SIZE 16 /* TODO: tweak */
   NSGlyph gbuf[GBUF_SIZE];
   int gbuf_len, gbuf_size;
-  NSPoint gbuf_point;
+  NSPoint gbuf_point = NSZeroPoint;
 
   NSView *controlView = nil;
 
@@ -2158,7 +2158,7 @@
        { /* before before */
        }
 
-      /* If there are text views attached to use, let them handle the
+      /* If there are text views attached to us, let them handle the
       change. */
       if ([self firstTextView])
        [[self firstTextView] setSelectedRange: newRange];
Index: Source/NSMenuView.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSMenuView.m,v
retrieving revision 1.103
diff -u -r1.103 NSMenuView.m
--- Source/NSMenuView.m 24 Sep 2004 10:54:18 -0000      1.103
+++ Source/NSMenuView.m 20 Jan 2005 13:20:23 -0000
@@ -1284,7 +1284,7 @@
   NSRect       currentFrame;
   NSRect       originalFrame;
   NSPoint      currentTopLeft;
-  NSPoint      originalTopLeft;
+  NSPoint      originalTopLeft = NSZeroPoint; /* Silence compiler.  */
   BOOL          restorePosition;
   /*
    * Only for non transient menus do we want
Index: Source/NSPanel.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSPanel.m,v
retrieving revision 1.51
diff -u -r1.51 NSPanel.m
--- Source/NSPanel.m    9 Jul 2004 00:06:39 -0000       1.51
+++ Source/NSPanel.m    20 Jan 2005 13:20:23 -0000
@@ -164,11 +164,5 @@
   return self;
 }
 
-
-- (void) sendEvent: (NSEvent*)theEvent
-{
-  [self _sendEvent: theEvent
-    becomesKeyOnlyIfNeeded: _becomesKeyOnlyIfNeeded];
-}
-
 @end /* NSPanel */
+
Index: Source/NSPasteboard.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSPasteboard.m,v
retrieving revision 1.60
diff -u -r1.60 NSPasteboard.m
--- Source/NSPasteboard.m       9 Nov 2004 17:57:45 -0000       1.60
+++ Source/NSPasteboard.m       20 Jan 2005 13:20:24 -0000
@@ -688,6 +688,7 @@
        * Locate the filter information needed, including the type we are
        * converting from and the name of the filter to use.
        */
+      info = nil;
       filters = [[GSServicesManager manager] filters];
       count = [filters count];
       while (fromType == nil && filterNumber < count)
@@ -713,6 +714,11 @@
                }
            }
        }
+      if (!info)
+       {
+         NSWarnMLog(@"Unable to provide data of type '%@'.", type);
+         return;
+       }
     }
 
   mechanism = [info objectForKey: @"NSInputMechanism"];
Index: Source/NSPrintOperation.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSPrintOperation.m,v
retrieving revision 1.33
diff -u -r1.33 NSPrintOperation.m
--- Source/NSPrintOperation.m   10 Jul 2004 10:19:34 -0000      1.33
+++ Source/NSPrintOperation.m   20 Jan 2005 13:20:24 -0000
@@ -94,8 +94,8 @@
                              xpage: (int *)xptr
                              ypage: (int *)yptr;
 - (NSRect) _adjustPagesFirst: (int)first 
-                                         last: (int)last 
-                                         info: (page_info_t *)info;
+                       last: (int)last
+                       info: (page_info_t *)info;
 - (void) _print;
 @end
 
@@ -832,7 +832,7 @@
 {
   int i, xpage, ypage;
   double hlimit, wlimit;
-  NSRect pageRect;
+  NSRect pageRect = NSZeroRect; /* Silence compiler warning.  */
   hlimit = [_view heightAdjustLimit];
   wlimit = [_view widthAdjustLimit];
   for (i = first; i <= last; i++)
Index: Source/NSProgressIndicator.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSProgressIndicator.m,v
retrieving revision 1.14
diff -u -r1.14 NSProgressIndicator.m
--- Source/NSProgressIndicator.m        7 Jun 2004 23:54:12 -0000       1.14
+++ Source/NSProgressIndicator.m        20 Jan 2005 13:20:24 -0000
@@ -33,7 +33,7 @@
 
 static NSColor *fillColour = nil;
 #define maxCount 1
-static NSImage *images[maxCount];
+//static NSImage *images[maxCount];
 
 + (void) initialize
 {
Index: Source/NSResponder.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSResponder.m,v
retrieving revision 1.38
diff -u -r1.38 NSResponder.m
--- Source/NSResponder.m        21 Oct 2004 21:01:36 -0000      1.38
+++ Source/NSResponder.m        20 Jan 2005 13:20:24 -0000
@@ -156,7 +156,7 @@
     }
 }
 
-- (void) insertText: (NSString*)aString
+- (void) insertText: (id)aString
 {
   if (_next_responder)
     [_next_responder insertText: aString];
Index: Source/NSSlider.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSSlider.m,v
retrieving revision 1.29
diff -u -r1.29 NSSlider.m
--- Source/NSSlider.m   13 Jun 2003 15:01:12 -0000      1.29
+++ Source/NSSlider.m   20 Jan 2005 13:20:24 -0000
@@ -32,7 +32,7 @@
 #include "AppKit/NSWindow.h"
 #include "AppKit/NSApplication.h"
 
-static inline 
+static inline
 float _floatValueForMousePoint (NSPoint point, NSRect knobRect,
                                NSRect slotRect, BOOL isVertical, 
                                float minValue, float maxValue, 
Index: Source/NSSpellChecker.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSSpellChecker.m,v
retrieving revision 1.20
diff -u -r1.20 NSSpellChecker.m
--- Source/NSSpellChecker.m     1 Jun 2004 05:50:57 -0000       1.20
+++ Source/NSSpellChecker.m     20 Jan 2005 13:20:24 -0000
@@ -325,7 +325,7 @@
               ignoredWords: nil
               wordCount: &count
               countOnly: YES];
-  
+
   return count;
 }
 
Index: Source/NSSplitView.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSSplitView.m,v
retrieving revision 1.55
diff -u -r1.55 NSSplitView.m
--- Source/NSSplitView.m        14 May 2004 20:44:50 -0000      1.55
+++ Source/NSSplitView.m        20 Jan 2005 13:20:24 -0000
@@ -126,6 +126,10 @@
       return;
     }
 
+  /* Silence compiler warnings.  */
+  r1 = NSZeroRect;
+  bigRect = NSZeroRect;
+
   vis = [self visibleRect];
 
   /* find out which divider it is */
Index: Source/NSTableHeaderView.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSTableHeaderView.m,v
retrieving revision 1.28
diff -u -r1.28 NSTableHeaderView.m
--- Source/NSTableHeaderView.m  30 Dec 2003 12:42:37 -0000      1.28
+++ Source/NSTableHeaderView.m  20 Jan 2005 13:20:26 -0000
@@ -547,7 +547,7 @@
          NSDate *distantFuture = [NSDate distantFuture];
          NSRect visibleRect = [self visibleRect];
          NSRect tvRect;
-         NSRect highlightRect, oldRect;
+         NSRect highlightRect = NSZeroRect, oldRect = NSZeroRect;
          BOOL outside = NO;
          BOOL lit = NO;
        
Index: Source/NSText.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSText.m,v
retrieving revision 1.102
diff -u -r1.102 NSText.m
--- Source/NSText.m     13 Jun 2003 15:01:12 -0000      1.102
+++ Source/NSText.m     20 Jan 2005 13:20:26 -0000
@@ -36,10 +36,10 @@
 */
 
 #include "AppKit/NSText.h"
-//#include "AppKit/NSTextView.h"
address@hidden NSTextView;
-#include "AppKit/NSSpellChecker.h"
+
 #include "AppKit/NSPanel.h"
+#include "AppKit/NSSpellChecker.h"
+#include "AppKit/NSTextView.h"
 
 
 static Class   abstract;
Index: Source/NSTextStorage.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSTextStorage.m,v
retrieving revision 1.27
diff -u -r1.27 NSTextStorage.m
--- Source/NSTextStorage.m      15 Feb 2004 18:23:13 -0000      1.27
+++ Source/NSTextStorage.m      20 Jan 2005 13:20:26 -0000
@@ -29,11 +29,10 @@
 #include "AppKit/NSAttributedString.h"
 #include "AppKit/NSTextStorage.h"
 #include "GNUstepGUI/GSLayoutManager.h"
+#include "GSTextStorage.h"
 
 @implementation NSTextStorage
 
address@hidden  GSTextStorage;
-
 static Class   abstract;
 static Class   concrete;
 
Index: Source/NSTextView.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSTextView.m,v
retrieving revision 1.164
diff -u -r1.164 NSTextView.m
--- Source/NSTextView.m 18 Jan 2005 13:18:29 -0000      1.164
+++ Source/NSTextView.m 20 Jan 2005 13:20:26 -0000
@@ -674,7 +674,7 @@
 
       if ([aDecoder containsValueForKey: @"NSTVFlags"])
         {
-         int vFlags = [aDecoder decodeIntForKey: @"NSTVFlags"];
+         //int vFlags = [aDecoder decodeIntForKey: @"NSTVFlags"];
          // FIXME set the flags
        }
       if ([aDecoder containsValueForKey: @"NSSharedData"])
@@ -1492,26 +1492,25 @@
   if (!_layoutManager)
     return;
 
+  size = _bounds.size;
+
   if (_tf.is_horizontally_resizable || _tf.is_vertically_resizable)
     {
       NSRect r = [_layoutManager usedRectForTextContainer: _textContainer];
+      NSSize s2;
       if (_textContainer == [_layoutManager extraLineFragmentTextContainer])
        {
          r = NSUnionRect(r, [_layoutManager extraLineFragmentUsedRect]);
        }
 
-      size = NSMakeSize(NSMaxX(r), NSMaxY(r));
-    }
-  
-  if (!_tf.is_horizontally_resizable)
-    size.width = _bounds.size.width;
-  else
-    size.width += 2 * _textContainerInset.width;
+      s2 = NSMakeSize(NSMaxX(r), NSMaxY(r));
 
-  if (!_tf.is_vertically_resizable)
-    size.height = _bounds.size.height;
-  else
-    size.height += 2 * _textContainerInset.height;
+      if (_tf.is_horizontally_resizable)
+       size.width = s2.width + 2 * _textContainerInset.width;
+
+      if (_tf.is_vertically_resizable)
+       size.height = s2.height + 2 * _textContainerInset.height;
+    }
 
   [self setConstrainedFrameSize: size];
 }
@@ -1728,11 +1727,11 @@
 
 /* insertString may actually be an NSAttributedString. If it is, and the
 text view isn't rich-text, we ignore the attributes and use the typing
-attributed.
+attributes.
 
 This method is for user changes; see NSTextView_actions.m.
 */
--(void) insertText: (NSString *)insertString
+-(void) insertText: (id)insertString
 {
   NSRange insertRange = [self rangeForUserTextChange];
   NSString *string;
Index: Source/NSWindow+Toolbar.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSWindow+Toolbar.m,v
retrieving revision 1.8
diff -u -r1.8 NSWindow+Toolbar.m
--- Source/NSWindow+Toolbar.m   27 Jul 2004 15:15:29 -0000      1.8
+++ Source/NSWindow+Toolbar.m   20 Jan 2005 13:20:26 -0000
@@ -35,7 +35,6 @@
 
 
 @interface NSToolbar (GNUstepPrivate)
-+ (NSArray *) _toolbars;
 - (GSToolbarView *) _toolbarView;
 - (void) _setWindow: (NSWindow *)window;
 - (NSWindow *) _window;
Index: Source/NSWindow.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/NSWindow.m,v
retrieving revision 1.321
diff -u -r1.321 NSWindow.m
--- Source/NSWindow.m   18 Jan 2005 16:04:40 -0000      1.321
+++ Source/NSWindow.m   20 Jan 2005 13:20:28 -0000
@@ -2915,11 +2915,15 @@
   // Quietly discard an unused mouse down.
 }
 
+- (BOOL) becomesKeyOnlyIfNeeded
+{
+  return NO;
+}
+
 /** Handles mouse and other events sent to the receiver by NSApplication.
     Do not invoke this method directly.
 */
-- (void) _sendEvent: (NSEvent*)theEvent
-       becomesKeyOnlyIfNeeded: (BOOL)becomesKeyOnlyIfNeeded
+- (void) sendEvent: (NSEvent*)theEvent
 {
   NSView       *v;
   NSEventType  type;
@@ -2955,7 +2959,8 @@
              if (_f.is_key == NO && _windowLevel != NSDesktopWindowLevel)
                {
                  /* NSPanel modification: check becomesKeyOnlyIfNeeded. */
-                 if (!becomesKeyOnlyIfNeeded || [v needsPanelToBecomeKey])
+                 if (![self becomesKeyOnlyIfNeeded]
+                     || [v needsPanelToBecomeKey])
                    [self makeKeyAndOrderFront: self];
                }
              /* Activate the app *after* making the receiver key, as app
@@ -3035,13 +3040,13 @@
        switch (type)
          {
            case NSLeftMouseDragged:
-              [_lastView mouseDragged: theEvent];
+             [_lastView mouseDragged: theEvent];
              break;
            case NSOtherMouseDragged:
-              [_lastView otherMouseDragged: theEvent];
+             [_lastView otherMouseDragged: theEvent];
              break;
            case NSRightMouseDragged:
-             [_lastView rightMouseDragged: theEvent];
+             [_lastView rightMouseDragged: theEvent];
              break;
            default:
              if (_f.accepts_mouse_moved)
@@ -3417,15 +3422,6 @@
     }
 }
 
-/** Handles mouse and other events sent to the receiver by NSApplication.
-    Do not invoke this method directly.
-*/
-- (void) sendEvent: (NSEvent*)theEvent
-{
-  [self _sendEvent: theEvent
-    becomesKeyOnlyIfNeeded: NO];
-}
-
 
 - (BOOL) tryToPerform: (SEL)anAction with: (id)anObject
 {
Index: Source/nsimage-tiff.h
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/nsimage-tiff.h,v
retrieving revision 1.1
diff -u -r1.1 nsimage-tiff.h
--- Source/nsimage-tiff.h       31 Jul 2003 23:52:10 -0000      1.1
+++ Source/nsimage-tiff.h       20 Jan 2005 13:20:28 -0000
@@ -69,8 +69,8 @@
 extern int   NSTiffClose(TIFF* image);
 
 extern int   NSTiffGetImageCount(TIFF* image);
-extern int   NSTiffWrite(TIFF* image, NSTiffInfo* info, char* data);
-extern int   NSTiffRead(TIFF* image, NSTiffInfo* info, char* data);
+extern int   NSTiffWrite(TIFF *image, NSTiffInfo *info, unsigned char *data);
+extern int   NSTiffRead(TIFF *image, NSTiffInfo *info, unsigned char *data);
 extern NSTiffInfo* NSTiffGetInfo(int imageNumber, TIFF* image);
 
 extern NSTiffColormap* NSTiffGetColormap(TIFF* image);
Index: Source/tiff.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/tiff.m,v
retrieving revision 1.30
diff -u -r1.30 tiff.m
--- Source/tiff.m       18 Sep 2004 13:16:55 -0000      1.30
+++ Source/tiff.m       20 Jan 2005 13:20:28 -0000
@@ -334,7 +334,7 @@
    direct color images. Thus the data array should be large 
    enough to hold this information. */
 int
-NSTiffRead(TIFF* image, NSTiffInfo* info, char* data)
+NSTiffRead(TIFF *image, NSTiffInfo *info, unsigned char *data)
 {
   int     i;
   unsigned int row, col;
@@ -443,7 +443,7 @@
        }
 
 int  
-NSTiffWrite(TIFF* image, NSTiffInfo* info, char* data)
+NSTiffWrite(TIFF *image, NSTiffInfo *info, unsigned char *data)
 {
   tdata_t      buf = (tdata_t)data;
   uint16        sample_info[2];

reply via email to

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