svn commit: r332297 - in head/sys/teken: . libteken

Poul-Henning Kamp phk at FreeBSD.org
Sun Apr 8 19:23:52 UTC 2018


Author: phk
Date: Sun Apr  8 19:23:50 2018
New Revision: 332297
URL: https://svnweb.freebsd.org/changeset/base/332297

Log:
  Pedantic polishing of code to please FlexeLint.
  
  Approved by:	ed

Modified:
  head/sys/teken/libteken/teken.3
  head/sys/teken/teken.c
  head/sys/teken/teken.h
  head/sys/teken/teken_scs.h
  head/sys/teken/teken_subr.h
  head/sys/teken/teken_subr_compat.h
  head/sys/teken/teken_wcwidth.h

Modified: head/sys/teken/libteken/teken.3
==============================================================================
--- head/sys/teken/libteken/teken.3	Sun Apr  8 19:11:25 2018	(r332296)
+++ head/sys/teken/libteken/teken.3	Sun Apr  8 19:23:50 2018	(r332297)
@@ -43,25 +43,25 @@
 .Ft void
 .Fn teken_set_winsize "teken_t *t" "const teken_pos_t *size"
 .Ft const teken_pos_t *
-.Fn teken_get_cursor "teken_t *t"
+.Fn teken_get_cursor "const teken_t *t"
 .Ft void
 .Fn teken_set_cursor "teken_t *t" "const teken_pos_t *pos"
 .Ft const teken_attr_t *
-.Fn teken_get_curattr "teken_t *t"
+.Fn teken_get_curattr "const teken_t *t"
 .Ft void
 .Fn teken_set_curattr "teken_t *t" "const teken_attr_t *attr"
 .Ft const teken_attr_t *
-.Fn teken_get_defattr "teken_t *t"
+.Fn teken_get_defattr "const teken_t *t"
 .Ft void
 .Fn teken_set_defattr "teken_t *t" "const teken_attr_t *attr"
 .Ft const char *
-.Fn teken_get_sequence "teken_t *t" "unsigned int id"
+.Fn teken_get_sequence "const teken_t *t" "unsigned int id"
 .Ft teken_color_t
 .Fn teken_256to16 "teken_color_t color"
 .Ft teken_color_t
 .Fn teken_256to8 "teken_color_t color"
 .Ft void
-.Fn teken_get_defattr_cons25 "teken_t *t" "int *fg" "int *bg"
+.Fn teken_get_defattr_cons25 "const teken_t *t" "int *fg" "int *bg"
 .Ft void
 .Fn teken_set_8bit "teken_t *t"
 .Ft void

Modified: head/sys/teken/teken.c
==============================================================================
--- head/sys/teken/teken.c	Sun Apr  8 19:11:25 2018	(r332296)
+++ head/sys/teken/teken.c	Sun Apr  8 19:23:50 2018	(r332297)
@@ -73,35 +73,38 @@ static teken_state_t	teken_state_init;
  */
 
 static inline void
-teken_funcs_bell(teken_t *t)
+teken_funcs_bell(const teken_t *t)
 {
 
+	teken_assert(t->t_funcs->tf_bell != NULL);
 	t->t_funcs->tf_bell(t->t_softc);
 }
 
 static inline void
-teken_funcs_cursor(teken_t *t)
+teken_funcs_cursor(const teken_t *t)
 {
 
 	teken_assert(t->t_cursor.tp_row < t->t_winsize.tp_row);
 	teken_assert(t->t_cursor.tp_col < t->t_winsize.tp_col);
 
+	teken_assert(t->t_funcs->tf_cursor != NULL);
 	t->t_funcs->tf_cursor(t->t_softc, &t->t_cursor);
 }
 
 static inline void
-teken_funcs_putchar(teken_t *t, const teken_pos_t *p, teken_char_t c,
+teken_funcs_putchar(const teken_t *t, const teken_pos_t *p, teken_char_t c,
     const teken_attr_t *a)
 {
 
 	teken_assert(p->tp_row < t->t_winsize.tp_row);
 	teken_assert(p->tp_col < t->t_winsize.tp_col);
 
+	teken_assert(t->t_funcs->tf_putchar != NULL);
 	t->t_funcs->tf_putchar(t->t_softc, p, c, a);
 }
 
 static inline void
-teken_funcs_fill(teken_t *t, const teken_rect_t *r,
+teken_funcs_fill(const teken_t *t, const teken_rect_t *r,
     const teken_char_t c, const teken_attr_t *a)
 {
 
@@ -110,11 +113,12 @@ teken_funcs_fill(teken_t *t, const teken_rect_t *r,
 	teken_assert(r->tr_end.tp_col > r->tr_begin.tp_col);
 	teken_assert(r->tr_end.tp_col <= t->t_winsize.tp_col);
 
+	teken_assert(t->t_funcs->tf_fill != NULL);
 	t->t_funcs->tf_fill(t->t_softc, r, c, a);
 }
 
 static inline void
-teken_funcs_copy(teken_t *t, const teken_rect_t *r, const teken_pos_t *p)
+teken_funcs_copy(const teken_t *t, const teken_rect_t *r, const teken_pos_t *p)
 {
 
 	teken_assert(r->tr_end.tp_row > r->tr_begin.tp_row);
@@ -124,20 +128,23 @@ teken_funcs_copy(teken_t *t, const teken_rect_t *r, co
 	teken_assert(p->tp_row + (r->tr_end.tp_row - r->tr_begin.tp_row) <= t->t_winsize.tp_row);
 	teken_assert(p->tp_col + (r->tr_end.tp_col - r->tr_begin.tp_col) <= t->t_winsize.tp_col);
 
+	teken_assert(t->t_funcs->tf_copy != NULL);
 	t->t_funcs->tf_copy(t->t_softc, r, p);
 }
 
 static inline void
-teken_funcs_param(teken_t *t, int cmd, unsigned int value)
+teken_funcs_param(const teken_t *t, int cmd, unsigned int value)
 {
 
+	teken_assert(t->t_funcs->tf_param != NULL);
 	t->t_funcs->tf_param(t->t_softc, cmd, value);
 }
 
 static inline void
-teken_funcs_respond(teken_t *t, const void *buf, size_t len)
+teken_funcs_respond(const teken_t *t, const void *buf, size_t len)
 {
 
+	teken_assert(t->t_funcs->tf_respond != NULL);
 	t->t_funcs->tf_respond(t->t_softc, buf, len);
 }
 
@@ -290,7 +297,7 @@ teken_input(teken_t *t, const void *buf, size_t len)
 }
 
 const teken_pos_t *
-teken_get_cursor(teken_t *t)
+teken_get_cursor(const teken_t *t)
 {
 
 	return (&t->t_cursor);
@@ -308,7 +315,7 @@ teken_set_cursor(teken_t *t, const teken_pos_t *p)
 }
 
 const teken_attr_t *
-teken_get_curattr(teken_t *t)
+teken_get_curattr(const teken_t *t)
 {
 
 	return (&t->t_curattr);
@@ -322,7 +329,7 @@ teken_set_curattr(teken_t *t, const teken_attr_t *a)
 }
 
 const teken_attr_t *
-teken_get_defattr(teken_t *t)
+teken_get_defattr(const teken_t *t)
 {
 
 	return (&t->t_defattr);
@@ -336,7 +343,7 @@ teken_set_defattr(teken_t *t, const teken_attr_t *a)
 }
 
 const teken_pos_t *
-teken_get_winsize(teken_t *t)
+teken_get_winsize(const teken_t *t)
 {
 
 	return (&t->t_winsize);
@@ -693,7 +700,7 @@ static const char * const special_strings_normal[] = {
 };
 
 const char *
-teken_get_sequence(teken_t *t, unsigned int k)
+teken_get_sequence(const teken_t *t, unsigned int k)
 {
 
 	/* Cons25 mode. */

Modified: head/sys/teken/teken.h
==============================================================================
--- head/sys/teken/teken.h	Sun Apr  8 19:11:25 2018	(r332296)
+++ head/sys/teken/teken.h	Sun Apr  8 19:23:50 2018	(r332297)
@@ -118,7 +118,7 @@ typedef struct {
 	tf_respond_t	*tf_respond;
 } teken_funcs_t;
 
-typedef teken_char_t teken_scs_t(teken_t *, teken_char_t);
+typedef teken_char_t teken_scs_t(const teken_t *, teken_char_t);
 
 /*
  * Terminal state.
@@ -166,11 +166,11 @@ void	teken_init(teken_t *, const teken_funcs_t *, void
 void	teken_input(teken_t *, const void *, size_t);
 
 /* Get/set teken attributes. */
-const teken_pos_t *teken_get_cursor(teken_t *);
-const teken_attr_t *teken_get_curattr(teken_t *);
-const teken_attr_t *teken_get_defattr(teken_t *);
-void	teken_get_defattr_cons25(teken_t *, int *, int *);
-const teken_pos_t *teken_get_winsize(teken_t *);
+const teken_pos_t *teken_get_cursor(const teken_t *);
+const teken_attr_t *teken_get_curattr(const teken_t *);
+const teken_attr_t *teken_get_defattr(const teken_t *);
+void	teken_get_defattr_cons25(const teken_t *, int *, int *);
+const teken_pos_t *teken_get_winsize(const teken_t *);
 void	teken_set_cursor(teken_t *, const teken_pos_t *);
 void	teken_set_curattr(teken_t *, const teken_attr_t *);
 void	teken_set_defattr(teken_t *, const teken_attr_t *);
@@ -202,7 +202,7 @@ void	teken_set_winsize_noreset(teken_t *, const teken_
 #define	TKEY_F10	0x13
 #define	TKEY_F11	0x14
 #define	TKEY_F12	0x15
-const char *teken_get_sequence(teken_t *, unsigned int);
+const char *teken_get_sequence(const teken_t *, unsigned int);
 
 /* Legacy features. */
 void	teken_set_8bit(teken_t *);

Modified: head/sys/teken/teken_scs.h
==============================================================================
--- head/sys/teken/teken_scs.h	Sun Apr  8 19:11:25 2018	(r332296)
+++ head/sys/teken/teken_scs.h	Sun Apr  8 19:23:50 2018	(r332297)
@@ -29,7 +29,7 @@
  */
 
 static inline teken_char_t
-teken_scs_process(teken_t *t, teken_char_t c)
+teken_scs_process(const teken_t *t, teken_char_t c)
 {
 
 	return (t->t_scs[t->t_curscs](t, c));
@@ -52,7 +52,7 @@ static const uint8_t teken_boxdrawing_8bit[31] = {
 };
 
 static teken_char_t
-teken_scs_special_graphics(teken_t *t, teken_char_t c)
+teken_scs_special_graphics(const teken_t *t, teken_char_t c)
 {
 
 	/* Box drawing. */
@@ -64,7 +64,7 @@ teken_scs_special_graphics(teken_t *t, teken_char_t c)
 }
 
 static teken_char_t
-teken_scs_uk_national(teken_t *t, teken_char_t c)
+teken_scs_uk_national(const teken_t *t, teken_char_t c)
 {
 
 	/* Pound sign. */
@@ -74,9 +74,10 @@ teken_scs_uk_national(teken_t *t, teken_char_t c)
 }
 
 static teken_char_t
-teken_scs_us_ascii(teken_t *t __unused, teken_char_t c)
+teken_scs_us_ascii(const teken_t *t, teken_char_t c)
 {
 
 	/* No processing. */
+	(void)t;
 	return (c);
 }

Modified: head/sys/teken/teken_subr.h
==============================================================================
--- head/sys/teken/teken_subr.h	Sun Apr  8 19:11:25 2018	(r332296)
+++ head/sys/teken/teken_subr.h	Sun Apr  8 19:23:50 2018	(r332297)
@@ -29,13 +29,13 @@
  */
 
 static void teken_subr_cursor_up(teken_t *, unsigned int);
-static void teken_subr_erase_line(teken_t *, unsigned int);
+static void teken_subr_erase_line(const teken_t *, unsigned int);
 static void teken_subr_regular_character(teken_t *, teken_char_t);
 static void teken_subr_reset_to_initial_state(teken_t *);
 static void teken_subr_save_cursor(teken_t *);
 
 static inline int
-teken_tab_isset(teken_t *t, unsigned int col)
+teken_tab_isset(const teken_t *t, unsigned int col)
 {
 	unsigned int b, o;
 
@@ -45,7 +45,7 @@ teken_tab_isset(teken_t *t, unsigned int col)
 	b = col / (sizeof(unsigned int) * 8);
 	o = col % (sizeof(unsigned int) * 8);
 
-	return (t->t_tabstops[b] & (1 << o));
+	return (t->t_tabstops[b] & (1U << o));
 }
 
 static inline void
@@ -59,7 +59,7 @@ teken_tab_clear(teken_t *t, unsigned int col)
 	b = col / (sizeof(unsigned int) * 8);
 	o = col % (sizeof(unsigned int) * 8);
 
-	t->t_tabstops[b] &= ~(1 << o);
+	t->t_tabstops[b] &= ~(1U << o);
 }
 
 static inline void
@@ -73,7 +73,7 @@ teken_tab_set(teken_t *t, unsigned int col)
 	b = col / (sizeof(unsigned int) * 8);
 	o = col % (sizeof(unsigned int) * 8);
 
-	t->t_tabstops[b] |= 1 << o;
+	t->t_tabstops[b] |= 1U << o;
 }
 
 static void
@@ -81,14 +81,14 @@ teken_tab_default(teken_t *t)
 {
 	unsigned int i;
 
-	memset(&t->t_tabstops, 0, T_NUMCOL / 8);
+	memset(t->t_tabstops, 0, T_NUMCOL / 8);
 
 	for (i = 8; i < T_NUMCOL; i += 8)
 		teken_tab_set(t, i);
 }
 
 static void
-teken_subr_do_scroll(teken_t *t, int amount)
+teken_subr_do_scroll(const teken_t *t, int amount)
 {
 	teken_rect_t tr;
 	teken_pos_t tp;
@@ -149,7 +149,7 @@ teken_subr_do_scroll(teken_t *t, int amount)
 }
 
 static ssize_t
-teken_subr_do_cpr(teken_t *t, unsigned int cmd, char response[16])
+teken_subr_do_cpr(const teken_t *t, unsigned int cmd, char response[16])
 {
 
 	switch (cmd) {
@@ -225,7 +225,7 @@ teken_subr_backspace(teken_t *t)
 }
 
 static void
-teken_subr_bell(teken_t *t)
+teken_subr_bell(const teken_t *t)
 {
 
 	teken_funcs_bell(t);
@@ -326,7 +326,7 @@ static void
 teken_subr_cursor_position(teken_t *t, unsigned int row, unsigned int col)
 {
 
-	row = row - 1 + t->t_originreg.ts_begin;
+	row = (row - 1) + t->t_originreg.ts_begin;
 	t->t_cursor.tp_row = row < t->t_originreg.ts_end ?
 	    row : t->t_originreg.ts_end - 1;
 
@@ -339,7 +339,7 @@ teken_subr_cursor_position(teken_t *t, unsigned int ro
 }
 
 static void
-teken_subr_cursor_position_report(teken_t *t, unsigned int cmd)
+teken_subr_cursor_position_report(const teken_t *t, unsigned int cmd)
 {
 	char response[18] = "\x1B[";
 	ssize_t len;
@@ -372,7 +372,7 @@ teken_subr_cursor_up(teken_t *t, unsigned int nrows)
 }
 
 static void
-teken_subr_delete_character(teken_t *t, unsigned int ncols)
+teken_subr_delete_character(const teken_t *t, unsigned int ncols)
 {
 	teken_rect_t tr;
 
@@ -395,7 +395,7 @@ teken_subr_delete_character(teken_t *t, unsigned int n
 }
 
 static void
-teken_subr_delete_line(teken_t *t, unsigned int nrows)
+teken_subr_delete_line(const teken_t *t, unsigned int nrows)
 {
 	teken_rect_t tr;
 
@@ -435,7 +435,7 @@ teken_subr_device_control_string(teken_t *t)
 }
 
 static void
-teken_subr_device_status_report(teken_t *t, unsigned int cmd)
+teken_subr_device_status_report(const teken_t *t, unsigned int cmd)
 {
 	char response[19] = "\x1B[?";
 	ssize_t len;
@@ -448,21 +448,23 @@ teken_subr_device_status_report(teken_t *t, unsigned i
 }
 
 static void
-teken_subr_double_height_double_width_line_top(teken_t *t __unused)
+teken_subr_double_height_double_width_line_top(const teken_t *t)
 {
 
+	(void)t;
 	teken_printf("double height double width top\n");
 }
 
 static void
-teken_subr_double_height_double_width_line_bottom(teken_t *t __unused)
+teken_subr_double_height_double_width_line_bottom(const teken_t *t)
 {
 
+	(void)t;
 	teken_printf("double height double width bottom\n");
 }
 
 static void
-teken_subr_erase_character(teken_t *t, unsigned int ncols)
+teken_subr_erase_character(const teken_t *t, unsigned int ncols)
 {
 	teken_rect_t tr;
 
@@ -478,7 +480,7 @@ teken_subr_erase_character(teken_t *t, unsigned int nc
 }
 
 static void
-teken_subr_erase_display(teken_t *t, unsigned int mode)
+teken_subr_erase_display(const teken_t *t, unsigned int mode)
 {
 	teken_rect_t r;
 
@@ -514,7 +516,7 @@ teken_subr_erase_display(teken_t *t, unsigned int mode
 }
 
 static void
-teken_subr_erase_line(teken_t *t, unsigned int mode)
+teken_subr_erase_line(const teken_t *t, unsigned int mode)
 {
 	teken_rect_t r;
 
@@ -540,42 +542,42 @@ teken_subr_erase_line(teken_t *t, unsigned int mode)
 }
 
 static void
-teken_subr_g0_scs_special_graphics(teken_t *t __unused)
+teken_subr_g0_scs_special_graphics(teken_t *t)
 {
 
 	t->t_scs[0] = teken_scs_special_graphics;
 }
 
 static void
-teken_subr_g0_scs_uk_national(teken_t *t __unused)
+teken_subr_g0_scs_uk_national(teken_t *t)
 {
 
 	t->t_scs[0] = teken_scs_uk_national;
 }
 
 static void
-teken_subr_g0_scs_us_ascii(teken_t *t __unused)
+teken_subr_g0_scs_us_ascii(teken_t *t)
 {
 
 	t->t_scs[0] = teken_scs_us_ascii;
 }
 
 static void
-teken_subr_g1_scs_special_graphics(teken_t *t __unused)
+teken_subr_g1_scs_special_graphics(teken_t *t)
 {
 
 	t->t_scs[1] = teken_scs_special_graphics;
 }
 
 static void
-teken_subr_g1_scs_uk_national(teken_t *t __unused)
+teken_subr_g1_scs_uk_national(teken_t *t)
 {
 
 	t->t_scs[1] = teken_scs_uk_national;
 }
 
 static void
-teken_subr_g1_scs_us_ascii(teken_t *t __unused)
+teken_subr_g1_scs_us_ascii(teken_t *t)
 {
 
 	t->t_scs[1] = teken_scs_us_ascii;
@@ -621,7 +623,7 @@ teken_subr_index(teken_t *t)
 }
 
 static void
-teken_subr_insert_character(teken_t *t, unsigned int ncols)
+teken_subr_insert_character(const teken_t *t, unsigned int ncols)
 {
 	teken_rect_t tr;
 
@@ -647,7 +649,7 @@ teken_subr_insert_character(teken_t *t, unsigned int n
 }
 
 static void
-teken_subr_insert_line(teken_t *t, unsigned int nrows)
+teken_subr_insert_line(const teken_t *t, unsigned int nrows)
 {
 	teken_rect_t tr;
 
@@ -679,14 +681,14 @@ teken_subr_insert_line(teken_t *t, unsigned int nrows)
 }
 
 static void
-teken_subr_keypad_application_mode(teken_t *t)
+teken_subr_keypad_application_mode(const teken_t *t)
 {
 
 	teken_funcs_param(t, TP_KEYPADAPP, 1);
 }
 
 static void
-teken_subr_keypad_numeric_mode(teken_t *t)
+teken_subr_keypad_numeric_mode(const teken_t *t)
 {
 
 	teken_funcs_param(t, TP_KEYPADAPP, 0);
@@ -748,21 +750,21 @@ teken_subr_operating_system_command(teken_t *t)
 }
 
 static void
-teken_subr_pan_down(teken_t *t, unsigned int nrows)
+teken_subr_pan_down(const teken_t *t, unsigned int nrows)
 {
 
 	teken_subr_do_scroll(t, (int)nrows);
 }
 
 static void
-teken_subr_pan_up(teken_t *t, unsigned int nrows)
+teken_subr_pan_up(const teken_t *t, unsigned int nrows)
 {
 
 	teken_subr_do_scroll(t, -(int)nrows);
 }
 
 static void
-teken_subr_primary_device_attributes(teken_t *t, unsigned int request)
+teken_subr_primary_device_attributes(const teken_t *t, unsigned int request)
 {
 
 	if (request == 0) {
@@ -775,7 +777,7 @@ teken_subr_primary_device_attributes(teken_t *t, unsig
 }
 
 static void
-teken_subr_do_putchar(teken_t *t, const teken_pos_t *tp, teken_char_t c,
+teken_subr_do_putchar(const teken_t *t, const teken_pos_t *tp, teken_char_t c,
     int width)
 {
 
@@ -1042,7 +1044,7 @@ teken_subr_save_cursor(teken_t *t)
 }
 
 static void
-teken_subr_secondary_device_attributes(teken_t *t, unsigned int request)
+teken_subr_secondary_device_attributes(const teken_t *t, unsigned int request)
 {
 
 	if (request == 0) {
@@ -1121,7 +1123,7 @@ teken_subr_set_mode(teken_t *t, unsigned int cmd)
 
 static void
 teken_subr_set_graphic_rendition(teken_t *t, unsigned int ncmds,
-    unsigned int cmds[])
+    const unsigned int cmds[])
 {
 	unsigned int i, n;
 
@@ -1208,7 +1210,7 @@ teken_subr_set_graphic_rendition(teken_t *t, unsigned 
 		case 95: /* Set bright foreground color: magenta */
 		case 96: /* Set bright foreground color: cyan */
 		case 97: /* Set bright foreground color: white */
-			t->t_curattr.ta_fgcolor = n - 90 + 8;
+			t->t_curattr.ta_fgcolor = (n - 90) + 8;
 			break;
 		case 100: /* Set bright background color: black */
 		case 101: /* Set bright background color: red */
@@ -1218,7 +1220,7 @@ teken_subr_set_graphic_rendition(teken_t *t, unsigned 
 		case 105: /* Set bright background color: magenta */
 		case 106: /* Set bright background color: cyan */
 		case 107: /* Set bright background color: white */
-			t->t_curattr.ta_bgcolor = n - 100 + 8;
+			t->t_curattr.ta_bgcolor = (n - 100) + 8;
 			break;
 		default:
 			teken_printf("unsupported attribute %u\n", n);
@@ -1258,23 +1260,26 @@ teken_subr_set_top_and_bottom_margins(teken_t *t, unsi
 }
 
 static void
-teken_subr_single_height_double_width_line(teken_t *t __unused)
+teken_subr_single_height_double_width_line(const teken_t *t)
 {
 
+	(void)t;
 	teken_printf("single height double width???\n");
 }
 
 static void
-teken_subr_single_height_single_width_line(teken_t *t __unused)
+teken_subr_single_height_single_width_line(const teken_t *t)
 {
 
+	(void)t;
 	teken_printf("single height single width???\n");
 }
 
 static void
-teken_subr_string_terminator(teken_t *t __unused)
+teken_subr_string_terminator(const teken_t *t)
 {
 
+	(void)t;
 	/*
 	 * Strings are already terminated in teken_input_char() when ^[
 	 * is inserted.
@@ -1290,8 +1295,10 @@ teken_subr_tab_clear(teken_t *t, unsigned int cmd)
 		teken_tab_clear(t, t->t_cursor.tp_col);
 		break;
 	case 3:
-		memset(&t->t_tabstops, 0, T_NUMCOL / 8);
+		memset(t->t_tabstops, 0, T_NUMCOL / 8);
 		break;
+	default:
+		break;
 	}
 }
 
@@ -1299,7 +1306,7 @@ static void
 teken_subr_vertical_position_absolute(teken_t *t, unsigned int row)
 {
 
-	row = row - 1 + t->t_originreg.ts_begin;
+	row = (row - 1) + t->t_originreg.ts_begin;
 	t->t_cursor.tp_row = row < t->t_originreg.ts_end ?
 	    row : t->t_originreg.ts_end - 1;
 

Modified: head/sys/teken/teken_subr_compat.h
==============================================================================
--- head/sys/teken/teken_subr_compat.h	Sun Apr  8 19:11:25 2018	(r332296)
+++ head/sys/teken/teken_subr_compat.h	Sun Apr  8 19:23:50 2018	(r332297)
@@ -29,15 +29,15 @@
  */
 
 static void
-teken_subr_cons25_set_border(teken_t *t, unsigned int c)
+teken_subr_cons25_set_border(const teken_t *t, unsigned int c)
 {
 
 	teken_funcs_param(t, TP_SETBORDER, c);
 }
 
 static void
-teken_subr_cons25_set_global_cursor_shape(teken_t *t, unsigned int ncmds,
-    unsigned int cmds[])
+teken_subr_cons25_set_global_cursor_shape(const teken_t *t, unsigned int ncmds,
+    const unsigned int cmds[])
 {
 	unsigned int code, i;
 
@@ -58,7 +58,7 @@ teken_subr_cons25_set_global_cursor_shape(teken_t *t, 
 }
 
 static void
-teken_subr_cons25_set_local_cursor_type(teken_t *t, unsigned int type)
+teken_subr_cons25_set_local_cursor_type(const teken_t *t, unsigned int type)
 {
 
 	teken_funcs_param(t, TP_SETLOCALCURSOR, type);
@@ -86,7 +86,7 @@ teken_subr_cons25_set_default_foreground(teken_t *t, u
 static const teken_color_t cons25_revcolors[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
 
 void
-teken_get_defattr_cons25(teken_t *t, int *fg, int *bg)
+teken_get_defattr_cons25(const teken_t *t, int *fg, int *bg)
 {
 
 	*fg = cons25_revcolors[teken_256to8(t->t_defattr.ta_fgcolor)];
@@ -96,14 +96,14 @@ teken_get_defattr_cons25(teken_t *t, int *fg, int *bg)
 }
 
 static void
-teken_subr_cons25_switch_virtual_terminal(teken_t *t, unsigned int vt)
+teken_subr_cons25_switch_virtual_terminal(const teken_t *t, unsigned int vt)
 {
 
 	teken_funcs_param(t, TP_SWITCHVT, vt);
 }
 
 static void
-teken_subr_cons25_set_bell_pitch_duration(teken_t *t, unsigned int pitch,
+teken_subr_cons25_set_bell_pitch_duration(const teken_t *t, unsigned int pitch,
     unsigned int duration)
 {
 
@@ -113,9 +113,10 @@ teken_subr_cons25_set_bell_pitch_duration(teken_t *t, 
 
 static void
 teken_subr_cons25_set_graphic_rendition(teken_t *t, unsigned int cmd,
-    unsigned int param __unused)
+    unsigned int param)
 {
 
+	(void)param;
 	switch (cmd) {
 	case 0: /* Reset. */
 		t->t_curattr = t->t_defattr;
@@ -135,6 +136,8 @@ teken_subr_cons25_set_terminal_mode(teken_t *t, unsign
 		break;
 	case 1: /* Switch terminal to cons25. */
 		t->t_stateflags |= TS_CONS25;
+		break;
+	default:
 		break;
 	}
 }

Modified: head/sys/teken/teken_wcwidth.h
==============================================================================
--- head/sys/teken/teken_wcwidth.h	Sun Apr  8 19:11:25 2018	(r332296)
+++ head/sys/teken/teken_wcwidth.h	Sun Apr  8 19:23:50 2018	(r332297)
@@ -103,7 +103,7 @@ static int teken_wcwidth(teken_char_t ucs)
 
   /* if we arrive here, ucs is not a combining or C0/C1 control character */
 
-  return 1 + 
+  return 1 +
     (ucs >= 0x1100 &&
      (ucs <= 0x115f ||                    /* Hangul Jamo init. consonants */
       ucs == 0x2329 || ucs == 0x232a ||


More information about the svn-src-head mailing list