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
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
24struct st_output_message_s24struct 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 }

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