Changeset 42378 for trunk/psLib/src/sys/psString.c
- Timestamp:
- Feb 8, 2023, 11:51:50 AM (3 years ago)
- Location:
- trunk/psLib
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/sys/psString.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20220316/psLib (added) merged: 42117-42118,42153,42346,42353-42354,42368
- Property svn:mergeinfo changed
-
trunk/psLib/src/sys/psString.c
r41171 r42378 41 41 42 42 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 47 char *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 43 59 psString p_psStringAlloc(const char *file, 44 60 unsigned int lineno,
Note:
See TracChangeset
for help on using the changeset viewer.
