blob: 07dc6257201aeac1328969688ff4afa0a8336086 (
plain) (
blame)
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
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
int
libterminput_unmarshal_state(struct libterminput_unmarshaller *how, struct libterminput_state *what)
{
if (how->load(how, what, sizeof(*what)))
return -1;
if (what->inited < 0 || what->inited > 1 ||
what->bracketed_paste > 1U ||
what->meta > 2U ||
what->n >= sizeof(what->partial) ||
what->npartial >= sizeof(what->partial) ||
what->stored_tail > what->stored_head ||
what->stored_head > sizeof(what->stored) ||
what->unused_bits)
goto einval;
switch (what->mouse_tracking) {
case 0:
case 1:
case 2:
case 3:
case 6:
break;
default:
goto einval;
}
return 0;
einval:
errno = EINVAL;
return -1;
}
|