IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42343


Ignore:
Timestamp:
Jan 31, 2023, 10:55:31 AM (3 years ago)
Author:
eugene
Message:

convert instances of strncpy to strncpy_nowarn (or memcpy in specific cases where ending 0 is not desired)

Location:
branches/eam_branches/ipp-20220316/Ohana/src
Files:
72 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/LoadDataPMM.c

    r40291 r42343  
    163163  if (!PMM_CCD_TABLE) abort ();
    164164
    165   strncpy (fileID, datafile, 7);
    166   fileID[7] = 0;
     165  strncpy_nowarn (fileID, datafile, 7);
    167166
    168167  f = fopen (PMM_CCD_TABLE, "r");
     
    177176    if (strncmp (fileID, &line[FILE_ID_INDEX], 7)) continue;
    178177   
    179     strncpy (date, &line[DATE_INDEX], 9);
    180     date[9] = 0;
    181 
    182     strncpy (timestr, &line[TIME_INDEX], 5);
    183     timestr[5] = 0;
    184 
    185     strncpy (RA, &line[RA_INDEX], 6);
    186     RA[6] = 0;
    187 
    188     strncpy (DEC, &line[DEC_INDEX], 7);
    189     DEC[7] = 0;
    190 
    191     strncpy (emulsion, &line[EMULSION_INDEX], 5);
    192     emulsion[5] = 0;
    193 
    194     strncpy (filter, &line[FILTER_INDEX], 6);
    195     filter[6] = 0;
    196 
    197     strncpy (EXPTIME, &line[EXPTIME_INDEX], 3);
    198     EXPTIME[3] = 0;
     178    strncpy_nowarn (date, &line[DATE_INDEX], 9);
     179    strncpy_nowarn (timestr, &line[TIME_INDEX], 5);
     180    strncpy_nowarn (RA, &line[RA_INDEX], 6);
     181    strncpy_nowarn (DEC, &line[DEC_INDEX], 7);
     182    strncpy_nowarn (emulsion, &line[EMULSION_INDEX], 5);
     183    strncpy_nowarn (filter, &line[FILTER_INDEX], 6);
     184    strncpy_nowarn (EXPTIME, &line[EXPTIME_INDEX], 3);
    199185
    200186    image[0].tzero   = pmm_date_to_sec (date, timestr);
     
    357343  double h, m, s, ra;
    358344 
    359   strncpy (tmp, &RA[0], 2);
    360   tmp[2] = 0;
    361   h = atof (tmp);
    362 
    363   strncpy (tmp, &RA[2], 2);
    364   tmp[2] = 0;
    365   m = atof (tmp);
    366 
    367   strncpy (tmp, &RA[4], 2);
    368   tmp[2] = 0;
    369   s = atof (tmp);
     345  strncpy_nowarn (tmp, &RA[0], 2); h = atof (tmp);
     346  strncpy_nowarn (tmp, &RA[2], 2); m = atof (tmp);
     347  strncpy_nowarn (tmp, &RA[4], 2); s = atof (tmp);
    370348
    371349  ra = 15.0 * (h + m / 60.0 + s / 3600.0);
     
    379357  double d, m, s, dec;
    380358
    381   strncpy (tmp, &DEC[1], 2);
    382   tmp[2] = 0;
    383   d = atof (tmp);
    384 
    385   strncpy (tmp, &DEC[3], 2);
    386   tmp[2] = 0;
    387   m = atof (tmp);
    388 
    389   strncpy (tmp, &DEC[5], 2);
    390   tmp[2] = 0;
    391   s = atof (tmp);
     359  strncpy_nowarn (tmp, &DEC[1], 2); d = atof (tmp);
     360  strncpy_nowarn (tmp, &DEC[3], 2); m = atof (tmp);
     361  strncpy_nowarn (tmp, &DEC[5], 2); s = atof (tmp);
    392362
    393363  dec = d + m / 60.0 + s / 3600.0;
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/SkyTableFromBSCIndex.c

    r39318 r42343  
    3535
    3636    memset (tycho[i].name, 0, 21);
    37     strncpy (tycho[i].name, line, 7);
    38     tycho[i].name[7] = 0;
     37    strncpy_nowarn (tycho[i].name, line, 7);
    3938  }
    4039  Ntycho = i;
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/SkyTableFromTychoIndex.c

    r28241 r42343  
    3535
    3636    memset (tycho[i].name, 0, 21);
    37     strncpy (tycho[i].name, line, 7);
    38     tycho[i].name[7] = 0;
     37    strncpy_nowarn (tycho[i].name, line, 7);
    3938  }
    4039  Ntycho = i;
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadatlas_readstars.c

    r41563 r42343  
    242242        // why do I need to copy temp here, does gprint modify the value of temp?
    243243        char temp[32];
    244         strncpy (temp, c0, 32);
    245         temp[31] = 0;
     244        strncpy_nowarn (temp, c0, 31);
    246245        gprint (GP_ERR, "skip line %s\n\n", temp);
    247246      }
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadgaia_dr2_readstars.c

    r40543 r42343  
    238238        // why do I need to copy temp here, does gprint modify the value of temp?
    239239        char temp[32];
    240         strncpy (temp, c0, 32);
    241         temp[31] = 0;
     240        strncpy_nowarn (temp, c0, 31);
    242241        gprint (GP_ERR, "skip line %s\n\n", temp);
    243242      }
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadgaia_edr3_readstars.c

    r41801 r42343  
    253253        // why do I need to copy temp here, does gprint modify the value of temp?
    254254        char temp[32];
    255         strncpy (temp, c0, 32);
    256         temp[31] = 0;
     255        strncpy_nowarn (temp, c0, 31);
    257256        gprint (GP_ERR, "skip line %s\n\n", temp);
    258257      }
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadsupercos_ops.c

    r38986 r42343  
    3838
    3939  Nchar = p2 - p1 - 1;
    40   strncpy (emulsion, p1, Nchar);
    41   emulsion[Nchar] = 0;
     40  strncpy_nowarn (emulsion, p1, Nchar);
    4241  stripwhite (emulsion);
    4342       
    4443  Nchar = p3 - p2 - 1;
    45   strncpy (filterID, p2, Nchar);
    46   filterID[Nchar] = 0;
     44  strncpy_nowarn (filterID, p2, Nchar);
    4745  stripwhite (filterID);
    4846       
     
    6967
    7068  char hour[3], minute[3];
    71   strncpy(hour, p1, 2); hour[2] = 0;
    72   strncpy(minute, p1+2, 2); minute[2] = 0;
     69  strncpy_nowarn(hour, p1, 2);
     70  strncpy_nowarn(minute, p1+2, 2);
    7371
    7472  double minuteF = atof (minute);
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugcs.c

    r42166 r42343  
    458458        // why do I need to copy temp here, does gprint modify the value of temp?
    459459        char temp[32];
    460         strncpy (temp, c0, 32);
    461         temp[31] = 0;
     460        strncpy_nowarn (temp, c0, 31);
    462461        gprint (GP_ERR, "skip line %s\n\n", temp);
    463462      }
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadukirt_uhs_readstars_ugps.c

    r42166 r42343  
    379379        // why do I need to copy temp here, does gprint modify the value of temp?
    380380        char temp[32];
    381         strncpy (temp, c0, 32);
    382         temp[31] = 0;
     381        strncpy_nowarn (temp, c0, 31);
    383382        gprint (GP_ERR, "skip line %s\n\n", temp);
    384383      }
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadukirt_uhs_readstars_uhs.c

    r42166 r42343  
    201201        // why do I need to copy temp here, does gprint modify the value of temp?
    202202        char temp[32];
    203         strncpy (temp, c0, 32);
    204         temp[31] = 0;
     203        strncpy_nowarn (temp, c0, 31);
    205204        gprint (GP_ERR, "skip line %s\n\n", temp);
    206205      }
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadukirt_uhs_readstars_uhs2022.c

    r42212 r42343  
    260260        // why do I need to copy temp here, does gprint modify the value of temp?
    261261        char temp[32];
    262         strncpy (temp, c0, 32);
    263         temp[31] = 0;
     262        strncpy_nowarn (temp, c0, 31);
    264263        gprint (GP_ERR, "skip line %s\n\n", temp);
    265264      }
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/loadukirt_uhs_readstars_ulas.c

    r42166 r42343  
    406406        // why do I need to copy temp here, does gprint modify the value of temp?
    407407        char temp[32];
    408         strncpy (temp, c0, 32);
    409         temp[31] = 0;
     408        strncpy_nowarn (temp, c0, 31);
    410409        gprint (GP_ERR, "skip line %s\n\n", temp);
    411410      }
  • branches/eam_branches/ipp-20220316/Ohana/src/addstar/src/mkcmf.c

    r40291 r42343  
    559559    Ns = strlen (simple);
    560560    No = 80 - Ns;
    561     strncpy (header.buffer, simple, Ns);
     561    strncpy_nowarn (header.buffer, simple, Ns);
    562562    memset (&header.buffer[Ns], ' ', No);
    563563  }
  • branches/eam_branches/ipp-20220316/Ohana/src/elixir/src/Photcodes.c

    r10336 r42343  
    172172
    173173  ALLOCATE (root, char, Nbyte + 1);
    174   strncpy (root, p1, Nbyte);
    175   root[Nbyte] = 0;
     174  strncpy_nowarn (root, p1, Nbyte);
    176175 
    177176  return (root);
     
    195194  Nbyte = p1-file;
    196195  ALLOCATE (path, char, Nbyte + 1);
    197   strncpy (path, file, Nbyte);
    198   path[Nbyte] = 0;
     196  strncpy_nowarn (path, file, Nbyte);
    199197 
    200198  return (path);
     
    232230  Nbyte = (p1 - p2);
    233231  ALLOCATE (path, char, Nbyte + 1);
    234   strncpy (path, p2, Nbyte);
    235   path[Nbyte] = 0;
     232  strncpy_nowarn (path, p2, Nbyte);
    236233 
    237234  return (path);
  • branches/eam_branches/ipp-20220316/Ohana/src/elixir/src/ProcessOps.c

    r27435 r42343  
    6969        REALLOCATE (value, char, Nbyte);
    7070      }   
    71       strncpy (&value[Nout], p1, Ncpy);
     71      strncpy_nowarn (&value[Nout], p1, Ncpy);
    7272      Nout += Ncpy;
    7373      p2 ++;
     
    9090      REALLOCATE (value, char, Nbyte);
    9191    }   
    92     strncpy (&value[Nout], p1, Ncpy);
     92    strncpy_nowarn (&value[Nout], p1, Ncpy);
    9393    Nout += Ncpy;
    94     value[Nout] = 0;
    9594  }
    9695
  • branches/eam_branches/ipp-20220316/Ohana/src/fixcat/src/aregion.c

    r27435 r42343  
    8484  Fread (buffer, 1, 48*NDecLines[NBigDec], f, "char");
    8585  for (i = 0; !done && (i < NDecLines[NBigDec]); i++) {
    86     strncpy (temp, &buffer[i*48], 48);
    87     temp[49] = 0;
     86    strncpy_nowarn (temp, &buffer[i*48], 48);
    8887    hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    8988    if (RA1 < RA0) RA1 += 360.0;
  • branches/eam_branches/ipp-20220316/Ohana/src/imregister/base/fits_scan_nchar.c

    r7080 r42343  
    2020
    2121  status = gfits_scan (header, field, "%s", N, tmpstr);
    22   strncpy (outstr, tmpstr, size - 1);
    23   outstr[size-1] = 0;
     22  strncpy_nowarn (outstr, tmpstr, size - 1);
    2423
    2524  return (status);
  • branches/eam_branches/ipp-20220316/Ohana/src/imregister/detrend/output.c

    r40501 r42343  
    148148    }
    149149    bzero (key, 33);
    150     strncpy (key, p, 32);
     150    strncpy_nowarn (key, p, 32);
    151151    if ((p = strrchr (key, '.')) != (char *) NULL) *p = 0;
    152152
  • branches/eam_branches/ipp-20220316/Ohana/src/imregister/imreg/iminfo.c

    r27590 r42343  
    9191  /* force strings to fit in available space (32 bytes) */
    9292  gfits_scan (&header, CameraKeyword,     "%s", 1, line);
    93   strncpy (image[0].instrument, line, 31);
    94   image[0].instrument[31] = 0;
     93  strncpy_nowarn (image[0].instrument, line, 31);
    9594
    9695  gfits_scan (&header, FilterKeyword, "%s", 1, line);
    9796  MatchFilterList (line);
    98   strncpy (image[0].filter, line, 31);
    99   image[0].filter[31] = 0;
     97  strncpy_nowarn (image[0].filter, line, 31);
    10098
    10199  /* header has RA & DEC in decimal degrees */
  • branches/eam_branches/ipp-20220316/Ohana/src/imregister/imreg/modify.c

    r34088 r42343  
    6969
    7070    if (output.modify_filter) {
    71       strncpy (image[i].filter, output.filter, 31);
     71      strncpy_nowarn (image[i].filter, output.filter, 31);
    7272    }
    7373
  • branches/eam_branches/ipp-20220316/Ohana/src/kapa2/src/LoadLabels.c

    r41341 r42343  
    2323
    2424  Nbytes = MIN (strlen(label), LABEL_MAXLEN - 1);
    25   strncpy (graph[0].label[mode].text, label, Nbytes);
    26   label[Nbytes] = 0;
     25  strncpy_nowarn (graph[0].label[mode].text, label, Nbytes);
    2726 
    2827  FREE (label);
  • branches/eam_branches/ipp-20220316/Ohana/src/kapa2/src/LoadTickmarks.c

    r16011 r42343  
    4747      line[128] = 0;
    4848      ALLOCATE (image[0].tickmarks.objects[Nobjects].text, char, (int) dx + 1);
    49       strncpy (image[0].tickmarks.objects[Nobjects].text, line, (int) dx);
    50       image[0].tickmarks.objects[Nobjects].text[(int)dx] = 0;
     49      strncpy_nowarn (image[0].tickmarks.objects[Nobjects].text, line, (int) dx);
    5150    }     
    5251   
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c

    r40291 r42343  
    230230
    231231    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    232     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    233     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     232    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    234233
    235234    out[i].tzero            = in[i].tzero;
     
    302301
    303302    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    304     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    305     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     303    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    306304
    307305    out[i].tzero            = in[i].tzero;
     
    358356
    359357  for (i = 0; i < Nvalues; i++) {
    360     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    361     out[i].name[31] = 0; // force termination
     358    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    362359
    363360    out[i].code  = in[i].code;         
     
    397394
    398395  for (i = 0; i < Nvalues; i++) {
    399     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    400     out[i].name[31] = 0; // force termination
     396    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    401397
    402398    out[i].code = in[i].code;         
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c

    r40291 r42343  
    225225
    226226    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    227     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    228     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     227    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    229228
    230229    out[i].tzero            = in[i].tzero;
     
    294293
    295294    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    296     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    297     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     295    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    298296
    299297    out[i].tzero            = in[i].tzero;
     
    353351
    354352  for (i = 0; i < Nvalues; i++) {
    355     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    356     out[i].name[31] = 0; // force termination
     353    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    357354
    358355    out[i].code  = in[i].code;         
     
    390387
    391388  for (i = 0; i < Nvalues; i++) {
    392     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    393     out[i].name[31] = 0; // force termination
     389    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    394390
    395391    out[i].code  = in[i].code;         
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_3.c

    r40291 r42343  
    2424
    2525    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    26     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    27     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     26    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    2827
    2928    out[i].tzero            = in[i].tzero;
     
    8887
    8988    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    90     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    91     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     89    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    9290
    9391    out[i].tzero            = in[i].tzero;
     
    146144
    147145  for (i = 0; i < Nvalues; i++) {
    148     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    149     out[i].name[31] = 0; // force termination
     146    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    150147
    151148    out[i].code  = in[i].code;         
     
    182179
    183180  for (i = 0; i < Nvalues; i++) {
    184     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    185     out[i].name[31] = 0; // force termination
     181    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    186182
    187183    out[i].code  = in[i].code;         
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c

    r40291 r42343  
    153153
    154154    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    155     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    156     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     155    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    157156
    158157    out[i].tzero            = in[i].tzero;
     
    220219
    221220    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    222     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    223     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     221    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    224222
    225223    out[i].tzero            = in[i].tzero;
     
    277275
    278276  for (i = 0; i < Nvalues; i++) {
    279     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    280     out[i].name[31] = 0; // force termination
     277    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    281278
    282279    out[i].code  = in[i].code;         
     
    313310
    314311  for (i = 0; i < Nvalues; i++) {
    315     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    316     out[i].name[31] = 0; // force termination
     312    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    317313
    318314    out[i].code  = in[i].code;         
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c

    r40291 r42343  
    313313
    314314    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    315     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    316     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     315    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    317316
    318317    out[i].tzero            = in[i].tzero;
     
    382381
    383382    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    384     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    385     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     383    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    386384
    387385    out[i].tzero            = in[i].tzero;
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c

    r40291 r42343  
    249249
    250250    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    251     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    252     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     251    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    253252
    254253    out[i].tzero            = in[i].tzero;
     
    317316
    318317    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    319     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    320     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     318    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    321319
    322320    out[i].tzero            = in[i].tzero;
     
    375373
    376374  for (i = 0; i < Nvalues; i++) {
    377     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    378     out[i].name[31] = 0; // force termination
     375    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    379376
    380377    out[i].code  = in[i].code;         
     
    411408
    412409  for (i = 0; i < Nvalues; i++) {
    413     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    414     out[i].name[31] = 0; // force termination
     410    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    415411
    416412    out[i].code  = in[i].code;         
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c

    r40291 r42343  
    260260
    261261    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    262     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    263     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     262    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    264263
    265264    out[i].tzero            = in[i].tzero;
     
    328327
    329328    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    330     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    331     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     329    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    332330
    333331    out[i].tzero            = in[i].tzero;
     
    391389
    392390  for (i = 0; i < Nvalues; i++) {
    393     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    394     out[i].name[31] = 0; // force termination
     391    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    395392
    396393    out[i].code  = in[i].code;         
     
    427424
    428425  for (i = 0; i < Nvalues; i++) {
    429     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    430     out[i].name[31] = 0; // force termination
     426    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    431427
    432428    out[i].code  = in[i].code;         
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c

    r40291 r42343  
    270270
    271271    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    272     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    273     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     272    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    274273
    275274    out[i].tzero            = in[i].tzero;
     
    338337
    339338    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    340     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    341     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     339    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    342340
    343341    out[i].tzero            = in[i].tzero;
     
    401399
    402400  for (i = 0; i < Nvalues; i++) {
    403     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    404     out[i].name[31] = 0; // force termination
     401    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    405402
    406403    out[i].code  = in[i].code;         
     
    437434
    438435  for (i = 0; i < Nvalues; i++) {
    439     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    440     out[i].name[31] = 0; // force termination
     436    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    441437
    442438    out[i].code  = in[i].code;         
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c

    r40291 r42343  
    308308
    309309    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    310     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    311     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     310    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    312311
    313312    out[i].tzero            = in[i].tzero;
     
    376375
    377376    // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN
    378     strncpy (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    379     out[i].name[DVO_IMAGE_NAME_LEN - 1] = 0; // force termination
     377    strncpy_nowarn (out[i].name, in[i].name, DVO_IMAGE_NAME_LEN - 1);
    380378
    381379    out[i].tzero            = in[i].tzero;
     
    439437
    440438  for (i = 0; i < Nvalues; i++) {
    441     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    442     out[i].name[31] = 0; // force termination
     439    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    443440
    444441    out[i].code  = in[i].code;         
     
    475472
    476473  for (i = 0; i < Nvalues; i++) {
    477     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    478     out[i].name[31] = 0; // force termination
     474    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    479475
    480476    out[i].code  = in[i].code;         
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c

    r40291 r42343  
    11341134
    11351135    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    1136     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    1137     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     1136    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    11381137
    11391138    out[i].tzero            = in[i].tzero;
     
    12031202
    12041203    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    1205     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    1206     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     1204    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    12071205
    12081206    out[i].tzero            = in[i].tzero;
     
    12671265
    12681266  for (i = 0; i < Nvalues; i++) {
    1269     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    1270     out[i].name[31] = 0; // force termination
     1267    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    12711268
    12721269    out[i].code  = in[i].code;         
     
    13031300
    13041301  for (i = 0; i < Nvalues; i++) {
    1305     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    1306     out[i].name[31] = 0; // force termination
     1302    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    13071303
    13081304    out[i].code  = in[i].code;         
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_PS1_V5_LOAD.c

    r40291 r42343  
    645645
    646646    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    647     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    648     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     647    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    649648
    650649    out[i].tzero            = in[i].tzero;
     
    714713
    715714    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    716     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    717     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     715    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    718716
    719717    out[i].tzero            = in[i].tzero;
     
    778776
    779777  for (i = 0; i < Nvalues; i++) {
    780     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    781     out[i].name[31] = 0; // force termination
     778    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    782779
    783780    out[i].code  = in[i].code;         
     
    814811
    815812  for (i = 0; i < Nvalues; i++) {
    816     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    817     out[i].name[31] = 0; // force termination
     813    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    818814
    819815    out[i].code  = in[i].code;         
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_PS1_V6.c

    r40291 r42343  
    860860
    861861    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    862     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    863     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     862    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    864863
    865864    out[i].tzero            = in[i].tzero;
     
    927926
    928927    // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN
    929     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    930     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     928    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    931929
    932930    out[i].tzero            = in[i].tzero;
     
    990988
    991989  for (i = 0; i < Nvalues; i++) {
    992     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    993     out[i].name[31] = 0; // force termination
     990    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    994991
    995992    out[i].code  = in[i].code;         
     
    10261023
    10271024  for (i = 0; i < Nvalues; i++) {
    1028     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    1029     out[i].name[31] = 0; // force termination
     1025    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    10301026
    10311027    out[i].code  = in[i].code;         
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_elixir.c

    r40291 r42343  
    217217
    218218    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    219     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    220     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     219    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    221220
    222221    out[i].tzero            = in[i].tzero;
     
    291290
    292291    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    293     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    294     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     292    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    295293
    296294    out[i].tzero            = in[i].tzero;
     
    346344
    347345  for (i = 0; i < Nvalues; i++) {
    348     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    349     out[i].name[31] = 0; // force termination
     346    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    350347
    351348    out[i].code  = in[i].code;         
     
    386383
    387384  for (i = 0; i < Nvalues; i++) {
    388     strncpy (out[i].name, in[i].name, 31); // out[32], in[32]
    389     out[i].name[31] = 0; // force termination
     385    strncpy_nowarn (out[i].name, in[i].name, 31); // out[32], in[32]
    390386
    391387    out[i].code  = in[i].code;         
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_loneos.c

    r40291 r42343  
    195195
    196196    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    197     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    198     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     197    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    199198
    200199    out[i].tzero            = in[i].tzero;
     
    270269
    271270    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    272     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    273     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     271    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    274272
    275273    out[i].tzero            = in[i].tzero;
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c

    r40291 r42343  
    238238
    239239    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    240     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    241     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     240    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    242241
    243242    out[i].tzero            = in[i].tzero;
     
    312311
    313312    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    314     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    315     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     313    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    316314
    317315    out[i].tzero            = in[i].tzero;
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c

    r40291 r42343  
    238238
    239239    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    240     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    241     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     240    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    242241
    243242    out[i].tzero            = in[i].tzero;
     
    312311
    313312    // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN
    314     strncpy (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    315     out[i].name[RAW_IMAGE_NAME_LEN - 1] = 0; // force termination
     313    strncpy_nowarn (out[i].name, in[i].name, RAW_IMAGE_NAME_LEN - 1);
    316314
    317315    out[i].tzero            = in[i].tzero;
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/skydb.c

    r38553 r42343  
    275275      new[Nnew].depth = 2;
    276276      new[Nnew].child = FALSE;
    277       strncpy (root, db[i].name, 5); root[5] = 0;
     277      strncpy_nowarn (root, db[i].name, 5);
    278278      myAssert (snprintf (new[Nnew].name, 18, "%s/r%04d.cpt", root, Rnumber) < 18, "overflow");
    279279      Rnumber ++;     
     
    364364        db[N].depth = 3;
    365365        db[N].child = FALSE;
    366         strncpy (root, db[i].name, 10); root[10] = 0;
     366        strncpy_nowarn (root, db[i].name, 10);
    367367        myAssert (snprintf (db[N].name, 18, "%s.%02d.cpt", root, Rnumber) < 18, "overflow");
    368368        Rnumber ++;
  • branches/eam_branches/ipp-20220316/Ohana/src/libdvo/src/skyregion_gsc.c

    r42116 r42343  
    254254  ALLOCATE (regions, SkyRegion, Nregions);
    255255  for (i = 0; i < Nregions; i++) {
    256     strncpy (temp, &buffer[i*48], 48);
    257     temp[48] = 0;
     256    strncpy_nowarn (temp, &buffer[i*48], 48);
    258257    hstgsc_hms_to_deg (&Rmin, &Rmax, &Dmin, &Dmax, &temp[7]);
    259258    if (Dmax < Dmin) SWAP (Dmin, Dmax);
  • branches/eam_branches/ipp-20220316/Ohana/src/libfits/header/F_convert_H.c

    r15487 r42343  
    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
  • branches/eam_branches/ipp-20220316/Ohana/src/libfits/header/F_modify.c

    r42116 r42343  
    4848    qe += 3;
    4949    qe = MIN (p + 80, qe);
    50     strncpy (comment, qe, p + 80 - qe);
     50    strncpy_nowarn (comment, qe, p + 80 - qe);
    5151  }
    5252  gfits_pad_ending (comment, 0x20, 82);  /* comment must contain spaces to the end */
    5353
    5454  /* write the numeric modes */
    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; }
     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; }
    6060  if (!strcmp (mode, "%lu"))  { snprintf (string, 200, "%-8s= %20lu / %-s ",   field, va_arg (argp, unsigned long),      comment); goto found_it; }
    6161  if (!strcmp (mode, "%llu")) { snprintf (string, 200, "%-8s= %20llu / %-s ",  field, va_arg (argp, unsigned long long), comment); goto found_it; }
    6262  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; }
     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; }
    7171
    7272  /* string value.  Quotes must be at least 8 chars apart */
     
    7474    char *ptr = va_arg (argp, char *);
    7575    if (!ptr) goto invalid;
    76     strncpy (data, ptr, 68);
     76    strncpy_nowarn (data, ptr, 68);
    7777    snprintf (string, 200, "%-8s= '%-8s' / %-s ", field, data, comment);
    7878    goto found_it;
     
    8585
    8686found_it:
    87   strncpy (p, string, 80);
     87  memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    8888  va_end (argp);
    8989  return (TRUE);
     
    134134    qe += 3;
    135135    qe = MIN (p + 80, qe);
    136     strncpy (comment, qe, p + 80 - qe);
     136    strncpy_nowarn (comment, qe, p + 80 - qe);
    137137  }
    138138  gfits_pad_ending (comment, 0x20, 82);  /* comment must contain spaces to the end */
     
    150150    char *ptr = va_arg (argp, char *);
    151151    if (!ptr) goto invalid;
    152     strncpy (data, ptr, 71);
     152    strncpy_nowarn (data, ptr, 71);
    153153    snprintf (string, 200, "%-8s %-71s", field, data);
    154154  } 
     
    163163    if (qs[-1] == 0x27) qs --;
    164164
    165     strncpy (data, qs, MAX (MIN (qe - qs, 71), 0));
     165    strncpy_nowarn (data, qs, MAX (MIN (qe - qs, 71), 0));
    166166
    167167    char *ptr = va_arg (argp, char *);
    168168    if (!ptr) goto invalid;
    169     strncpy (comment, ptr, 80);
     169    strncpy_nowarn (comment, ptr, 80);
    170170    gfits_pad_ending (comment, 0x20, 82);  /* comment must contain spaces to the end */
    171171    snprintf (string, 200, "%-8s= %s / %-s", field, data, comment);
     
    173173  }
    174174
    175   strncpy (p, string, 80);
     175  memcpy (p, string, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    176176  va_end (argp);
    177177  return (TRUE);
  • branches/eam_branches/ipp-20220316/Ohana/src/libfits/header/F_print.c

    r42116 r42343  
    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);
     
    137137    if (!ptr) goto invalid;
    138138    bzero (line, 80);
    139     strncpy (line, ptr, 71);
     139    strncpy_nowarn (line, ptr, 71);
    140140    snprintf (string, 200, "%-8s %-71s", field, line);
    141141  } 
     
    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);
  • branches/eam_branches/ipp-20220316/Ohana/src/libfits/header/F_scan.c

    r39324 r42343  
    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  }
  • branches/eam_branches/ipp-20220316/Ohana/src/libfits/table/F_get_T_column.c

    r38553 r42343  
    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;
  • branches/eam_branches/ipp-20220316/Ohana/src/libfits/table/F_get_T_value.c

    r38553 r42343  
    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);
  • branches/eam_branches/ipp-20220316/Ohana/src/libfits/table/F_table_column.c

    r38553 r42343  
    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:
  • branches/eam_branches/ipp-20220316/Ohana/src/libkapa/src/RotFont.c

    r41341 r42343  
    3030  currentfont = RotFonts[DEFFONT].font;
    3131  currentscale = 1.0;
    32   strncpy (currentname, RotFonts[DEFFONT].name, 63); currentname[63] = 0;
     32  strncpy_nowarn (currentname, RotFonts[DEFFONT].name, 63);
    3333  currentsize = RotFonts[DEFFONT].size;
    3434}
     
    7979    currentsize = size;
    8080    if (name != currentname) {
    81       strncpy (currentname, name, 63); currentname[63] = 0;
     81      strncpy_nowarn (currentname, name, 63);
    8282    }
    8383    return (TRUE);
  • branches/eam_branches/ipp-20220316/Ohana/src/libohana/include/ohana.h

    r41468 r42343  
    296296char   *strcreate              PROTO((char *string));
    297297char   *strncreate             PROTO((char *string, int n));
     298char   *strncpy_nowarn         PROTO((char *dest, char *src, size_t n));
    298299int     strextend              PROTO((char **input, char *format,...)) OHANA_FORMAT(printf, 2, 3);
    299300int     scan_line              PROTO((FILE *f, char *line));
  • branches/eam_branches/ipp-20220316/Ohana/src/libohana/src/findexec.c

    r42144 r42343  
    291291      if (e == (char *) NULL) {
    292292        done = TRUE;
    293         strncpy (path, c, strlen(c));
     293        strncpy_nowarn (path, c, strlen(c));
    294294      } else {
    295         strncpy (path, c, e-c);
     295        strncpy_nowarn (path, c, e-c);
    296296        c = e+1;
    297297        e = strchr (c, ':');
  • branches/eam_branches/ipp-20220316/Ohana/src/libohana/src/string.c

    r40549 r42343  
    4242 
    4343  return (value);
     44}
     45
     46// gcc (Ubuntu 20.04) complains when strncpy is used to copy a fraction of a buffer,
     47// potentially skipping the ending NULL.  To avoid the error, manually copy
     48// and (to ensure the buffer ends in a NULL) set the last + 1 byte to NUL:
     49// WARNING : len(dest) must be >= n + 1
     50char *strncpy_nowarn (char *dest, char *src, size_t n) {
     51
     52  size_t i;
     53 
     54  char *d = dest;
     55  char *s = src;
     56  for (i = 0; i < n && *s != 0; i++, d++, s++) { *d = *s; }
     57  for ( ; i <= n; i++, d++) { *d = 0; }
     58 
     59  return dest;
    4460}
    4561
     
    125141  ALLOCATE (out, char, N1 + N2 + N3 + 1);
    126142
    127   strncpy (out, string, N1);
    128   strncpy (&out[N1], with, N2);
    129   strncpy (&out[N1+N2], ext, N3);
    130   out[N1+N2+N3] = 0;
     143  strncpy_nowarn (&out[0],     string, N1);
     144  strncpy_nowarn (&out[N1],    with,   N2);
     145  strncpy_nowarn (&out[N1+N2], ext,    N3);
    131146
    132147  return out;
  • branches/eam_branches/ipp-20220316/Ohana/src/misc/src/cfhtlog.c

    r18 r42343  
    303303                           year, month,day,hour,min);
    304304                    for (j = 0; j < nprobes; j++) {
    305                         strncpy(bufstr, data + (14 + probes[j]*9), 9);
    306                         bufstr[9] =0;
     305                        strncpy_nowarn(bufstr, data + (14 + probes[j]*9), 9);
    307306                        printf("%s ", bufstr);
    308307                    }
  • branches/eam_branches/ipp-20220316/Ohana/src/misc/src/fakecmp.c

    r27435 r42343  
    8181    line[80] = 0;
    8282    bzero (keyword, 10);
    83     strncpy (keyword, line, 8);
     83    strncpy_nowarn (keyword, line, 8);
    8484   
    8585    /* replace existing keywords, unless this is a COMMENT or HISTORY field */
     
    8787      p = gfits_header_field (&header, keyword, 1);
    8888      if (p != (char *) NULL) {
    89         strncpy (p, line, 80);
     89        strncpy_nowarn (p, line, 80);
    9090        continue;
    9191      }
     
    106106
    107107    /* insert the new line here */
    108     strncpy (p, line, 80);
     108    strncpy_nowarn (p, line, 80);
    109109  }
    110110
  • branches/eam_branches/ipp-20220316/Ohana/src/misc/src/gtfringetable.c

    r7080 r42343  
    7272      N = strlen (p);
    7373
    74     strncpy (line, p, N);
     74    strncpy_nowarn (line, p, N);
    7575
    7676    fprintf (stderr, "%s\n", line);
  • branches/eam_branches/ipp-20220316/Ohana/src/misc/src/mkfringetable.c

    r14590 r42343  
    200200      N = strlen (p);
    201201
    202     strncpy (line, p, N);
     202    strncpy_nowarn (line, p, N);
    203203
    204204    fprintf (stderr, "%s\n", line);
  • branches/eam_branches/ipp-20220316/Ohana/src/mosastro/src/output.c

    r27435 r42343  
    1717
    1818    bzero (outname, 256);
    19     strncpy (outname, chip[i].file, N);
     19    strncpy_nowarn (outname, chip[i].file, N);
    2020
    2121    strcat (outname, ext);
  • branches/eam_branches/ipp-20220316/Ohana/src/nightd/src/misc.c

    r27611 r42343  
    208208    Nchar = e - p;
    209209    ALLOCATE (args[N], char, Nchar + 1);
    210     strncpy (args[N], p, Nchar);
    211     args[N][Nchar] = 0;
     210    strncpy_nowarn (args[N], p, Nchar);
    212211    p = e;
    213212    for (; isspace (*p); p++);
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.basic/memory.c

    r41341 r42343  
    2727  if (!strcasecmp (argv[1], "checkfree")) {
    2828    ohana_memcheck (1);
     29    return (TRUE);
     30  }
     31  if (!strcasecmp (argv[1], "stats")) {
     32    OhanaMemstats memstats = ohana_memstats (0);
     33    set_variable ("memory:Ntotal", memstats.Ntotal);
     34    set_variable ("memory:Nbytes", memstats.Nbytes);
     35    set_variable ("memory:Ngood",  memstats.Ngood);
     36    set_variable ("memory:Nbad",   memstats.Nbad);
    2937    return (TRUE);
    3038  }
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.basic/test/stackmath.tp

    r42342 r42343  
    11
    2 input tap.sh
     2input ../../test/tap.tp
    33
    44macro go
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/read_vectors.c

    r42082 r42343  
    385385      if (!lineStatus && VERBOSE) {
    386386        char temp[32];
    387         strncpy (temp, c0, 32);
    388         temp[31] = 0;
     387        strncpy_nowarn (temp, c0, 31);
    389388        gprint (GP_ERR, "skip line %s\n\n", temp);
    390389      }
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/test/histogram.sh

    r20936 r42343  
    3535 local i
    3636
    37  list word -x "ps -p $PID -o rss"
    38  $startmem = $word:1
     37 create xhis 0 10 0.1
     38 $i = 1
     39
     40 memory stats
     41 $startmem = $memory:Ntotal
    3942
    4043 for i 0 1000
     
    4245 end
    4346 
    44  list word -x "ps -p $PID -o rss"
    45  $endmem = $word:1
     47 memory stats
     48 $endmem = $memory:Ntotal
    4649
    4750 $PASS = 1
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/test/join.sh

    r36084 r42343  
    2121
    2222 join ID1 ID2
    23 
    24 mana: for i 0 index1[]
    25 >> echo index1[$i] index2[$i]
    26 >> end
    27 0 2
    28 2 1
    29 4 0
    30 5 3
    31 mana: join ID1 ID2 -outer
    32 mana: vectors
    33     N       name      size
    34     0        ID1          6 (INT)
    35     1       val1          6 (FLT)
    36     2        ID2          4 (INT)
    37     3        val          4 (FLT)
    38     4     index1          6 (INT)
    39     5     index2          4 (INT)
    40 mana: for i 0 index1[]
    41 >> echo index1[$i]
    42 >> end
    43 2
    44 -1
    45 1
    46 -1
    47 0
    48 3
    49 mana: echo ID1[2]
    50 3
    51 mana: echo ID1[0] ID2[2]
    52 1 1
    53 mana: for i 0 index1[]
    54 >> if (index1[$i] == -1) continue
    55 >> $N = index1[$i]
    56 >> echo $i index1[$i] ID1[$i] ID2[$N]
    57 >> end
    58 0 2 1 1
    59 2 1 3 3
    60 4 0 5 5
    61 5 3 6 6
    62 mana: for i 0 index2[]
    63 >> if (index2[$i] == -1) continue
    64 >> $N = index2[$i]
    65 >> echo $i index2[$i] ID2[$i] ID1[$N]
    66 >> end
    67 0 4 5 5
    68 1 2 3 3
    69 2 0 1 1
    70 3 5 6 6
    71 mana:
    72 
    73  # if ((xvec[1024] != 17) || (yvec[1024] != 100))
    74  #  $PASS = 0
    75  #  echo "Value mismatch: xvec[1024] yvec[1024] (should be 17,100)"
    76  # end
    77  #
    78  # imhist -q buff xvec yvec -region 40 0 25 10 -range 0 10
    79  #
    80  # if ((xvec[1024] != 10) || (yvec[1024] != 100))
    81  #  $PASS = 0
    82  #  echo "Value mismatch: xvec[1024] yvec[1024] (should be 10,100)"
    83  # end
    8423
    8524end
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/wd.c

    r41674 r42343  
    115115      Ns = strlen (simple);
    116116      No = 80 - Ns;
    117       strncpy (temp_header.buffer, simple, Ns);
     117      strncpy_nowarn (temp_header.buffer, simple, Ns);
    118118      memset (&temp_header.buffer[Ns], ' ', No);
    119119    }
     
    275275  return (f);
    276276}
    277 
    278 
    279 ///    /* fix up header */
    280 ///    {
    281 ///      static char simple[] = "XTENSION= 'IMAGE  '            / Image extension";
    282 ///      int Ns, No;
    283 ///      Ns = strlen (simple);
    284 ///      No = 80 - Ns;
    285 ///      strncpy (temp_header.buffer, simple, Ns);
    286 ///      memset (&temp_header.buffer[Ns], ' ', No);
    287 ///    }
    288 ///
    289 ///    /* position to end of file to write new extend */
    290 ///    fseeko (f, 0LL, SEEK_END);
    291 ///    nbytes = fwrite (temp_header.buffer, 1, temp_header.datasize, f);
    292 ///    fclose (f);
    293 ///    if (nbytes != temp_header.datasize) {
    294 ///      gprint (GP_ERR, "failed to write file\n");
    295 ///      status = FALSE;
    296 ///      goto done1;
    297 ///    }
    298 ///
    299 ///  }
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/write_vectors.c

    r42166 r42343  
    214214    /* identify type (%NNNNd %NNNNf) */
    215215    for (p2 = p1 + 1; (*p2 == '.') || (*p2 == '-') || (*p2 == '+') || (*p2 == ' ') || isdigit(*p2); p2++);
    216     strncpy (fmtlist[j], p0, p2 - p0 + 1);
     216    strncpy_nowarn (fmtlist[j], p0, p2 - p0 + 1);
    217217    switch (*p2) {
    218218      case 'e':
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/dvo/aregion.c

    r27435 r42343  
    4949  fread (buffer, 1, 48*NDecLines[NBigDec], f);
    5050  for (i = 0; !done && (i < NDecLines[NBigDec]); i++) {
    51     strncpy (temp, &buffer[i*48], 48);
    52     temp[49] = 0;
     51    strncpy_nowarn (temp, &buffer[i*48], 48);
    5352    hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    5453    if (RA1 < RA0) RA1 += 360.0;
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/dvo/find_regions.c

    r27435 r42343  
    100100    fread (buffer, 48*NDecLines[NBigDec + j], 1, f);
    101101    for (i = 0; (i < NDecLines[NBigDec + j]); i++) {
    102       strncpy (temp, &buffer[i*48], 48);
    103       temp[49] = 0;
     102      strncpy_nowarn (temp, &buffer[i*48], 48);
    104103      hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    105104      if (RA1 < RA0) RA1 += 360.0;
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/VectorIO.c

    r42166 r42343  
    261261  memset (endptr, ' ', FT_LINE_LENGTH);
    262262
    263   strncpy (endptr, newline, 80);
     263  strncpy_nowarn (endptr, newline, 80);
    264264  endptr += FT_LINE_LENGTH;
    265265
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/expand_vectors.c

    r42165 r42343  
    5151
    5252  n = L - line;
    53   strncpy (newline, line, n);
     53  strncpy_nowarn (newline, line, n);
    5454  N = newline + n;
    5555  J = 0;
     
    256256
    257257    n = (int) (w - L);
    258     strncpy (N, L, n);
     258    strncpy_nowarn (N, L, n);
    259259    N += n;
    260260    n = strlen (strValue);
    261     strncpy (N, strValue, n);
     261    strncpy_nowarn (N, strValue, n);
    262262    N += n;
    263263    L = q + 1;
     
    274274
    275275  n = strlen (L);
    276   strncpy (N, L, n);
    277   N[n] = 0;
     276  strncpy_nowarn (N, L, n);
    278277  free (line);
    279278  return (newline);
  • branches/eam_branches/ipp-20220316/Ohana/src/opihi/test/tests.sh

    r41470 r42343  
    5353  for Tj 0 $testscripts:n
    5454    if ($VERBOSE > 1)
    55       echo " running $testscripts:$Tj"
     55      echo " ----- running $testscripts:$Tj -----"
    5656    end
    5757    runtests $testscripts:$Tj     
  • branches/eam_branches/ipp-20220316/Ohana/src/tools/src/findexec.c

    r12333 r42343  
    101101        done = TRUE;
    102102        bzero (path, 256);
    103         strncpy (path, c, strlen(c));
     103        strncpy_nowarn (path, c, strlen(c));
    104104      } else {
    105105        bzero (path, 256);
    106         strncpy (path, c, e-c);
     106        strncpy_nowarn (path, c, e-c);
    107107        c = e+1;
    108108        e = strchr (c, ':');
  • branches/eam_branches/ipp-20220316/Ohana/src/tools/src/fits_insert.c

    r27491 r42343  
    8585    p = gfits_header_field (&header, "COMMENT", Cnumber);
    8686    if (p != (char *) NULL) {
    87       strncpy (p, line, 80);
     87      memcpy (p, line, 80); // do not use strncpy_nowarn: do NOT set last byte to NULL
    8888    }
    8989  }
     
    108108    line[80] = 0;
    109109    bzero (keyword, 10);
    110     strncpy (keyword, line, 8);
     110    strncpy_nowarn (keyword, line, 8);
    111111   
    112112    /* replace existing keywords, unless this is a COMMENT or HISTORY field */
     
    114114      p = gfits_header_field (&header, keyword, 1);
    115115      if (p != (char *) NULL) {
    116         strncpy (p, line, 80);
     116        strncpy_nowarn (p, line, 80);
    117117        continue;
    118118      }
     
    151151        exit (1);
    152152      }
    153       strncpy (p+80, "END", 3);
     153      memcpy (p+80, "END", 3); // do not use strncpy_nowarn, do NOT set last byte to NULL
    154154      for (i = 3; i < 80; i++) { p[80+i] = ' '; }
    155155    }
    156156    /* insert the new line here */
    157     strncpy (p, line, 80);
     157    memcpy (p, line, 80); // do not use strncpy_nowarn, do NOT set last byte to NULL
    158158  }
    159159  if (fclose (f)) {
  • branches/eam_branches/ipp-20220316/Ohana/src/tools/src/mpcorb_predict.c

    r42076 r42343  
    775775  // set the byte after the range to NULL and scanf the values.  or just use strtod as needed:
    776776
    777   strncpy (planet->ID, line, 7); planet->ID[7] = 0;
     777  strncpy_nowarn (planet->ID, line, 7);
    778778
    779779  char *endptr;
  • branches/eam_branches/ipp-20220316/Ohana/src/tools/src/mpcorb_predict_tests.c

    r41713 r42343  
    10591059  // set the byte after the range to NULL and scanf the values.  or just use strtod as needed:
    10601060
    1061   strncpy (planet->ID, line, 7); planet->ID[7] = 0;
     1061  strncpy_nowarn (planet->ID, line, 7);
    10621062
    10631063  MPC_DOUBLE (planet->mean_anomaly, 27, 35);
Note: See TracChangeset for help on using the changeset viewer.