]> git.eshelyaron.com Git - emacs.git/commitdiff
* frame.c (x_report_frame_params): Port better to wider ints.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 Oct 2012 01:43:28 +0000 (18:43 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 1 Oct 2012 01:43:28 +0000 (18:43 -0700)
Do not assume that EMACS_UINT is the same width as uprintmax_t,
or that pointers can be printed in 15 decimal digits.
Avoid GCC warnings if EMACS_UINT is wider than a pointer.

src/ChangeLog
src/frame.c

index 96f6eb07cd175488cfb6cbbd928a251aceb6e65d..9704c6d44693e899958f19f8d25fbea33cd30877 100644 (file)
@@ -1,3 +1,10 @@
+2012-10-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * frame.c (x_report_frame_params): Port better to wider ints.
+       Do not assume that EMACS_UINT is the same width as uprintmax_t,
+       or that pointers can be printed in 15 decimal digits.
+       Avoid GCC warnings if EMACS_UINT is wider than a pointer.
+
 2012-09-30  Fabrice Popineau  <fabrice.popineau@supelec.fr>
 
        Support x64 build on MS-Windows.
index 33bbe0ad70435f57a7fcd99e0e4f623d18905fa1..0a1277409806f9c04ebeb4dd18efaa7f9e1fb2ab 100644 (file)
@@ -3028,9 +3028,9 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
 void
 x_report_frame_params (struct frame *f, Lisp_Object *alistptr)
 {
-  char buf[16];
   Lisp_Object tem;
-  EMACS_UINT w;
+  uprintmax_t w;
+  char buf[INT_BUFSIZE_BOUND (w)];
 
   /* Represent negative positions (off the top or left screen edge)
      in a way that Fmodify_frame_parameters will understand correctly.  */
@@ -3067,7 +3067,7 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr)
      MS-Windows it returns a value whose type is HANDLE, which is
      actually a pointer.  Explicit casting avoids compiler
      warnings.  */
-  w = (EMACS_UINT) FRAME_X_WINDOW (f);
+  w = (uintptr_t) FRAME_X_WINDOW (f);
   store_in_alist (alistptr, Qwindow_id,
                  make_formatted_string (buf, "%"pMu, w));
 #ifdef HAVE_X_WINDOWS
@@ -3075,7 +3075,7 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr)
   /* Tooltip frame may not have this widget.  */
   if (FRAME_X_OUTPUT (f)->widget)
 #endif
-    w = (EMACS_UINT) FRAME_OUTER_WINDOW (f);
+    w = (uintptr_t) FRAME_OUTER_WINDOW (f);
   store_in_alist (alistptr, Qouter_window_id,
                  make_formatted_string (buf, "%"pMu, w));
 #endif