IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 8, 2023, 12:17:35 PM (3 years ago)
Author:
eugene
Message:

merge from eam_branches/ipp-20220316. fixes for more pendantic gcc; add opihi memory stats; string vector improvements; use named macros for fixed string lengths

Location:
trunk/Ohana
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/libfits/header/F_convert_H.c

    r15487 r42389  
    1111  Ns = strlen (line);
    1212  No = 80 - Ns;
    13   strncpy (header->buffer, line, Ns);
     13  strncpy_nowarn (header->buffer, line, Ns);
    1414  memset (&header->buffer[Ns], ' ', No);
    1515
     
    2727  Ns = strlen (line);
    2828  No = 80 - Ns;
    29   strncpy (header->buffer, line, Ns);
     29  strncpy_nowarn (header->buffer, line, Ns);
    3030  memset (&header->buffer[Ns], ' ', No);
    3131
     
    4646  Ns = strlen (line);
    4747  No = 80 - Ns;
    48   strncpy (header->buffer, line, Ns);
     48  strncpy_nowarn (header->buffer, line, Ns);
    4949  memset (&header->buffer[Ns], ' ', No);
    5050
  • trunk/Ohana/src/libfits/header/F_create_H.c

    r34577 r42389  
    1212
    1313  ALLOCATE (header[0].buffer, char, NBYTES);
     14  bzero (header[0].buffer, NBYTES);
    1415
    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';
    1820
    1921  gfits_modify_alt (header, "SIMPLE", "%t", 1, header[0].simple);
     
    2224                                       
    2325  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);
    2527    gfits_modify (header,  axis, OFF_T_FMT, 1,  header[0].Naxis[i]);
    2628  }
  • trunk/Ohana/src/libfits/header/F_modify.c

    r38441 r42389  
    88  /* this function is extremely similar to gfits_print, except it allows for changing an existing field. */
    99
    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];
    1113  char *p, *qe;
    1214  va_list argp;
     
    1416  va_start (argp, N);
    1517  bzero (data, 82);
    16   bzero (string, 82);
     18  bzero (string, 200);
    1719  bzero (comment, 82);
    1820
     
    4648    qe += 3;
    4749    qe = MIN (p + 80, qe);
    48     strncpy (comment, qe, p + 80 - qe);
     50    strncpy_nowarn (comment, qe, p + 80 - qe);
    4951  }
    5052  gfits_pad_ending (comment, 0x20, 82);  /* comment must contain spaces to the end */
    5153
    5254  /* 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; }
    6971
    7072  /* string value.  Quotes must be at least 8 chars apart */
     
    7274    char *ptr = va_arg (argp, char *);
    7375    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);
    7678    goto found_it;
    7779  }
     
    8385
    8486found_it:
    85   strncpy (p, string, 80);
     87  memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    8688  va_end (argp);
    8789  return (TRUE);
     
    9496  /* this function is extremely similar to gfits_print, except it allows for changing an existing field. */
    9597
    96   char comment[82], string[82], data[82];
     98  char comment[82], string[200], data[82];
    9799  char *p, *qs, *qe;
    98100  va_list argp;
     
    100102  va_start (argp, N);
    101103  bzero (data, 82);
    102   bzero (string, 82);
    103104  bzero (comment, 82);
     105  bzero (string, 200);
    104106
    105107  if (mode[0] != '%') {
     
    132134    qe += 3;
    133135    qe = MIN (p + 80, qe);
    134     strncpy (comment, qe, p + 80 - qe);
     136    strncpy_nowarn (comment, qe, p + 80 - qe);
    135137  }
    136138  gfits_pad_ending (comment, 0x20, 82);  /* comment must contain spaces to the end */
     
    139141  if (!strcmp (mode, "%t")) {
    140142    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);
    142144    else
    143       snprintf (string, 81, "%-8s= %18s F / %-s ", field, " ", comment);
     145      snprintf (string, 200, "%-8s= %18s F / %-s ", field, " ", comment);
    144146  }
    145147
     
    148150    char *ptr = va_arg (argp, char *);
    149151    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);
    152154  } 
    153155
     
    161163    if (qs[-1] == 0x27) qs --;
    162164
    163     strncpy (data, qs, MAX (MIN (qe - qs, 71), 0));
     165    strncpy_nowarn (data, qs, MAX (MIN (qe - qs, 71), 0));
    164166
    165167    char *ptr = va_arg (argp, char *);
    166168    if (!ptr) goto invalid;
    167     strncpy (comment, ptr, 80);
     169    strncpy_nowarn (comment, ptr, 80);
    168170    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);
    170172    /* this will keep the original line, but truncate the comment */
    171173  }
    172174
    173   strncpy (p, string, 80);
     175  memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    174176  va_end (argp);
    175177  return (TRUE);
  • trunk/Ohana/src/libfits/header/F_print.c

    r34577 r42389  
    88
    99  static char blank[] = " ";
    10   char string[82], line[80];
     10  char string[200], line[80];
    1111  char *p;
    1212  va_list argp; 
     
    4646
    4747  /* 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; }
    6464
    6565  /* 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 */
     
    6969    strcpy (line, ptr);
    7070    line[68] = 0;
    71     snprintf (string, 81, "%-8s= '%-8s' / %46s ", field, line, blank);
     71    snprintf (string, 200, "%-8s= '%-8s' / %46s ", field, line, blank);
    7272    goto found_it;
    7373  }
     
    7878
    7979found_it:
    80   strncpy (p, string, 80);
     80  memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    8181  va_end (argp);
    8282  return (TRUE);
     
    8989
    9090  static char blank[] = " ";
    91   char string[82], line[80];
     91  char string[200], line[80];
    9292  char *p, a;
    9393  va_list argp; 
     
    126126    a = va_arg (argp, int);
    127127    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);
    129129    else
    130       snprintf (string, 81, "%-8s= %18s F / %46s ", field, blank, blank);
     130      snprintf (string, 200, "%-8s= %18s F / %46s ", field, blank, blank);
    131131  }
    132132
     
    137137    if (!ptr) goto invalid;
    138138    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);
    141141  } 
    142142
     
    154154  if (!strcmp (mode, "%C")) goto invalid;
    155155
    156   strncpy (p, string, 80);
     156  memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    157157 
    158158  va_end (argp);
  • trunk/Ohana/src/libfits/header/F_scan.c

    r39324 r42389  
    111111  /* non-data entry (COMMENT, HISTORY) */
    112112  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);
    114114    return (TRUE);
    115115  }
  • trunk/Ohana/src/libfits/matrix/F_compress_M.c

    r41739 r42389  
    8686  char keyword[11];
    8787  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);
    8989    if (!gfits_modify (theader, keyword, OFF_T_FMT, 1,  header[0].Naxis[i])) ESCAPE;
    9090  }
    9191
    9292  for (i = 0; i < header->Naxes; i++) {
    93     snprintf (keyword, 10, "ZTILE%d", i + 1);
     93    snprintf_nowarn (keyword, 10, "ZTILE%d", i + 1);
    9494    if (!gfits_modify (theader, keyword, "%lu", 1, ztile[i])) ESCAPE;
    9595  }
     
    131131  // note the difference between the keywords (1 indexed) and the variables (0 indexed)
    132132  for (i = 0; i < Noptions; i++) {
    133     snprintf (key, 10, "ZNAME%d", i + 1);
     133    snprintf_nowarn (key, 10, "ZNAME%d", i + 1);
    134134    if (!gfits_modify (header, key, "%s", 1, optname[i])) break;
    135135
    136     snprintf (key, 10, "ZVAL%d", i + 1);
     136    snprintf_nowarn (key, 10, "ZVAL%d", i + 1);
    137137    if (!gfits_modify (header, key, "%s", 1, optvalue[i])) break;
    138138  }
  • trunk/Ohana/src/libfits/matrix/F_uncompress_M.c

    r41474 r42389  
    9090  int axis;
    9191  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);
    9494    MOD_KEYWORD_REQUIRED (zaxis,  naxis,  OFF_T_FMT,  &header->Naxis[axis],  header->Naxis[axis]);
    9595  }   
     
    108108    // if ZTILE1 exists, all ZTILEn must exist:
    109109    for (axis = 1; axis < header->Naxes; axis++) {
    110       snprintf (key, 10, "ZTILE%d", axis + 1);
     110      snprintf_nowarn (key, 10, "ZTILE%d", axis + 1);
    111111      if (!gfits_scan (header, key, "%lu", 1, &ztile[axis])) ESCAPE;
    112112      gfits_delete (header, key, 1);
  • trunk/Ohana/src/libfits/table/F_create_TH.c

    r38989 r42389  
    1717  myAssert (!header->buffer, "failed to init header or free buffer?");
    1818  ALLOCATE (header[0].buffer, char, NBYTES);
     19  bzero (header[0].buffer, NBYTES);
    1920 
    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';
    2325 
    2426  gfits_modify (header, "XTENSION", "%s", 1, type);
  • trunk/Ohana/src/libfits/table/F_get_T_column.c

    r38553 r42389  
    3232    ALLOCATE (Ivalues, int, table[0].Naxis[1]);
    3333    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);
    3635      Ivalues[i] = atof (tmp);
    3736    }
     
    4140    ALLOCATE (Dvalues, double, table[0].Naxis[1]);
    4241    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);
    4543      Dvalues[i] = atof (tmp);
    4644    }
     
    5351    for (i = 0; i < table[0].Naxis[1]; i++) {
    5452      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);
    5754    }
    5855    values[0] = (char *) Cvalues;
  • trunk/Ohana/src/libfits/table/F_get_T_value.c

    r38553 r42389  
    2626 
    2727  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);
    3029
    3130  if (!strcmp (mode, "%d"))  *(int      *) value = (int)      atof (tmp);
  • trunk/Ohana/src/libfits/table/F_table_column.c

    r38553 r42389  
    7272
    7373  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);
    7675    switch (M) {
    7776    case 0:
Note: See TracChangeset for help on using the changeset viewer.