Safe copy: copies maxlen-1 max and for maxlen>0 returns zero terminated dest.
| 295 | |
| 296 | // Safe copy: copies maxlen-1 max and for maxlen>0 returns zero terminated dest. |
| 297 | void wcsncpyz(wchar *dest, const wchar *src, size_t maxlen) |
| 298 | { |
| 299 | if (maxlen>0) |
| 300 | { |
| 301 | while (--maxlen>0 && *src!=0) |
| 302 | *dest++=*src++; |
| 303 | *dest=0; |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | |
| 308 | // Safe append: resulting dest length cannot exceed maxlen and dest |
no outgoing calls