Merge branch 'stable-2.0'
[bpt/guile.git] / libguile / r6rs-ports.c
index c6ad90a..fc67689 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009, 2010, 2011, 2013 Free Software Foundation, Inc.
+/* Copyright (C) 2009, 2010, 2011, 2013, 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
@@ -216,10 +216,14 @@ cbp_seek (SCM port, scm_t_off offset, int whence)
          result = scm_call_0 (get_position_proc);
        else
          scm_wrong_type_arg_msg (FUNC_NAME, 0, port,
-                                 "R6RS custom binary port does not "
-                                 "support `port-position'");
-
-       offset += scm_to_int (result);
+                                 "R6RS custom binary port with "
+                                 "`port-position' support");
+       c_result = scm_to_int (result);
+       if (offset == 0)
+         /* We just want to know the current position.  */
+         break;
+
+       offset += c_result;
        /* Fall through.  */
       }
 
@@ -232,8 +236,7 @@ cbp_seek (SCM port, scm_t_off offset, int whence)
          result = scm_call_1 (set_position_proc, scm_from_int (offset));
        else
          scm_wrong_type_arg_msg (FUNC_NAME, 0, port,
-                                 "R6RS custom binary port does not "
-                                 "support `set-port-position!'");
+                                 "seekable R6RS custom binary port");
 
        /* Assuming setting the position succeeded.  */
        c_result = offset;
@@ -1181,6 +1184,8 @@ initialize_transcoded_ports (void)
   scm_set_port_close (transcoded_port_type, tp_close);
 }
 
+SCM_INTERNAL SCM scm_i_make_transcoded_port (SCM);
+
 SCM_DEFINE (scm_i_make_transcoded_port,
            "%make-transcoded-port", 1, 0, 0,
            (SCM port),