To support this change, turn on lots more compiler warnings, and fix all the warnings generated.
Showing the changes to src/util.c (1 of 93 files). Show all
Unified · Split
| @@ -16,9 +16,9 @@ · 15 unmodified lines | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include "st_i.h" | 18 | #include "st_i.h" |
| 19 | #include <stddef.h> | ||
| 19 | #include <string.h> | 20 | #include <string.h> |
| 20 | #include <ctype.h> | 21 | #include <ctype.h> |
| 21 | |||
| 22 | #include <stdarg.h> | 22 | #include <stdarg.h> |
| 23 | 23 | ||
| 24 | struct st_output_message_s | 24 | struct st_output_message_s |
| @@ -49,8 +49,8 @@ void st_output_message(FILE * file, st_output_message_t message) · 24 unmodified lines | |||
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | dot_pos = strrchr(drivername, '.'); | 51 | dot_pos = strrchr(drivername, '.'); |
| 52 | if (dot_pos != NULL && dot_pos - drivername <= sizeof(buffer) - 1) { | 52 | if (dot_pos != NULL && dot_pos - drivername <= (ptrdiff_t)(sizeof(buffer) - 1)) { |
| 53 | strncpy(buffer, drivername, dot_pos - drivername); | 53 | strncpy(buffer, drivername, (size_t)(dot_pos - drivername)); |
| 54 | buffer[dot_pos - drivername] = '\0'; | 54 | buffer[dot_pos - drivername] = '\0'; |
| 55 | drivername = buffer; | 55 | drivername = buffer; |
| 56 | } | 56 | } |