summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2018-01-16 17:54:04 -0600
committerJeremy Kerr <jk@ozlabs.org>2018-04-12 14:22:26 +0800
commit0a58169a7838f74332e74393c4b87f40840e0b41 (patch)
tree6dad92b7c37598170ebff86a9e4725963a554a82
parenta5ecb153a9ab51da729787cfda74fb548bfecd39 (diff)
downloadfbterm-0a58169a7838f74332e74393c4b87f40840e0b41.tar.gz
fbterm-0a58169a7838f74332e74393c4b87f40840e0b41.zip
vterm_states: -1 isn't an unsigned short
../../../src/lib/vterm_states.cpp:43:1: error: narrowing conversion of ‘-1’ from ‘int’ to ‘u16 {aka short unsigned int}’ inside { } [-Wnarrowing] Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r--src/lib/vterm.cpp4
-rw-r--r--src/lib/vterm.h2
-rw-r--r--src/lib/vterm_states.cpp18
3 files changed, 13 insertions, 11 deletions
diff --git a/src/lib/vterm.cpp b/src/lib/vterm.cpp
index 3a5dcc7..ce4abcf 100644
--- a/src/lib/vterm.cpp
+++ b/src/lib/vterm.cpp
@@ -68,13 +68,13 @@ u8 VTerm::control_map[MAX_CONTROL_CODE], VTerm::escape_map[NR_STATES][MAX_ESCAPE
void VTerm::init_state()
{
- for (u8 i = 1; control_sequences[i].code != (u16)-1; i++) {
+ for (u8 i = 1; control_sequences[i].code != CODE_TERM; i++) {
control_map[control_sequences[i].code] = i;
}
u8 state = ESnormal;
for (u8 i = 1; ; i++) {
- if (escape_sequences[i].code == (u16)-1) {
+ if (escape_sequences[i].code == CODE_TERM) {
state++;
if (state == NR_STATES) break;
} else {
diff --git a/src/lib/vterm.h b/src/lib/vterm.h
index 32ffd2a..2191953 100644
--- a/src/lib/vterm.h
+++ b/src/lib/vterm.h
@@ -25,6 +25,8 @@
#include "type.h"
+#define CODE_TERM 0xffff
+
class VTerm {
public:
struct CharAttr {
diff --git a/src/lib/vterm_states.cpp b/src/lib/vterm_states.cpp
index 49e7588..afce901 100644
--- a/src/lib/vterm_states.cpp
+++ b/src/lib/vterm_states.cpp
@@ -39,14 +39,14 @@ const VTerm::Sequence VTerm::control_sequences[] = {
{ 0x1B, 0, ESesc },
{ 0x7F, 0, ESkeep },
{ 0x9B, 0, ESsquare },
- { -1}
+ { CODE_TERM }
};
const VTerm::Sequence VTerm::escape_sequences[] = {
{ 0, 0, ESnormal },
// ESnormal
- { -1 },
+ { CODE_TERM },
// ESesc
{ '[', &VTerm::clear_param, ESsquare },
@@ -65,7 +65,7 @@ const VTerm::Sequence VTerm::escape_sequences[] = {
{ '8', &VTerm::restore_cursor, ESnormal },
{ '>', &VTerm::keypad_numeric, ESnormal },
{ '=', &VTerm::keypad_application, ESnormal },
- { -1 },
+ { CODE_TERM },
// ESsquare
{ '[', 0, ESfunckey },
@@ -104,7 +104,7 @@ const VTerm::Sequence VTerm::escape_sequences[] = {
{ '`', &VTerm::cursor_position_col, ESnormal },
{ ']', &VTerm::linux_specific, ESnormal },
{ '}', &VTerm::fbterm_specific, ESnormal },
- { -1 },
+ { CODE_TERM },
// ESnonstd
{ '0' | ADDSAME(9), &VTerm::set_palette, ESkeep },
@@ -112,25 +112,25 @@ const VTerm::Sequence VTerm::escape_sequences[] = {
{ 'a' | ADDSAME(5), &VTerm::set_palette, ESkeep },
{ 'P', &VTerm::begin_set_palette, ESkeep },
{ 'R', &VTerm::reset_palette, ESnormal },
- { -1 },
+ { CODE_TERM },
// ESpercent
{ '@', &VTerm::clear_utf8, ESnormal },
{ 'G', &VTerm::set_utf8, ESnormal },
{ '8', &VTerm::set_utf8, ESnormal },
- { -1 },
+ { CODE_TERM },
// EScharset
{ '0', &VTerm::set_charset, ESnormal },
{ 'B', &VTerm::set_charset, ESnormal },
{ 'U', &VTerm::set_charset, ESnormal },
{ 'K', &VTerm::set_charset, ESnormal },
- { -1 },
+ { CODE_TERM },
// EShash
{ '8', &VTerm::screen_align, ESnormal },
- { -1 },
+ { CODE_TERM },
// ESfunckey
- { -1 },
+ { CODE_TERM },
};
OpenPOWER on IntegriCloud