guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.11-92-gae6f7


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.11-92-gae6f77d
Date: Wed, 12 Nov 2014 05:51:37 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=ae6f77ddfaf8e752589d9050c9e517cb1c52cbf0

The branch, stable-2.0 has been updated
       via  ae6f77ddfaf8e752589d9050c9e517cb1c52cbf0 (commit)
       via  81d2c84674f03f9028f26474ab19d3d3f353881a (commit)
       via  fdd319e9bd4121d844662d3d8ccc69b462b60840 (commit)
       via  10679f4c59fcffb0657219e28e38d15df8ad09a0 (commit)
       via  03242f398f3520b1b27caf5885c8d5600094f944 (commit)
       via  fda17c20a3d088fccab1671c8881bd217d83d5f6 (commit)
      from  9c5d6aa9642891e571a7e7a2428c2084fe1058cf (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ae6f77ddfaf8e752589d9050c9e517cb1c52cbf0
Author: Mark H Weaver <address@hidden>
Date:   Wed Nov 12 00:40:47 2014 -0500

    Fix bytevector-fill! to accept fill arguments greater than 127.
    
    Fixes <http://bugs.gnu.org/19027>.
    
    * libguile/bytevectors.c (scm_bytevector_fill_x): Accept fill arguments
      between -128 and 255.
    
    * test-suite/tests/bytevectors.test ("2.2 General Operations"): Add
      tests.

commit 81d2c84674f03f9028f26474ab19d3d3f353881a
Author: Mark H Weaver <address@hidden>
Date:   Wed Nov 12 00:35:34 2014 -0500

    Avoid signed overflow and use size_t in bytevectors.c.
    
    * libguile/bytevectors.c (ULONG_MAX): Remove (unportable) fallback
      definition.  It is no longer used.
      (scm_make_bytevector): Use 'size_t' instead of 'unsigned' for
      indices.  Use 'scm_t_uint8' instead of 'signed char' for elements
      and c_fill.  Previously relied on GNU-C-specific behavior when
      casting integers in the range 128-255 to signed char.
      (GENERIC_INTEGER_ACCESSOR_PROLOGUE, INTEGER_LIST_TO_BYTEVECTOR)
      (scm_bytevector_eq_p, scm_bytevector_copy_x, scm_bytevector_copy)
      (scm_bytevector_to_u8_list, scm_u8_list_to_bytevector)
      (scm_bytevector_fill_x): Use 'size_t' instead of 'unsigned' for
      indices.  Use 'scm_t_uint8' for elements.

commit fdd319e9bd4121d844662d3d8ccc69b462b60840
Author: Mark H Weaver <address@hidden>
Date:   Wed Nov 12 00:19:10 2014 -0500

    Add SCM_VALIDATE_SIZE_COPY and SCM_NUM2SIZE.
    
    * libguile/validate.h (SCM_VALIDATE_SIZE_COPY, SCM_NUM2SIZE): New
      macros.

commit 10679f4c59fcffb0657219e28e38d15df8ad09a0
Author: Mark H Weaver <address@hidden>
Date:   Tue Nov 11 23:14:26 2014 -0500

    Fix bytevector-copy when applied to SRFI-4 homogeneous numeric vectors.
    
    Fixes <http://bugs.gnu.org/18866>.
    Reported by tantalum <address@hidden>.
    
    * libguile/bytevectors.c (scm_bytevector_copy): Always create a VU8
      bytevector.
    
    * test-suite/tests/bytevectors.test: Add test.

commit 03242f398f3520b1b27caf5885c8d5600094f944
Author: Thomas Klausner <address@hidden>
Date:   Thu Oct 30 00:33:39 2014 +0100

    Avoid bash-specific '==' comparison operator in guile.m4.
    
    Fixes <http://bugs.gnu.org/18898>.
    
    * meta/guile.m4 (GUILE_PROGS): Use '=' instead of the bash-specific '=='
      comparison operator in 'test' call.

commit fda17c20a3d088fccab1671c8881bd217d83d5f6
Author: Mark H Weaver <address@hidden>
Date:   Tue Nov 11 22:30:14 2014 -0500

    Fix strerror error handling when given a non-integer argument.
    
    Fixes <http://bugs.gnu.org/18065>.
    Reported and fixed by Glenn Michaels <address@hidden>.
    
    * libguile/error.c (scm_strerror): Convert the argument to a C integer
      outside of the critical section, to avoid deadlock on error.
    * THANKS: Add Glenn Michaels to the fixes section.

-----------------------------------------------------------------------

Summary of changes:
 THANKS                            |    1 +
 libguile/bytevectors.c            |   84 +++++++++++++++++++------------------
 libguile/error.c                  |    9 +++-
 libguile/validate.h               |    7 +++
 meta/guile.m4                     |    2 +-
 test-suite/tests/bytevectors.test |   30 ++++++++++++-
 6 files changed, 85 insertions(+), 48 deletions(-)

diff --git a/THANKS b/THANKS
index 1aeb4a4..d5e8222 100644
--- a/THANKS
+++ b/THANKS
@@ -134,6 +134,7 @@ For fixes or providing information which led to a fix:
             Dan McMahill
           Roger Mc Murtrie
           Scott McPeak
+          Glenn Michaels
          Andrew Milkowski
             Tim Mooney
         Han-Wen Nienhuys
diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index b210440..8f698d5 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009, 2010, 2011, 2012, 2014 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2014 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -43,9 +43,6 @@
 
 #ifdef HAVE_LIMITS_H
 # include <limits.h>
-#else
-/* Assuming 32-bit longs.  */
-# define ULONG_MAX 4294967295UL
 #endif
 
 #include <string.h>
@@ -463,10 +460,10 @@ SCM_DEFINE (scm_make_bytevector, "make-bytevector", 1, 1, 
0,
 #define FUNC_NAME s_scm_make_bytevector
 {
   SCM bv;
-  unsigned c_len;
-  signed char c_fill = '\0';
+  size_t c_len;
+  scm_t_uint8 c_fill = 0;
 
-  SCM_VALIDATE_UINT_COPY (1, len, c_len);
+  SCM_VALIDATE_SIZE_COPY (1, len, c_len);
   if (!scm_is_eq (fill, SCM_UNDEFINED))
     {
       int value;
@@ -474,16 +471,16 @@ SCM_DEFINE (scm_make_bytevector, "make-bytevector", 1, 1, 
0,
       value = scm_to_int (fill);
       if (SCM_UNLIKELY ((value < -128) || (value > 255)))
        scm_out_of_range (FUNC_NAME, fill);
-      c_fill = (signed char) value;
+      c_fill = (scm_t_uint8) value;
     }
 
   bv = make_bytevector (c_len, SCM_ARRAY_ELEMENT_TYPE_VU8);
   if (!scm_is_eq (fill, SCM_UNDEFINED))
     {
-      unsigned i;
-      signed char *contents;
+      size_t i;
+      scm_t_uint8 *contents;
 
-      contents = SCM_BYTEVECTOR_CONTENTS (bv);
+      contents = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bv);
       for (i = 0; i < c_len; i++)
        contents[i] = c_fill;
     }
@@ -510,7 +507,7 @@ SCM_DEFINE (scm_bytevector_eq_p, "bytevector=?", 2, 0, 0,
 #define FUNC_NAME s_scm_bytevector_eq_p
 {
   SCM result = SCM_BOOL_F;
-  unsigned c_len1, c_len2;
+  size_t c_len1, c_len2;
 
   SCM_VALIDATE_BYTEVECTOR (1, bv1);
   SCM_VALIDATE_BYTEVECTOR (2, bv2);
@@ -538,14 +535,19 @@ SCM_DEFINE (scm_bytevector_fill_x, "bytevector-fill!", 2, 
0, 0,
            "Fill bytevector @var{bv} with @var{fill}, a byte.")
 #define FUNC_NAME s_scm_bytevector_fill_x
 {
-  unsigned c_len, i;
-  signed char *c_bv, c_fill;
+  size_t c_len, i;
+  scm_t_uint8 *c_bv, c_fill;
+  int value;
 
   SCM_VALIDATE_BYTEVECTOR (1, bv);
-  c_fill = scm_to_int8 (fill);
+
+  value = scm_to_int (fill);
+  if (SCM_UNLIKELY ((value < -128) || (value > 255)))
+    scm_out_of_range (FUNC_NAME, fill);
+  c_fill = (scm_t_uint8) value;
 
   c_len = SCM_BYTEVECTOR_LENGTH (bv);
-  c_bv = SCM_BYTEVECTOR_CONTENTS (bv);
+  c_bv = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bv);
 
   for (i = 0; i < c_len; i++)
     c_bv[i] = c_fill;
@@ -563,16 +565,16 @@ SCM_DEFINE (scm_bytevector_copy_x, "bytevector-copy!", 5, 
0, 0,
            "@var{target_start}.")
 #define FUNC_NAME s_scm_bytevector_copy_x
 {
-  unsigned c_len, c_source_len, c_target_len;
-  unsigned c_source_start, c_target_start;
+  size_t c_len, c_source_len, c_target_len;
+  size_t c_source_start, c_target_start;
   signed char *c_source, *c_target;
 
   SCM_VALIDATE_BYTEVECTOR (1, source);
   SCM_VALIDATE_BYTEVECTOR (3, target);
 
-  c_len = scm_to_uint (len);
-  c_source_start = scm_to_uint (source_start);
-  c_target_start = scm_to_uint (target_start);
+  c_len = scm_to_size_t (len);
+  c_source_start = scm_to_size_t (source_start);
+  c_target_start = scm_to_size_t (target_start);
 
   c_source = SCM_BYTEVECTOR_CONTENTS (source);
   c_target = SCM_BYTEVECTOR_CONTENTS (target);
@@ -598,7 +600,7 @@ SCM_DEFINE (scm_bytevector_copy, "bytevector-copy", 1, 0, 0,
 #define FUNC_NAME s_scm_bytevector_copy
 {
   SCM copy;
-  unsigned c_len;
+  size_t c_len;
   signed char *c_bv, *c_copy;
 
   SCM_VALIDATE_BYTEVECTOR (1, bv);
@@ -606,7 +608,7 @@ SCM_DEFINE (scm_bytevector_copy, "bytevector-copy", 1, 0, 0,
   c_len = SCM_BYTEVECTOR_LENGTH (bv);
   c_bv = SCM_BYTEVECTOR_CONTENTS (bv);
 
-  copy = make_bytevector (c_len, SCM_BYTEVECTOR_ELEMENT_TYPE (bv));
+  copy = make_bytevector (c_len, SCM_ARRAY_ELEMENT_TYPE_VU8);
   c_copy = SCM_BYTEVECTOR_CONTENTS (copy);
   memcpy (c_copy, c_bv, c_len);
 
@@ -702,15 +704,15 @@ SCM_DEFINE (scm_bytevector_to_u8_list, 
"bytevector->u8-list", 1, 0, 0,
 #define FUNC_NAME s_scm_bytevector_to_u8_list
 {
   SCM lst, pair;
-  unsigned c_len, i;
-  unsigned char *c_bv;
+  size_t c_len, i;
+  scm_t_uint8 *c_bv;
 
   SCM_VALIDATE_BYTEVECTOR (1, bv);
 
   c_len = SCM_BYTEVECTOR_LENGTH (bv);
-  c_bv = (unsigned char *) SCM_BYTEVECTOR_CONTENTS (bv);
+  c_bv = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bv);
 
-  lst = scm_make_list (scm_from_uint (c_len), SCM_UNSPECIFIED);
+  lst = scm_make_list (scm_from_size_t (c_len), SCM_UNSPECIFIED);
   for (i = 0, pair = lst;
        i < c_len;
        i++, pair = SCM_CDR (pair))
@@ -728,13 +730,13 @@ SCM_DEFINE (scm_u8_list_to_bytevector, 
"u8-list->bytevector", 1, 0, 0,
 #define FUNC_NAME s_scm_u8_list_to_bytevector
 {
   SCM bv, item;
-  long c_len, i;
-  unsigned char *c_bv;
+  size_t c_len, i;
+  scm_t_uint8 *c_bv;
 
   SCM_VALIDATE_LIST_COPYLEN (1, lst, c_len);
 
   bv = make_bytevector (c_len, SCM_ARRAY_ELEMENT_TYPE_VU8);
-  c_bv = (unsigned char *) SCM_BYTEVECTOR_CONTENTS (bv);
+  c_bv = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bv);
 
   for (i = 0; i < c_len; lst = SCM_CDR (lst), i++)
     {
@@ -746,7 +748,7 @@ SCM_DEFINE (scm_u8_list_to_bytevector, 
"u8-list->bytevector", 1, 0, 0,
 
          c_item = SCM_I_INUM (item);
          if (SCM_LIKELY ((c_item >= 0) && (c_item < 256)))
-           c_bv[i] = (unsigned char) c_item;
+           c_bv[i] = (scm_t_uint8) c_item;
          else
            goto type_error;
        }
@@ -880,20 +882,20 @@ bytevector_large_set (char *c_bv, size_t c_size, int 
signed_p,
 }
 
 #define GENERIC_INTEGER_ACCESSOR_PROLOGUE(_sign)                       \
-  unsigned long c_len, c_index, c_size;                                        
\
+  size_t c_len, c_index, c_size;                                       \
   char *c_bv;                                                          \
                                                                        \
   SCM_VALIDATE_BYTEVECTOR (1, bv);                                     \
-  c_index = scm_to_ulong (index);                                      \
-  c_size = scm_to_ulong (size);                                                
\
+  c_index = scm_to_size_t (index);                                     \
+  c_size = scm_to_size_t (size);                                       \
                                                                        \
   c_len = SCM_BYTEVECTOR_LENGTH (bv);                                  \
   c_bv = (char *) SCM_BYTEVECTOR_CONTENTS (bv);                                
\
                                                                        \
   /* C_SIZE must have its 3 higher bits set to zero so that            \
-     multiplying it by 8 yields a number that fits in an               \
-     unsigned long.  */                                                        
\
-  if (SCM_UNLIKELY ((c_size == 0) || (c_size >= (ULONG_MAX >> 3L))))   \
+     multiplying it by 8 yields a number that fits in a                        
\
+     size_t.  */                                                       \
+  if (SCM_UNLIKELY (c_size == 0 || c_size >= (SCM_I_SIZE_MAX >> 3)))    \
     scm_out_of_range (FUNC_NAME, size);                                        
\
   if (SCM_UNLIKELY (c_index + c_size > c_len))                         \
     scm_out_of_range (FUNC_NAME, index);
@@ -1157,18 +1159,18 @@ SCM_DEFINE (scm_bytevector_to_uint_list, 
"bytevector->uint-list",
 
 #define INTEGER_LIST_TO_BYTEVECTOR(_sign)                              \
   SCM bv;                                                              \
-  long c_len;                                                          \
+  size_t c_len;                                                                
\
   size_t c_size;                                                       \
   char *c_bv, *c_bv_ptr;                                               \
                                                                        \
   SCM_VALIDATE_LIST_COPYLEN (1, lst, c_len);                           \
   SCM_VALIDATE_SYMBOL (2, endianness);                                 \
-  c_size = scm_to_uint (size);                                         \
+  c_size = scm_to_size_t (size);                                       \
                                                                        \
-  if (SCM_UNLIKELY ((c_size == 0) || (c_size >= (ULONG_MAX >> 3L))))   \
+  if (SCM_UNLIKELY (c_size == 0 || c_size >= (SCM_I_SIZE_MAX >> 3)))    \
     scm_out_of_range (FUNC_NAME, size);                                        
\
                                                                        \
-  bv = make_bytevector (c_len * c_size, SCM_ARRAY_ELEMENT_TYPE_VU8);     \
+  bv = make_bytevector (c_len * c_size, SCM_ARRAY_ELEMENT_TYPE_VU8);    \
   c_bv = (char *) SCM_BYTEVECTOR_CONTENTS (bv);                                
\
                                                                        \
   for (c_bv_ptr = c_bv;                                                        
\
diff --git a/libguile/error.c b/libguile/error.c
index b5565a0..7971046 100644
--- a/libguile/error.c
+++ b/libguile/error.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2004, 2006, 2010,
- *   2012, 2013, 2014 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1998, 2000, 2001, 2004, 2006, 2010, 2012-2014
+ *   Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -121,10 +121,13 @@ SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0,
 #define FUNC_NAME s_scm_strerror
 {
   SCM ret;
+  int errnum = scm_to_int (err);  /* Must be done outside of the
+                                    critical section below, to avoid a
+                                    deadlock on errors.  */
   scm_dynwind_begin (0);
   scm_i_dynwind_pthread_mutex_lock (&scm_i_misc_mutex);
 
-  ret = scm_from_locale_string (strerror (scm_to_int (err)));
+  ret = scm_from_locale_string (strerror (errnum));
 
   scm_dynwind_end ();
   return ret;
diff --git a/libguile/validate.h b/libguile/validate.h
index 0bdc057..3b587cc 100644
--- a/libguile/validate.h
+++ b/libguile/validate.h
@@ -92,6 +92,8 @@
 #define SCM_NUM2ULONG_LONG_DEF(pos, arg, def) \
   (SCM_UNBNDP (arg) ? def : scm_to_ulong_long (arg))
 
+#define SCM_NUM2SIZE(pos, arg) (scm_to_size_t (arg))
+
 #define SCM_NUM2FLOAT(pos, arg) ((float) scm_to_double (arg))
 
 #define SCM_NUM2DOUBLE(pos, arg) (scm_to_double (arg))
@@ -201,6 +203,11 @@
     cvar = SCM_NUM2LONG (pos, k); \
   } while (0)
 
+#define SCM_VALIDATE_SIZE_COPY(pos, k, cvar) \
+  do { \
+    cvar = SCM_NUM2SIZE (pos, k);              \
+  } while (0)
+
 #define SCM_VALIDATE_FLOAT_COPY(pos, k, cvar) \
   do { \
     cvar = SCM_NUM2FLOAT (pos, k); \
diff --git a/meta/guile.m4 b/meta/guile.m4
index 441dcd4..dd3c212 100644
--- a/meta/guile.m4
+++ b/meta/guile.m4
@@ -231,7 +231,7 @@ AC_DEFUN([GUILE_PROGS],
           AC_MSG_ERROR([Guile $_guile_required_version required, but 
$_guile_prog_version found])
         fi
       fi
-    elif test "$GUILE_EFFECTIVE_VERSION" == "$_major_version.$_minor_version" 
-a -z "$_micro_version"; then
+    elif test "$GUILE_EFFECTIVE_VERSION" = "$_major_version.$_minor_version" 
-a -z "$_micro_version"; then
       # Allow prereleases that have the right effective version.
       true
     else
diff --git a/test-suite/tests/bytevectors.test 
b/test-suite/tests/bytevectors.test
index 637d6d4..5b5adb3 100644
--- a/test-suite/tests/bytevectors.test
+++ b/test-suite/tests/bytevectors.test
@@ -1,7 +1,6 @@
 ;;;; bytevectors.test --- R6RS bytevectors. -*- mode: scheme; coding: utf-8; 
-*-
 ;;;;
-;;;; Copyright (C) 2009, 2010, 2011, 2012, 2013,
-;;;;   2014 Free Software Foundation, Inc.
+;;;; Copyright (C) 2009-2014 Free Software Foundation, Inc.
 ;;;;
 ;;;; Ludovic Courtès
 ;;;;
@@ -22,7 +21,8 @@
 (define-module (test-bytevector)
   :use-module (test-suite lib)
   :use-module (system base compile)
-  :use-module (rnrs bytevectors))
+  :use-module (rnrs bytevectors)
+  :use-module (srfi srfi-4))
 
 ;;; Some of the tests in here are examples taken from the R6RS Standard
 ;;; Libraries document.
@@ -46,6 +46,21 @@
          (not (bytevector=? (make-bytevector 20 7)
                             (make-bytevector 20 0)))))
 
+  ;; This failed prior to Guile 2.0.12.
+  ;; See <http://bugs.gnu.org/19027>.
+  (pass-if-equal "bytevector-fill! with fill 255"
+      #vu8(255 255 255 255)
+    (let ((bv (make-bytevector 4)))
+      (bytevector-fill! bv 255)
+      bv))
+
+  ;; This is a Guile-specific extension.
+  (pass-if-equal "bytevector-fill! with fill -128"
+      #vu8(128 128 128 128)
+    (let ((bv (make-bytevector 4)))
+      (bytevector-fill! bv -128)
+      bv))
+
   (pass-if "bytevector-copy! overlapping"
     ;; See <http://debbugs.gnu.org/10070>.
     (let ((b (u8-list->bytevector '(1 2 3 4 5 6 7 8))))
@@ -689,6 +704,15 @@
     (let ((bv (uniform-array->bytevector (make-bitvector 9 #t))))
       (= (bytevector-length bv) 2))))
 
+
+(with-test-prefix "srfi-4 homogeneous numeric vectors as bytevectors"
+
+  ;; This failed prior to Guile 2.0.12.
+  ;; See <http://bugs.gnu.org/18866>.
+  (pass-if-equal "bytevector-copy on srfi-4 arrays"
+      (make-bytevector 8 #xFF)
+    (bytevector-copy (make-u32vector 2 #xFFFFFFFF))))
+
 ;;; Local Variables:
 ;;; eval: (put 'with-test-prefix/c&e 'scheme-indent-function 1)
 ;;; End:


hooks/post-receive
-- 
GNU Guile



reply via email to

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