From 49d8fa1058aaf23c29e074b2314492ae40d2f557 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 21 Feb 2017 12:05:07 +0000 Subject: Types change: big pass on libstddjb and libunixonacid libdatastruct still missing, library still not functional --- src/librandom/random_name.c | 1 + src/librandom/random_string.c | 2 +- src/librandom/random_uint32.c | 2 +- src/librandom/random_unsort.c | 10 +++++----- src/librandom/surf.c | 11 +++++------ src/librandom/surf_init.c | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/librandom') diff --git a/src/librandom/random_name.c b/src/librandom/random_name.c index f972e93..1c8eb04 100644 --- a/src/librandom/random_name.c +++ b/src/librandom/random_name.c @@ -2,6 +2,7 @@ /* MT-unsafe */ +#include #include void random_name (char *s, size_t n) diff --git a/src/librandom/random_string.c b/src/librandom/random_string.c index 5053824..cd2a0aa 100644 --- a/src/librandom/random_string.c +++ b/src/librandom/random_string.c @@ -31,7 +31,7 @@ void random_string (char *s, size_t n) { while (n) { - register int r = getrandom(s, n, 0) ; + int r = getrandom(s, n, 0) ; if (r >= 0) { s += r ; diff --git a/src/librandom/random_uint32.c b/src/librandom/random_uint32.c index a2144f1..26c0968 100644 --- a/src/librandom/random_uint32.c +++ b/src/librandom/random_uint32.c @@ -29,7 +29,7 @@ uint32_t random_uint32 (uint32_t n) { char tmp[4] ; random_string(tmp, 4) ; - uint32_unpack(tmp, &x) ; + uint32_unpack_big(tmp, &x) ; if (x >= min) break ; } return x % n ; diff --git a/src/librandom/random_unsort.c b/src/librandom/random_unsort.c index 98a4b09..4596136 100644 --- a/src/librandom/random_unsort.c +++ b/src/librandom/random_unsort.c @@ -1,7 +1,7 @@ /* ISC license. */ #include -#include +#include #include void random_unsort (char *s, size_t n, size_t chunksize) @@ -9,9 +9,9 @@ void random_unsort (char *s, size_t n, size_t chunksize) char tmp[chunksize] ; while (n--) { - register uint32_t i = random_uint32(n+1) ; - byte_copy(tmp, chunksize, s + i * chunksize) ; - byte_copy(s + i * chunksize, chunksize, s + n * chunksize) ; - byte_copy(s + n * chunksize, chunksize, tmp) ; + uint32_t i = random_uint32(n+1) ; + memcpy(tmp, s + i * chunksize, chunksize) ; + memcpy(s + i * chunksize, s + n * chunksize, chunksize) ; + memcpy(s + n * chunksize, tmp, chunksize) ; } } diff --git a/src/librandom/surf.c b/src/librandom/surf.c index fe5346e..1b68fc2 100644 --- a/src/librandom/surf.c +++ b/src/librandom/surf.c @@ -1,9 +1,8 @@ /* ISC license. */ -#include #include +#include #include -#include #include #define ROTATE(x, b) (((x) << (b)) | ((x) >> (32 - (b)))) @@ -38,19 +37,19 @@ static void surfit (SURFSchedule *ctx) void surf (SURFSchedule *ctx, char *s, size_t n) { { - register size_t i = 32 - ctx->pos ; + size_t i = 32 - ctx->pos ; if (n < i) i = n ; - byte_copy(s, i, ctx->out + ctx->pos) ; + memcpy(s, ctx->out + ctx->pos, i) ; s += i ; n -= i ; ctx->pos += i ; } while (n > 32) { surfit(ctx) ; - byte_copy(s, 32, ctx->out) ; + memcpy(s, ctx->out, 32) ; s += 32 ; n -= 32 ; } if (!n) return ; surfit(ctx) ; - byte_copy(s, n, ctx->out) ; + memcpy(s, ctx->out, n) ; ctx->pos = n ; } diff --git a/src/librandom/surf_init.c b/src/librandom/surf_init.c index d1d9b3c..53abdcc 100644 --- a/src/librandom/surf_init.c +++ b/src/librandom/surf_init.c @@ -6,7 +6,7 @@ void surf_init (SURFSchedule *ctx, char const *s) { SURFSchedule zero = SURFSCHEDULE_ZERO ; - register unsigned int i = 4 ; + unsigned int i = 4 ; *ctx = zero ; for (; i < 12 ; i++) uint32_unpack(s + (i<<2) - 16, ctx->in + i) ; for (i = 0 ; i < 32 ; i++) uint32_unpack(s + 32 + (i<<2), ctx->seed + i) ; -- cgit v1.2.3