ref: 4ee3d8da899b4d15b6d9f537804e06c754b9fcc5
parent: 80e484d564586d035af62709835cd6ed65a05d38
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Jan 6 15:07:02 EST 2023
libmemdraw: avoid some gcc warnings
--- a/libmemdraw/draw.c
+++ b/libmemdraw/draw.c
@@ -1282,7 +1282,7 @@
r = p->bytermin + y*p->bwidth;
bits = *r++;
nbits = 8;
- if(i=x&(npack-1)){
+ if((i=x&(npack-1)) != 0){
bits <<= depth*i;
nbits -= depth*i;
}
@@ -1310,7 +1310,7 @@
r = p->bytey0s + y*p->bwidth;
bits = *r++;
nbits = 8;
- if(i=x&(npack-1)){
+ if((i=x&(npack-1)) != 0){
bits <<= depth*i;
nbits -= depth*i;
}
--- a/libmemdraw/ellipse.c
+++ b/libmemdraw/ellipse.c
@@ -124,7 +124,7 @@
p.op = op;
u = (t<<1)*(a-b);
- if(b<a && u>b*b || a<b && -u>a*a) {
+ if((b<a && u>b*b) || (a<b && -u>a*a)) {
/* if(b<a&&(t<<1)>b*b/a || a<b&&(t<<1)>a*a/b) # very thick */
bellipse(b, newstate(&in, a, b), &p);
return;
@@ -207,7 +207,7 @@
{
Rectangle r;
-/* print("R %d,%d %d,%d\n", x0, y0, x1, y1); /**/
+/* print("R %d,%d %d,%d\n", x0, y0, x1, y1); */
r = Rect(p->c.x+x0, p->c.y+y0, p->c.x+x1+1, p->c.y+y1+1);
memdraw(p->dst, r, p->src, addpt(p->sp, r.min), memopaque, ZP, p->op);
}
@@ -222,7 +222,7 @@
Point p0;
Rectangle r;
-/* print("P%d %d,%d\n", p->t, x, y); /**/
+/* print("P%d %d,%d\n", p->t, x, y); */
p0 = Pt(p->c.x+x, p->c.y+y);
r = Rpt(addpt(p0, p->disc->r.min), addpt(p0, p->disc->r.max));
memdraw(p->dst, r, p->src, addpt(p->sp, r.min), p->disc, p->disc->r.min, p->op);
@@ -235,7 +235,7 @@
void
eline(int x0, int y0, int x1, int y1, Param *p)
{
-/* print("L%d %d,%d %d,%d\n", p->t, x0, y0, x1, y1); /**/
+/* print("L%d %d,%d %d,%d\n", p->t, x0, y0, x1, y1); */
if(x1 > x0+1)
erect(x0+1, y0-p->t, x1-1, y1+p->t, p);
else if(y1 > y0+1)
--- a/libmemdraw/line.c
+++ b/libmemdraw/line.c
@@ -13,23 +13,24 @@
static
int
-lmin(int a, int b)
+lmax(int a, int b)
{
- if(a < b)
+ if(a > b)
return a;
return b;
}
+#ifdef NOTUSED
+
static
int
-lmax(int a, int b)
+lmin(int a, int b)
{
- if(a > b)
+ if(a < b)
return a;
return b;
}
-#ifdef NOTUSED
/*
* Rather than line clip, we run the Bresenham loop over the full line,
* and clip on each pixel. This is more expensive but means that
--- a/libmemdraw/string.c
+++ b/libmemdraw/string.c
@@ -13,7 +13,7 @@
Fontchar *i;
s = (uchar*)cs;
- for(; c=*s; p.x+=width, cp.x+=width){
+ for(; (c=*s) != 0; p.x+=width, cp.x+=width){
width = 0;
if(c < Runeself)
s++;
@@ -46,7 +46,7 @@
p = Pt(0, f->height);
s = (uchar*)cs;
- for(; c=*s; p.x+=width){
+ for(; (c=*s) != 0; p.x+=width){
width = 0;
if(c < Runeself)
s++;