Fix memmove arithemtic error. - sam - An updated version of the sam text editor. | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 258b74b67b0885d97c6ea71e5d8c231cb5a92ded | |
parent 1f4860ac9d58b65870094a6867a7b16c8f7c2f48 | |
Author: Rob King <[email protected]> | |
Date: Sun, 25 Sep 2016 22:15:51 -0500 | |
Fix memmove arithemtic error. | |
Diffstat: | |
libXg/gwin.c | 2 +- | |
libframe/frbox.c | 5 +++-- | |
2 files changed, 4 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/libXg/gwin.c b/libXg/gwin.c | |
@@ -158,7 +158,7 @@ Mappingaction(Widget w, XEvent *e, String *p, Cardinal *np) | |
#define STUFFCOMPOSE() \ | |
f = ((GwinWidget)w)->gwin.gotchar; \ | |
if (f) \ | |
- for (c = 0; c < composing; c++) \ | |
+ for (int c = 0; c < composing; c++) \ | |
(*f)(compose[c], 0, Tcurrent, 0, 0, NULL) | |
typedef struct Unikeysym Unikeysym; | |
diff --git a/libframe/frbox.c b/libframe/frbox.c | |
@@ -117,9 +117,10 @@ chopbox(Frame *f, Frbox *b, int n) /* drop first n chars;… | |
{ | |
if(b->nrune<0 || b->nrune<n) | |
berror("chopbox"); | |
- memmove(b->a.ptr, runeindex(b->a.ptr, n), b->nrune - n); | |
+ | |
+ uchar *ri = runeindex(b->a.ptr, n); | |
+ memmove(b->a.ptr, ri, strlen((char *)ri) + 1); | |
b->nrune -= n; | |
- b->a.ptr[b->nrune] = 0; | |
b->wid = strwidth(f->font, (char *)b->a.ptr); | |
} | |