summaryrefslogtreecommitdiffstats
path: root/package/fbterm/0003-C++11-compliance.patch
blob: 1a06da3d1628149ee93cc18cefa10eb44493cf14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
lib/vterm_states: fix C++11 compliance

In C++11, narrowing a type is no longer allowed in structure
initializers:

    struct foo { u16 u; };
    foo f[] = { {0}, {-1} };

results in the gcc-6 to whine out loudly, and fail:

    error: narrowing conversion of ‘-1’ from ‘int’ to ‘u16 {aka short unsigned int}’ inside { } [-Wnarrowing]
     };
     ^

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

diff -durN fbterm-1.7.0.orig/src/lib/vterm_states.cpp fbterm-1.7.0/src/lib/vterm_states.cpp
--- fbterm-1.7.0.orig/src/lib/vterm_states.cpp	2010-10-06 06:23:08.000000000 +0200
+++ fbterm-1.7.0/src/lib/vterm_states.cpp	2016-08-13 16:54:29.495451127 +0200
@@ -22,6 +22,7 @@
 #include "vterm.h"
 
 #define ADDSAME(len) ((len) << 8)
+#define ENDSEQ  { ((u16)-1) }
 
 const VTerm::Sequence VTerm::control_sequences[] = {
 	{ 0,	0,	ESkeep },
@@ -39,14 +40,14 @@
 	{ 0x1B, 0,	ESesc },
 	{ 0x7F, 0,	ESkeep },
 	{ 0x9B, 0,	ESsquare },
-	{ -1}
+	ENDSEQ
 };
 
 const VTerm::Sequence VTerm::escape_sequences[] = {
 	{   0, 0, ESnormal },
 
 	// ESnormal
-	{ -1 },
+	ENDSEQ,
 
 	// ESesc
 	{ '[', &VTerm::clear_param,	ESsquare },
@@ -65,7 +66,7 @@
 	{ '8', &VTerm::restore_cursor,	ESnormal },
 	{ '>', &VTerm::keypad_numeric,	ESnormal },
 	{ '=', &VTerm::keypad_application,	ESnormal },
-	{ -1 },
+	ENDSEQ,
 
 	// ESsquare
 	{ '[', 0,	ESfunckey },
@@ -104,7 +105,7 @@
 	{ '`', &VTerm::cursor_position_col,	ESnormal },
 	{ ']', &VTerm::linux_specific, ESnormal },
 	{ '}', &VTerm::fbterm_specific, ESnormal },
-	{ -1 },
+	ENDSEQ,
 
 	// ESnonstd
 	{ '0' | ADDSAME(9), &VTerm::set_palette,    ESkeep },
@@ -112,25 +113,25 @@
 	{ 'a' | ADDSAME(5), &VTerm::set_palette,    ESkeep },
 	{ 'P', &VTerm::begin_set_palette, ESkeep },
 	{ 'R', &VTerm::reset_palette, ESnormal },
-	{ -1 },
+	ENDSEQ,
 
 	// ESpercent
 	{ '@', &VTerm::clear_utf8,	ESnormal },
 	{ 'G', &VTerm::set_utf8,	ESnormal },
 	{ '8', &VTerm::set_utf8,	ESnormal },
-	{ -1 },
+	ENDSEQ,
 
 	// EScharset
 	{ '0', &VTerm::set_charset, ESnormal },
 	{ 'B', &VTerm::set_charset, ESnormal },
 	{ 'U', &VTerm::set_charset, ESnormal },
 	{ 'K', &VTerm::set_charset, ESnormal },
-	{ -1 },
+	ENDSEQ,
 
 	// EShash
 	{ '8', &VTerm::screen_align,	ESnormal },
-	{ -1 },
+	ENDSEQ,
 
 	// ESfunckey
-	{ -1 },
+	ENDSEQ,
 };
OpenPOWER on IntegriCloud