From dd1378e7fd51efc46f861265d52ce257212688e7 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Sat, 17 Sep 2016 12:06:59 +0000
Subject: [PATCH] (editdraw.c) Cleanup -Wformat-signedness warning
Cleanup -Wformat-signedness warning.
editdraw.c:127:62: error: format '%d' expects argument of type 'int', but argument 4 has type 'unsigned int' [-Werror=format=]
g_snprintf (byte_str, sizeof (byte_str), "%04d 0x%03X",
^
editdraw.c:326:30: error: format '%d' expects argument of type 'int', but argument 2 has type 'unsigned int' [-Werror=format=]
tty_printf ("[%05d 0x%04X]", cur_utf, cur_utf);
^
editdraw.c:334:30: error: format '%d' expects argument of type 'int', but argument 2 has type 'unsigned int' [-Werror=format=]
tty_printf ("[%05d 0x%04X]", (unsigned int) cur_byte, (unsigned int) cur_byte);
^
editdraw.c:554:20: warning: conversion to 'unsigned int' from 'long int' may alter its value [-Wconversion]
cur_line = edit->start_line + row;
^~~~
editdraw.c:557:59: error: format '%i' expects argument of type 'int', but argument 4 has type 'unsigned int' [-Werror=format=]
g_snprintf (line_stat, sizeof (line_stat), "%7i ", cur_line + 1);
^
Signed-off-by: Andreas Mohr <and@gmx.li>
---
src/editor/editdraw.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/editor/editdraw.c b/src/editor/editdraw.c
index ce6df58..899e3a8 100644
a
|
b
|
status_string (WEdit * edit, char *s, int w) |
124 | 124 | cur_utf = edit_buffer_get_utf (&edit->buffer, edit->buffer.curs1, &char_length); |
125 | 125 | if (char_length > 0) |
126 | 126 | { |
127 | | g_snprintf (byte_str, sizeof (byte_str), "%04d 0x%03X", |
| 127 | g_snprintf (byte_str, sizeof (byte_str), "%04u 0x%03X", |
128 | 128 | (unsigned) cur_utf, (unsigned) cur_utf); |
129 | 129 | } |
130 | 130 | else |
… |
… |
edit_status_window (WEdit * edit) |
323 | 323 | cur_utf = edit_buffer_get_utf (&edit->buffer, edit->buffer.curs1, &char_length); |
324 | 324 | if (char_length <= 0) |
325 | 325 | cur_utf = edit_buffer_get_current_byte (&edit->buffer); |
326 | | tty_printf ("[%05d 0x%04X]", cur_utf, cur_utf); |
| 326 | tty_printf ("[%05u 0x%04X]", cur_utf, cur_utf); |
327 | 327 | } |
328 | 328 | #endif |
329 | 329 | else |
… |
… |
edit_status_window (WEdit * edit) |
331 | 331 | unsigned char cur_byte; |
332 | 332 | |
333 | 333 | cur_byte = edit_buffer_get_current_byte (&edit->buffer); |
334 | | tty_printf ("[%05d 0x%04X]", (unsigned int) cur_byte, (unsigned int) cur_byte); |
| 334 | tty_printf ("[%05u 0x%04X]", (unsigned int) cur_byte, (unsigned int) cur_byte); |
335 | 335 | } |
336 | 336 | } |
337 | 337 | } |
… |
… |
edit_draw_this_line (WEdit * edit, off_t b, long row, long start_col, long end_c |
549 | 549 | |
550 | 550 | if (option_line_state) |
551 | 551 | { |
552 | | unsigned int cur_line; |
| 552 | long cur_line; |
553 | 553 | |
554 | 554 | cur_line = edit->start_line + row; |
555 | | if (cur_line <= (unsigned int) edit->buffer.lines) |
| 555 | if (cur_line <= edit->buffer.lines) |
556 | 556 | { |
557 | | g_snprintf (line_stat, sizeof (line_stat), "%7i ", cur_line + 1); |
| 557 | g_snprintf (line_stat, sizeof (line_stat), "%7ld ", cur_line + 1); |
558 | 558 | } |
559 | 559 | else |
560 | 560 | { |