Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms.
This commit is contained in:
parent
226d80b821
commit
cbeb0b26e4
492 changed files with 3218 additions and 3167 deletions
|
|
@ -799,10 +799,10 @@ _drawmsgwrite(Display *d, void *v, int n)
|
|||
|
||||
while((n-=m) > 0){
|
||||
a += m;
|
||||
//fprint(2, "msgwrite %d(%d)...", n, *a);
|
||||
/*fprint(2, "msgwrite %d(%d)...", n, *a); */
|
||||
switch(*a){
|
||||
default:
|
||||
//fprint(2, "bad command %d\n", *a);
|
||||
/*fprint(2, "bad command %d\n", *a); */
|
||||
err = "bad draw command";
|
||||
goto error;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ enum
|
|||
Maxunscroll = 25, /* maximum #entries before scrolling turns on */
|
||||
Nscroll = 20, /* number entries in scrolling part */
|
||||
Scrollwid = 14, /* width of scroll bar */
|
||||
Gap = 4, /* between text and scroll bar */
|
||||
Gap = 4 /* between text and scroll bar */
|
||||
};
|
||||
|
||||
static Image *menutxt;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ initdraw(void (*error)(Display*, char*), char *fontname, char *label)
|
|||
if(fontname == nil){
|
||||
snprint(buf, sizeof buf, "%d %d\n0 %d\t%s\n", df->height, df->ascent,
|
||||
df->n-1, deffontname);
|
||||
//BUG: Need something better for this installsubfont("*default*", df);
|
||||
/*BUG: Need something better for this installsubfont("*default*", df); */
|
||||
font = buildfont(display, buf, deffontname);
|
||||
if(font == nil){
|
||||
fprint(2, "initdraw: can't open default font: %r\n");
|
||||
|
|
|
|||
|
|
@ -92,14 +92,14 @@ _memimagedrawsetup(Memimage *dst, Rectangle r, Memimage *src, Point p0, Memimage
|
|||
DBG print("memimagedraw %p/%luX %R @ %p %p/%luX %P %p/%luX %P... ", dst, dst->chan, r, dst->data->bdata, src, src->chan, p0, mask, mask->chan, p1);
|
||||
|
||||
if(drawclip(dst, &r, src, &p0, mask, &p1, &par.sr, &par.mr) == 0){
|
||||
// if(drawdebug)
|
||||
// iprint("empty clipped rectangle\n");
|
||||
/* if(drawdebug) */
|
||||
/* iprint("empty clipped rectangle\n"); */
|
||||
return nil;
|
||||
}
|
||||
|
||||
if(op < Clear || op > SoverD){
|
||||
// if(drawdebug)
|
||||
// iprint("op out of range: %d\n", op);
|
||||
/* if(drawdebug) */
|
||||
/* iprint("op out of range: %d\n", op); */
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ DBG print("memimagedraw %p/%luX %R @ %p %p/%luX %P %p/%luX %P... ", dst, dst->ch
|
|||
par.srgba = _imgtorgba(src, par.sval);
|
||||
par.sdval = _rgbatoimg(dst, par.srgba);
|
||||
if((par.srgba&0xFF) == 0 && (op&DoutS)){
|
||||
// if (drawdebug) iprint("fill with transparent source\n");
|
||||
/* if (drawdebug) iprint("fill with transparent source\n"); */
|
||||
return nil; /* no-op successfully handled */
|
||||
}
|
||||
if((par.srgba&0xFF) == 0xFF)
|
||||
|
|
@ -133,7 +133,7 @@ DBG print("memimagedraw %p/%luX %R @ %p %p/%luX %P %p/%luX %P... ", dst, dst->ch
|
|||
if(Dx(mask->r)==1 && Dy(mask->r)==1){
|
||||
par.mval = pixelbits(mask, mask->r.min);
|
||||
if(par.mval == 0 && (op&DoutS)){
|
||||
// if(drawdebug) iprint("fill with zero mask\n");
|
||||
/* if(drawdebug) iprint("fill with zero mask\n"); */
|
||||
return nil; /* no-op successfully handled */
|
||||
}
|
||||
par.state |= Simplemask;
|
||||
|
|
@ -143,8 +143,8 @@ DBG print("memimagedraw %p/%luX %R @ %p %p/%luX %P %p/%luX %P... ", dst, dst->ch
|
|||
}
|
||||
}
|
||||
|
||||
// if(drawdebug)
|
||||
// iprint("dr %R sr %R mr %R...", r, par.sr, par.mr);
|
||||
/* if(drawdebug) */
|
||||
/* iprint("dr %R sr %R mr %R...", r, par.sr, par.mr); */
|
||||
DBG print("draw dr %R sr %R mr %R %lux\n", r, par.sr, par.mr, par.state);
|
||||
|
||||
return ∥
|
||||
|
|
@ -167,7 +167,7 @@ _memimagedraw(Memdrawparam *par)
|
|||
*/
|
||||
DBG print("test hwdraw\n");
|
||||
if(hwdraw(par)){
|
||||
//if(drawdebug) iprint("hw handled\n");
|
||||
/*if(drawdebug) iprint("hw handled\n"); */
|
||||
DBG print("hwdraw handled\n");
|
||||
return;
|
||||
}
|
||||
|
|
@ -176,7 +176,7 @@ DBG print("hwdraw handled\n");
|
|||
*/
|
||||
DBG print("test memoptdraw\n");
|
||||
if(memoptdraw(par)){
|
||||
//if(drawdebug) iprint("memopt handled\n");
|
||||
/*if(drawdebug) iprint("memopt handled\n"); */
|
||||
DBG print("memopt handled\n");
|
||||
return;
|
||||
}
|
||||
|
|
@ -187,7 +187,7 @@ DBG print("memopt handled\n");
|
|||
*/
|
||||
DBG print("test chardraw\n");
|
||||
if(chardraw(par)){
|
||||
//if(drawdebug) iprint("chardraw handled\n");
|
||||
/*if(drawdebug) iprint("chardraw handled\n"); */
|
||||
DBG print("chardraw handled\n");
|
||||
return;
|
||||
}
|
||||
|
|
@ -197,7 +197,7 @@ DBG print("chardraw handled\n");
|
|||
*/
|
||||
DBG print("do alphadraw\n");
|
||||
alphadraw(par);
|
||||
//if(drawdebug) iprint("alphadraw handled\n");
|
||||
/*if(drawdebug) iprint("alphadraw handled\n"); */
|
||||
DBG print("alphadraw handled\n");
|
||||
}
|
||||
#undef DBG
|
||||
|
|
@ -663,9 +663,9 @@ alphadraw(Memdrawparam *par)
|
|||
* but it avoids a fair amount of code duplication to make this a case here
|
||||
* rather than have a separate booldraw.
|
||||
*/
|
||||
//if(drawdebug) iprint("flag %lud mchan %lux=?%x dd %d\n", src->flags&Falpha, mask->chan, GREY1, dst->depth);
|
||||
/*if(drawdebug) iprint("flag %lud mchan %lux=?%x dd %d\n", src->flags&Falpha, mask->chan, GREY1, dst->depth); */
|
||||
if(!(src->flags&Falpha) && mask->chan == GREY1 && dst->depth >= 8 && op == SoverD){
|
||||
//if(drawdebug) iprint("boolcopy...");
|
||||
/*if(drawdebug) iprint("boolcopy..."); */
|
||||
rdsrc = convfn(dst, &dpar, src, &spar);
|
||||
rddst = readptr;
|
||||
rdmask = readfn(mask);
|
||||
|
|
@ -1817,13 +1817,13 @@ static Readfn*
|
|||
convfn(Memimage *dst, Param *dpar, Memimage *src, Param *spar)
|
||||
{
|
||||
if(dst->chan == src->chan && !(src->flags&Frepl)){
|
||||
//if(drawdebug) iprint("readptr...");
|
||||
/*if(drawdebug) iprint("readptr..."); */
|
||||
return readptr;
|
||||
}
|
||||
|
||||
if(dst->chan==CMAP8 && (src->chan==GREY1||src->chan==GREY2||src->chan==GREY4)){
|
||||
/* cheat because we know the replicated value is exactly the color map entry. */
|
||||
//if(drawdebug) iprint("Readnbit...");
|
||||
/*if(drawdebug) iprint("Readnbit..."); */
|
||||
return readnbit;
|
||||
}
|
||||
|
||||
|
|
@ -1840,7 +1840,7 @@ convfn(Memimage *dst, Param *dpar, Memimage *src, Param *spar)
|
|||
spar->dx = Dx(spar->img->r);
|
||||
}
|
||||
|
||||
//if(drawdebug) iprint("genconv...");
|
||||
/*if(drawdebug) iprint("genconv..."); */
|
||||
return genconv;
|
||||
}
|
||||
|
||||
|
|
@ -2040,7 +2040,7 @@ _rgbatoimg(Memimage *img, u32int rgba)
|
|||
}
|
||||
d += nb;
|
||||
}
|
||||
// print("rgba2img %.8lux = %.*lux\n", rgba, 2*d/8, v);
|
||||
/* print("rgba2img %.8lux = %.*lux\n", rgba, 2*d/8, v); */
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
@ -2329,7 +2329,7 @@ if(0) if(drawdebug) iprint("chardraw? mf %lux md %d sf %lux dxs %d dys %d dd %d
|
|||
|| op != SoverD)
|
||||
return 0;
|
||||
|
||||
//if(drawdebug) iprint("chardraw...");
|
||||
/*if(drawdebug) iprint("chardraw..."); */
|
||||
|
||||
depth = mask->depth;
|
||||
maskwid = mask->width*sizeof(u32int);
|
||||
|
|
@ -2365,14 +2365,14 @@ DBG print("bsh %d\n", bsh);
|
|||
sp[2] = v>>16;
|
||||
sp[3] = v>>24;
|
||||
|
||||
//print("sp %x %x %x %x\n", sp[0], sp[1], sp[2], sp[3]);
|
||||
/*print("sp %x %x %x %x\n", sp[0], sp[1], sp[2], sp[3]); */
|
||||
for(y=0; y<dy; y++, rp+=maskwid, wp+=dstwid){
|
||||
q = rp;
|
||||
if(bsh)
|
||||
bits = *q++;
|
||||
switch(ddepth){
|
||||
case 8:
|
||||
//if(drawdebug) iprint("8loop...");
|
||||
/*if(drawdebug) iprint("8loop..."); */
|
||||
wc = wp;
|
||||
for(x=bx; x>ex; x--, wc++){
|
||||
i = x&7;
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ main(int argc, char *argv[])
|
|||
stmp = allocmemimage(Rect(0, 0, Xrange, Yrange), strtochan(schan));
|
||||
mtmp = allocmemimage(Rect(0, 0, Xrange, Yrange), strtochan(mchan));
|
||||
ones = allocmemimage(Rect(0, 0, Xrange, Yrange), strtochan(mchan));
|
||||
// print("chan %lux %lux %lux %lux %lux %lux\n", dst->chan, src->chan, mask->chan, stmp->chan, mtmp->chan, ones->chan);
|
||||
/* print("chan %lux %lux %lux %lux %lux %lux\n", dst->chan, src->chan, mask->chan, stmp->chan, mtmp->chan, ones->chan); */
|
||||
if(dst==0 || src==0 || mask==0 || mtmp==0 || ones==0) {
|
||||
Alloc:
|
||||
fprint(2, "dtest: allocation failed: %r\n");
|
||||
|
|
@ -235,13 +235,13 @@ dumpimage(char *name, Memimage *img, void *vdata, Point labelpt)
|
|||
bpp = img->depth;
|
||||
Bprint(&b, "%s\t%d\tr %R clipr %R repl %d data %p *%P\n", name, r.min.x, r, img->clipr, (img->flags&Frepl) ? 1 : 0, vdata, labelpt);
|
||||
mask = (1ULL<<bpp)-1;
|
||||
// for(y=r.min.y; y<r.max.y; y++){
|
||||
/* for(y=r.min.y; y<r.max.y; y++){ */
|
||||
for(y=0; y<Yrange; y++){
|
||||
nb = 0;
|
||||
v = 0;
|
||||
p = data+(byteaddr(img, Pt(0,y))-(uchar*)img->data->bdata);
|
||||
Bprint(&b, "%-4d\t", y);
|
||||
// for(x=r.min.x; x<r.max.x; x++){
|
||||
/* for(x=r.min.x; x<r.max.x; x++){ */
|
||||
for(x=0; x<Xrange; x++){
|
||||
if(x==0)
|
||||
Bprint(&b, "\t");
|
||||
|
|
@ -263,7 +263,7 @@ dumpimage(char *name, Memimage *img, void *vdata, Point labelpt)
|
|||
nb += 8;
|
||||
}
|
||||
nb -= bpp;
|
||||
// print("bpp %d v %.8lux mask %.8lux nb %d\n", bpp, v, mask, nb);
|
||||
/* print("bpp %d v %.8lux mask %.8lux nb %d\n", bpp, v, mask, nb); */
|
||||
fmt(&b, arg, (v>>nb)&mask);
|
||||
}
|
||||
Bprint(&b, "\n");
|
||||
|
|
@ -635,8 +635,8 @@ replicate(Memimage *i, Memimage *tmp)
|
|||
i->flags |= Frepl;
|
||||
i->r = r;
|
||||
i->clipr = randrect();
|
||||
// fprint(2, "replicate [[%d %d] [%d %d]] [[%d %d][%d %d]]\n", r.min.x, r.min.y, r.max.x, r.max.y,
|
||||
// i->clipr.min.x, i->clipr.min.y, i->clipr.max.x, i->clipr.max.y);
|
||||
/* fprint(2, "replicate [[%d %d] [%d %d]] [[%d %d][%d %d]]\n", r.min.x, r.min.y, r.max.x, r.max.y, */
|
||||
/* i->clipr.min.x, i->clipr.min.y, i->clipr.max.x, i->clipr.max.y); */
|
||||
tmp->clipr = i->clipr;
|
||||
}
|
||||
|
||||
|
|
@ -651,7 +651,7 @@ verifyrectmaskrepl(int srcrepl, int maskrepl)
|
|||
int x, y;
|
||||
Memimage *s, *m;
|
||||
|
||||
// print("verfrect %d %d\n", srcrepl, maskrepl);
|
||||
/* print("verfrect %d %d\n", srcrepl, maskrepl); */
|
||||
src->flags &= ~Frepl;
|
||||
src->r = Rect(0, 0, Xrange, Yrange);
|
||||
src->clipr = src->r;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ enum
|
|||
{
|
||||
Arrow1 = 8,
|
||||
Arrow2 = 10,
|
||||
Arrow3 = 3,
|
||||
Arrow3 = 3
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ enum
|
|||
Maxunscroll = 25, /* maximum #entries before scrolling turns on */
|
||||
Nscroll = 20, /* number entries in scrolling part */
|
||||
Scrollwid = 14, /* width of scroll bar */
|
||||
Gap = 4, /* between text and scroll bar */
|
||||
Gap = 4 /* between text and scroll bar */
|
||||
};
|
||||
|
||||
static Image *menutxt;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ _layerop(
|
|||
fr = front->layer->screenr;
|
||||
if(rectXrect(r, fr) == 0){
|
||||
/* r doesn't touch this window; continue on next rearmost */
|
||||
// assert(front && front->layer && front->layer->screen && front->layer->rear);
|
||||
/* assert(front && front->layer && front->layer->screen && front->layer->rear); */
|
||||
front = front->layer->rear;
|
||||
goto Top;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ _memline(Memimage *dst, Point p0, Point p1, int end0, int end1, int radius, Memi
|
|||
|
||||
/* XXX */
|
||||
/* this is not the correct set of tests */
|
||||
// if(log2[dst->depth] != log2[src->depth] || log2[dst->depth]!=3)
|
||||
// return;
|
||||
/* if(log2[dst->depth] != log2[src->depth] || log2[dst->depth]!=3) */
|
||||
/* return; */
|
||||
|
||||
/* can't use sutherland-cohen clipping because lines are wide */
|
||||
r = memlinebbox(p0, p1, end0, end1, radius);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ xdraw(Memdrawparam *par)
|
|||
m = Simplesrc|Fullsrc|Simplemask|Fullmask;
|
||||
if((state&m) == m){
|
||||
_xfillcolor(dst, r, par->sdval);
|
||||
// xdirtyxdata(dst, r);
|
||||
/* xdirtyxdata(dst, r); */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ xdraw(Memdrawparam *par)
|
|||
|
||||
XCopyArea(_x.display, xsrc->pixmap, xdst->pixmap, gc,
|
||||
sp.x, sp.y, Dx(r), Dy(r), dp.x, dp.y);
|
||||
// xdirtyxdata(dst, r);
|
||||
/* xdirtyxdata(dst, r); */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ xdraw(Memdrawparam *par)
|
|||
XSetTSOrigin(_x.display, gc, mp.x, mp.y);
|
||||
XFillRectangle(_x.display, xdst->pixmap, gc, dp.x, dp.y,
|
||||
Dx(r), Dy(r));
|
||||
// xdirtyxdata(dst, r);
|
||||
/* xdirtyxdata(dst, r); */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ getwindow(Display *d, int ref)
|
|||
oi = d->image;
|
||||
i = getimage0(d, oi);
|
||||
d->image = i;
|
||||
// fprint(2, "getwindow %p -> %p\n", oi, i);
|
||||
/* fprint(2, "getwindow %p -> %p\n", oi, i); */
|
||||
|
||||
_screen = allocscreen(i, d->white, 0);
|
||||
_freeimage1(screen);
|
||||
|
|
@ -181,7 +181,7 @@ xerror(XDisplay *d, XErrorEvent *e)
|
|||
static int
|
||||
xioerror(XDisplay *d)
|
||||
{
|
||||
//print("X I/O error\n");
|
||||
/*print("X I/O error\n"); */
|
||||
sysfatal("X I/O error\n");
|
||||
abort();
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ applegetsnarf(void)
|
|||
PasteboardSyncFlags flags;
|
||||
UInt32 i;
|
||||
|
||||
// fprint(2, "applegetsnarf\n");
|
||||
/* fprint(2, "applegetsnarf\n"); */
|
||||
qlock(&clip.lk);
|
||||
if(clip.apple == nil){
|
||||
if(PasteboardCreate(kPasteboardClipboard, &clip.apple) != noErr){
|
||||
|
|
@ -614,7 +614,7 @@ appleputsnarf(char *s)
|
|||
CFDataRef cfdata;
|
||||
PasteboardSyncFlags flags;
|
||||
|
||||
// fprint(2, "appleputsnarf\n");
|
||||
/* fprint(2, "appleputsnarf\n"); */
|
||||
|
||||
if(strlen(s) >= SnarfSize)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -26,14 +26,14 @@ drawtopwindow(void)
|
|||
void
|
||||
drawresizewindow(Rectangle r)
|
||||
{
|
||||
// XConfigureRequestEvent e;
|
||||
/* XConfigureRequestEvent e; */
|
||||
XWindowChanges e;
|
||||
int value_mask;
|
||||
|
||||
memset(&e, 0, sizeof e);
|
||||
value_mask = CWWidth|CWHeight;
|
||||
// e.x = r.min.x;
|
||||
// e.y = r.min.y;
|
||||
/* e.x = r.min.x; */
|
||||
/* e.y = r.min.y; */
|
||||
e.width = Dx(r);
|
||||
e.height = Dy(r);
|
||||
XConfigureWindow(_x.display, _x.drawable, value_mask, &e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue