public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] libblkid: fix compiler warning [smatch]
@ 2013-10-07 22:04 Sami Kerola
  2013-10-07 22:04 ` [PATCH 2/2] various: fix mixing declarations and code compiler warnings [smatch] Sami Kerola
  2013-10-08 13:52 ` [PATCH 1/2] libblkid: fix compiler warning [smatch] Karel Zak
  0 siblings, 2 replies; 4+ messages in thread
From: Sami Kerola @ 2013-10-07 22:04 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

warning: overflow in implicit constant conversion

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 libblkid/src/superblocks/bcache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libblkid/src/superblocks/bcache.c b/libblkid/src/superblocks/bcache.c
index 303f7ee..f5a8ce6 100644
--- a/libblkid/src/superblocks/bcache.c
+++ b/libblkid/src/superblocks/bcache.c
@@ -20,7 +20,7 @@
 #define node(i, j)         ((i)->d + (j))
 #define end(i)             node(i, (i)->keys)
 
-static const char bcache_magic[] = {
+static const unsigned char bcache_magic[] = {
 	0xc6, 0x85, 0x73, 0xf6, 0x4e, 0x1a, 0x45, 0xca,
 	0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81
 };
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] various: fix mixing declarations and code compiler warnings [smatch]
  2013-10-07 22:04 [PATCH 1/2] libblkid: fix compiler warning [smatch] Sami Kerola
@ 2013-10-07 22:04 ` Sami Kerola
  2013-10-08 13:55   ` Karel Zak
  2013-10-08 13:52 ` [PATCH 1/2] libblkid: fix compiler warning [smatch] Karel Zak
  1 sibling, 1 reply; 4+ messages in thread
From: Sami Kerola @ 2013-10-07 22:04 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 libfdisk/src/dos.c           |  6 +++---
 libmount/python/pylibmount.c |  3 ++-
 libmount/python/tab.c        |  3 ++-
 term-utils/mesg.c            | 10 +++++-----
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index d9b1e74..d93e44b 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -1180,9 +1180,9 @@ static int dos_verify_disklabel(struct fdisk_context *cxt)
 	}
 
 	if (l->ext_offset) {
+		sector_t e_last;
 		p = self_partition(cxt, l->ext_index);
-
-		sector_t e_last = dos_partition_get_start(p)
+		e_last = dos_partition_get_start(p)
 				  + dos_partition_get_size(p) - 1;
 
 		for (i = 4; i < cxt->label->nparts_max; i++) {
@@ -1612,7 +1612,7 @@ static int dos_list_disklabel(struct fdisk_context *cxt)
 	for (i = 0; i < cxt->label->nparts_max; i++) {
 		struct pte *pe = self_pte(cxt, i);
 		struct dos_partition *p = pe->pt_entry;
-		unsigned int psects, pblocks, podd = 0;;
+		unsigned int psects, pblocks, podd = 0;
 		struct fdisk_parttype *type;
 		struct tt_line *ln;
 		char *str;
diff --git a/libmount/python/pylibmount.c b/libmount/python/pylibmount.c
index 1403bfe..c538bb5 100644
--- a/libmount/python/pylibmount.c
+++ b/libmount/python/pylibmount.c
@@ -90,6 +90,7 @@ PyObject *PyObjectResultInt(int i)
 
 PyObject *PyObjectResultStr(const char *s)
 {
+	PyObject *result;
 	if (!s)
 		/* TODO: maybe lie about it and return "":
 		 * which would allow for
@@ -97,7 +98,7 @@ PyObject *PyObjectResultStr(const char *s)
 		 * fs.comment += "comment"
 		return Py_BuildValue("s", ""); */
 		Py_RETURN_NONE;
-	PyObject *result = Py_BuildValue("s", s);
+	result = Py_BuildValue("s", s);
 	if (!result)
 		PyErr_SetString(PyExc_RuntimeError, CONSTRUCT_ERR);
 	return result;
diff --git a/libmount/python/tab.c b/libmount/python/tab.c
index 9ea6924..6f255ae 100644
--- a/libmount/python/tab.c
+++ b/libmount/python/tab.c
@@ -600,9 +600,10 @@ static int Table_init(TableObject *self, PyObject *args, PyObject *kwds)
 		self->iter = mnt_new_iter(MNT_ITER_FORWARD);
 
 	if (errcb) {
+		PyObject *tmp;
 		if (!PyCallable_Check(errcb))
 			return -1;
-		PyObject *tmp = self->errcb;
+		tmp = self->errcb;
 		Py_INCREF(errcb);
 		self->errcb = errcb;
 		Py_XDECREF(tmp);
diff --git a/term-utils/mesg.c b/term-utils/mesg.c
index 097fb9c..12e4e0e 100644
--- a/term-utils/mesg.c
+++ b/term-utils/mesg.c
@@ -88,11 +88,6 @@ int main(int argc, char *argv[])
 	char *tty;
 	int ch, verbose = FALSE;
 
-	setlocale(LC_ALL, "");
-	bindtextdomain(PACKAGE, LOCALEDIR);
-	textdomain(PACKAGE);
-	atexit(close_stdout);
-
 	static const struct option longopts[] = {
 		{ "verbose",    no_argument,       0, 'v' },
 		{ "version",    no_argument,       0, 'V' },
@@ -100,6 +95,11 @@ int main(int argc, char *argv[])
 		{ NULL,         0, 0, 0 }
 	};
 
+	setlocale(LC_ALL, "");
+	bindtextdomain(PACKAGE, LOCALEDIR);
+	textdomain(PACKAGE);
+	atexit(close_stdout);
+
 	while ((ch = getopt_long(argc, argv, "vVh", longopts, NULL)) != -1)
 		switch (ch) {
 		case 'v':
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] libblkid: fix compiler warning [smatch]
  2013-10-07 22:04 [PATCH 1/2] libblkid: fix compiler warning [smatch] Sami Kerola
  2013-10-07 22:04 ` [PATCH 2/2] various: fix mixing declarations and code compiler warnings [smatch] Sami Kerola
@ 2013-10-08 13:52 ` Karel Zak
  1 sibling, 0 replies; 4+ messages in thread
From: Karel Zak @ 2013-10-08 13:52 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Mon, Oct 07, 2013 at 11:04:22PM +0100, Sami Kerola wrote:
> warning: overflow in implicit constant conversion
> 
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
>  libblkid/src/superblocks/bcache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libblkid/src/superblocks/bcache.c b/libblkid/src/superblocks/bcache.c
> index 303f7ee..f5a8ce6 100644
> --- a/libblkid/src/superblocks/bcache.c
> +++ b/libblkid/src/superblocks/bcache.c
> @@ -20,7 +20,7 @@
>  #define node(i, j)         ((i)->d + (j))
>  #define end(i)             node(i, (i)->keys)
>  
> -static const char bcache_magic[] = {
> +static const unsigned char bcache_magic[] = {
>  	0xc6, 0x85, 0x73, 0xf6, 0x4e, 0x1a, 0x45, 0xca,
>  	0x82, 0x65, 0xf5, 0x7f, 0x48, 0xba, 0x6d, 0x81
>  };

 The code is correct, the magic string is "const char *", not
 unsigned... gcc does not like your patch:

 libblkid/src/superblocks/bcache.c:129:3: warning: pointer targets in initialization differ in signedness [-Wpointer-sign]


    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] various: fix mixing declarations and code compiler warnings [smatch]
  2013-10-07 22:04 ` [PATCH 2/2] various: fix mixing declarations and code compiler warnings [smatch] Sami Kerola
@ 2013-10-08 13:55   ` Karel Zak
  0 siblings, 0 replies; 4+ messages in thread
From: Karel Zak @ 2013-10-08 13:55 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Mon, Oct 07, 2013 at 11:04:23PM +0100, Sami Kerola wrote:
>  libfdisk/src/dos.c           |  6 +++---
>  libmount/python/pylibmount.c |  3 ++-
>  libmount/python/tab.c        |  3 ++-
>  term-utils/mesg.c            | 10 +++++-----
>  4 files changed, 12 insertions(+), 10 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-08 13:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-07 22:04 [PATCH 1/2] libblkid: fix compiler warning [smatch] Sami Kerola
2013-10-07 22:04 ` [PATCH 2/2] various: fix mixing declarations and code compiler warnings [smatch] Sami Kerola
2013-10-08 13:55   ` Karel Zak
2013-10-08 13:52 ` [PATCH 1/2] libblkid: fix compiler warning [smatch] Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox