History

Fix read and write return types: now st_size_t, like the size inputs.

To support this change, turn on lots more compiler warnings, and fix all the warnings generated.

rrt committed 19 years ago

Commit 4d743c41 parent ce1f8f393 files · +875 −1236Browse files

Showing the changes to src/util.c (1 of 93 files). Show all

Unified · Split

src/util.c+3−3
@@ -16,9 +16,9 @@ · 15 unmodified lines
1616 */
1717
1818 #include "st_i.h"
19+#include <stddef.h>
1920 #include <string.h>
2021 #include <ctype.h>
21−
2222 #include <stdarg.h>
2323
2424 struct st_output_message_s
@@ -49,8 +49,8 @@ void st_output_message(FILE * file, st_output_message_t message) · 24 unmodified lines
4949 }
5050
5151 dot_pos = strrchr(drivername, '.');
52− if (dot_pos != NULL && dot_pos - drivername <= sizeof(buffer) - 1) {
53− strncpy(buffer, drivername, dot_pos - drivername);
52+ if (dot_pos != NULL && dot_pos - drivername <= (ptrdiff_t)(sizeof(buffer) - 1)) {
53+ strncpy(buffer, drivername, (size_t)(dot_pos - drivername));
5454 buffer[dot_pos - drivername] = '\0';
5555 drivername = buffer;
5656 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t