diff --git a/src/dbusbind.c b/src/dbusbind.c
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1247,7 +1247,7 @@
   CHECK_STRING (service);
   GCPRO3 (bus, serial, service);
 
-  XD_DEBUG_MESSAGE ("%d %s ", XUINT (serial), SDATA (service));
+  XD_DEBUG_MESSAGE ("%ld %s ", XUINT (serial), SDATA (service));
 
   /* Open a connection to the bus.  */
   connection = xd_initialize (bus);
@@ -1341,7 +1341,7 @@
   CHECK_STRING (service);
   GCPRO3 (bus, serial, service);
 
-  XD_DEBUG_MESSAGE ("%d %s ", XUINT (serial), SDATA (service));
+  XD_DEBUG_MESSAGE ("%ld %s ", XUINT (serial), SDATA (service));
 
   /* Open a connection to the bus.  */
   connection = xd_initialize (bus);
diff --git a/src/font.c b/src/font.c
--- a/src/font.c
+++ b/src/font.c
@@ -1357,7 +1357,7 @@
     {
       f[XLFD_AVGWIDTH_INDEX] = alloca (11);
       len += sprintf (f[XLFD_AVGWIDTH_INDEX],
-		      "%d", XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1;
+		      "%ld", XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1;
     }
   else
     f[XLFD_AVGWIDTH_INDEX] = "*", len += 2;
@@ -1673,7 +1673,7 @@
     }
 
   if (INTEGERP (AREF (font, FONT_DPI_INDEX)))
-    len += sprintf (work, ":dpi=%d", XINT (AREF (font, FONT_DPI_INDEX)));
+    len += sprintf (work, ":dpi=%ld", XINT (AREF (font, FONT_DPI_INDEX)));
   if (INTEGERP (AREF (font, FONT_SPACING_INDEX)))
     len += strlen (":spacing=100");
   if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX)))
@@ -1686,7 +1686,7 @@
       if (STRINGP (val))
 	len += SBYTES (val);
       else if (INTEGERP (val))
-	len += sprintf (work, "%d", XINT (val));
+	len += sprintf (work, "%ld", XINT (val));
       else if (SYMBOLP (val))
 	len += (NILP (val) ? 5 : 4); /* for "false" or "true" */
     }
@@ -1713,9 +1713,9 @@
       p += sprintf (p, ":%s=%s", style_names[i],
 		    SDATA (SYMBOL_NAME (styles[i])));
   if (INTEGERP (AREF (font, FONT_DPI_INDEX)))
-    p += sprintf (p, ":dpi=%d", XINT (AREF (font, FONT_DPI_INDEX)));
+    p += sprintf (p, ":dpi=%ld", XINT (AREF (font, FONT_DPI_INDEX)));
   if (INTEGERP (AREF (font, FONT_SPACING_INDEX)))
-    p += sprintf (p, ":spacing=%d", XINT (AREF (font, FONT_SPACING_INDEX)));
+    p += sprintf (p, ":spacing=%ld", XINT (AREF (font, FONT_SPACING_INDEX)));
   if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX)))
     {
       if (XINT (AREF (font, FONT_AVGWIDTH_INDEX)) == 0)
diff --git a/src/nsfns.m b/src/nsfns.m
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1772,7 +1772,7 @@
 {
   check_ns ();
 #ifdef NS_IMPL_COCOA
-  PSFlush ();
+  /*PSFlush ();*/
 #endif
   /*ns_delete_terminal (dpyinfo->terminal); */
   [NSApp terminate: NSApp];
diff --git a/src/nsfont.m b/src/nsfont.m
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -245,7 +245,10 @@
 	    return w;
       }
 #endif
-    w = [sfont widthOfString: cstr];
+    NSDictionary *attrsDictionary =
+      [NSDictionary dictionaryWithObject:sfont
+		    forKey:NSFontAttributeName];
+    w = [cstr sizeWithAttributes:attrsDictionary].width;
     return max (w, 2.0);
 }
 
diff --git a/src/nsgui.h b/src/nsgui.h
--- a/src/nsgui.h
+++ b/src/nsgui.h
@@ -129,12 +129,13 @@
 } XRectangle;
 
 #ifndef __OBJC__
-typedef struct _NSPoint { float x, y; } NSPoint;
-typedef struct _NSSize  { float width, height; } NSSize;
+typedef double CGFloat;
+typedef struct _NSPoint { CGFloat x, y; } NSPoint;
+typedef struct _NSSize  { CGFloat width, height; } NSSize;
 typedef struct _NSRect  { NSPoint origin; NSSize size; } NSRect;
 #endif
 
-#define NativeRectangle struct _NSRect
+#define NativeRectangle NSRect
 
 #define CONVERT_TO_XRECT(xr, nr)		\
   ((xr).x     = (nr).origin.x,			\
diff --git a/src/nsterm.m b/src/nsterm.m
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1481,7 +1481,7 @@
      Convert a color to a lisp string with the RGB equivalent
    -------------------------------------------------------------------------- */
 {
-  float red, green, blue, alpha, gray;
+  CGFloat red, green, blue, alpha, gray;
   char buf[1024];
   const char *str;
   NSTRACE (ns_color_to_lisp);
@@ -1523,7 +1523,7 @@
          and set color_def pixel to the resulting index.
    -------------------------------------------------------------------------- */
 {
-  float r, g, b, a;
+  CGFloat r, g, b, a;
 
   [((NSColor *)col) getRed: &r green: &g blue: &b alpha: &a];
   color_def->red   = r * 65535;
@@ -5833,15 +5833,18 @@
   em_portion = portion;
   em_whole = whole;
 
-  if (portion >= whole)
-    [self setFloatValue: 0.0 knobProportion: 1.0];
+  if (portion >= whole) {
+    [self setDoubleValue: 0.0];
+    [self setKnobProportion: 1.0];
+  }
   else
     {
       float pos, por;
       portion = max ((float)whole*min_portion/pixel_height, portion);
       pos = (float)position / (whole - portion);
       por = (float)portion/whole;
-      [self setFloatValue: pos knobProportion: por];
+      [self setDoubleValue: pos];
+      [self setKnobProportion: por];
     }
 #ifdef NS_IMPL_GNUSTEP
   [self display];
@@ -5946,7 +5949,7 @@
     case NSScrollerKnobSlot:  /* GNUstep-only */
       last_hit_part = scroll_bar_move_ratio; break;
     default:  /* NSScrollerNoPart? */
-      fprintf (stderr, "EmacsScoller-mouseDown: unexpected part %d\n", part);
+      fprintf (stderr, "EmacsScoller-mouseDown: unexpected part %ld\n", part);
       return;
     }
 
diff --git a/src/process.c b/src/process.c
--- a/src/process.c
+++ b/src/process.c
@@ -1522,7 +1522,7 @@
 	    insert_string ("?");
 	  if (INTEGERP (speed))
 	    {
-	      sprintf (tembuf, " at %d b/s", XINT (speed));
+	      sprintf (tembuf, " at %ld b/s", XINT (speed));
 	      insert_string (tembuf);
 	    }
 	  insert_string (")\n");

