Changeset 42389 for trunk/Ohana/src/libfits
- Timestamp:
- Feb 8, 2023, 12:17:35 PM (3 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 12 edited
-
. (modified) (1 prop)
-
src/libfits/header/F_convert_H.c (modified) (3 diffs)
-
src/libfits/header/F_create_H.c (modified) (2 diffs)
-
src/libfits/header/F_modify.c (modified) (11 diffs)
-
src/libfits/header/F_print.c (modified) (8 diffs)
-
src/libfits/header/F_scan.c (modified) (1 diff)
-
src/libfits/matrix/F_compress_M.c (modified) (2 diffs)
-
src/libfits/matrix/F_uncompress_M.c (modified) (2 diffs)
-
src/libfits/table/F_create_TH.c (modified) (1 diff)
-
src/libfits/table/F_get_T_column.c (modified) (3 diffs)
-
src/libfits/table/F_get_T_value.c (modified) (1 diff)
-
src/libfits/table/F_table_column.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
-
trunk/Ohana/src/libfits/header/F_convert_H.c
r15487 r42389 11 11 Ns = strlen (line); 12 12 No = 80 - Ns; 13 strncpy (header->buffer, line, Ns);13 strncpy_nowarn (header->buffer, line, Ns); 14 14 memset (&header->buffer[Ns], ' ', No); 15 15 … … 27 27 Ns = strlen (line); 28 28 No = 80 - Ns; 29 strncpy (header->buffer, line, Ns);29 strncpy_nowarn (header->buffer, line, Ns); 30 30 memset (&header->buffer[Ns], ' ', No); 31 31 … … 46 46 Ns = strlen (line); 47 47 No = 80 - Ns; 48 strncpy (header->buffer, line, Ns);48 strncpy_nowarn (header->buffer, line, Ns); 49 49 memset (&header->buffer[Ns], ' ', No); 50 50 -
trunk/Ohana/src/libfits/header/F_create_H.c
r34577 r42389 12 12 13 13 ALLOCATE (header[0].buffer, char, NBYTES); 14 bzero (header[0].buffer, NBYTES); 14 15 15 for (i = 0; i < NBYTES; i++) 16 header[0].buffer[i] = ' '; 17 strncpy (header[0].buffer, "END", 3); 16 for (i = 0; i < NBYTES; i++) header[0].buffer[i] = ' '; 17 header[0].buffer[0] = 'E'; 18 header[0].buffer[1] = 'N'; 19 header[0].buffer[2] = 'D'; 18 20 19 21 gfits_modify_alt (header, "SIMPLE", "%t", 1, header[0].simple); … … 22 24 23 25 for (i = 0; i < header[0].Naxes; i++) { 24 snprintf (axis, 10, "NAXIS%d", i + 1);26 snprintf_nowarn (axis, 10, "NAXIS%d", i + 1); 25 27 gfits_modify (header, axis, OFF_T_FMT, 1, header[0].Naxis[i]); 26 28 } -
trunk/Ohana/src/libfits/header/F_modify.c
r38441 r42389 8 8 /* this function is extremely similar to gfits_print, except it allows for changing an existing field. */ 9 9 10 char comment[82], string[82], data[82]; 10 // the output string needs to be long enough to keep the compiler from 11 // complaining, even though the string cannot be more than 80 chars 12 char comment[82], string[200], data[82]; 11 13 char *p, *qe; 12 14 va_list argp; … … 14 16 va_start (argp, N); 15 17 bzero (data, 82); 16 bzero (string, 82);18 bzero (string, 200); 17 19 bzero (comment, 82); 18 20 … … 46 48 qe += 3; 47 49 qe = MIN (p + 80, qe); 48 strncpy (comment, qe, p + 80 - qe);50 strncpy_nowarn (comment, qe, p + 80 - qe); 49 51 } 50 52 gfits_pad_ending (comment, 0x20, 82); /* comment must contain spaces to the end */ 51 53 52 54 /* write the numeric modes */ 53 if (!strcmp (mode, "%d")) { snprintf (string, 81, "%-8s= %20d / %-s ", field, va_arg (argp, int),comment); goto found_it; }54 if (!strcmp (mode, "%ld")) { snprintf (string, 81, "%-8s= %20ld / %-s ", field, va_arg (argp, long),comment); goto found_it; }55 if (!strcmp (mode, "%lld")) { snprintf (string, 81, "%-8s= %20lld / %-s ", field, va_arg (argp, long long),comment); goto found_it; }56 if (!strcmp (mode, "%Ld")) { snprintf (string, 81, "%-8s= %20lld / %-s ", field, va_arg (argp, long long),comment); goto found_it; }57 if (!strcmp (mode, "%u")) { snprintf (string, 81, "%-8s= %20u / %-s ", field, va_arg (argp, unsigned),comment); goto found_it; }58 if (!strcmp (mode, "%lu")) { snprintf (string, 81, "%-8s= %20lu / %-s ", field, va_arg (argp, unsigned long), comment); goto found_it; }59 if (!strcmp (mode, "%llu")) { snprintf (string, 81, "%-8s= %20llu / %-s ", field, va_arg (argp, unsigned long long), comment); goto found_it; }60 if (!strcmp (mode, "%Lu")) { snprintf (string, 81, "%-8s= %20llu / %-s ", field, va_arg (argp, unsigned long long), comment); goto found_it; }61 if (!strcmp (mode, "%hd")) { snprintf (string, 81, "%-8s= %20d / %-s ", field, va_arg (argp, int),comment); goto found_it; }62 if (!strcmp (mode, "%f")) { snprintf (string, 81, "%-8s= %20.10f / %-s ", field, va_arg (argp, double),comment); goto found_it; }63 if (!strcmp (mode, "%lf")) { snprintf (string, 81, "%-8s= %20.10f / %-s ", field, va_arg (argp, double),comment); goto found_it; }64 if (!strcmp (mode, "%e")) { snprintf (string, 81, "%-8s= %20.10E / %-s ", field, va_arg (argp, double),comment); goto found_it; }65 if (!strcmp (mode, "%le")) { snprintf (string, 81, "%-8s= %20.10E / %-s ", field, va_arg (argp, double),comment); goto found_it; }66 if (!strcmp (mode, "%g")) { snprintf (string, 81, "%-8s= %20.10G / %-s ", field, va_arg (argp, double),comment); goto found_it; }67 if (!strcmp (mode, "%lg")) { snprintf (string, 81, "%-8s= %20.10G / %-s ", field, va_arg (argp, double),comment); goto found_it; }68 if (!strcmp (mode, "%jd")) { snprintf (string, 81, "%-8s= %20jd / %-s ", field, va_arg (argp, intmax_t),comment); goto found_it; }55 if (!strcmp (mode, "%d")) { snprintf (string, 200, "%-8s= %20d / %-s ", field, va_arg (argp, int), comment); goto found_it; } 56 if (!strcmp (mode, "%ld")) { snprintf (string, 200, "%-8s= %20ld / %-s ", field, va_arg (argp, long), comment); goto found_it; } 57 if (!strcmp (mode, "%lld")) { snprintf (string, 200, "%-8s= %20lld / %-s ", field, va_arg (argp, long long), comment); goto found_it; } 58 if (!strcmp (mode, "%Ld")) { snprintf (string, 200, "%-8s= %20lld / %-s ", field, va_arg (argp, long long), comment); goto found_it; } 59 if (!strcmp (mode, "%u")) { snprintf (string, 200, "%-8s= %20u / %-s ", field, va_arg (argp, unsigned), comment); goto found_it; } 60 if (!strcmp (mode, "%lu")) { snprintf (string, 200, "%-8s= %20lu / %-s ", field, va_arg (argp, unsigned long), comment); goto found_it; } 61 if (!strcmp (mode, "%llu")) { snprintf (string, 200, "%-8s= %20llu / %-s ", field, va_arg (argp, unsigned long long), comment); goto found_it; } 62 if (!strcmp (mode, "%Lu")) { snprintf (string, 200, "%-8s= %20llu / %-s ", field, va_arg (argp, unsigned long long), comment); goto found_it; } 63 if (!strcmp (mode, "%hd")) { snprintf (string, 200, "%-8s= %20d / %-s ", field, va_arg (argp, int), comment); goto found_it; } 64 if (!strcmp (mode, "%f")) { snprintf (string, 200, "%-8s= %20.10f / %-s ", field, va_arg (argp, double), comment); goto found_it; } 65 if (!strcmp (mode, "%lf")) { snprintf (string, 200, "%-8s= %20.10f / %-s ", field, va_arg (argp, double), comment); goto found_it; } 66 if (!strcmp (mode, "%e")) { snprintf (string, 200, "%-8s= %20.10E / %-s ", field, va_arg (argp, double), comment); goto found_it; } 67 if (!strcmp (mode, "%le")) { snprintf (string, 200, "%-8s= %20.10E / %-s ", field, va_arg (argp, double), comment); goto found_it; } 68 if (!strcmp (mode, "%g")) { snprintf (string, 200, "%-8s= %20.10G / %-s ", field, va_arg (argp, double), comment); goto found_it; } 69 if (!strcmp (mode, "%lg")) { snprintf (string, 200, "%-8s= %20.10G / %-s ", field, va_arg (argp, double), comment); goto found_it; } 70 if (!strcmp (mode, "%jd")) { snprintf (string, 200, "%-8s= %20jd / %-s ", field, va_arg (argp, intmax_t), comment); goto found_it; } 69 71 70 72 /* string value. Quotes must be at least 8 chars apart */ … … 72 74 char *ptr = va_arg (argp, char *); 73 75 if (!ptr) goto invalid; 74 strncpy (data, ptr, 68);75 snprintf (string, 81, "%-8s= '%-8s' / %-s ", field, data, comment);76 strncpy_nowarn (data, ptr, 68); 77 snprintf (string, 200, "%-8s= '%-8s' / %-s ", field, data, comment); 76 78 goto found_it; 77 79 } … … 83 85 84 86 found_it: 85 strncpy (p, string, 80);87 memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL 86 88 va_end (argp); 87 89 return (TRUE); … … 94 96 /* this function is extremely similar to gfits_print, except it allows for changing an existing field. */ 95 97 96 char comment[82], string[ 82], data[82];98 char comment[82], string[200], data[82]; 97 99 char *p, *qs, *qe; 98 100 va_list argp; … … 100 102 va_start (argp, N); 101 103 bzero (data, 82); 102 bzero (string, 82);103 104 bzero (comment, 82); 105 bzero (string, 200); 104 106 105 107 if (mode[0] != '%') { … … 132 134 qe += 3; 133 135 qe = MIN (p + 80, qe); 134 strncpy (comment, qe, p + 80 - qe);136 strncpy_nowarn (comment, qe, p + 80 - qe); 135 137 } 136 138 gfits_pad_ending (comment, 0x20, 82); /* comment must contain spaces to the end */ … … 139 141 if (!strcmp (mode, "%t")) { 140 142 if (va_arg (argp, int)) 141 snprintf (string, 81, "%-8s= %18s T / %-s ", field, " ", comment);143 snprintf (string, 200, "%-8s= %18s T / %-s ", field, " ", comment); 142 144 else 143 snprintf (string, 81, "%-8s= %18s F / %-s ", field, " ", comment);145 snprintf (string, 200, "%-8s= %18s F / %-s ", field, " ", comment); 144 146 } 145 147 … … 148 150 char *ptr = va_arg (argp, char *); 149 151 if (!ptr) goto invalid; 150 strncpy (data, ptr, 71);151 snprintf (string, 81, "%-8s %-71s", field, data);152 strncpy_nowarn (data, ptr, 71); 153 snprintf (string, 200, "%-8s %-71s", field, data); 152 154 } 153 155 … … 161 163 if (qs[-1] == 0x27) qs --; 162 164 163 strncpy (data, qs, MAX (MIN (qe - qs, 71), 0));165 strncpy_nowarn (data, qs, MAX (MIN (qe - qs, 71), 0)); 164 166 165 167 char *ptr = va_arg (argp, char *); 166 168 if (!ptr) goto invalid; 167 strncpy (comment, ptr, 80);169 strncpy_nowarn (comment, ptr, 80); 168 170 gfits_pad_ending (comment, 0x20, 82); /* comment must contain spaces to the end */ 169 snprintf (string, 81, "%-8s= %s / %-s", field, data, comment);171 snprintf (string, 200, "%-8s= %s / %-s", field, data, comment); 170 172 /* this will keep the original line, but truncate the comment */ 171 173 } 172 174 173 strncpy (p, string, 80);175 memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL 174 176 va_end (argp); 175 177 return (TRUE); -
trunk/Ohana/src/libfits/header/F_print.c
r34577 r42389 8 8 9 9 static char blank[] = " "; 10 char string[ 82], line[80];10 char string[200], line[80]; 11 11 char *p; 12 12 va_list argp; … … 46 46 47 47 /* write the numeric modes */ 48 if (!strcmp (mode, "%d")) { snprintf (string, 81, "%-8s= %20d / %46s ", field, va_arg (argp, int), blank); goto found_it; }49 if (!strcmp (mode, "%ld")) { snprintf (string, 81, "%-8s= %20ld / %46s ", field, va_arg (argp, long), blank); goto found_it; }50 if (!strcmp (mode, "%lld")){ snprintf (string, 81, "%-8s= %20lld / %46s ", field, va_arg (argp, long long), blank); goto found_it; }51 if (!strcmp (mode, "%Ld")) { snprintf (string, 81, "%-8s= %20lld / %46s ", field, va_arg (argp, long long), blank); goto found_it; }52 if (!strcmp (mode, "%u")) { snprintf (string, 81, "%-8s= %20u / %46s ", field, va_arg (argp, unsigned), blank); goto found_it; }53 if (!strcmp (mode, "%lu")) { snprintf (string, 81, "%-8s= %20lu / %46s ", field, va_arg (argp, unsigned long), blank); goto found_it; }54 if (!strcmp (mode, "%llu")){ snprintf (string, 81, "%-8s= %20llu / %46s ", field, va_arg (argp, unsigned long long), blank); goto found_it; }55 if (!strcmp (mode, "%Lu")) { snprintf (string, 81, "%-8s= %20llu / %46s ", field, va_arg (argp, unsigned long long), blank); goto found_it; }56 if (!strcmp (mode, "%hd")) { snprintf (string, 81, "%-8s= %20d / %46s ", field, va_arg (argp, int), blank); goto found_it; }57 if (!strcmp (mode, "%f")) { snprintf (string, 81, "%-8s= %20.10f / %46s ", field, va_arg (argp, double), blank); goto found_it; }58 if (!strcmp (mode, "%lf")) { snprintf (string, 81, "%-8s= %20.10f / %46s ", field, va_arg (argp, double), blank); goto found_it; }59 if (!strcmp (mode, "%e")) { snprintf (string, 81, "%-8s= %20.10E / %46s ", field, va_arg (argp, double), blank); goto found_it; }60 if (!strcmp (mode, "%le")) { snprintf (string, 81, "%-8s= %20.10E / %46s ", field, va_arg (argp, double), blank); goto found_it; }61 if (!strcmp (mode, "%g")) { snprintf (string, 81, "%-8s= %20.10G / %46s ", field, va_arg (argp, double), blank); goto found_it; }62 if (!strcmp (mode, "%lg")) { snprintf (string, 81, "%-8s= %20.10G / %46s ", field, va_arg (argp, double), blank); goto found_it; }63 if (!strcmp (mode, "%jd")) { snprintf (string, 81, "%-8s= %20jd / %46s ", field, va_arg (argp, intmax_t), blank); goto found_it; }48 if (!strcmp (mode, "%d")) { snprintf (string, 200, "%-8s= %20d / %46s ", field, va_arg (argp, int), blank); goto found_it; } 49 if (!strcmp (mode, "%ld")) { snprintf (string, 200, "%-8s= %20ld / %46s ", field, va_arg (argp, long), blank); goto found_it; } 50 if (!strcmp (mode, "%lld")){ snprintf (string, 200, "%-8s= %20lld / %46s ", field, va_arg (argp, long long), blank); goto found_it; } 51 if (!strcmp (mode, "%Ld")) { snprintf (string, 200, "%-8s= %20lld / %46s ", field, va_arg (argp, long long), blank); goto found_it; } 52 if (!strcmp (mode, "%u")) { snprintf (string, 200, "%-8s= %20u / %46s ", field, va_arg (argp, unsigned), blank); goto found_it; } 53 if (!strcmp (mode, "%lu")) { snprintf (string, 200, "%-8s= %20lu / %46s ", field, va_arg (argp, unsigned long), blank); goto found_it; } 54 if (!strcmp (mode, "%llu")){ snprintf (string, 200, "%-8s= %20llu / %46s ", field, va_arg (argp, unsigned long long), blank); goto found_it; } 55 if (!strcmp (mode, "%Lu")) { snprintf (string, 200, "%-8s= %20llu / %46s ", field, va_arg (argp, unsigned long long), blank); goto found_it; } 56 if (!strcmp (mode, "%hd")) { snprintf (string, 200, "%-8s= %20d / %46s ", field, va_arg (argp, int), blank); goto found_it; } 57 if (!strcmp (mode, "%f")) { snprintf (string, 200, "%-8s= %20.10f / %46s ", field, va_arg (argp, double), blank); goto found_it; } 58 if (!strcmp (mode, "%lf")) { snprintf (string, 200, "%-8s= %20.10f / %46s ", field, va_arg (argp, double), blank); goto found_it; } 59 if (!strcmp (mode, "%e")) { snprintf (string, 200, "%-8s= %20.10E / %46s ", field, va_arg (argp, double), blank); goto found_it; } 60 if (!strcmp (mode, "%le")) { snprintf (string, 200, "%-8s= %20.10E / %46s ", field, va_arg (argp, double), blank); goto found_it; } 61 if (!strcmp (mode, "%g")) { snprintf (string, 200, "%-8s= %20.10G / %46s ", field, va_arg (argp, double), blank); goto found_it; } 62 if (!strcmp (mode, "%lg")) { snprintf (string, 200, "%-8s= %20.10G / %46s ", field, va_arg (argp, double), blank); goto found_it; } 63 if (!strcmp (mode, "%jd")) { snprintf (string, 200, "%-8s= %20jd / %46s ", field, va_arg (argp, intmax_t), blank); goto found_it; } 64 64 65 65 /* string value. Quotes must be at least 8 chars apart. Longer lines will this should be fixed to allow arbitrary string lengths, up to 69 chars */ … … 69 69 strcpy (line, ptr); 70 70 line[68] = 0; 71 snprintf (string, 81, "%-8s= '%-8s' / %46s ", field, line, blank);71 snprintf (string, 200, "%-8s= '%-8s' / %46s ", field, line, blank); 72 72 goto found_it; 73 73 } … … 78 78 79 79 found_it: 80 strncpy (p, string, 80);80 memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL 81 81 va_end (argp); 82 82 return (TRUE); … … 89 89 90 90 static char blank[] = " "; 91 char string[ 82], line[80];91 char string[200], line[80]; 92 92 char *p, a; 93 93 va_list argp; … … 126 126 a = va_arg (argp, int); 127 127 if (a == 1) 128 snprintf (string, 81, "%-8s= %18s T / %46s ", field, blank, blank);128 snprintf (string, 200, "%-8s= %18s T / %46s ", field, blank, blank); 129 129 else 130 snprintf (string, 81, "%-8s= %18s F / %46s ", field, blank, blank);130 snprintf (string, 200, "%-8s= %18s F / %46s ", field, blank, blank); 131 131 } 132 132 … … 137 137 if (!ptr) goto invalid; 138 138 bzero (line, 80); 139 strncpy (line, ptr, 71);140 snprintf (string, 81, "%-8s %-71s", field, line);139 strncpy_nowarn (line, ptr, 71); 140 snprintf (string, 200, "%-8s %-71s", field, line); 141 141 } 142 142 … … 154 154 if (!strcmp (mode, "%C")) goto invalid; 155 155 156 strncpy (p, string, 80);156 memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL 157 157 158 158 va_end (argp); -
trunk/Ohana/src/libfits/header/F_scan.c
r39324 r42389 111 111 /* non-data entry (COMMENT, HISTORY) */ 112 112 if (!strcmp (mode, "%S")) { 113 strncpy (va_arg (argp, char *), p + 8, FT_HISTORY_LENGTH);113 strncpy_nowarn (va_arg (argp, char *), p + 8, FT_HISTORY_LENGTH); 114 114 return (TRUE); 115 115 } -
trunk/Ohana/src/libfits/matrix/F_compress_M.c
r41739 r42389 86 86 char keyword[11]; 87 87 for (i = 0; i < header[0].Naxes; i++) { 88 snprintf (keyword, 10, "ZNAXIS%d", i + 1);88 snprintf_nowarn (keyword, 10, "ZNAXIS%d", i + 1); 89 89 if (!gfits_modify (theader, keyword, OFF_T_FMT, 1, header[0].Naxis[i])) ESCAPE; 90 90 } 91 91 92 92 for (i = 0; i < header->Naxes; i++) { 93 snprintf (keyword, 10, "ZTILE%d", i + 1);93 snprintf_nowarn (keyword, 10, "ZTILE%d", i + 1); 94 94 if (!gfits_modify (theader, keyword, "%lu", 1, ztile[i])) ESCAPE; 95 95 } … … 131 131 // note the difference between the keywords (1 indexed) and the variables (0 indexed) 132 132 for (i = 0; i < Noptions; i++) { 133 snprintf (key, 10, "ZNAME%d", i + 1);133 snprintf_nowarn (key, 10, "ZNAME%d", i + 1); 134 134 if (!gfits_modify (header, key, "%s", 1, optname[i])) break; 135 135 136 snprintf (key, 10, "ZVAL%d", i + 1);136 snprintf_nowarn (key, 10, "ZVAL%d", i + 1); 137 137 if (!gfits_modify (header, key, "%s", 1, optvalue[i])) break; 138 138 } -
trunk/Ohana/src/libfits/matrix/F_uncompress_M.c
r41474 r42389 90 90 int axis; 91 91 for (axis = 0; axis < header->Naxes; axis++) { 92 snprintf (zaxis, 10, "ZNAXIS%d", axis + 1);93 snprintf (naxis, 10, "NAXIS%d",axis + 1);92 snprintf_nowarn (zaxis, 10, "ZNAXIS%d", axis + 1); 93 snprintf_nowarn (naxis, 10, "NAXIS%d", axis + 1); 94 94 MOD_KEYWORD_REQUIRED (zaxis, naxis, OFF_T_FMT, &header->Naxis[axis], header->Naxis[axis]); 95 95 } … … 108 108 // if ZTILE1 exists, all ZTILEn must exist: 109 109 for (axis = 1; axis < header->Naxes; axis++) { 110 snprintf (key, 10, "ZTILE%d", axis + 1);110 snprintf_nowarn (key, 10, "ZTILE%d", axis + 1); 111 111 if (!gfits_scan (header, key, "%lu", 1, &ztile[axis])) ESCAPE; 112 112 gfits_delete (header, key, 1); -
trunk/Ohana/src/libfits/table/F_create_TH.c
r38989 r42389 17 17 myAssert (!header->buffer, "failed to init header or free buffer?"); 18 18 ALLOCATE (header[0].buffer, char, NBYTES); 19 bzero (header[0].buffer, NBYTES); 19 20 20 for (i = 0; i < NBYTES; i++) 21 header[0].buffer[i] = ' '; 22 strncpy (header[0].buffer, "END", 3); 21 for (i = 0; i < NBYTES; i++) header[0].buffer[i] = ' '; 22 header[0].buffer[0] = 'E'; 23 header[0].buffer[1] = 'N'; 24 header[0].buffer[2] = 'D'; 23 25 24 26 gfits_modify (header, "XTENSION", "%s", 1, type); -
trunk/Ohana/src/libfits/table/F_get_T_column.c
r38553 r42389 32 32 ALLOCATE (Ivalues, int, table[0].Naxis[1]); 33 33 for (i = 0; i < table[0].Naxis[1]; i++) { 34 strncpy (tmp, &table[0].buffer[i*table[0].Naxis[0] + start], Nchar); 35 tmp[Nchar] = 0; 34 strncpy_nowarn (tmp, &table[0].buffer[i*table[0].Naxis[0] + start], Nchar); 36 35 Ivalues[i] = atof (tmp); 37 36 } … … 41 40 ALLOCATE (Dvalues, double, table[0].Naxis[1]); 42 41 for (i = 0; i < table[0].Naxis[1]; i++) { 43 strncpy (tmp, &table[0].buffer[i*table[0].Naxis[0] + start], Nchar); 44 tmp[Nchar] = 0; 42 strncpy_nowarn (tmp, &table[0].buffer[i*table[0].Naxis[0] + start], Nchar); 45 43 Dvalues[i] = atof (tmp); 46 44 } … … 53 51 for (i = 0; i < table[0].Naxis[1]; i++) { 54 52 ALLOCATE (Cvalues[i], char, N + 1); 55 strncpy (Cvalues[i], &table[0].buffer[i*table[0].Naxis[0] + start], N); 56 Cvalues[i][N] = 0; 53 strncpy_nowarn (Cvalues[i], &table[0].buffer[i*table[0].Naxis[0] + start], N); 57 54 } 58 55 values[0] = (char *) Cvalues; -
trunk/Ohana/src/libfits/table/F_get_T_value.c
r38553 r42389 26 26 27 27 byte = Y*table[0].Naxis[0] + start; 28 strncpy (tmp, &table[0].buffer[byte], Nchar); 29 tmp[Nchar] = 0; 28 strncpy_nowarn (tmp, &table[0].buffer[byte], Nchar); 30 29 31 30 if (!strcmp (mode, "%d")) *(int *) value = (int) atof (tmp); -
trunk/Ohana/src/libfits/table/F_table_column.c
r38553 r42389 72 72 73 73 for (i = 0; i < table[0].Naxis[1]; i++) { 74 strncpy (temp, &table[0].buffer[i*table[0].Naxis[0] + start - 1], width); 75 temp[width] = 0; 74 strncpy_nowarn (temp, &table[0].buffer[i*table[0].Naxis[0] + start - 1], width); 76 75 switch (M) { 77 76 case 0:
Note:
See TracChangeset
for help on using the changeset viewer.
