Changeset 38553 for trunk/Ohana/src/libfits/table/F_define_column.c
- Timestamp:
- Jun 25, 2015, 10:41:05 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libfits/table/F_define_column.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libfits/table/F_define_column.c
r38441 r38553 11 11 off_t Naxis1; 12 12 int Nfields, Nbytes, Nval; 13 char type[ 16], field[16];13 char type[64], field[64]; 14 14 15 15 if (!gfits_bintable_format (format, type, &Nval, &Nbytes)) return (FALSE); … … 21 21 Naxis1 += Nbytes*Nval; 22 22 23 s printf (field, "TTYPE%d", Nfields);23 snprintf (field, 64, "TTYPE%d", Nfields); 24 24 gfits_modify (header, field, "%s", 1, label); 25 25 gfits_modify_alt (header, field, "%C", 1, comment); 26 s printf (field, "TUNIT%d", Nfields);26 snprintf (field, 64, "TUNIT%d", Nfields); 27 27 gfits_modify (header, field, "%s", 1, unit); 28 s printf (field, "TFORM%d", Nfields);28 snprintf (field, 64, "TFORM%d", Nfields); 29 29 gfits_modify (header, field, "%s", 1, format); 30 30 31 31 // add scaling parameters unless they amount to a noop 32 32 if ((bscale != 1.0) || (bzero != 0.0)) { 33 s printf (field, "TSCAL%d", Nfields);33 snprintf (field, 64, "TSCAL%d", Nfields); 34 34 gfits_modify (header, field, "%lf", 1, bscale); 35 s printf (field, "TZERO%d", Nfields);35 snprintf (field, 64, "TZERO%d", Nfields); 36 36 gfits_modify (header, field, "%lf", 1, bzero); 37 37 } … … 54 54 off_t Naxis1; 55 55 int Nfields, Nbytes, Nval; 56 char type[ 16], field[16];56 char type[64], field[64]; 57 57 58 58 if (!gfits_bintable_format (format, type, &Nval, &Nbytes)) return (FALSE); … … 64 64 Naxis1 += Nbytes*Nval; 65 65 66 s printf (field, "TTYPE%d", Nfields);66 snprintf (field, 64, "TTYPE%d", Nfields); 67 67 gfits_modify (header, field, "%s", 1, label); 68 68 if (comment) { … … 70 70 } 71 71 if (unit) { 72 s printf (field, "TUNIT%d", Nfields);72 snprintf (field, 64, "TUNIT%d", Nfields); 73 73 gfits_modify (header, field, "%s", 1, unit); 74 74 } 75 s printf (field, "TFORM%d", Nfields);75 snprintf (field, 64, "TFORM%d", Nfields); 76 76 gfits_modify (header, field, "%s", 1, format); 77 77 78 78 // add scaling parameters unless they amount to a noop 79 79 if ((bscale != 1.0) || (bzero != 0.0)) { 80 s printf (field, "TSCAL%d", Nfields);80 snprintf (field, 64, "TSCAL%d", Nfields); 81 81 gfits_modify (header, field, "%lf", 1, bscale); 82 s printf (field, "TZERO%d", Nfields);82 snprintf (field, 64, "TZERO%d", Nfields); 83 83 gfits_modify (header, field, "%lf", 1, bzero); 84 84 } … … 97 97 off_t Naxis1; 98 98 int Nstart, Nfields, Nbytes, Nval; 99 char type[ 16], field[16], cformat[16];99 char type[64], field[64], cformat[64]; 100 100 101 101 strcpy (cformat, format); … … 109 109 Naxis1 += Nbytes*Nval; 110 110 111 s printf (field, "TTYPE%d", Nfields);111 snprintf (field, 64, "TTYPE%d", Nfields); 112 112 gfits_modify (header, field, "%s", 1, label); 113 113 gfits_modify_alt (header, field, "%C", 1, comment); 114 s printf (field, "TUNIT%d", Nfields);114 snprintf (field, 64, "TUNIT%d", Nfields); 115 115 gfits_modify (header, field, "%s", 1, unit); 116 s printf (field, "TFORM%d", Nfields);116 snprintf (field, 64, "TFORM%d", Nfields); 117 117 gfits_modify (header, field, "%s", 1, format); 118 118 119 s printf (field, "TBCOL%d", Nfields);119 snprintf (field, 64, "TBCOL%d", Nfields); 120 120 gfits_modify (header, field, "%d", 1, Nstart); 121 121
Note:
See TracChangeset
for help on using the changeset viewer.
