Changeset 41739
- Timestamp:
- Jul 30, 2021, 11:11:47 AM (5 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libfits/matrix/F_compress_M.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libfits/matrix/F_compress_M.c
r41474 r41739 288 288 } 289 289 290 // copy everything except the fields which get translated: 291 // SIMPLE, NAXIS, NAXIS0 - 9, BSCALE, BZERO, BLANK, 290 292 int gfits_copy_keywords_compress (Header *srchead, Header *tgthead) { 291 293 OHANA_UNUSED_PARAM(tgthead); … … 294 296 # if (0) 295 297 int i; 296 298 char endline[82]; 299 300 // find the END of the header 301 char *p = gfits_header_field (tgthead, "END", 1); 302 if (p == NULL) return (FALSE); 303 304 // save the END line 305 memcpy (endline, p, FT_LINE_LENGTH); 306 307 // p tracks the current last (non-END) header line 297 308 for (i = 0; i < srchead->datasize; i += FT_LINE_LENGTH) { 298 } 299 # endif 300 309 310 NEED TO FIX THIS --- 311 312 // is there enough space for 2 more lines (keyword + END)? 313 if (tgthead->datasize - (p - (tgthead->buffer)) < 2*FT_LINE_LENGTH) { 314 tgthead->datasize += FT_RECORD_SIZE; 315 REALLOCATE (tgthead->buffer, char, tgthead->datasize); 316 p = gfits_header_field (tgthead, "END", 1); 317 if (p == NULL) return (FALSE); 318 } 319 320 // copy the line to the target header 321 memcpy (p, &srchead->buffer[i], FT_LINE_LENGTH); 322 323 // advance p: 324 p += FT_LINE_LENGTH; 325 } 326 327 // is there enough space for 1 more line? 328 if (tgthead->datasize - (p - (tgthead->buffer)) < FT_LINE_LENGTH) { 329 tgthead->datasize += FT_RECORD_SIZE; 330 REALLOCATE (tgthead->buffer, char, tgthead->datasize); 331 p = gfits_header_field (tgthead, "END", 1); 332 if (p == NULL) return (FALSE); 333 } 334 # endif 301 335 return TRUE; 302 336 } 337 338 # if (0) 339 int gfits_add_keyword_raw (Header *header) { 340 341 /* new entry, find the END of the header */ 342 p = gfits_header_field (header, "END", 1); 343 if (p == NULL) return (FALSE); 344 345 /* is there enough space for 1 more line? */ 346 if (header[0].datasize - (p - (header[0].buffer)) < 2*FT_LINE_LENGTH) { 347 header[0].datasize += FT_RECORD_SIZE; 348 REALLOCATE (header[0].buffer, char, header[0].datasize); 349 p = gfits_header_field (header, "END", 1); 350 if (p == NULL) return (FALSE); 351 memset (p + FT_LINE_LENGTH, ' ', FT_RECORD_SIZE); 352 } 353 354 /* push END line back 1 */ 355 memmove ((p + FT_LINE_LENGTH), p, FT_LINE_LENGTH); 356 memset (p, ' ', FT_LINE_LENGTH); 357 # endif 358 303 359 304 360 // raw_pixsize is the bytes / pixel for the input matrix
Note:
See TracChangeset
for help on using the changeset viewer.
