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_print.c

    r28246 r33648  
    6565  /* string value.  Quotes must be at least 18 chars apart.  Longer lines will this should be fixed to allow arbitrary string lengths, up to 69 chars */
    6666  if (!strcmp (mode, "%s")) {
    67     strcpy (line, va_arg (argp, char *));
     67    char *ptr = va_arg (argp, char *);
     68    if (!ptr) goto invalid;
     69    strcpy (line, ptr);
    6870    line[68] = 0;
    6971    snprintf (string, 81, "%-8s= '%-18s' / %46s ", field, line, blank);
    7072    goto found_it;
    7173  }
     74
     75invalid:
     76  va_end (argp);
    7277  return (FALSE);
    7378
     
    7681  va_end (argp);
    7782  return (TRUE);
    78 
    7983}
    8084
     
    130134  if (!strcmp (mode, "%S")) {
    131135    /* we are forcing the entry to be <= 69 char long */
    132     strcpy (line, va_arg (argp, char *));
    133     line[71] = 0;
     136    char *ptr = va_arg (argp, char *);
     137    if (!ptr) goto invalid;
     138    bzero (line, 80);
     139    strncpy (line, ptr, 71);
    134140    snprintf (string, 81, "%-8s %-71s", field, line);
    135141  } 
     
    146152
    147153  /* can't write the comment in gfits_print - use gfits_modify */
    148   if (!strcmp (mode, "%C")) return (FALSE);
     154  if (!strcmp (mode, "%C")) goto invalid;
    149155
    150156  strncpy (p, string, 80);
     
    153159  return (TRUE);
    154160
     161invalid:
     162  va_end (argp);
     163  return (FALSE);
    155164}
Note: See TracChangeset for help on using the changeset viewer.