summaryrefslogtreecommitdiff
path: root/console-client
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2015-12-29 17:35:00 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2015-12-29 20:47:40 +0100
commitcc3e97aa0141410eb8b05cab34aecf65f44a164c (patch)
treef7b72d19129e8172cdde52706634b3935f329f61 /console-client
parentb4cf10f408d50e4caaeda6d2bc9df2db3398a9cd (diff)
fix compiler warnings in hurd/console-client
console-client: Fix several compiler warnings. * console-client/bdf.c: Use size_t instead of int. * console-client/driver.c: Remove unused variable errstring. * console-client/pc-kbd.c: Cast sc to scancode_x1 before comparing with enum values. * console-client/vga-dynacolor.h: Use an explicit if in reference counting. * console-client/vga-dynafont.c: Use usigned char for bitmaps. * console-client/vga-support.c: Use unsigned char instead of char. * console-client/vga-support.h: Likewise. * console-client/vga.c: Use conchar_attr_equal instead of casting structures to integers. * hurd/console.h: Add conchar_attr_equal to compare conchar_attr_t structures.
Diffstat (limited to 'console-client')
-rw-r--r--console-client/bdf.c4
-rw-r--r--console-client/driver.c2
-rw-r--r--console-client/pc-kbd.c21
-rw-r--r--console-client/vga-dynacolor.h10
-rw-r--r--console-client/vga-dynafont.c8
-rw-r--r--console-client/vga-support.c8
-rw-r--r--console-client/vga-support.h4
-rw-r--r--console-client/vga.c2
8 files changed, 34 insertions, 25 deletions
diff --git a/console-client/bdf.c b/console-client/bdf.c
index 467c1392..b61ef35c 100644
--- a/console-client/bdf.c
+++ b/console-client/bdf.c
@@ -128,7 +128,7 @@ parse_hexbyte (char *line, unsigned char *byte)
COMMENT lines, and removes whitespace at the beginning and end of a
line. */
static int
-next_line (char **line, int *size, FILE *file, int *count)
+next_line (char **line, size_t *size, FILE *file, int *count)
{
int len;
@@ -184,7 +184,7 @@ bdf_read (FILE *filep, bdf_font_t *font, int *linecount)
{
bdf_error_t err = 0;
char *line = 0;
- int line_size = 0;
+ size_t line_size = 0;
int len;
int done = 0;
bdf_font_t bdf;
diff --git a/console-client/driver.c b/console-client/driver.c
index 64078241..7a55bbe4 100644
--- a/console-client/driver.c
+++ b/console-client/driver.c
@@ -130,7 +130,7 @@ error_t driver_add (const char *const name, const char *const driver,
shobj = dlopen (filename, RTLD_LAZY);
if (!shobj)
{
- const char *errstring = dlerror (); /* Must always call or it leaks! */
+ (void) dlerror (); /* Must always call or it leaks! */
if (errno != ENOENT)
{
free (filename);
diff --git a/console-client/pc-kbd.c b/console-client/pc-kbd.c
index 21c09876..6f2d827a 100644
--- a/console-client/pc-kbd.c
+++ b/console-client/pc-kbd.c
@@ -1100,10 +1100,11 @@ input_loop (void *unused)
}
else if (state.extended == 1)
{
+ const enum scancode_x1 scx1 = (enum scancode_x1) sc;
state.extended = 0;
- if (sc == SC_X1_RIGHT_CTRL)
+ if (scx1 == SC_X1_RIGHT_CTRL)
state.right_ctrl = down;
- else if (sc == SC_X1_RIGHT_ALT)
+ else if (scx1 == SC_X1_RIGHT_ALT)
{
state.right_alt = down;
@@ -1139,23 +1140,23 @@ input_loop (void *unused)
}
}
}
- else if (state.right_alt && down && sc == SC_X1_PAD_SLASH) /* XXX */
+ else if (state.right_alt && down && scx1 == SC_X1_PAD_SLASH) /* XXX */
state.direct = (state.direct << 4) | 0xb;
- else if (state.right_alt && down && sc == SC_X1_PAD_ENTER) /* XXX */
+ else if (state.right_alt && down && scx1 == SC_X1_PAD_ENTER) /* XXX */
state.direct = (state.direct << 4) | 0xf;
- else if (state.left_alt && down && sc == SC_X1_RIGHT) /* XXX */
+ else if (state.left_alt && down && scx1 == SC_X1_RIGHT) /* XXX */
console_switch (0, 1);
- else if (state.left_alt && down && sc == SC_X1_LEFT) /* XXX */
+ else if (state.left_alt && down && scx1 == SC_X1_LEFT) /* XXX */
console_switch (0, -1);
- else if (state.left_alt && down && sc == SC_X1_UP) /* XXX */
+ else if (state.left_alt && down && scx1 == SC_X1_UP) /* XXX */
console_scrollback (CONS_SCROLL_DELTA_LINES, 1);
- else if (state.left_alt && down && sc == SC_X1_DOWN) /* XXX */
+ else if (state.left_alt && down && scx1 == SC_X1_DOWN) /* XXX */
console_scrollback (CONS_SCROLL_DELTA_LINES, -1);
else if ((state.right_shift || state.left_shift)
- && down && sc == SC_X1_PGUP) /* XXX */
+ && down && scx1 == SC_X1_PGUP) /* XXX */
console_scrollback (CONS_SCROLL_DELTA_SCREENS, 0.5);
else if ((state.right_shift || state.left_shift)
- && down && sc == SC_X1_PGDN) /* XXX */
+ && down && scx1 == SC_X1_PGDN) /* XXX */
console_scrollback (CONS_SCROLL_DELTA_SCREENS, -0.5);
else if (down && sc < sizeof (sc_x1_to_kc)/sizeof (sc_x1_to_kc[0]))
{
diff --git a/console-client/vga-dynacolor.h b/console-client/vga-dynacolor.h
index 304bcc1b..0526e0d8 100644
--- a/console-client/vga-dynacolor.h
+++ b/console-client/vga-dynacolor.h
@@ -77,11 +77,17 @@ signed char dynacolor_allocate (dynacolor_t *dc, unsigned char col);
/* Add a reference to palette entry P in the dynamic font DC. */
#define dynacolor_add_ref(dc,p) \
- ((dc).ref[0] >= 0 && (dc).ref[p]++)
+ do { \
+ if ((dc).ref[0] >= 0) \
+ (dc).ref[p]++; \
+ } while (0)
/* Deallocate a reference for palette entry P in the dynamic font DC. */
#define dynacolor_release(dc,p) \
- ((dc).ref[0] >= 0 && (dc).ref[p]--)
+ do { \
+ if ((dc).ref[0] >= 0) \
+ (dc).ref[p]--; \
+ } while (0)
/* This is a convenience function that looks up a replacement color
pair if the original colors are not available. The function always
diff --git a/console-client/vga-dynafont.c b/console-client/vga-dynafont.c
index 573d63b4..2cee47ed 100644
--- a/console-client/vga-dynafont.c
+++ b/console-client/vga-dynafont.c
@@ -46,7 +46,7 @@ static dynafont_t active_dynafont;
/* One glyph in a VGA font is 8 pixels wide and 32 pixels high. Only
the first N lines are visible, and N depends on the VGA register
settings. */
-typedef char vga_font_glyph[VGA_FONT_HEIGHT];
+typedef unsigned char vga_font_glyph[VGA_FONT_HEIGHT];
/* For each glyph in the VGA font, one instance of this structure is
@@ -329,7 +329,7 @@ create_system_font (void)
else
{
int i;
- char glyph_bitmap[32];
+ unsigned char glyph_bitmap[32];
for (i = 0; i < 16; i++)
{
@@ -591,7 +591,7 @@ dynafont_new (bdf_font_t font, bdf_font_t font_italic, bdf_font_t font_bold,
else
{
int i;
- char *gl = df->vga_font[FONT_INDEX_UNKNOWN];
+ unsigned char *gl = df->vga_font[FONT_INDEX_UNKNOWN];
/* XXX Take font height into account. */
gl[0] = 0x7E; /* ****** */
gl[1] = 0xC3; /* ** ** */
@@ -988,7 +988,7 @@ dynafont_activate (dynafont_t df)
{
int height = (df->font->bbox.height > 32) ? 32 : df->font->bbox.height;
- vga_write_font_buffer (0, 0, (char *) df->vga_font,
+ vga_write_font_buffer (0, 0, (unsigned char *) df->vga_font,
df->size * VGA_FONT_HEIGHT);
vga_select_font_buffer (0, (df->size == 512) ? 1 : 0);
diff --git a/console-client/vga-support.c b/console-client/vga-support.c
index e8497f82..3a2d7586 100644
--- a/console-client/vga-support.c
+++ b/console-client/vga-support.c
@@ -216,7 +216,7 @@ vga_fini (void)
DATALEN bytes from DATA (if WRITE is not 0). */
static void
vga_read_write_font_buffer (int write, int buffer, int index,
- char *data, size_t datalen)
+ unsigned char *data, size_t datalen)
{
char saved_seq_map;
char saved_seq_mode;
@@ -271,7 +271,8 @@ vga_read_write_font_buffer (int write, int buffer, int index,
/* Write DATALEN bytes from DATA to the font buffer BUFFER, starting
from glyph INDEX. */
void
-vga_write_font_buffer (int buffer, int index, char *data, size_t datalen)
+vga_write_font_buffer (int buffer, int index, unsigned char *data,
+ size_t datalen)
{
vga_read_write_font_buffer (1, buffer, index, data, datalen);
}
@@ -279,7 +280,8 @@ vga_write_font_buffer (int buffer, int index, char *data, size_t datalen)
/* Read DATALEN bytes into DATA from the font buffer BUFFER, starting
from glyph INDEX. */
void
-vga_read_font_buffer (int buffer, int index, char *data, size_t datalen)
+vga_read_font_buffer (int buffer, int index, unsigned char *data,
+ size_t datalen)
{
vga_read_write_font_buffer (0, buffer, index, data, datalen);
}
diff --git a/console-client/vga-support.h b/console-client/vga-support.h
index 38c6248f..17c0b5fd 100644
--- a/console-client/vga-support.h
+++ b/console-client/vga-support.h
@@ -44,12 +44,12 @@ void vga_fini (void);
/* Write DATALEN bytes from DATA to the font buffer BUFFER, starting
from glyph index. */
void vga_write_font_buffer (int buffer, int index,
- char *data, size_t datalen);
+ unsigned char *data, size_t datalen);
/* Read DATALEN bytes into DATA from the font buffer BUFFER, starting
from glyph INDEX. */
void vga_read_font_buffer (int buffer, int index,
- char *data, size_t datalen);
+ unsigned char *data, size_t datalen);
/* Set FONT_BUFFER_SUPP to FONT_BUFFER if the font is small. */
void vga_select_font_buffer (int font_buffer, int font_buffer_supp);
diff --git a/console-client/vga.c b/console-client/vga.c
index cf6c8c35..2d74aae3 100644
--- a/console-client/vga.c
+++ b/console-client/vga.c
@@ -713,7 +713,7 @@ vga_display_write (void *handle, conchar_t *str, size_t length,
return 0;
if (!disp->cur_conchar_attr_init
- || *(uint32_t *) &disp->cur_conchar_attr != *(uint32_t *) &str->attr)
+ || !conchar_attr_equal (&disp->cur_conchar_attr, &str->attr))
{
if (!disp->cur_conchar_attr_init)
disp->cur_conchar_attr_init = 1;