termptyesc: _handle_xterm_set_color_class() gets obj==NULL in tests

+ simplify _handle_xterm_10_command()
This commit is contained in:
Boris Faure 2020-11-15 20:10:43 +01:00
parent 05b95705ae
commit a29e7a718a
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
1 changed files with 15 additions and 12 deletions

View File

@ -4124,7 +4124,8 @@ _handle_xterm_10_command(Termpty *ty, Eina_Unicode *p, int len)
if (*p == '?')
{
int r, g, b;
char bf[7];
char bf[32];
int l;
#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST)
evas_object_textgrid_palette_get(
termio_textgrid_get(ty->obj),
@ -4136,10 +4137,8 @@ _handle_xterm_10_command(Termpty *ty, Eina_Unicode *p, int len)
g = config->colors[0].g;
b = config->colors[0].b;
#endif
TERMPTY_WRITE_STR("\033]10;#");
snprintf(bf, sizeof(bf), "%.2X%.2X%.2X", r, g, b);
termpty_write(ty, bf, 6);
TERMPTY_WRITE_STR("\007");
l = snprintf(bf, sizeof(bf), "\033]10;#%.2X%.2X%.2X\007", r, g, b);
termpty_write(ty, bf, l);
}
else
{
@ -4164,14 +4163,18 @@ _handle_xterm_set_color_class(Termpty *ty, Eina_Unicode *p, int len,
const char *color_class,
uint8_t number)
{
if (!p || !*p || !obj)
if (!p || !*p)
goto err;
#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST)
if (!obj)
goto err;
#endif
if (*p == '?')
{
int r = 0, g = 0, b = 0;
char buf[64];
size_t l;
int l;
if (edje_object_color_class_get(obj, color_class, &r, &g, &b, NULL,
NULL, NULL, NULL, NULL,