diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2010-04-10 19:54:32 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2010-04-10 19:58:09 +0200 |
commit | 0b7bb7f85a4bd7e2ef6bd3644a0c1a0c8d42a1d9 (patch) | |
tree | 1dc87019c173f544c471d9bea6f249cd31918563 /source4/lib/registry | |
parent | 458a441f7ff36e03fb59299b44986f10e062ee78 (diff) | |
download | samba-0b7bb7f85a4bd7e2ef6bd3644a0c1a0c8d42a1d9.tar.gz samba-0b7bb7f85a4bd7e2ef6bd3644a0c1a0c8d42a1d9.tar.bz2 samba-0b7bb7f85a4bd7e2ef6bd3644a0c1a0c8d42a1d9.zip |
s4:registry - "patchfile_preg.c" - use more "sizeof"s on length specification
This makes the code more clear to read.
Diffstat (limited to 'source4/lib/registry')
-rw-r--r-- | source4/lib/registry/patchfile_preg.c | 12 |
1 files changed, 6 insertions, 6 deletions
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; |