emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108648: Fix recently-introduced p


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r108648: Fix recently-introduced process.c problems found by static checking.
Date: Fri, 02 Nov 2012 01:46:00 -0000
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108648
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2012-06-17 23:58:00 -0700
message:
  Fix recently-introduced process.c problems found by static checking.
  
  * process.c (write_queue_push, write_queue_pop, send_process):
  Use ptrdiff_t, not int or EMACS_INT, for buffer lengths and offsets.
  (write_queue_pop): Fix pointer signedness problem.
  (send_process): Remove unused local.
modified:
  src/ChangeLog
  src/process.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-06-17 10:11:39 +0000
+++ b/src/ChangeLog     2012-06-18 06:58:00 +0000
@@ -1,3 +1,11 @@
+2012-06-18  Paul Eggert  <address@hidden>
+
+       Fix recently-introduced process.c problems found by static checking.
+       * process.c (write_queue_push, write_queue_pop, send_process):
+       Use ptrdiff_t, not int or EMACS_INT, for buffer lengths and offsets.
+       (write_queue_pop): Fix pointer signedness problem.
+       (send_process): Remove unused local.
+
 2012-06-17  Chong Yidong  <address@hidden>
 
        * xdisp.c (redisplay_internal): No need to redisplay terminal

=== modified file 'src/process.c'
--- a/src/process.c     2012-06-17 09:00:37 +0000
+++ b/src/process.c     2012-06-18 06:58:00 +0000
@@ -5393,9 +5393,9 @@
 
 static void
 write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
-                  const char *buf, int len, int front)
+                  const char *buf, ptrdiff_t len, int front)
 {
-  EMACS_INT offset;
+  ptrdiff_t offset;
   Lisp_Object entry, obj;
 
   if (STRINGP (input_obj))
@@ -5423,10 +5423,10 @@
 
 static int
 write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
-                const char **buf, EMACS_INT *len)
+                const char **buf, ptrdiff_t *len)
 {
   Lisp_Object entry, offset_length;
-  EMACS_INT offset;
+  ptrdiff_t offset;
 
   if (NILP (p->write_queue))
     return 0;
@@ -5439,7 +5439,7 @@
 
   *len = XINT (XCDR (offset_length));
   offset = XINT (XCAR (offset_length));
-  *buf = SDATA (*obj) + offset;
+  *buf = SSDATA (*obj) + offset;
 
   return 1;
 }
@@ -5584,7 +5584,7 @@
 
       do   /* while !NILP (p->write_queue) */
        {
-         EMACS_INT cur_len = -1;
+         ptrdiff_t cur_len = -1;
          const char *cur_buf;
          Lisp_Object cur_object;
 
@@ -5653,8 +5653,6 @@
                       that may allow the program
                       to finish doing output and read more.  */
                    {
-                     ptrdiff_t offset = 0;
-
 #ifdef BROKEN_PTY_READ_AFTER_EAGAIN
                      /* A gross hack to work around a bug in FreeBSD.
                         In the following sequence, read(2) returns
@@ -5680,15 +5678,14 @@
                        }
 #endif /* BROKEN_PTY_READ_AFTER_EAGAIN */
 
-                     /* Put what we should have written in
-                        wait_queue */
+                     /* Put what we should have written in wait_queue.  */
                      write_queue_push (p, cur_object, cur_buf, cur_len, 1);
 #ifdef EMACS_HAS_USECS
                      wait_reading_process_output (0, 20000, 0, 0, Qnil, NULL, 
0);
 #else
                      wait_reading_process_output (1, 0, 0, 0, Qnil, NULL, 0);
 #endif
-                     /* reread queue, to see what is left */
+                     /* Reread queue, to see what is left.  */
                      break;
                    }
                  else


reply via email to

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