IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 1, 2012, 2:22:08 PM (14 years ago)
Author:
eugene
Message:

fix byteswap error for 64bit tables (simplify byteswap code generally to clean up); add function to get type of specified column by seq number; defaults for Bzero and Bscale in tables without temp (0.0,1.0); function to set a bintable column from a vector of different type; better error handling for F_print,F_modify

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libfits/header/F_modify.c

    r28246 r33648  
    7070  /* string value.  Quotes must be at least 18 chars apart */
    7171  if (!strcmp (mode, "%s")) {
    72     strncpy (data, va_arg (argp, char *), 68);
     72    char *ptr = va_arg (argp, char *);
     73    if (!ptr) goto invalid;
     74    strncpy (data, ptr, 68);
    7375    snprintf (string, 81, "%-8s= '%-18s' / %-s ", field, data, comment);
    7476    goto found_it;
     
    7678
    7779  /* failed to find mode */
     80invalid:
     81  va_end (argp);
    7882  return (FALSE);
    7983
     
    8286  va_end (argp);
    8387  return (TRUE);
    84 
    8588}
    8689
     
    143146  /* comment type of value.  */
    144147  if (!strcmp (mode, "%S")) {
    145     strncpy (data, va_arg (argp, char *), 71);
     148    char *ptr = va_arg (argp, char *);
     149    if (!ptr) goto invalid;
     150    strncpy (data, ptr, 71);
    146151    snprintf (string, 81, "%-8s %-71s", field, data);
    147152  } 
     
    157162
    158163    strncpy (data, qs, MAX (MIN (qe - qs, 71), 0));
    159     strncpy (comment, va_arg (argp, char *), 80);
     164
     165    char *ptr = va_arg (argp, char *);
     166    if (!ptr) goto invalid;
     167    strncpy (comment, ptr, 80);
    160168    gfits_pad_ending (comment, ' ', 82);  /* comment must contain spaces to the end */
    161169    snprintf (string, 81, "%-8s= %s / %-s", field, data, comment);
     
    167175  return (TRUE);
    168176
     177invalid:
     178  va_end (argp);
     179  return (FALSE);
    169180}
    170181
Note: See TracChangeset for help on using the changeset viewer.