From 0b7bb7f85a4bd7e2ef6bd3644a0c1a0c8d42a1d9 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sat, 10 Apr 2010 19:54:32 +0200 Subject: s4:registry - "patchfile_preg.c" - use more "sizeof"s on length specification This makes the code more clear to read. --- source4/lib/registry/patchfile_preg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4') diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index ed521e3dfa..625904bd52 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -33,7 +33,7 @@ static WERROR preg_read_utf16(int fd, char *c) { uint16_t v; - if (read(fd, &v, 2) < 2) { + if (read(fd, &v, sizeof(uint16_t)) < sizeof(uint16_t)) { return WERR_GENERAL_FAILURE; } push_codepoint(c, v); @@ -46,7 +46,7 @@ static WERROR preg_write_utf16(int fd, const char *string) for (i = 0; i < strlen(string); i+=size) { v = next_codepoint(&string[i], &size); - if (write(fd, &v, 2) < 2) { + if (write(fd, &v, sizeof(uint16_t)) < sizeof(uint16_t)) { return WERR_GENERAL_FAILURE; } } @@ -190,7 +190,7 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename, strncpy(preg_header.hdr, "PReg", 4); SIVAL(&preg_header.version, 0, 1); - write(data->fd, (uint8_t *)&preg_header,8); + write(data->fd, (uint8_t *)&preg_header, sizeof(preg_header)); data->ctx = ctx; @@ -230,7 +230,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, buf_ptr = buf; /* Read first 8 bytes (the header) */ - if (read(fd, &preg_header, 8) != 8) { + if (read(fd, &preg_header, sizeof(preg_header)) != sizeof(preg_header)) { DEBUG(0, ("Could not read PReg file: %s\n", strerror(errno))); ret = WERR_GENERAL_FAILURE; @@ -279,7 +279,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, value_name = talloc_strdup(mem_ctx, buf); /* Get the type */ - if (read(fd, &value_type, 4) < 4) { + if (read(fd, &value_type, sizeof(uint32_t)) < sizeof(uint32_t)) { DEBUG(0, ("Error while reading PReg\n")); ret = WERR_GENERAL_FAILURE; goto cleanup; @@ -296,7 +296,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, } /* Get data length */ - if (read(fd, &length, 4) < 4) { + if (read(fd, &length, sizeof(uint32_t)) < sizeof(uint32_t)) { DEBUG(0, ("Error while reading PReg\n")); ret = WERR_GENERAL_FAILURE; goto cleanup; -- cgit