]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/memory-stream.cc
Run `make grand-replace'.
[lilypond.git] / flower / memory-stream.cc
index 30e2453fa405abe68ea9d3a58989cb59f9e50faf..270438dcae5257286c808657bea047bb91c8a642 100644 (file)
@@ -3,24 +3,24 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
-
+  (c) 2005--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
-#include <assert.h>
-#include <string.h>
-#include <stdlib.h>
+#include <cassert>
+#include <cstring>
+#include <cstdlib>
+using namespace std;
 
 #include "memory-stream.hh"
 
-
 /*
   TODO: add read support as well.
 */
 const int Memory_out_stream::block_size_ = 1024;
 
-cookie_io_functions_t
-Memory_out_stream::functions_ = {
+lily_cookie_io_functions_t
+Memory_out_stream::functions_
+= {
   Memory_out_stream::reader,
   Memory_out_stream::writer,
   Memory_out_stream::seeker,
@@ -30,7 +30,7 @@ Memory_out_stream::functions_ = {
 int
 Memory_out_stream::cleaner (void *cookie)
 {
-  Memory_out_stream *stream = (Memory_out_stream*) cookie;
+  Memory_out_stream *stream = (Memory_out_stream *) cookie;
 
   stream->file_ = 0;
   return 0;
@@ -41,7 +41,11 @@ Memory_out_stream::Memory_out_stream ()
   size_ = 0;
   buffer_ = 0;
   buffer_blocks_ = 0;
-  file_ = fopencookie ((void*) this, "w", functions_);
+  file_ = 0;
+
+#if 0
+  file_ = fopencookie ((void *) this, "w", functions_);
+#endif
 }
 
 Memory_out_stream::~Memory_out_stream ()
@@ -64,7 +68,7 @@ Memory_out_stream::get_length () const
   return size_;
 }
 
-const char *
+char const *
 Memory_out_stream::get_string () const
 {
   return buffer_;
@@ -72,10 +76,10 @@ Memory_out_stream::get_string () const
 
 ssize_t
 Memory_out_stream::writer (void *cookie,
-                          const char *buffer,
+                          char const *buffer,
                           size_t size)
 {
-  Memory_out_stream *stream = (Memory_out_stream*) cookie;
+  Memory_out_stream *stream = (Memory_out_stream *) cookie;
 
   ssize_t newsize = stream->size_ + size;
 
@@ -88,8 +92,8 @@ Memory_out_stream::writer (void *cookie,
     }
 
   if (change)
-    stream->buffer_ = (char*) realloc (stream->buffer_,
-                                      stream->buffer_blocks_ * block_size_);
+    stream->buffer_ = (char *) realloc (stream->buffer_,
+                                       stream->buffer_blocks_ * block_size_);
 
   memcpy (stream->buffer_ + stream->size_, buffer, size);
   stream->size_ = newsize;