[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 49/58: r6rs-ports: Accept 'port-position' values greater
From: |
Andy Wingo |
Subject: |
[Guile-commits] 49/58: r6rs-ports: Accept 'port-position' values greater than 2^32. |
Date: |
Tue, 7 Aug 2018 06:58:38 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 0075b7f4dc2aaad157e866ec7be91ac9f6362b93
Author: Ludovic Courtès <address@hidden>
Date: Thu Jul 19 17:45:54 2018 +0200
r6rs-ports: Accept 'port-position' values greater than 2^32.
Reported by Ricardo Wurmus <address@hidden>.
Fixes <https://bugs.gnu.org/32161>.
* libguile/r6rs-ports.c (custom_binary_port_seek): Use 'scm_to_off_t'
instead of 'scm_to_int'.
* test-suite/tests/r6rs-ports.test ("8.2.7 Input Ports")["custom binary
input port position, long offset"]: New test.
---
libguile/r6rs-ports.c | 2 +-
test-suite/tests/r6rs-ports.test | 12 +++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/libguile/r6rs-ports.c b/libguile/r6rs-ports.c
index 5677305..0e90848 100644
--- a/libguile/r6rs-ports.c
+++ b/libguile/r6rs-ports.c
@@ -225,7 +225,7 @@ custom_binary_port_seek (SCM port, scm_t_off offset, int
whence)
scm_wrong_type_arg_msg (FUNC_NAME, 0, port,
"R6RS custom binary port with "
"`port-position' support");
- c_result = scm_to_int (result);
+ c_result = scm_to_off_t (result);
if (offset == 0)
/* We just want to know the current position. */
break;
diff --git a/test-suite/tests/r6rs-ports.test b/test-suite/tests/r6rs-ports.test
index ba3131f..e6ee10a 100644
--- a/test-suite/tests/r6rs-ports.test
+++ b/test-suite/tests/r6rs-ports.test
@@ -1,6 +1,6 @@
;;;; r6rs-ports.test --- R6RS I/O port tests. -*- coding: utf-8; -*-
;;;;
-;;;; Copyright (C) 2009-2012, 2013-2015 Free Software Foundation, Inc.
+;;;; Copyright (C) 2009-2012, 2013-2015, 2018 Free Software Foundation, Inc.
;;;; Ludovic Courtès
;;;;
;;;; This library is free software; you can redistribute it and/or
@@ -498,6 +498,16 @@ not `set-port-position!'"
(u8-list->bytevector
(map char->integer (string->list "Port!")))))))
+ (pass-if-equal "custom binary input port position, long offset"
+ (expt 2 42)
+ ;; In Guile <= 2.2.4, 'seek' would throw to 'out-of-range'.
+ (let* ((port (make-custom-binary-input-port "the port"
+ (const 0)
+ (const (expt 2 42))
+ #f #f)))
+ (port-position port)))
+
+
(pass-if-equal "custom binary input port buffered partial reads"
"Hello Port!"
;; Check what happens when READ! returns less than COUNT bytes.
- [Guile-commits] 41/58: linker: Don't rely on out-of-range bv-ref exceptions., (continued)
- [Guile-commits] 41/58: linker: Don't rely on out-of-range bv-ref exceptions., Andy Wingo, 2018/08/07
- [Guile-commits] 40/58: GDB support: Add 'guile-backtrace' command., Andy Wingo, 2018/08/07
- [Guile-commits] 27/58: Make module autoloading thread-safe., Andy Wingo, 2018/08/07
- [Guile-commits] 51/58: compile: Improve error message., Andy Wingo, 2018/08/07
- [Guile-commits] 28/58: vm: Fix typo when checking for 'madvise' error code., Andy Wingo, 2018/08/07
- [Guile-commits] 30/58: doc: Fix typo., Andy Wingo, 2018/08/07
- [Guile-commits] 36/58: vm: Fix another typo., Andy Wingo, 2018/08/07
- [Guile-commits] 32/58: tests: Adjust i18n.test to 'fr_FR.utf8' locale in glibc 2.27., Andy Wingo, 2018/08/07
- [Guile-commits] 39/58: GDB support: Add note about (gdb frame-filters)., Andy Wingo, 2018/08/07
- [Guile-commits] 31/58: doc: Document (ice-9 match) macros., Andy Wingo, 2018/08/07
- [Guile-commits] 49/58: r6rs-ports: Accept 'port-position' values greater than 2^32.,
Andy Wingo <=
- [Guile-commits] 45/58: Update NEWS., Andy Wingo, 2018/08/07
- [Guile-commits] 58/58: Add missing include to adapt to recent merge from master, Andy Wingo, 2018/08/07
- [Guile-commits] 53/58: r6rs-ports: 'put-bytevector' accepts 64-bit integers., Andy Wingo, 2018/08/07
- [Guile-commits] 47/58: Update release docs., Andy Wingo, 2018/08/07
- [Guile-commits] 42/58: vm: Fix stack-marking bug in multi-threaded programs., Andy Wingo, 2018/08/07
- [Guile-commits] 52/58: compile: Update copyright year., Andy Wingo, 2018/08/07
- [Guile-commits] 25/58: Add SRFI 71: Extended LET-syntax for multiple values., Andy Wingo, 2018/08/07
- [Guile-commits] 37/58: types: Recognize 'scm_t_port_type' and decode port type name., Andy Wingo, 2018/08/07
- [Guile-commits] 48/58: Make srfi-71 visible through 'cond-expand'., Andy Wingo, 2018/08/07
- [Guile-commits] 46/58: build: Really build srfi/srfi-71.scm., Andy Wingo, 2018/08/07