summaryrefslogtreecommitdiff
path: root/graphics/plotutils/files/patch-libplot_z__write.c
blob: e00bb2ce9625537d09920f0a4814570f87591f68 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
$FreeBSD$

--- libplot/z_write.c.orig	Thu Aug  7 12:40:31 2003
+++ libplot/z_write.c	Thu Aug  7 12:49:08 2003
@@ -83,12 +83,12 @@
   void *error_ptr;
   png_error_ptr error_fn_ptr, warn_fn_ptr;
 #ifdef LIBPLOTTER
-  ostream *stream = _plotter->data->outstream;
-  ostream *errorstream = _plotter->data->errstream;
+  std::ostream *outstream = _plotter->data->outstream;
+  std::ostream *errstream = _plotter->data->errstream;
 #endif
 
 #ifdef LIBPLOTTER
-  if (fp == (FILE *)NULL && stream == (ostream *)NULL)
+  if (fp == (FILE *)NULL && outstream == (std::ostream *)NULL)
     return 0;
 #else
   if (fp == (FILE *)NULL)
@@ -102,11 +102,11 @@
 
   /* work out libpng error handling (i.e. callback functions and data) */
 #ifdef LIBPLOTTER
-  if (errorstream)
+  if (errstream)
     {
       error_fn_ptr = _our_error_fn_stream;
       warn_fn_ptr = _our_warn_fn_stream;
-      error_ptr = (void *)errorstream;
+      error_ptr = (void *)errstream;
     }
   else if (errorfp)
     {
@@ -158,11 +158,11 @@
     }
   
 #ifdef LIBPLOTTER
-  if (stream)
+  if (outstream)
     {
       /* use custom write and flush functions, defined below */
       png_set_write_fn (png_ptr, 
-			(void *)stream,
+			(void *)outstream,
 			(png_rw_ptr)_our_write_fn, 
 			(png_flush_ptr)_our_IO_flush_fn);
     }
@@ -481,28 +481,28 @@
 static void 
 _our_write_fn (png_struct *png_ptr, png_byte *data, png_size_t length)
 {
-  ostream *stream;
+    std::ostream *outstream;
 
-  stream = (ostream *)png_get_io_ptr (png_ptr);
-  stream->write (data, length);
+  outstream = (std::ostream *)png_get_io_ptr (png_ptr);
+  outstream->write ((const char*)data, length);
 }
 
 static void 
 _our_IO_flush_fn (png_struct *png_ptr)
 {
-  ostream *stream;
+    std::ostream *outstream;
 
-  stream = (ostream *)png_get_io_ptr (png_ptr);
-  stream->flush ();
+  outstream = (std::ostream *)png_get_io_ptr (png_ptr);
+  outstream->flush ();
 }
 
 /* custom error and warning handlers (for streams) */
 static void 
 _our_error_fn_stream (png_struct *png_ptr, const char *data)
 {
-  ostream *errstream;
+    std::ostream *errstream;
 
-  errstream = (ostream *)png_get_error_ptr (png_ptr);
+  errstream = (std::ostream *)png_get_error_ptr (png_ptr);
   if (errstream)
     {
 #ifdef PTHREAD_SUPPORT
@@ -526,9 +526,9 @@
 static void 
 _our_warn_fn_stream (png_struct *png_ptr, const char *data)
 {
-  ostream *errstream;
+    std::ostream *errstream;
 
-  errstream = (ostream *)png_get_error_ptr (png_ptr);
+  errstream = (std::ostream *)png_get_error_ptr (png_ptr);
   if (errstream)
     {
 #ifdef PTHREAD_SUPPORT