guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 01/02: Fix ports bug when size_t is 32 bits


From: Andy Wingo
Subject: [Guile-commits] 01/02: Fix ports bug when size_t is 32 bits
Date: Sat, 18 Jun 2016 11:16:52 +0000 (UTC)

wingo pushed a commit to branch master
in repository guile.

commit 0c1ee6eae63bf6ea5e516569d1c6ead4afde39f2
Author: Andy Wingo <address@hidden>
Date:   Sat Jun 18 13:08:12 2016 +0200

    Fix ports bug when size_t is 32 bits
    
    * libguile/ports.c (scm_end_input): I am a complete idiot.  I had no
      idea that `- (uint32_t) x' is actually still a uint32_t.
---
 libguile/ports.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libguile/ports.c b/libguile/ports.c
index 2694dcf..858dd01 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -2307,12 +2307,14 @@ scm_end_input (SCM port)
 {
   SCM buf;
   size_t discarded;
+  scm_t_off offset;
 
   buf = SCM_PORT (port)->read_buf;
   discarded = scm_port_buffer_take (buf, NULL, (size_t) -1);
+  offset = - (scm_t_off) discarded;
 
-  if (discarded != 0)
-    SCM_PORT_TYPE (port)->seek (port, -discarded, SEEK_CUR);
+  if (offset != 0)
+    SCM_PORT_TYPE (port)->seek (port, offset, SEEK_CUR);
 }
 
 SCM_DEFINE (scm_force_output, "force-output", 0, 1, 0,



reply via email to

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