From 0529184996f36819d860c9692d516930ce932102 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Sat, 16 Jul 2016 13:24:25 +0000
Subject: [PATCH] (background.c) Cleanup some compile warnings
background.c:273:34: warning: implicit conversion changes signedness: 'int' to 'gsize' (aka 'unsigned long') [-Wsign-conversion]
data[i] = g_malloc (size + 1);
~~~~~~~~ ~~~~~^~~
background.c:274:32: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
if (read (fd, data[i], size) != size)
~~~~ ^~~~
background.c:382:51: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
ret = write (to_child_fd, resstr, len);
~~~~~ ^~~
background.c:379:19: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
len = strlen (resstr);
~ ^~~~~~~~~~~~~~~
background.c:446:40: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
ret = write (parent_fd, value, len);
~~~~~ ^~~
background.c:474:39: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
(write (parent_fd, value, len) != len))
~~~~~ ^~~
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/background.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/background.c b/src/background.c
index 54b6e7d..d341a28 100644
a
|
b
|
background_attention (int fd, void *closure) |
264 | 264 | |
265 | 265 | for (i = 0; i < argc; i++) |
266 | 266 | { |
267 | | int size; |
| 267 | unsigned int size; |
268 | 268 | |
269 | 269 | if (read (fd, &size, sizeof (size)) != sizeof (size)) |
270 | 270 | { |
… |
… |
background_attention (int fd, void *closure) |
348 | 348 | } |
349 | 349 | else if (type == Return_String) |
350 | 350 | { |
351 | | int len; |
| 351 | size_t len; |
352 | 352 | char *resstr = NULL; |
353 | 353 | |
354 | 354 | /* FIXME: string routines should also use the Foreground/Background |
… |
… |
parent_va_call (void *routine, gpointer data, int argc, va_list ap) |
437 | 437 | parent_call_header (routine, argc, Return_Integer, ctx); |
438 | 438 | for (i = 0; i < argc; i++) |
439 | 439 | { |
440 | | int len; |
| 440 | size_t len; |
441 | 441 | void *value; |
442 | 442 | |
443 | | len = va_arg (ap, int); |
| 443 | len = va_arg (ap, size_t); |
444 | 444 | value = va_arg (ap, void *); |
445 | 445 | ret = write (parent_fd, &len, sizeof (len)); |
446 | 446 | ret = write (parent_fd, value, len); |
… |
… |
parent_va_call_string (void *routine, int argc, va_list ap) |
465 | 465 | parent_call_header (routine, argc, Return_String, NULL); |
466 | 466 | for (i = 0; i < argc; i++) |
467 | 467 | { |
468 | | int len; |
| 468 | unsigned int len; |
469 | 469 | void *value; |
470 | 470 | |
471 | | len = va_arg (ap, int); |
| 471 | len = va_arg (ap, unsigned int); |
472 | 472 | value = va_arg (ap, void *); |
473 | 473 | if ((write (parent_fd, &len, sizeof (len)) != sizeof (len)) || |
474 | 474 | (write (parent_fd, value, len) != len)) |