[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Sat Apr 10 11:59:15 MDT 2010


The branch, master has been updated
       via  0b7bb7f... s4:registry - "patchfile_preg.c" - use more "sizeof"s on length specification
       via  458a441... s4:registry - "patchfile_preg.c" - fix indentation
       via  c7c8f0c... s4:registry - "patchfile_preg.c" - fix a datatype
      from  1038a13... libwbclient: Fix a memleak in wbcGetDisplayName

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0b7bb7f85a4bd7e2ef6bd3644a0c1a0c8d42a1d9
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sat Apr 10 19:54:32 2010 +0200

    s4:registry - "patchfile_preg.c" - use more "sizeof"s on length specification
    
    This makes the code more clear to read.

commit 458a441f7ff36e03fb59299b44986f10e062ee78
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sat Apr 10 19:48:23 2010 +0200

    s4:registry - "patchfile_preg.c" - fix indentation

commit c7c8f0ccf370176479480772d88ccb794b6728a2
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sat Apr 10 19:42:00 2010 +0200

    s4:registry - "patchfile_preg.c" - fix a datatype
    
    This should be an "uint16_t" (only two bytes are written).

-----------------------------------------------------------------------

Summary of changes:
 source4/lib/registry/patchfile_preg.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c
index eb84b56..625904b 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);
@@ -41,12 +41,12 @@ static WERROR preg_read_utf16(int fd, char *c)
 }
 static WERROR preg_write_utf16(int fd, const char *string)
 {
-	codepoint_t v;
+	uint16_t v;
 	size_t i, size;
 
 	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;
 		}
 	}
@@ -89,16 +89,19 @@ static WERROR reg_preg_diff_del_key(void *_data, const char *key_name)
 	DATA_BLOB blob;
 	WERROR werr;
 
-	parent_name = talloc_strndup(data->ctx, key_name, strrchr(key_name, '\\')-key_name);
+	parent_name = talloc_strndup(data->ctx, key_name,
+				     strrchr(key_name, '\\')-key_name);
 	W_ERROR_HAVE_NO_MEMORY(parent_name);
-	blob.data = (uint8_t *)talloc_strndup(data->ctx, key_name+(strrchr(key_name, '\\')-key_name)+1,
-			strlen(key_name)-(strrchr(key_name, '\\')-key_name));
+	blob.data = (uint8_t*)talloc_strndup(data->ctx,
+					     key_name+(strrchr(key_name, '\\')-key_name)+1,
+					     strlen(key_name)-(strrchr(key_name, '\\')-key_name));
 	W_ERROR_HAVE_NO_MEMORY(blob.data);
 	blob.length = strlen((char *)blob.data)+1;
 	
 
 	/* FIXME: These values should be accumulated to be written at done(). */
-	werr = reg_preg_diff_set_value(data, parent_name, "**DeleteKeys", REG_SZ, blob);
+	werr = reg_preg_diff_set_value(data, parent_name, "**DeleteKeys",
+				       REG_SZ, blob);
 
 	talloc_free(parent_name);
 	talloc_free(blob.data);
@@ -140,7 +143,8 @@ static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name)
 	SIVAL(blob.data, 0, 0);
 	blob.length = sizeof(uint32_t);
 
-	werr = reg_preg_diff_set_value(data, key_name, "**DelVals.", REG_DWORD, blob);
+	werr = reg_preg_diff_set_value(data, key_name, "**DelVals.", REG_DWORD,
+				       blob);
 
 	talloc_free(blob.data);
 
@@ -186,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;
 
@@ -226,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;
@@ -275,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;
@@ -292,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;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list