temporarily disable elisp exception tests
[bpt/guile.git] / libguile / fports.c
index 672f575..8395f0e 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
  *   2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
- *   2014 Free Software Foundation, Inc.
+ *   2014, 2015 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
@@ -33,9 +33,7 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 #ifdef HAVE_IO_H
 #include <io.h>
 #endif
@@ -157,7 +155,7 @@ SCM_DEFINE (scm_setvbuf, "setvbuf", 2, 1, 0,
   int cmode;
   long csize;
   size_t ndrained;
-  char *drained;
+  char *drained = NULL;
   scm_t_port *pt;
   scm_t_ptob_descriptor *ptob;
 
@@ -344,7 +342,8 @@ scm_open_file_with_encoding (SCM filename, SCM mode,
   SCM port;
   int fdes, flags = 0, binary = 0;
   unsigned int retries;
-  char *file, *md, *ptr;
+  char *file;
+  const char *md, *ptr;
 
   if (SCM_UNLIKELY (!(scm_is_false (encoding) || scm_is_string (encoding))))
     scm_wrong_type_arg_msg (FUNC_NAME, 0, encoding,
@@ -355,8 +354,10 @@ scm_open_file_with_encoding (SCM filename, SCM mode,
   file = scm_to_locale_string (filename);
   scm_dynwind_free (file);
 
-  md = scm_to_locale_string (mode);
-  scm_dynwind_free (md);
+  if (SCM_UNLIKELY (!scm_i_try_narrow_string (mode)))
+    scm_out_of_range (FUNC_NAME, mode);
+
+  md = scm_i_string_chars (mode);
 
   switch (*md)
     {