From d3f469056e4d51859220eec1769e7f69b35d67f4 Mon Sep 17 00:00:00 2001 From: Francesco Palumbo Date: Wed, 24 May 2023 20:16:58 +0200 Subject: [PATCH] fix types for ARM support; fix errno handling; minor fixes; license GPL3 or later fix --- README.md | 2 +- changelog.md | 7 ++++++- examples/pactions.gsh | 15 ++++++++++----- man/guish.1 | 2 +- src/cutils.h | 26 +++++++++++++------------- src/evaluator.c | 8 ++++---- src/main.c | 4 ++-- src/sourcedriver.c | 4 ++-- src/sourcedriver.h | 6 +++--- src/tokenizer.c | 7 ++++--- src/widget.c | 15 ++++++++------- 11 files changed, 54 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index b9d0adc..d7eda97 100644 --- a/README.md +++ b/README.md @@ -1718,4 +1718,4 @@ Grazie mille. # LICENSE -**GPL3** see COPYING +**GPL-3.0-or-later** see COPYING diff --git a/changelog.md b/changelog.md index 460fde8..7d6c0ee 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ +## 2.6.10 (2023-05-24) + +* fix types for ARM support; fix errno handling; minor fixes; license GPL3 or later fix + ## 2.6.9 (2023-05-24) -* fixed LDFLAGS; removed dynamic loading of imlib2 +* fixed LDFLAGS; removed dynamic loading of imlib2 [commit](https://codeberg.org/phranz/guish/commit/c3e0b994a4dd40ee5c9a4a0971b288961eb140b9) + ## 2.6.8 (2023-05-22) diff --git a/examples/pactions.gsh b/examples/pactions.gsh index 5d62f03..3f891e4 100755 --- a/examples/pactions.gsh +++ b/examples/pactions.gsh @@ -73,12 +73,17 @@ shutdown=|b| q }s'b:1|bc:gray|bg:#fbfbfc' + @cont2 <<< @lock <<< @suspend <<< @reboot <<< @hibernate <<< @shutdown main=|p| - v <<< @cont1 <<< @cont2 :'Power Actions' + v + <<< @cont1 <<< @cont2 :'Power Actions' -@cont1 s'm:h'w,Q -@cont2 w -@main n +@main +n ++ +s'm:r' t -for x in *:{@x+} +@cont1 o,w +@cont2 o +@main o diff --git a/man/guish.1 b/man/guish.1 index 044cd40..f998318 100644 --- a/man/guish.1 +++ b/man/guish.1 @@ -1552,5 +1552,5 @@ Grazie mille. .SH LICENSE .BR .P -.B GPL3 +.B GPL-3.0-or-later see COPYING diff --git a/src/cutils.h b/src/cutils.h index 798b2f9..300c61d 100644 --- a/src/cutils.h +++ b/src/cutils.h @@ -18,7 +18,7 @@ #ifndef CUTILS_H #define CUTILS_H -#define CUTILS_VERSION "0.2.0" +#define CUTILS_VERSION "0.2.1" #include #include @@ -862,18 +862,18 @@ r->free(r); \ return 1; \ } \ - static size_t __ ## n ## _hash(n* p, t1 k) { \ - char b[64] = {0}; \ - size_t h; \ - char* s; \ - sprintf(b, "%p", (void*)(size_t)k); \ - s = p->strcmp ? (char*)strtoull(b, NULL, 16) : b; \ - size_t l = strlen(s); \ - h = 3; \ - for (size_t i=0; isize; \ - } \ + static size_t __ ## n ## _hash(n* p, t1 k) { \ + char b[64] = {0}; \ + size_t h; \ + char* s; \ + sprintf(b, "%p", (void*)(size_t)k); \ + s = p->strcmp ? (char*)(size_t)strtoull(b, NULL, 16) : b; \ + size_t l = strlen(s); \ + h = 3; \ + for (size_t i=0; isize; \ + } \ static int __ ## n ## _cmpkeys(n* p, t1 ok, t1 nk) { \ if (!ok || !nk) \ return 0; \ diff --git a/src/evaluator.c b/src/evaluator.c index 2a7d46a..75c4190 100644 --- a/src/evaluator.c +++ b/src/evaluator.c @@ -1179,7 +1179,7 @@ size_t eval_expressions(vec_token_t* v, vec_token_t* args) { attr->type = T_QUOTE; break; } - sprintf(buf, "%lu", p->subs->count); + sprintf(buf, "%lu", (unsigned long)p->subs->count); zfree(attr->data); attr->data = salloc(buf); break; @@ -1407,7 +1407,7 @@ size_t eval_expressions(vec_token_t* v, vec_token_t* args) { } #ifdef DEBUG debug("APPLYING FUNC: '%s'\n", func->data); - debug("NUMBER OF PARAMETERS : %lu\n", params->count); + debug("NUMBER OF PARAMETERS : %lu\n", (unsigned long)params->count); debug("------------------------\n"); debug("FUNCTION PARAMETERS:\n"); showtokens(params); @@ -1849,11 +1849,11 @@ size_t eval_expressions(vec_token_t* v, vec_token_t* args) { token_t* arg; params->pop_back(params, &arg); if (arg->type != T_BLOCK) { - sprintf(buf, "%lu", strlen(arg->data)); + sprintf(buf, "%lu", (unsigned long)strlen(arg->data)); } else { decap_block(arg->block->data); vec_token_t* objs = parse_phrase(arg->block->data, cs); - sprintf(buf, "%ld", objs->count); + sprintf(buf, "%lu", (unsigned long)objs->count); release_phrase(objs); } func->type = T_QUOTE; diff --git a/src/main.c b/src/main.c index 0f46ee7..156b7be 100644 --- a/src/main.c +++ b/src/main.c @@ -32,8 +32,8 @@ #include "main.h" #define AUTHOR "Francesco Palumbo " -#define LICENSE "GPL3" -#define VERSION "2.6.9" +#define LICENSE "GPL-3.0-or-later" +#define VERSION "2.6.10" int exit_status; unsigned long options; diff --git a/src/sourcedriver.c b/src/sourcedriver.c index 2833d8d..407d9cd 100644 --- a/src/sourcedriver.c +++ b/src/sourcedriver.c @@ -61,7 +61,7 @@ int new_source(int s, void* data) { return 0; debug("source type: %d\n", s); - debug("allsources count: %lu\n", allsources->count); + debug("allsources count: %lu\n", (unsigned long)allsources->count); sourcedata_t* p = NULL; switch (s) { @@ -217,7 +217,7 @@ head_t* pull() { return h; } -void push(char c) { +void push(int c) { if (c == EOF) return; switch (current->s) { diff --git a/src/sourcedriver.h b/src/sourcedriver.h index f8550b8..ec029c1 100644 --- a/src/sourcedriver.h +++ b/src/sourcedriver.h @@ -31,8 +31,8 @@ enum sources { typedef struct head_t { size_t pos; - char c; - char o; + int c; + int o; } head_t; typedef struct sourcedata_t { @@ -56,7 +56,7 @@ void sourcedriver_free(); void sinfo(const char*, unsigned long long); int new_source(int, void*); sourcedata_t* evalsrc(char*, unsigned long, char*); -void push(char); +void push(int); head_t* pull(); int source_exahusted(); void next_source(); diff --git a/src/tokenizer.c b/src/tokenizer.c index d09a2d4..27c7bb9 100644 --- a/src/tokenizer.c +++ b/src/tokenizer.c @@ -208,7 +208,7 @@ phrase_t* tokenize() { phrase_t* p = NULL; head_t* h = NULL; token_t* w = NULL; - char o; + int o; int nl = 0; int code = 0; int expr = 0; @@ -677,7 +677,7 @@ phrase_t* tokenize() { pbuf(bp, w->data, h->c); } else if (oneof(h->c, "xX")) { char b[3]; - unsigned char c; + char c; char* e = NULL; for (size_t i=0; i<2; ++i) { @@ -689,7 +689,8 @@ phrase_t* tokenize() { b[i] = h->c; } b[2] = 0; - c = (unsigned char)strtol(b, &e, 16); + errno = 0; + c = (char)strtol(b, &e, 16); if (!valid(c) || *e || errno == ERANGE || errno == EINVAL) { sinfo(current->n, w->lineno); fprintf(stderr, "error, bad hex value.\n"); diff --git a/src/widget.c b/src/widget.c index 0cdc289..38fd5cc 100644 --- a/src/widget.c +++ b/src/widget.c @@ -690,7 +690,7 @@ void show(widget_t* w) { if (w->etype == E_PAGE) showsubs(w); - + XMapWindow(display, w->wid); w->flags |= F_VISIBLE; if (w->flags & F_CLOSED) @@ -700,10 +700,10 @@ void show(widget_t* w) { if (w->parent || w->flags & F_BYPASS || w->flags & F_TRAYED) return; - - // wm (i3) workaround + // wm workaround XResizeWindow(display, w->wid, w->w, w->h); - Atom wmstate = XInternAtom(display, "WM_STATE", True); + + Atom wmstate = XInternAtom(display, "WM_STATE", False); if (wmstate == None) return; @@ -731,7 +731,7 @@ void hide(widget_t* w) { if (w->parent || w->flags & F_BYPASS || w->flags & F_TRAYED) return; - Atom wmstate = XInternAtom(display, "WM_STATE", True); + Atom wmstate = XInternAtom(display, "WM_STATE", False); if (wmstate == None) return; @@ -740,11 +740,12 @@ void hide(widget_t* w) { unsigned long n; unsigned long bafter; unsigned char *props; - + size_t count = 0; while (XGetWindowProperty(display, w->wid, wmstate, 0, ~(0l), False, AnyPropertyType, &type, &format, &n, &bafter, &props) == Success) { - if (props && *props == WithdrawnState) + if ((props && *props == WithdrawnState) || count > 1000) break; usleep(1000); + ++count; XFree(props); } XFree(props); -- 2.11.4.GIT