]> git.donarmstrong.com Git - lilypond.git/commitdiff
(Source_file): use copy(). Remove contents_str0()
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 24 Aug 2006 10:31:54 +0000 (10:31 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 24 Aug 2006 10:31:54 +0000 (10:31 +0000)
ChangeLog
lily/include/source-file.hh
lily/source-file.cc

index e482fa5ef0d1a95c7be326b53cb4777483b243ef..f51b12190a3ee542f3d8f91cfca477aa3487a1e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-08-24  Han-Wen Nienhuys  <hanwen@lilypond.org>
+
+       * lily/source-file.cc (Source_file): use copy(). Remove contents_str0()
+
 2006-08-24  Graham Percival  <gpermus@gmail.com>
 
        * Documentation/user/changing-defaults.itely, global.itely,
@@ -5,7 +9,8 @@
 
 2006-08-23  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
-       * buildscripts/mutopia-index.py (allfiles): filter lily-XXX and snippet-map
+       * buildscripts/mutopia-index.py (allfiles):  filter  lily-XXX and
+       snippet-map
 
        * scm/define-context-properties.scm
        (translator-property-description): robustness: detect type errors
index 05fd73359fe4db7b47145602f97249f874fecf58..76942ba6b168f54d2e1b46b31d4693a02147cba4 100644 (file)
@@ -32,7 +32,6 @@ class Source_file
   vector<char> characters_;
   SCM str_port_;
 
-  char const *contents_str0 () const;
   void load_stdin ();
   void init_port ();
   void init ();
index cfa66b628f738d55b2f677d92535e7667a4d4563..186ea1eaf83ff752ad7ab1032eb0dc58e14a1595 100644 (file)
@@ -78,19 +78,13 @@ gulp_file (string filename, int desired_size)
   vector<char> cxx_arr;
   cxx_arr.resize (filesize);
 
-  /* ugh, how to do neatly in STL? */
-  memcpy (&cxx_arr[0], str, filesize);
+
+  copy (str, str + filesize, cxx_arr.begin ());
   
   free (str);
   return cxx_arr;
 }
 
-char const * 
-Source_file::contents_str0 () const
-{
-  return &characters_[0];
-}
-
 void
 Source_file::init ()
 {
@@ -108,10 +102,9 @@ Source_file::Source_file (string filename, string data)
   name_ = filename;
 
   characters_.resize (data.length ());
-  /* ugh, how to do neatly in STL? */
-  memcpy ((&characters_[0]), data.c_str (), data.length ());
-  
+
+  copy (data.begin (), data.end (), characters_.begin ());
+
   init_port ();
 
   for (vsize i = 0; i < characters_.size (); i++)
@@ -143,7 +136,7 @@ Source_file::Source_file (string filename_string)
 void
 Source_file::init_port ()
 {
-  SCM str = scm_makfrom0str (contents_str0 ());
+  SCM str = scm_makfrom0str (c_str ());
   str_port_ = scm_mkstrport (SCM_INUM0, str, SCM_OPN | SCM_RDNG, __FUNCTION__);
   scm_set_port_filename_x (str_port_, scm_makfrom0str (name_.c_str ()));
 }