emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r105037: Fix warnings in ns*m files:


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105037: Fix warnings in ns*m files: Replace deprecated methods, declare new interfaces.
Date: Fri, 08 Jul 2011 12:04:23 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105037
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Fri 2011-07-08 12:04:23 +0200
message:
  Fix warnings in ns*m files: Replace deprecated methods, declare new 
interfaces. 
  
  * emacs.c: Declare unexec_init_emacs_zone.
  
  * nsfns.m (check_ns_display_info): Cast to long and use %ld in error
  to avoid warning.
  
  * nsimage.m (allocInitFromFile): Don't use deprecated method
  bestRepresentationForDevice on OSX >= 10.6.
  
  * nsmenu.m (fillWithWidgetValue): Don't use depercated method
  sizeToFit on OSX >= 10.2.
  
  * nsselect.m (ns_string_from_pasteboard): Don't use deprecated methods
  cString and lossyCString on OSX >= 10.4
  
  * nsterm.h (MAC_OS_X_VERSION_10_3, MAC_OS_X_VERSION_10_4)
  (MAC_OS_X_VERSION_10_5): Define if not defined.
  (EmacsView, EmacsTooltip): Implements NSWindowDelegate on OSX >= 10.6.
  (EmacsMenu): Implements NSMenuDelegate on OSX >= 10.6.
  (EmacsToolbar): Implements NSToolbarDelegate on OSX >= 10.6.
  
  * nsterm.m (keyDown): Call to wantsToDelayTextChangeNotifications and
  variable firstTime not needed on OSX >= 10.6.
  (setPosition): setFloatValue:knobProportion: is deprecated on OSX
  >= 10.5.  Use setKnobProportion, setDoubleValue.
modified:
  src/ChangeLog
  src/emacs.c
  src/nsfns.m
  src/nsimage.m
  src/nsmenu.m
  src/nsselect.m
  src/nsterm.h
  src/nsterm.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-07-08 08:42:58 +0000
+++ b/src/ChangeLog     2011-07-08 10:04:23 +0000
@@ -1,5 +1,30 @@
 2011-07-08  Jan Djärv  <address@hidden>
 
+       * nsterm.m (keyDown): Call to wantsToDelayTextChangeNotifications and
+       variable firstTime not needed on OSX >= 10.6.
+       (setPosition): setFloatValue:knobProportion: is deprecated on OSX
+       >= 10.5.  Use setKnobProportion, setDoubleValue.
+
+       * nsterm.h (MAC_OS_X_VERSION_10_3, MAC_OS_X_VERSION_10_4)
+       (MAC_OS_X_VERSION_10_5): Define if not defined.
+       (EmacsView, EmacsTooltip): Implements NSWindowDelegate on OSX >= 10.6.
+       (EmacsMenu): Implements NSMenuDelegate on OSX >= 10.6.
+       (EmacsToolbar): Implements NSToolbarDelegate on OSX >= 10.6.
+
+       * nsselect.m (ns_string_from_pasteboard): Don't use deprecated methods
+       cString and lossyCString on OSX >= 10.4
+
+       * nsmenu.m (fillWithWidgetValue): Don't use depercated method
+       sizeToFit on OSX >= 10.2.
+
+       * nsimage.m (allocInitFromFile): Don't use deprecated method
+       bestRepresentationForDevice on OSX >= 10.6.
+
+       * nsfns.m (check_ns_display_info): Cast to long and use %ld in error
+       to avoid warning.
+
+       * emacs.c: Declare unexec_init_emacs_zone.
+
        * nsgui.h: Fix compiler warning about gnulib redefining verify.
 
        * nsselect.m (ns_get_local_selection): Change to extern (Bug#8842).

=== modified file 'src/emacs.c'
--- a/src/emacs.c       2011-06-24 21:25:22 +0000
+++ b/src/emacs.c       2011-07-08 10:04:23 +0000
@@ -129,6 +129,10 @@
   on subsequent starts.  */
 int initialized;
 
+#ifdef DARWIN_OS
+extern void unexec_init_emacs_zone (void);
+#endif
+
 #ifdef DOUG_LEA_MALLOC
 /* Preserves a pointer to the memory allocated that copies that
    static data inside glibc's malloc.  */

=== modified file 'src/nsfns.m'
--- a/src/nsfns.m       2011-07-08 08:11:35 +0000
+++ b/src/nsfns.m       2011-07-08 10:04:23 +0000
@@ -162,7 +162,7 @@
       struct terminal *t = get_terminal (frame, 1);
 
       if (t->type != output_ns)
-        error ("Terminal %d is not a Nextstep display", XINT (frame));
+        error ("Terminal %ld is not a Nextstep display", (long) XINT (frame));
 
       return t->display_info.ns;
     }

=== modified file 'src/nsimage.m'
--- a/src/nsimage.m     2011-01-25 04:08:28 +0000
+++ b/src/nsimage.m     2011-07-08 10:04:23 +0000
@@ -189,7 +189,11 @@
   image = [[EmacsImage alloc] initByReferencingFile:
                      [NSString stringWithUTF8String: SDATA (found)]];
 
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 
MAC_OS_X_VERSION_10_6
+  imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]];
+#else
   imgRep = [image bestRepresentationForDevice: nil];
+#endif
   if (imgRep == nil)
     {
       [image release];

=== modified file 'src/nsmenu.m'
--- a/src/nsmenu.m      2011-07-08 08:11:35 +0000
+++ b/src/nsmenu.m      2011-07-08 10:04:23 +0000
@@ -695,9 +695,11 @@
   if ([[self window] isVisible])
     [self sizeToFit];
 #else
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_2
   if ([self supermenu] == nil)
     [self sizeToFit];
 #endif
+#endif
 }
 
 

=== modified file 'src/nsselect.m'
--- a/src/nsselect.m    2011-07-08 08:11:35 +0000
+++ b/src/nsselect.m    2011-07-08 10:04:23 +0000
@@ -352,16 +352,22 @@
       utfStr = [mstr UTF8String];
       length = [mstr lengthOfBytesUsingEncoding: NSUTF8StringEncoding];
 
+#if ! defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < 
MAC_OS_X_VERSION_10_4
       if (!utfStr) 
         {
           utfStr = [mstr cString];
           length = strlen (utfStr);
         }
+#endif
     }
   NS_HANDLER
     {
       message1 ("ns_string_from_pasteboard: UTF8String failed\n");
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 
MAC_OS_X_VERSION_10_4
+      utfStr = "Conversion failed";
+#else
       utfStr = [str lossyCString];
+#endif
       length = strlen (utfStr);
     }
   NS_ENDHANDLER

=== modified file 'src/nsterm.h'
--- a/src/nsterm.h      2011-07-08 08:11:35 +0000
+++ b/src/nsterm.h      2011-07-08 10:04:23 +0000
@@ -26,10 +26,19 @@
 #ifdef HAVE_NS
 
 #ifdef NS_IMPL_COCOA
+#ifndef MAC_OS_X_VERSION_10_3
+#define MAC_OS_X_VERSION_10_3 1030
+#endif
+#ifndef MAC_OS_X_VERSION_10_4
+#define MAC_OS_X_VERSION_10_4 1040
+#endif
+#ifndef MAC_OS_X_VERSION_10_5
+#define MAC_OS_X_VERSION_10_5 1050
+#endif
 #ifndef MAC_OS_X_VERSION_10_6
 #define MAC_OS_X_VERSION_10_6 1060
 #endif
-#endif
+#endif /* NS_IMPL_COCOA */
 
 #ifdef __OBJC__
 
@@ -61,7 +70,11 @@
 
 @class EmacsToolbar;
 
address@hidden EmacsView : NSView <NSTextInput> /* 10.6+: NSWindowDelegate */
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 
MAC_OS_X_VERSION_10_6
address@hidden EmacsView : NSView <NSTextInput, NSWindowDelegate>
+#else
address@hidden EmacsView : NSView <NSTextInput>
+#endif
    {
    char *old_title;
    BOOL windowClosing;
@@ -112,7 +125,11 @@
 
    ========================================================================== 
*/
 
address@hidden EmacsMenu : NSMenu  /* 10.6+: <NSMenuDelegate> */
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 
MAC_OS_X_VERSION_10_6
address@hidden EmacsMenu : NSMenu  <NSMenuDelegate>
+#else
address@hidden EmacsMenu : NSMenu
+#endif
 {
   struct frame *frame;
   unsigned long keyEquivModMask;
@@ -139,7 +156,11 @@
 
 @class EmacsImage;
 
address@hidden EmacsToolbar : NSToolbar  /* 10.6+: <NSToolbarDelegate> */
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 
MAC_OS_X_VERSION_10_6
address@hidden EmacsToolbar : NSToolbar <NSToolbarDelegate>
+#else
address@hidden EmacsToolbar : NSToolbar
+#endif
    {
      EmacsView *emacsView;
      NSMutableDictionary *identifierToItem;
@@ -182,7 +203,11 @@
 - (Lisp_Object)runDialogAt: (NSPoint)p;
 @end
 
address@hidden EmacsTooltip : NSObject  /* 10.6+: <NSWindowDelegate> */
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 
MAC_OS_X_VERSION_10_6
address@hidden EmacsTooltip : NSObject <NSWindowDelegate>
+#else
address@hidden EmacsTooltip : NSObject
+#endif
   {
     NSWindow *win;
     NSTextField *textField;

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2011-07-08 08:11:35 +0000
+++ b/src/nsterm.m      2011-07-08 10:04:23 +0000
@@ -4515,7 +4515,9 @@
   unsigned fnKeysym = 0;
   int flags;
   static NSMutableArray *nsEvArray;
+#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < 
MAC_OS_X_VERSION_10_6
   static BOOL firstTime = YES;
+#endif
   int left_is_none;
 
   NSTRACE (keyDown);
@@ -4703,13 +4705,15 @@
         }
     }
 
+  
+#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < 
MAC_OS_X_VERSION_10_6
   /* if we get here we should send the key for input manager processing */
   if (firstTime && [[NSInputManager currentInputManager]
                      wantsToDelayTextChangeNotifications] == NO)
     fprintf (stderr,
           "Emacs: WARNING: TextInput mgr wants marked text to be 
permanent!\n");
   firstTime = NO;
-
+#endif
   if (NS_KEYLOG && !processingCompose)
     fprintf (stderr, "keyDown: Begin compose sequence.\n");
 
@@ -6066,14 +6070,26 @@
   em_whole = whole;
 
   if (portion >= whole)
-    [self setFloatValue: 0.0 knobProportion: 1.0];
+    {
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > 
MAC_OS_X_VERSION_10_5
+      [self setKnobProportion: 1.0];
+      [self setDoubleValue: 1.0];
+#else
+      [self setFloatValue: 0.0 knobProportion: 1.0];
+#endif
+    }
   else
     {
       float pos, por;
       portion = max ((float)whole*min_portion/pixel_height, portion);
       pos = (float)position / (whole - portion);
       por = (float)portion/whole;
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > 
MAC_OS_X_VERSION_10_5
+      [self setKnobProportion: por];
+      [self setDoubleValue: pos];
+#else
       [self setFloatValue: pos knobProportion: por];
+#endif
     }
   return self;
 }


reply via email to

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