* [PATCH 2/4] setterm: fix dubious one-bit signed bitfield [smatch scan]
2014-10-15 21:19 [PATCH 1/4] eject: move unreachable code to preprocessor #else block [smatch scan] Sami Kerola
@ 2014-10-15 21:19 ` Sami Kerola
2014-10-15 21:19 ` [PATCH 3/4] ul: fix filter() indentation Sami Kerola
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sami Kerola @ 2014-10-15 21:19 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
term-utils/setterm.c:165:24: error: dubious one-bit signed bitfield
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
term-utils/setterm.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/term-utils/setterm.c b/term-utils/setterm.c
index f21466e..fefb0a9 100644
--- a/term-utils/setterm.c
+++ b/term-utils/setterm.c
@@ -162,9 +162,10 @@ struct setterm_control {
/* colors */
int opt_fo_color:4, opt_ba_color:4, opt_ul_color:4, opt_hb_color:4;
/* boolean options */
- int opt_cu_on:1, opt_li_on:1, opt_bo_on:1, opt_hb_on:1, opt_bl_on:1,
- opt_re_on:1, opt_un_on:1, opt_rep_on:1, opt_appck_on:1,
- opt_invsc_on:1, opt_msg_on:1, opt_cl_all:1, vcterm:1;
+ unsigned int opt_cu_on:1, opt_li_on:1, opt_bo_on:1, opt_hb_on:1,
+ opt_bl_on:1, opt_re_on:1, opt_un_on:1, opt_rep_on:1,
+ opt_appck_on:1, opt_invsc_on:1, opt_msg_on:1, opt_cl_all:1,
+ vcterm:1;
/* Option flags. Set when an option is invoked. */
uint64_t opt_term:1, opt_reset:1, opt_initialize:1, opt_cursor:1,
opt_linewrap:1, opt_default:1, opt_foreground:1,
--
2.1.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/4] ul: fix filter() indentation
2014-10-15 21:19 [PATCH 1/4] eject: move unreachable code to preprocessor #else block [smatch scan] Sami Kerola
2014-10-15 21:19 ` [PATCH 2/4] setterm: fix dubious one-bit signed bitfield " Sami Kerola
@ 2014-10-15 21:19 ` Sami Kerola
2014-10-15 21:19 ` [PATCH 4/4] sfdisk: fix compiler warnings about uninitialized variables Sami Kerola
2014-10-20 12:10 ` [PATCH 1/4] eject: move unreachable code to preprocessor #else block [smatch scan] Karel Zak
3 siblings, 0 replies; 5+ messages in thread
From: Sami Kerola @ 2014-10-15 21:19 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
Content of the while() loop missed one indentation step.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
text-utils/ul.c | 160 ++++++++++++++++++++++++++------------------------------
1 file changed, 75 insertions(+), 85 deletions(-)
diff --git a/text-utils/ul.c b/text-utils/ul.c
index 054f7b9..20a0551 100644
--- a/text-utils/ul.c
+++ b/text-utils/ul.c
@@ -281,94 +281,84 @@ static void filter(FILE *f)
wint_t c;
int i, w;
- while ((c = getwc(f)) != WEOF)
- switch (c) {
-
- case '\b':
- setcol(col - 1);
- continue;
-
- case '\t':
- setcol((col+8) & ~07);
- continue;
-
- case '\r':
- setcol(0);
- continue;
-
- case SO:
- mode |= ALTSET;
- continue;
-
- case SI:
- mode &= ~ALTSET;
- continue;
-
- case IESC:
- if(handle_escape(f)) {
- c = getwc(f);
- errx(EXIT_FAILURE,
- _("unknown escape sequence in input: %o, %o"),
- IESC, c);
- }
- continue;
-
- case '_':
- if (obuf[col].c_char || obuf[col].c_width < 0) {
- while(col > 0 && obuf[col].c_width < 0)
- col--;
- w = obuf[col].c_width;
- for (i = 0; i < w; i++)
- obuf[col++].c_mode |= UNDERL | mode;
- setcol(col);
+ while ((c = getwc(f)) != WEOF) {
+ switch (c) {
+ case '\b':
+ setcol(col - 1);
continue;
- }
- obuf[col].c_char = '_';
- obuf[col].c_width = 1;
- /* fall through */
- case ' ':
- setcol(col + 1);
- continue;
-
- case '\n':
- flushln();
- continue;
-
- case '\f':
- flushln();
- putwchar('\f');
- continue;
-
- default:
- if (!iswprint(c))
- /* non printable */
+ case '\t':
+ setcol((col + 8) & ~07);
+ continue;
+ case '\r':
+ setcol(0);
+ continue;
+ case SO:
+ mode |= ALTSET;
+ continue;
+ case SI:
+ mode &= ~ALTSET;
+ continue;
+ case IESC:
+ if (handle_escape(f)) {
+ c = getwc(f);
+ errx(EXIT_FAILURE,
+ _("unknown escape sequence in input: %o, %o"), IESC, c);
+ }
+ continue;
+ case '_':
+ if (obuf[col].c_char || obuf[col].c_width < 0) {
+ while (col > 0 && obuf[col].c_width < 0)
+ col--;
+ w = obuf[col].c_width;
+ for (i = 0; i < w; i++)
+ obuf[col++].c_mode |= UNDERL | mode;
+ setcol(col);
+ continue;
+ }
+ obuf[col].c_char = '_';
+ obuf[col].c_width = 1;
+ /* fall through */
+ case ' ':
+ setcol(col + 1);
+ continue;
+ case '\n':
+ flushln();
+ continue;
+ case '\f':
+ flushln();
+ putwchar('\f');
+ continue;
+ default:
+ if (!iswprint(c))
+ /* non printable */
+ continue;
+ w = wcwidth(c);
+ needcol(col + w);
+ if (obuf[col].c_char == '\0') {
+ obuf[col].c_char = c;
+ for (i = 0; i < w; i++)
+ obuf[col + i].c_mode = mode;
+ obuf[col].c_width = w;
+ for (i = 1; i < w; i++)
+ obuf[col + i].c_width = -1;
+ } else if (obuf[col].c_char == '_') {
+ obuf[col].c_char = c;
+ for (i = 0; i < w; i++)
+ obuf[col + i].c_mode |= UNDERL | mode;
+ obuf[col].c_width = w;
+ for (i = 1; i < w; i++)
+ obuf[col + i].c_width = -1;
+ } else if ((wint_t) obuf[col].c_char == c) {
+ for (i = 0; i < w; i++)
+ obuf[col + i].c_mode |= BOLD | mode;
+ } else {
+ w = obuf[col].c_width;
+ for (i = 0; i < w; i++)
+ obuf[col + i].c_mode = mode;
+ }
+ setcol(col + w);
continue;
- w = wcwidth(c);
- needcol(col + w);
- if (obuf[col].c_char == '\0') {
- obuf[col].c_char = c;
- for (i = 0; i < w; i++)
- obuf[col+i].c_mode = mode;
- obuf[col].c_width = w;
- for (i = 1; i < w; i++)
- obuf[col+i].c_width = -1;
- } else if (obuf[col].c_char == '_') {
- obuf[col].c_char = c;
- for (i = 0; i < w; i++)
- obuf[col+i].c_mode |= UNDERL|mode;
- obuf[col].c_width = w;
- for (i = 1; i < w; i++)
- obuf[col+i].c_width = -1;
- } else if ((wint_t) obuf[col].c_char == c) {
- for (i = 0; i < w; i++)
- obuf[col+i].c_mode |= BOLD|mode;
- } else {
- w = obuf[col].c_width;
- for (i = 0; i < w; i++)
- obuf[col+i].c_mode = mode;
}
- setcol(col + w);
- continue;
}
if (maxcol)
flushln();
--
2.1.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 4/4] sfdisk: fix compiler warnings about uninitialized variables
2014-10-15 21:19 [PATCH 1/4] eject: move unreachable code to preprocessor #else block [smatch scan] Sami Kerola
2014-10-15 21:19 ` [PATCH 2/4] setterm: fix dubious one-bit signed bitfield " Sami Kerola
2014-10-15 21:19 ` [PATCH 3/4] ul: fix filter() indentation Sami Kerola
@ 2014-10-15 21:19 ` Sami Kerola
2014-10-20 12:10 ` [PATCH 1/4] eject: move unreachable code to preprocessor #else block [smatch scan] Karel Zak
3 siblings, 0 replies; 5+ messages in thread
From: Sami Kerola @ 2014-10-15 21:19 UTC (permalink / raw)
To: util-linux; +Cc: kerolasa
warning: 'str' may be used uninitialized in this function [-Wmaybe-uninitialized]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
disk-utils/sfdisk.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
index ad0e17e..49369bd 100644
--- a/disk-utils/sfdisk.c
+++ b/disk-utils/sfdisk.c
@@ -756,7 +756,7 @@ static int command_partuuid(struct sfdisk *sf, int argc, char **argv)
/* print partition uuid */
if (!uuid) {
- const char *str;
+ const char *str = NULL;
if (fdisk_get_partition(sf->cxt, partno - 1, &pa) == 0)
str = fdisk_partition_get_uuid(pa);
@@ -811,7 +811,7 @@ static int command_partlabel(struct sfdisk *sf, int argc, char **argv)
/* print partition name */
if (!name) {
- const char *str;
+ const char *str = NULL;
if (fdisk_get_partition(sf->cxt, partno - 1, &pa) == 0)
str = fdisk_partition_get_name(pa);
@@ -867,7 +867,7 @@ static int command_partattrs(struct sfdisk *sf, int argc, char **argv)
/* print partition name */
if (!attrs) {
- const char *str;
+ const char *str = NULL;
if (fdisk_get_partition(sf->cxt, partno - 1, &pa) == 0)
str = fdisk_partition_get_attrs(pa);
--
2.1.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/4] eject: move unreachable code to preprocessor #else block [smatch scan]
2014-10-15 21:19 [PATCH 1/4] eject: move unreachable code to preprocessor #else block [smatch scan] Sami Kerola
` (2 preceding siblings ...)
2014-10-15 21:19 ` [PATCH 4/4] sfdisk: fix compiler warnings about uninitialized variables Sami Kerola
@ 2014-10-20 12:10 ` Karel Zak
3 siblings, 0 replies; 5+ messages in thread
From: Karel Zak @ 2014-10-20 12:10 UTC (permalink / raw)
To: Sami Kerola; +Cc: util-linux
On Wed, Oct 15, 2014 at 10:19:25PM +0100, Sami Kerola wrote:
> eject.c:466 toggle_tray() info: ignoring unreachable code.
All 4 patches applied. Thanks.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread