]> git.donarmstrong.com Git - lilypond.git/blobdiff - lib/simple-file-storage.cc
partial: 1.3.24.jcn
[lilypond.git] / lib / simple-file-storage.cc
index a8e98aaeb83441315c4c40db2b4ee68234260e6f..b7f94acead995dd5a0c99f3b6d364255295c1558 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include <stdio.h>
 #endif
 
 #include "simple-file-storage.hh"
-#include "varray.hh"
+#include "array.hh"
 #include "string.hh"
 #include "warn.hh"
 
 void
 Simple_file_storage::load_stdin ()
 {
-  int data_len = 0;
   len_i_ = 0;
 
   int c;
@@ -42,7 +41,7 @@ Simple_file_storage::load_file (String s)
 
   if (!f)
     {
-      warning (_ ("can't open file `") + s + "'");
+      warning (_f ("Can't open file: `%s'", s));
       return ;
     }
 
@@ -54,8 +53,7 @@ Simple_file_storage::load_file (String s)
   ret = fread (data_p_, sizeof (char), len_i_, f);
 
   if  (ret!=len_i_)
-    warning (_ ("Huh? got ") + String (ret) + _ (", expected ")
-            + String (len_i_) + _ (" characters"));
+    warning (_f ("Huh?  Got %d, expected %d characters", ret, len_i_));
 
   fclose (f);
 }
@@ -67,12 +65,8 @@ Simple_file_storage::load_file (String s)
   Should check IO status
 
   This is of course a build it yourself version of mmap, so we should
-  have been using that... (see Mapped_file_storage) But we noticed
-  some problems with this (unexplained lexer crashes)
-
-  [Some versions later] The crashes aren't caused by the mmap
-  code. But no reason to take it out, is there?  mmap ()
-
+  have been using that..., but this is simple & portable
+  
 */
 
 Simple_file_storage::Simple_file_storage (String s)
@@ -80,7 +74,7 @@ Simple_file_storage::Simple_file_storage (String s)
   data_p_ = 0;
   len_i_ = 0;
 
-  if (!s.length_i ())
+  if (!s.length_i () || (s == "-"))
     load_stdin ();
   else
     load_file (s);