X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fif2img.cpp;h=a230974db30135b812917d6bb802d00f48372e24;hp=c3a4bfe801ab80d56c42cd8afc4055db9faaaaec;hb=2d39e823ba389fc68e5317c422b55be006094252;hpb=207332eec9416d299766abb697312cfd27eb890e diff --git a/src/if2img.cpp b/src/if2img.cpp index c3a4bfe..a230974 100644 --- a/src/if2img.cpp +++ b/src/if2img.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: if2img.cpp,v 1.7 2000/06/19 17:58:13 kevin Exp $ +** $Id: if2img.cpp,v 1.8 2000/06/22 10:17:28 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -451,7 +451,7 @@ sdf2d_to_pgm (ImageFile& im, char *outfile, int nxcell, int nycell, double densm int ny = im.ny(); ImageFileArray v = im.getArray(); - unsigned char* rowp = new unsigned char [nx * nxcell]; + unsigned char rowp [nx * nxcell]; if ((fp = fopen (outfile, "wb")) == NULL) return; @@ -474,7 +474,6 @@ sdf2d_to_pgm (ImageFile& im, char *outfile, int nxcell, int nycell, double densm fprintf(fp, "%c ", rowp[ic]); } } - delete rowp; fclose(fp); } @@ -487,7 +486,7 @@ sdf2d_to_pgmasc (ImageFile& im, char *outfile, int nxcell, int nycell, double de int ny = im.ny(); ImageFileArray v = im.getArray(); - unsigned char* rowp = new unsigned char [nx * nxcell]; + unsigned char rowp [nx * nxcell]; if (rowp == NULL) return; @@ -513,7 +512,6 @@ sdf2d_to_pgmasc (ImageFile& im, char *outfile, int nxcell, int nycell, double de fprintf(fp, "\n"); } } - delete rowp; fclose(fp); } @@ -531,7 +529,7 @@ sdf2d_to_png (ImageFile& im, char *outfile, int bitdepth, int nxcell, int nycell int ny = im.ny(); ImageFileArray v = im.getArray(); - unsigned char* rowp = new unsigned char [nx * nxcell * (bitdepth / 8)]; + unsigned char rowp [nx * nxcell * (bitdepth / 8)]; if ((fp = fopen (outfile, "wb")) == NULL) return; @@ -580,7 +578,6 @@ sdf2d_to_png (ImageFile& im, char *outfile, int bitdepth, int nxcell, int nycell for (int ir = 0; ir < nycell; ir++) png_write_rows (png_ptr, &row_pointer, 1); } - delete rowp; png_write_end(png_ptr, info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr); @@ -605,7 +602,7 @@ sdf2d_to_gif (ImageFile& im, char *outfile, int nxcell, int nycell, double densm int ny = im.ny(); ImageFileArray v = im.getArray(); - usnigned char* rowp = new unsigned char [nx * nxcell]; + unsigned char rowp [nx * nxcell]; if (rowp == NULL) return; @@ -628,7 +625,6 @@ sdf2d_to_gif (ImageFile& im, char *outfile, int nxcell, int nycell, double densm } } } - delete rowp; if ((out = fopen(outfile,"w")) == NULL) { sys_error(ERR_FATAL, "Error opening output file %s for writing", outfile);