summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-01-14 20:09:51 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-01-14 20:09:51 +0000
commitdb086527035619204569f79672b7a01fc26d8aa4 (patch)
treeea5a305a25d5fdb717b385e7beef075254d9ac6f /src
parent8849baf295715efd428e9243b67b2576a41f8fe4 (diff)
downloadskalibs-db086527035619204569f79672b7a01fc26d8aa4.tar.xz
Fix/clarify utilisations of 'char' (thanks Esben Haabendal)
Diffstat (limited to 'src')
-rw-r--r--src/libstddjb/child_spawn.c4
-rw-r--r--src/libstddjb/mininetstring_read.c4
-rw-r--r--src/libstddjb/mininetstring_write.c4
-rw-r--r--src/libstddjb/selfpipe_internal.c4
-rw-r--r--src/libstddjb/sgetopt.c4
5 files changed, 10 insertions, 10 deletions
diff --git a/src/libstddjb/child_spawn.c b/src/libstddjb/child_spawn.c
index 18cee96..addc7cd 100644
--- a/src/libstddjb/child_spawn.c
+++ b/src/libstddjb/child_spawn.c
@@ -138,8 +138,8 @@ pid_t child_spawn (char const *prog, char const *const *argv, char const *const
syncdie:
{
- char c = errno ;
- fd_write(syncpipe[1], &c, 1) ;
+ unsigned char c = errno ;
+ fd_write(syncpipe[1], (char const *)&c, 1) ;
}
_exit(127) ;
}
diff --git a/src/libstddjb/mininetstring_read.c b/src/libstddjb/mininetstring_read.c
index 6a38523..f7c7a55 100644
--- a/src/libstddjb/mininetstring_read.c
+++ b/src/libstddjb/mininetstring_read.c
@@ -22,8 +22,8 @@ int mininetstring_read (int fd, stralloc *sa, uint32 *w)
}
if (*w & (1U << 31))
{
- char c ;
- switch (fd_read(fd, &c, 1))
+ unsigned char c ;
+ switch (fd_read(fd, (char *)&c, 1))
{
case -1 : return -1 ;
case 0 : return (errno = EPIPE, -1) ;
diff --git a/src/libstddjb/mininetstring_write.c b/src/libstddjb/mininetstring_write.c
index cb3c30e..5eddc7b 100644
--- a/src/libstddjb/mininetstring_write.c
+++ b/src/libstddjb/mininetstring_write.c
@@ -23,8 +23,8 @@ int mininetstring_write (int fd, char const *s, uint16 len, uint32 *w)
}
if (*w & (1U << 31))
{
- char c = len & 0xFFU ;
- switch (fd_write(fd, &c, 1))
+ unsigned char c = len & 0xFFU ;
+ switch (fd_write(fd, (char const *)&c, 1))
{
case -1 : return -1 ;
case 0 : return (errno = EAGAIN, -1) ;
diff --git a/src/libstddjb/selfpipe_internal.c b/src/libstddjb/selfpipe_internal.c
index e5d5d95..f65e07a 100644
--- a/src/libstddjb/selfpipe_internal.c
+++ b/src/libstddjb/selfpipe_internal.c
@@ -22,8 +22,8 @@ int selfpipe[2] = { -1, -1 } ;
static void selfpipe_trigger (int s)
{
- char c = (char)s ;
- fd_write(selfpipe[1], &c, 1) ;
+ unsigned char c = (unsigned char)s ;
+ fd_write(selfpipe[1], (char *)&c, 1) ;
}
struct skasigaction const selfpipe_ssa = { &selfpipe_trigger, SKASA_NOCLDSTOP | SKASA_MASKALL } ;
diff --git a/src/libstddjb/sgetopt.c b/src/libstddjb/sgetopt.c
index 3f94c93..f576689 100644
--- a/src/libstddjb/sgetopt.c
+++ b/src/libstddjb/sgetopt.c
@@ -9,7 +9,7 @@
int sgetopt_r (int argc, char const *const *argv, char const *opts, subgetopt_t *o)
{
- char c = (char)subgetopt_r(argc, argv, opts, o) ;
+ int c = subgetopt_r(argc, argv, opts, o) ;
if (o->err && ((c == '?') || (c == ':')))
{
buffer_puts(buffer_2, o->prog ? o->prog : argv[0]) ;
@@ -18,5 +18,5 @@ int sgetopt_r (int argc, char const *const *argv, char const *opts, subgetopt_t
"illegal option" : "option requires an argument") ;
buffer_putflush(buffer_2, "\n", 1) ;
}
- return (int)c ;
+ return c ;
}