mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
Have examples compile warning-free at -O3
This commit is contained in:
1 parent
97e73c10c8
commit
4926e98956
2 files changed
+13
-7
No files matched your search
@@ -79,6 +79,9 @@ uint32_t num_loops_remaining = 0;
|
||||
|
||||
wuffs_base__flicks cumulative_delay_micros = 0;
|
||||
|
||||
// ignore_return_value suppresses errors from -Wall -Werror.
|
||||
static void ignore_return_value(int ignored) {}
|
||||
|
||||
const char* read_stdin() {
|
||||
while (src_len < SRC_BUFFER_SIZE) {
|
||||
const int stdin_fd = 0;
|
||||
@@ -184,7 +187,7 @@ void print_ascii_art(wuffs_base__image_buffer* ib) {
|
||||
}
|
||||
*p++ = '\n';
|
||||
}
|
||||
write(stdout_fd, print_buffer, p - print_buffer);
|
||||
ignore_return_value(write(stdout_fd, print_buffer, p - print_buffer));
|
||||
}
|
||||
|
||||
void print_color_art(wuffs_base__image_buffer* ib) {
|
||||
@@ -212,7 +215,7 @@ void print_color_art(wuffs_base__image_buffer* ib) {
|
||||
}
|
||||
p = append_pascal_string(p, reset_color_pascal_string);
|
||||
|
||||
write(stdout_fd, print_buffer, p - print_buffer);
|
||||
ignore_return_value(write(stdout_fd, print_buffer, p - print_buffer));
|
||||
}
|
||||
|
||||
// ----
|
||||
@@ -330,8 +333,8 @@ const char* play() {
|
||||
|
||||
int fail(const char* msg) {
|
||||
const int stderr_fd = 2;
|
||||
write(stderr_fd, msg, strnlen(msg, 4095));
|
||||
write(stderr_fd, "\n", 1);
|
||||
ignore_return_value(write(stderr_fd, msg, strnlen(msg, 4095)));
|
||||
ignore_return_value(write(stderr_fd, "\n", 1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+6
-3
@@ -51,6 +51,9 @@ for a C compiler $cc, such as clang or gcc.
|
||||
char dst_buffer[DST_BUFFER_SIZE];
|
||||
char src_buffer[SRC_BUFFER_SIZE];
|
||||
|
||||
// ignore_return_value suppresses errors from -Wall -Werror.
|
||||
static void ignore_return_value(int ignored) {}
|
||||
|
||||
static const char* decode() {
|
||||
wuffs_gzip__decoder dec;
|
||||
wuffs_gzip__decoder__initialize(&dec, WUFFS_VERSION, 0);
|
||||
@@ -80,7 +83,7 @@ static const char* decode() {
|
||||
if (dst.wi) {
|
||||
// TODO: handle EINTR and other write errors; see "man 2 write".
|
||||
const int stdout_fd = 1;
|
||||
write(stdout_fd, dst_buffer, dst.wi);
|
||||
ignore_return_value(write(stdout_fd, dst_buffer, dst.wi));
|
||||
}
|
||||
|
||||
if (s == WUFFS_GZIP__STATUS_OK) {
|
||||
@@ -98,8 +101,8 @@ static const char* decode() {
|
||||
|
||||
int fail(const char* msg) {
|
||||
const int stderr_fd = 2;
|
||||
write(stderr_fd, msg, strnlen(msg, 4095));
|
||||
write(stderr_fd, "\n", 1);
|
||||
ignore_return_value(write(stderr_fd, msg, strnlen(msg, 4095)));
|
||||
ignore_return_value(write(stderr_fd, "\n", 1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user