summaryrefslogtreecommitdiff
path: root/src/libstddjb/mininetstring_read.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-02-21 12:05:07 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-02-21 12:05:07 +0000
commit49d8fa1058aaf23c29e074b2314492ae40d2f557 (patch)
tree393f884d5a99f984e992a0f35f1b02ac43536217 /src/libstddjb/mininetstring_read.c
parentfdffefb8032922ce7ffe4c00816072a8ff2148fc (diff)
downloadskalibs-49d8fa1058aaf23c29e074b2314492ae40d2f557.tar.xz
Types change: big pass on libstddjb and libunixonacid
libdatastruct still missing, library still not functional
Diffstat (limited to 'src/libstddjb/mininetstring_read.c')
-rw-r--r--src/libstddjb/mininetstring_read.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libstddjb/mininetstring_read.c b/src/libstddjb/mininetstring_read.c
index f7c7a55..eaaaf99 100644
--- a/src/libstddjb/mininetstring_read.c
+++ b/src/libstddjb/mininetstring_read.c
@@ -1,12 +1,13 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <errno.h>
#include <skalibs/allreadwrite.h>
-#include <skalibs/uint32.h>
#include <skalibs/stralloc.h>
#include <skalibs/mininetstring.h>
-int mininetstring_read (int fd, stralloc *sa, uint32 *w)
+int mininetstring_read (int fd, stralloc *sa, uint32_t *w)
{
if (!*w)
{
@@ -15,8 +16,8 @@ int mininetstring_read (int fd, stralloc *sa, uint32 *w)
{
case -1 : return -1 ;
case 0 : return 0 ;
- case 1 : *w = ((uint32)pack[0] << 8) | (1U << 31) ; break ;
- case 2 : *w = ((uint32)pack[0] << 8) | (uint32)pack[1] | (1U << 30) ; break ;
+ case 1 : *w = ((uint32_t)pack[0] << 8) | (1U << 31) ; break ;
+ case 2 : *w = ((uint32_t)pack[0] << 8) | (uint32_t)pack[1] | (1U << 30) ; break ;
default : return (errno = EDOM, -1) ;
}
}
@@ -27,7 +28,7 @@ int mininetstring_read (int fd, stralloc *sa, uint32 *w)
{
case -1 : return -1 ;
case 0 : return (errno = EPIPE, -1) ;
- case 1 : *w |= (uint32)c | (1U << 30) ; *w &= ~(1U << 31) ; break ;
+ case 1 : *w |= (uint32_t)c | (1U << 30) ; *w &= ~(1U << 31) ; break ;
default : return (errno = EDOM, -1) ;
}
}
@@ -37,7 +38,7 @@ int mininetstring_read (int fd, stralloc *sa, uint32 *w)
*w &= ~(1U << 30) ;
}
{
- register unsigned int r = allread(fd, sa->s + sa->len, *w) ;
+ size_t r = allread(fd, sa->s + sa->len, *w) ;
sa->len += r ; *w -= r ;
}
return *w ? -1 : 1 ;