X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fctrec.c;h=1843d3123f48b2721a2b1280fe1150cb057e7f5d;hb=c50886476dddf65aa71d519509b42f71303a149a;hp=fb23af9f456ea3a7fbf9270d790a2d180edd6985;hpb=2f71224f911d19adaa941d7553a9462a1aef7293;p=ctsim.git diff --git a/src/ctrec.c b/src/ctrec.c index fb23af9..1843d31 100644 --- a/src/ctrec.c +++ b/src/ctrec.c @@ -2,8 +2,14 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctrec.c,v 1.8 2000/05/04 18:16:34 kevin Exp $ +** $Id: ctrec.c,v 1.10 2000/05/11 01:06:30 kevin Exp $ ** $Log: ctrec.c,v $ +** Revision 1.10 2000/05/11 01:06:30 kevin +** Changed sprintf to snprintf +** +** Revision 1.9 2000/05/08 20:02:32 kevin +** ANSI C changes +** ** Revision 1.8 2000/05/04 18:16:34 kevin ** renamed filter definitions ** @@ -56,15 +62,7 @@ #include "ct.h" -#define O_INTERP 1 -#define O_FILTER 2 -#define O_FILTER_PARAM 3 -#define O_BACKPROJ 4 -#define O_VERBOSE 5 -#define O_TRACE 6 -#define O_HELP 7 -#define O_DEBUG 8 -#define O_VERSION 9 +enum {O_INTERP, O_FILTER, O_FILTER_PARAM, O_BACKPROJ, O_VERBOSE, O_TRACE, O_HELP, O_DEBUG, O_VERSION}; static struct option my_options[] = { @@ -150,7 +148,7 @@ main (const int argc, char *const argv[]) int opt_filter = FILTER_ABS_BANDLIMIT; int opt_interp = I_LINEAR; int opt_interp_param = 1; - int opt_backproj = O_BPROJ_DIFF2; + BackprojType opt_backproj = O_BPROJ_DIFF2; #ifdef MPI_CT IMAGE *im_local; RAYSUM *rs_local; @@ -246,13 +244,12 @@ main (const int argc, char *const argv[]) ny = strtol(argv[optind + 3], &endptr, 10); if (opt_filter == FILTER_G_HAMMING || opt_filter == FILTER_ABS_G_HAMMING) - sprintf (filt_name, "%s: alpha = %.2f", + snprintf (filt_name, sizeof(filt_name), "%s: alpha = %.2f", name_of_filter (opt_filter), opt_filter_param); else - sprintf (filt_name, "%s", name_of_filter (opt_filter)); + snprintf (filt_name, sizeof(filt_name), "%s", name_of_filter (opt_filter)); - sprintf (remark, - "Reconstruct: %dx%d, %s, %s, %s", + snprintf (remark, sizeof(remark), "Reconstruct: %dx%d, %s, %s, %s", nx, ny, filt_name, name_of_interpolation (opt_interp), name_of_backproj(opt_backproj)); if (opt_verbose) @@ -376,7 +373,7 @@ main (const int argc, char *const argv[]) printf("Time to reduce image = %f secs, max time = %f\n", mpi_t, mpi_t_g); } if (mpi_ct.my_rank == 0) { - strncpy (im_global->remark, remark, MAXREMARK); + strncpy (im_global->remark, remark, sizeof(im_global->remark)); time_end = MPI_Wtime(); im_global->calctime = time_end - time_start; image_save (im_global); @@ -385,7 +382,7 @@ main (const int argc, char *const argv[]) } #else raysum_close (rs_global); - strncpy (im_global->remark, remark, MAXREMARK); + strncpy (im_global->remark, remark, sizeof(im_global->remark)); time_end = td_current_sec(); im_global->calctime = time_end - time_start; image_save (im_global);