- Timestamp:
- Feb 1, 2023, 4:13:02 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20220316/psLib/src/sys/psString.c
r41171 r42346 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.
