IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 8, 2023, 11:51:50 AM (3 years ago)
Author:
eugene
Message:

merge from eam_branches/ipp-20220316. deal with more restrictive gcc / autoconf: add no_warn version of strncpy; mysql removes my_bool after v8.0.0

Location:
trunk/psLib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib

  • trunk/psLib/src/sys/psString.c

    r41171 r42378  
    4141
    4242
     43// gcc (Ubuntu 20.04) complains when strncpy is used to copy a fraction of a buffer,
     44// potentially skipping the ending NULL.  To avoid the error, manually copy
     45// and (to ensure the buffer ends in a NULL) set the last + 1 byte to NUL:
     46// WARNING : len(dest) must be >= n + 1
     47char *ps_strncpy_nowarn (char *dest, const char *src, size_t n) {
     48
     49  size_t i;
     50 
     51  char *d = dest;
     52  char *s = (char *) src;
     53  for (i = 0; i < n && *s != 0; i++, d++, s++) { *d = *s; }
     54  for ( ; i <= n; i++, d++) { *d = 0; }
     55 
     56  return dest;
     57}
     58
    4359psString p_psStringAlloc(const char *file,
    4460                         unsigned int lineno,
Note: See TracChangeset for help on using the changeset viewer.