Submitted By:            Randy McMurchy <randy_at_linuxfromscratch_dot_org>
Date:                    2004-10-31
Initial Package Version: 2.4.1
Upstream Status:         Not submitted (too much of a hack)
Origin:                  http://lists.gnu.org/archive/html/bug-gnu-utils/2003-01/msg00207.html
Description:             Fixes C++ error using GCC >= 3.x.x
                         Note: This patch is not meant to be used directly. It
                         is called by libplotter/Makefile which is created
                         with a patched Makefile.in. You'll also need:
                         plotutils-2.4.1-libplotter_Makefile-1.patch
                         plotutils-2.4.1-g_write_cc_fix-1.patch
                         plotutils-2.4.1-z_write_cc_fix-1.patch
                         plotutils-2.4.1-i_rle_cc_fix-1.patch

diff -Naur ../../plotutils-2.4.1-orig/libplot/n_write.c ./n_write.cc
--- ../../plotutils-2.4.1-orig/libplot/n_write.c	2000-06-16 05:42:13.000000000 +0000
+++ ./n_write.cc	2004-10-31 18:41:10.030984800 +0000
@@ -208,7 +208,7 @@
 		  linebuf[pos++] = '0';
 		if (pos >= MAX_PBM_PIXELS_PER_LINE || i == (width - 1))
 		  {
-		    stream->write (linebuf, pos);
+		    stream->write (reinterpret_cast<const char*>(linebuf), pos);
 		    stream->put ('\n');
 
 		    pos = 0;
@@ -253,7 +253,7 @@
 		  rowbuf[bytecount++] = outbyte;
 		}
 	      /* emit row of bytes */
-	      stream->write (rowbuf, bytecount);
+	      stream->write (reinterpret_cast<const char*>(rowbuf), bytecount);
 	    }
 
 	  free (rowbuf);
@@ -366,7 +366,7 @@
 		num_pixels++;
 		if (num_pixels >= MAX_PGM_PIXELS_PER_LINE || i == (width - 1))
 		  {
-		    stream->write (linebuf, pos);
+		    stream->write (reinterpret_cast<const char*>(linebuf), pos);
 		    stream->put ('\n');
 
 		    num_pixels = 0;
@@ -392,7 +392,7 @@
 	    {
 	      for (i = 0; i < width; i++)
 		rowbuf[i] = pixmap[j][i].u.rgb[0];
-	      stream->write (rowbuf, width);
+	      stream->write (reinterpret_cast<const char*>(rowbuf), width);
 	    }
 	  free (rowbuf);
 	}
@@ -514,7 +514,7 @@
 		num_pixels++;
 		if (num_pixels >= MAX_PPM_PIXELS_PER_LINE || i == (width - 1))
 		  {
-		    stream->write (linebuf, pos);
+		    stream->write (reinterpret_cast<const char*>(linebuf), pos);
 		    stream->put ('\n');
 
 		    num_pixels = 0;
@@ -542,7 +542,7 @@
 	      for (i = 0; i < width; i++)
 		for (component = 0; component < 3; component++)
 		  rowbuf[3 * i + component] = pixmap[j][i].u.rgb[component];
-	      stream->write (rowbuf, 3 * width);
+	      stream->write (reinterpret_cast<const char*>(rowbuf), 3 * width);
 	    }
 	  free (rowbuf);
 	}

