Bounded string copy
| 13 | |
| 14 | // Bounded string copy |
| 15 | size_t str_copy(char *dest, const char *src, size_t max) |
| 16 | { |
| 17 | size_t len = 0; |
| 18 | if (max != 0) { |
| 19 | len = strlen(src); |
| 20 | if (len > max - 1) { |
| 21 | len = max - 1; |
| 22 | } |
| 23 | memcpy(dest, src, len); |
| 24 | dest[len] = '\0'; |
| 25 | } |
| 26 | return len; |
| 27 | } |
| 28 | |
| 29 | QString str_titlecase(const QString& str) |
| 30 | { |
no outgoing calls
no test coverage detected