[PATCH] lib: Fix signed/unsigned comparisons

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri Dec 5 06:20:12 MST 2014


Hi!

We've got a LOT of those, but you have to start somewhere..

I'd appreciate review&push!

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 64617e7433608cee8ca9f1c92c0131fecc22a431 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 3 Dec 2014 15:54:19 +0100
Subject: [PATCH] lib: Fix signed/unsigned comparisons

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 lib/util/data_blob.c | 4 ++--
 lib/util/util.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/util/data_blob.c b/lib/util/data_blob.c
index 1b0e6ab..4723669 100644
--- a/lib/util/data_blob.c
+++ b/lib/util/data_blob.c
@@ -135,7 +135,7 @@ print the data_blob as hex string
 **/
 _PUBLIC_ char *data_blob_hex_string_lower(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob)
 {
-	int i;
+	size_t i;
 	char *hex_string;
 
 	hex_string = talloc_array(mem_ctx, char, (blob->length*2)+1);
@@ -155,7 +155,7 @@ _PUBLIC_ char *data_blob_hex_string_lower(TALLOC_CTX *mem_ctx, const DATA_BLOB *
 
 _PUBLIC_ char *data_blob_hex_string_upper(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob)
 {
-	int i;
+	size_t i;
 	char *hex_string;
 
 	hex_string = talloc_array(mem_ctx, char, (blob->length*2)+1);
diff --git a/lib/util/util.c b/lib/util/util.c
index 157a4aa..562f7df 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -732,7 +732,7 @@ _PUBLIC_ void dump_data_pw(const char *msg, const uint8_t * data, size_t len)
  */
 _PUBLIC_ bool all_zero(const uint8_t *ptr, size_t size)
 {
-	int i;
+	size_t i;
 	if (!ptr) return true;
 	for (i=0;i<size;i++) {
 		if (ptr[i]) return false;
-- 
2.1.0



More information about the samba-technical mailing list