Trivial changes: whitespace and modes.

Remote whitespace at the ends of lines.
Remove blank lines from the ends of files.
Change modes on source files so that they
are not executable.

Signed-off-by: Dan Cross <cross@gajendra.net>
This commit is contained in:
Dan Cross 2020-01-10 14:44:21 +00:00
parent 77a0a5b519
commit fa325e9b42
1021 changed files with 5688 additions and 6193 deletions

View file

@ -10,7 +10,7 @@ allocimagemix(Display *d, u32int color1, u32int color3)
if(qmask == nil)
qmask = allocimage(d, Rect(0,0,1,1), GREY8, 1, 0x3F3F3FFF);
if(d->screenimage->depth <= 8){ /* create a 2×2 texture */
t = allocimage(d, Rect(0,0,1,1), d->screenimage->chan, 0, color1);
if(t == nil)

View file

@ -201,4 +201,3 @@ Pfmt(Fmt *f)
p = va_arg(f->args, Point);
return fmtprint(f, "[%d %d]", p.x, p.y);
}

View file

@ -154,7 +154,7 @@ freefont(Font *f)
f->display->firstfont = f->next;
}
if(f->lodpi != f)
if(f->lodpi != f)
freefont(f->lodpi);
if(f->hidpi != f)
freefont(f->hidpi);

View file

@ -42,7 +42,7 @@ strtochan(char *s)
p++;
while(*p && !isspace((uchar)*p)){
if((q = strchr(channames, p[0])) == nil)
if((q = strchr(channames, p[0])) == nil)
return 0;
t = q-channames;
if(p[1] < '0' || p[1] > '9')

View file

@ -3,7 +3,7 @@
#include <draw.h>
/*
* compressed data are seuences of byte codes.
* compressed data are seuences of byte codes.
* if the first byte b has the 0x80 bit set, the next (b^0x80)+1 bytes
* are data. otherwise, it's two bytes specifying a previous string to repeat.
*/

View file

@ -15,7 +15,7 @@ _setdrawop(Display *d, Drawop op)
a[1] = op;
}
}
static void
draw1(Image *dst, Rectangle *r, Image *src, Point *p0, Image *mask, Point *p1, Drawop op)
{

View file

@ -23,10 +23,10 @@ int
_displayconnect(Display *d)
{
int pid, p[2];
fmtinstall('W', drawfcallfmt);
fmtinstall('H', encodefmt);
if(pipe(p) < 0)
return -1;
if((pid=fork()) < 0){
@ -84,7 +84,7 @@ _displaymux(Display *d)
d->mux->settag = drawsettag;
d->mux->aux = d;
muxinit(d->mux);
return 0;
}
@ -94,7 +94,7 @@ drawsend(Mux *mux, void *vmsg)
int n;
uchar *msg;
Display *d;
msg = vmsg;
GET(msg, n);
d = mux->aux;
@ -148,7 +148,7 @@ drawgettag(Mux *mux, void *vmsg)
{
uchar *msg;
USED(mux);
msg = vmsg;
return msg[4];
}
@ -158,7 +158,7 @@ drawsettag(Mux *mux, void *vmsg, uint tag)
{
uchar *msg;
USED(mux);
msg = vmsg;
msg[4] = tag;
return 0;
@ -169,7 +169,7 @@ displayrpc(Display *d, Wsysmsg *tx, Wsysmsg *rx, void **freep)
{
int n, nn;
void *tpkt, *rpkt;
n = sizeW2M(tx);
tpkt = malloc(n);
if(freep)
@ -295,7 +295,7 @@ int
_displaycursor(Display *d, Cursor *c, Cursor2 *c2)
{
Wsysmsg tx, rx;
tx.type = Tcursor2;
if(c == nil){
memset(&tx.cursor, 0, sizeof tx.cursor);
@ -316,7 +316,7 @@ int
_displaybouncemouse(Display *d, Mouse *m)
{
Wsysmsg tx, rx;
tx.type = Tbouncemouse;
tx.mouse = *m;
return displayrpc(d, &tx, &rx, nil);
@ -326,7 +326,7 @@ int
_displaylabel(Display *d, char *label)
{
Wsysmsg tx, rx;
tx.type = Tlabel;
tx.label = label;
return displayrpc(d, &tx, &rx, nil);
@ -338,7 +338,7 @@ _displayrdsnarf(Display *d)
void *p;
char *s;
Wsysmsg tx, rx;
tx.type = Trdsnarf;
if(displayrpc(d, &tx, &rx, &p) < 0)
return nil;
@ -351,7 +351,7 @@ int
_displaywrsnarf(Display *d, char *snarf)
{
Wsysmsg tx, rx;
tx.type = Twrsnarf;
tx.snarf = snarf;
return displayrpc(d, &tx, &rx, nil);
@ -362,7 +362,7 @@ _displayrddraw(Display *d, void *v, int n)
{
void *p;
Wsysmsg tx, rx;
tx.type = Trddraw;
tx.count = n;
if(displayrpc(d, &tx, &rx, &p) < 0)
@ -376,7 +376,7 @@ int
_displaywrdraw(Display *d, void *v, int n)
{
Wsysmsg tx, rx;
tx.type = Twrdraw;
tx.count = n;
tx.data = v;
@ -398,7 +398,7 @@ int
_displayresize(Display *d, Rectangle r)
{
Wsysmsg tx, rx;
tx.type = Tresize;
tx.rect = r;
return displayrpc(d, &tx, &rx, nil);
@ -409,7 +409,7 @@ canreadfd(int fd)
{
fd_set rs, ws, xs;
struct timeval tv;
FD_ZERO(&rs);
FD_ZERO(&ws);
FD_ZERO(&xs);
@ -423,4 +423,3 @@ canreadfd(int fd)
return 1;
return 0;
}

View file

@ -17,7 +17,7 @@ static int
PUTSTRING(uchar *p, char *s)
{
int n;
if(s == nil)
s = "";
n = strlen(s);
@ -30,14 +30,14 @@ static int
GETSTRING(uchar *p, char **s)
{
int n;
GET(p, n);
memmove(p, p+4, n);
*s = (char*)p;
p[n] = 0;
return n+4;
}
uint
sizeW2M(Wsysmsg *m)
{
@ -96,7 +96,7 @@ uint
convW2M(Wsysmsg *m, uchar *p, uint n)
{
int nn;
nn = sizeW2M(m);
if(n < nn || nn == 0 || n < 6)
return 0;
@ -188,7 +188,7 @@ convW2M(Wsysmsg *m, uchar *p, uint n)
PUT(p+14, m->rect.max.x);
PUT(p+18, m->rect.max.y);
break;
}
}
return nn;
}
@ -196,7 +196,7 @@ uint
convM2W(uchar *p, uint n, Wsysmsg *m)
{
int nn;
if(n < 6)
return 0;
GET(p, nn);
@ -288,7 +288,7 @@ convM2W(uchar *p, uint n, Wsysmsg *m)
GET(p+14, m->rect.max.x);
GET(p+18, m->rect.max.y);
break;
}
}
return nn;
}
@ -313,7 +313,7 @@ int
drawfcallfmt(Fmt *fmt)
{
Wsysmsg *m;
m = va_arg(fmt->args, Wsysmsg*);
fmtprint(fmt, "tag=%d ", m->tag);
switch(m->type){
@ -325,7 +325,7 @@ drawfcallfmt(Fmt *fmt)
return fmtprint(fmt, "Trdmouse");
case Rrdmouse:
return fmtprint(fmt, "Rrdmouse x=%d y=%d buttons=%d msec=%d resized=%d",
m->mouse.xy.x, m->mouse.xy.y,
m->mouse.xy.x, m->mouse.xy.y,
m->mouse.buttons, m->mouse.msec, m->resized);
case Tbouncemouse:
return fmtprint(fmt, "Tbouncemouse x=%d y=%d buttons=%d",

View file

@ -20,4 +20,3 @@ drawrepl(Rectangle r, Point p)
p.y = drawreplxy(r.min.y, r.max.y, p.y);
return p;
}

View file

@ -187,7 +187,7 @@ static Ebuf*
newebuf(Slave *s, int n)
{
Ebuf *eb;
eb = malloc(sizeof(*eb) - sizeof(eb->u.buf) + n);
if(eb == nil)
drawerror(display, "events: out of memory");
@ -205,7 +205,7 @@ startrpc(int type)
{
uchar buf[100];
Wsysmsg w;
w.type = type;
convW2M(&w, buf, sizeof buf);
return muxrpcstart(display->mux, buf);
@ -217,7 +217,7 @@ finishrpc(Muxrpc *r, Wsysmsg *w)
uchar *p;
void *v;
int n;
if(!muxrpccanfinish(r, &v))
return 0;
p = v;
@ -245,9 +245,9 @@ extract(int canblock)
* Also make sure that we don't interfere with app-specific locking.
*/
if(display->locking){
/*
* if locking is being done by program,
* this means it can't depend on automatic
/*
* if locking is being done by program,
* this means it can't depend on automatic
* flush in emouse() etc.
*/
if(canqlock(&display->qlock)){
@ -311,7 +311,7 @@ extract(int canblock)
max = eslave[i].fd;
}
}
if(!canblock){
tv.tv_sec = 0;
tv.tv_usec = 0;
@ -437,4 +437,3 @@ ereadmouse(Mouse *m)
eresized(1);
return 1;
}

View file

@ -54,7 +54,7 @@ cachechars(Font *f, char **ss, Rune **rr, ushort *cp, int max, int *wp, char **s
c++;
h++;
}
/*
* Not found; toss out oldest entry
*/
@ -91,7 +91,7 @@ cachechars(Font *f, char **ss, Rune **rr, ushort *cp, int max, int *wp, char **s
break;
}
c = &f->cache[h]; /* may have reallocated f->cache */
Found:
wid += c->width;
c->age = f->age;

View file

@ -73,14 +73,14 @@ scalesubfont(Subfont *f, int scale)
int y, x, x2, j;
uchar *src, *dst;
int srcn, dstn, n, mask, v, pack;
r = f->bits->r;
r2 = r;
r2.min.x *= scale;
r2.min.y *= scale;
r2.max.x *= scale;
r2.max.y *= scale;
srcn = bytesperline(r, f->bits->depth);
src = malloc(srcn);
dstn = bytesperline(r2, f->bits->depth);
@ -111,7 +111,7 @@ scalesubfont(Subfont *f, int scale)
f->bits = i;
f->height *= scale;
f->ascent *= scale;
for(j=0; j<f->n; j++) {
f->info[j].x *= scale;
f->info[j].top *= scale;

View file

@ -3,7 +3,7 @@
#include <draw.h>
/*
* Sine and Cosine of arctangents, calculated by
* Sine and Cosine of arctangents, calculated by
* (sin(atan(index/100.0))*1024.+0.5)
* (cos(atan(index/100.0))*1024.+0.5)
* To use, get rational tangent between 0<=tan<=1, scale by 100,

View file

@ -90,7 +90,7 @@ geninitdraw(char *devdir, void(*error)(Display*, char*), char *fontname, char *l
visibleclicks = p != nil && *p == '1';
if(visibleclicks) {
Font *f;
f = display->defaultfont;
mousebuttons = allocimage(display, Rect(0,0,64,22), screen->chan, 0, DWhite);
border(mousebuttons, mousebuttons->r, 1, display->black, ZP);
@ -129,7 +129,7 @@ getimage0(Display *d, Image *image)
/*
* If there's an old screen, it has id 0. The 'J' request below
* will try to install the new screen as id 0, so the old one
* will try to install the new screen as id 0, so the old one
* must be freed first.
*/
if(image){
@ -172,7 +172,7 @@ getimage0(Display *d, Image *image)
image->clipr.min.y = atoi(info+9*12);
image->clipr.max.x = atoi(info+10*12);
image->clipr.max.y = atoi(info+11*12);
a = bufimage(d, 3);
a[0] = 'q';
a[1] = 1;
@ -193,9 +193,9 @@ getwindow(Display *d, int ref)
{
Image *i, *oi;
Font *f;
/* XXX check for destroyed? */
/*
* Libdraw promises not to change the value of "screen",
* so we have to reuse the image structure
@ -262,7 +262,7 @@ _initdisplay(void (*error)(Display*, char*), char *label)
free(disp->buf);
goto Error2;
}
if(_displaymux(disp) < 0
|| _displayconnect(disp) < 0
|| _displayinit(disp, label, winsize) < 0)
@ -276,7 +276,7 @@ _initdisplay(void (*error)(Display*, char*), char *label)
image = getimage0(disp, nil);
if(image == nil)
goto Error4;
disp->image = image;
disp->white = allocimage(disp, Rect(0, 0, 1, 1), GREY1, 1, DWhite);
disp->black = allocimage(disp, Rect(0, 0, 1, 1), GREY1, 1, DBlack);
@ -285,7 +285,7 @@ _initdisplay(void (*error)(Display*, char*), char *label)
free(disp->black);
goto Error4;
}
disp->opaque = disp->white;
disp->transparent = disp->black;
@ -390,7 +390,7 @@ flushimage(Display *d, int visible)
r = rectaddpt(r, _drawmouse.xy);
r = rectaddpt(r, Pt(-Dx(mousebuttons->r)/2, -Dy(mousebuttons->r)-3));
drawop(mousesave, mousesave->r, screen, nil, r.min, S);
r1 = rectaddpt(Rect(0, 0, 22, 22), r.min);
if(_drawmouse.buttons & 1)
drawop(screen, r1, mousebuttons, nil, ZP, S);
@ -404,7 +404,7 @@ flushimage(Display *d, int visible)
drawop(screen, r, mousesave, nil, ZP, S);
return ret;
}
if(visible){
*d->bufp++ = 'v'; /* five bytes always reserved for this */
if(d->_isnewdisplay){

View file

@ -4,7 +4,7 @@
int
iprint(char *fmt, ...)
{
{
va_list arg;
va_start(arg, fmt);

View file

@ -25,7 +25,7 @@ _ioproc(void *arg)
{
Rune r;
Keyboardctl *kc;
kc = arg;
threadsetname("kbdproc");
for(;;){
@ -49,4 +49,3 @@ initkeyboard(char *file)
proccreate(_ioproc, kc, 32*1024);
return kc;
}

View file

@ -93,4 +93,3 @@ setcursor2(Mousectl *mc, Cursor *c, Cursor2 *c2)
{
_displaycursor(mc->display, c, c2);
}

View file

@ -24,4 +24,3 @@ newwindow(char *str)
strcpy(buf, "new");
return mount(fd, -1, "/dev", MBEFORE, buf);
}

View file

@ -10,7 +10,7 @@ parsefontscale(char *name, char **base)
{
char *p;
int scale;
p = name;
scale = 0;
while('0' <= *p && *p <= '9') {
@ -24,7 +24,7 @@ parsefontscale(char *name, char **base)
scale = 1;
}
return scale;
}
}
extern char _defontfile[];
@ -114,7 +114,7 @@ swapfont(Font *targ, Font **oldp, Font **newp)
if(targ != *oldp)
sysfatal("bad swapfont %p %p %p", targ, *oldp, *newp);
old = *oldp;
new = *newp;
@ -175,12 +175,12 @@ hidpiname(Font *f)
{
char *p, *q;
int size;
// If font name has form x,y return y.
p = strchr(f->namespec, ',');
if(p != nil)
return strdup(p+1);
// If font name is /mnt/font/Name/Size/font, scale Size.
if(strncmp(f->name, "/mnt/font/", 10) == 0) {
p = strchr(f->name+10, '/');
@ -191,9 +191,9 @@ hidpiname(Font *f)
while('0' <= *q && *q <= '9')
size = size*10 + *q++ - '0';
return smprint("%.*s%d%s", utfnlen(f->name, p-f->name), f->name, size*2, q);
}
}
// Otherwise use pixel doubling.
// Otherwise use pixel doubling.
scale:
return smprint("%d*%s", f->scale*2, f->name);
}
@ -210,7 +210,7 @@ loadhidpi(Font *f)
swapfont(f, &f->lodpi, &f->hidpi);
return;
}
name = hidpiname(f);
fnew = openfont1(f->display, name);
if(fnew == nil)
@ -227,7 +227,7 @@ openfont(Display *d, char *name)
Font *f;
char *p;
char *namespec;
// If font name has form x,y use x for lodpi, y for hidpi.
name = strdup(name);
namespec = strdup(name);
@ -240,7 +240,7 @@ openfont(Display *d, char *name)
f->lodpi = f;
free(f->namespec);
f->namespec = namespec;
/* add to display list for when dpi changes */
/* d can be nil when invoked from mc. */
if(d != nil) {
@ -252,12 +252,12 @@ openfont(Display *d, char *name)
else
d->firstfont = f;
d->lastfont = f;
/* if this is a hi-dpi display, find hi-dpi version and swap */
if(d->dpi >= DefaultDPI*3/2)
loadhidpi(f);
}
free(name);
return f;
@ -270,7 +270,7 @@ _fontpipe(char *name)
char c;
char buf[1024], *argv[10];
int nbuf, pid;
if(pipe(p) < 0)
return -1;
pid = rfork(RFNOWAIT|RFFDG|RFPROC);
@ -294,7 +294,7 @@ _fontpipe(char *name)
_exit(0);
}
close(p[1]);
// success marked with leading \001.
// otherwise an error happened.
for(nbuf=0; nbuf<sizeof buf-1; nbuf++) {

View file

@ -11,7 +11,7 @@
* over the color map looking for the nearest point in RGB
* space. There is no visual psychology reason for that
* criterion, but it's easy to implement and the results are
* far more pleasing.
* far more pleasing.
*
int
rgb2cmap(int cr, int cg, int cb)

View file

@ -25,5 +25,5 @@ mousescrollsize(int maxlines)
if(lines)
return lines;
return pcnt * maxlines/100.0;
return pcnt * maxlines/100.0;
}

View file

@ -137,7 +137,7 @@ _string(Image *dst, Point pt, Image *src, Point sp, Font *f, char *s, Rune *r, i
else
break;
}
/*
/*
* must not free sf until cachechars has found it in the cache
* and picked up its own reference.
*/

View file

@ -55,7 +55,7 @@ _stringnwidth(Font *f, char *s, Rune *r, int len)
else
break;
}
/*
/*
* must not free sf until cachechars has found it in the cache
* and picked up its own reference.
*/

View file

@ -20,9 +20,9 @@ allocsubfont(char *name, int n, int height, int ascent, Fontchar *info, Image *i
f->ref = 1;
if(name){
/*
* if already caching this subfont, leave older
* if already caching this subfont, leave older
* (and hopefully more widely used) copy in cache.
* this case should not happen -- we got called
* this case should not happen -- we got called
* because cachechars needed this subfont and it
* wasn't in the cache.
*/

View file

@ -11,7 +11,7 @@ subfontname(char *cfname, char *fname, int maxdepth)
{
char *t, *u, *tmp1, *tmp2, *base;
int i, scale;
scale = parsefontscale(fname, &base);
t = strdup(cfname); /* t is the return string */

View file

@ -12,4 +12,3 @@ _drawflength(int fd)
return -1;
return s.st_size;
}

View file

@ -27,4 +27,3 @@ drawresizewindow(Rectangle r)
{
_displayresize(display, r);
}