IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 9, 2017, 12:47:22 PM (9 years ago)
Author:
eugene
Message:

mostly harmless changes to track down dvopsps segfaults: watch out for Bzero,Bscale in F_set_column.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20170809/src/libfits/header/F_print.c

    r34577 r40113  
    77  /* this function expects one more argument, the value to be written */
    88
    9   static char blank[] = " ";
    10   char string[82], line[80];
     9  char string[82], line[82], blank[82];
    1110  char *p;
    1211  va_list argp; 
     
    4140  memset (p, ' ', FT_LINE_LENGTH);
    4241
     42  memset (blank, ' ', FT_LINE_LENGTH); blank[FT_LINE_LENGTH] = 0;
     43
    4344  /* write the new FITS card, setting the comment to be blank */
    4445  /* in these lines, the value field will expand as needed, forcing out the comment
     
    6768    char *ptr = va_arg (argp, char *);
    6869    if (!ptr) goto invalid;
    69     strcpy (line, ptr);
    70     line[68] = 0;
     70    strncpy (line, ptr, 68); line[68] = 0;
    7171    snprintf (string, 81, "%-8s= '%-8s' / %46s ", field, line, blank);
    7272    goto found_it;
     
    8888  /* this function expects one more argument, the value to be written */
    8989
    90   static char blank[] = " ";
    91   char string[82], line[80];
    92   char *p, a;
     90  char string[82], line[82], blank[82];
     91  char *p;
    9392  va_list argp; 
    9493
    9594  va_start (argp, N);
     95  bzero (line, 82);
     96  bzero (string, 82);
     97  bzero (blank, 82);
    9698 
    9799  if (mode[0] != '%') {
     
    122124  memset (p, ' ', FT_LINE_LENGTH);
    123125
     126  memset (blank, ' ', FT_LINE_LENGTH); blank[FT_LINE_LENGTH] = 0;
     127
    124128  /* write the boolean mode */
    125129  if (!strcmp (mode, "%t")) {
    126     a = va_arg (argp, int);
    127     if (a == 1)
     130    int a = va_arg (argp, int);
     131    if (a == 1) {
    128132      snprintf (string, 81, "%-8s= %18s T / %46s ", field, blank, blank);
    129     else
     133    } else {
    130134      snprintf (string, 81, "%-8s= %18s F / %46s ", field, blank, blank);
     135    }
    131136  }
    132137
Note: See TracChangeset for help on using the changeset viewer.