projects
/
ctsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r117: *** empty log message ***
[ctsim.git]
/
src
/
if2img.cpp
diff --git
a/src/if2img.cpp
b/src/if2img.cpp
index 018e504abf6027fc741ce9fe555d8ea47475515b..a230974db30135b812917d6bb802d00f48372e24 100644
(file)
--- 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
**
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: if2img.cpp,v 1.
6 2000/06/18 10:27:11
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
**
** 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
@@
-255,7
+255,7
@@
if2img_main (int argc, char *const argv[])
#else
cout << "Unknown version number" << endl;
#endif
#else
cout << "Unknown version number" << endl;
#endif
-
exit
(0);
+
return
(0);
case O_HELP:
case '?':
if2img_usage(argv[0]);
case O_HELP:
case '?':
if2img_usage(argv[0]);
@@
-282,7
+282,7
@@
if2img_main (int argc, char *const argv[])
pim = new ImageFile (in_file);
ImageFile& im = *pim;
if (! im.fileRead()) {
pim = new ImageFile (in_file);
ImageFile& im = *pim;
if (! im.fileRead()) {
- sys_error (ERR_
SEVERE
, "File %s does not exist", in_file);
+ sys_error (ERR_
FATAL
, "File %s does not exist", in_file);
return (1);
}
return (1);
}
@@
-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();
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;
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]);
}
}
fprintf(fp, "%c ", rowp[ic]);
}
}
- delete rowp;
fclose(fp);
}
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();
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;
if (rowp == NULL)
return;
@@
-513,7
+512,6
@@
sdf2d_to_pgmasc (ImageFile& im, char *outfile, int nxcell, int nycell, double de
fprintf(fp, "\n");
}
}
fprintf(fp, "\n");
}
}
- delete rowp;
fclose(fp);
}
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();
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;
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);
}
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);
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();
int ny = im.ny();
ImageFileArray v = im.getArray();
- u
snigned char* rowp = new unsigned char
[nx * nxcell];
+ u
nsigned char rowp
[nx * nxcell];
if (rowp == NULL)
return;
if (rowp == NULL)
return;
@@
-628,11
+625,10
@@
sdf2d_to_gif (ImageFile& im, char *outfile, int nxcell, int nycell, double densm
}
}
}
}
}
}
- delete rowp;
if ((out = fopen(outfile,"w")) == NULL) {
if ((out = fopen(outfile,"w")) == NULL) {
- sys_error(ERR_
SEVERE,
"Error opening output file %s for writing", outfile);
-
exit
(1);
+ sys_error(ERR_
FATAL,
"Error opening output file %s for writing", outfile);
+
return
(1);
}
gdImageGif(gif,out);
fclose(out);
}
gdImageGif(gif,out);
fclose(out);
@@
-646,6
+642,16
@@
sdf2d_to_gif (ImageFile& im, char *outfile, int nxcell, int nycell, double densm
int
main (int argc, char *const argv[])
{
int
main (int argc, char *const argv[])
{
- return (if2img_main(argc, argv));
+ int retval = 1;
+
+ try {
+ retval = if2img_main(argc, argv);
+ } catch (exception e) {
+ cerr << "Exception: " << e.what() << endl;
+ } catch (...) {
+ cerr << "Unknown exception" << endl;
+ }
+
+ return (retval);
}
#endif
}
#endif