summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2019-07-15 19:58:35 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2019-07-15 19:58:35 -0400
commitc3ff775bfe4556ffbe920cbfbc860e471dfc7f07 (patch)
tree0fbeaafb2ec09955240bac3eb3a9bbe49a44f52e /src/util.c
parentf7a9ead69089a862fbd9aab6995980d3ecd290bf (diff)
fix gcc-normal compiler warnings, no object change
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c160
1 files changed, 80 insertions, 80 deletions
diff --git a/src/util.c b/src/util.c
index 303ccbf..13e4016 100644
--- a/src/util.c
+++ b/src/util.c
@@ -123,59 +123,59 @@ void MoveOutline(Window root, int x, int y, int width, int height, int bw, int t
xthird = (xinnerr - xinnerl) / 3; \
ythird = (yinnerb - yinnert) / 3; \
\
- r->x1 = xl; \
- r->y1 = yt; \
- r->x2 = xr; \
- r->y2 = yt; \
+ r->x1 = (short)(xl); \
+ r->y1 = (short)(yt); \
+ r->x2 = (short)(xr); \
+ r->y2 = (short)(yt); \
r++; \
\
- r->x1 = xl; \
- r->y1 = yb; \
- r->x2 = xr; \
- r->y2 = yb; \
+ r->x1 = (short)(xl); \
+ r->y1 = (short)(yb); \
+ r->x2 = (short)(xr); \
+ r->y2 = (short)(yb); \
r++; \
\
- r->x1 = xl; \
- r->y1 = yt; \
- r->x2 = xl; \
- r->y2 = yb; \
+ r->x1 = (short)(xl); \
+ r->y1 = (short)(yt); \
+ r->x2 = (short)(xl); \
+ r->y2 = (short)(yb); \
r++; \
\
- r->x1 = xr; \
- r->y1 = yt; \
- r->x2 = xr; \
- r->y2 = yb; \
+ r->x1 = (short)(xr); \
+ r->y1 = (short)(yt); \
+ r->x2 = (short)(xr); \
+ r->y2 = (short)(yb); \
r++; \
\
- r->x1 = xinnerl + xthird; \
- r->y1 = yinnert; \
- r->x2 = r->x1; \
- r->y2 = yinnerb; \
+ r->x1 = (short)(xinnerl + xthird); \
+ r->y1 = (short)(yinnert); \
+ r->x2 = (short)(r->x1); \
+ r->y2 = (short)(yinnerb); \
r++; \
\
- r->x1 = xinnerl + (2 * xthird); \
- r->y1 = yinnert; \
- r->x2 = r->x1; \
- r->y2 = yinnerb; \
+ r->x1 = (short)(xinnerl + (2 * xthird)); \
+ r->y1 = (short)(yinnert); \
+ r->x2 = (short)(r->x1); \
+ r->y2 = (short)(yinnerb); \
r++; \
\
- r->x1 = xinnerl; \
- r->y1 = yinnert + ythird; \
- r->x2 = xinnerr; \
- r->y2 = r->y1; \
+ r->x1 = (short)(xinnerl); \
+ r->y1 = (short)(yinnert + ythird); \
+ r->x2 = (short)(xinnerr); \
+ r->y2 = (short)(r->y1); \
r++; \
\
- r->x1 = xinnerl; \
- r->y1 = yinnert + (2 * ythird); \
- r->x2 = xinnerr; \
- r->y2 = r->y1; \
+ r->x1 = (short)(xinnerl); \
+ r->y1 = (short)(yinnert + (2 * ythird)); \
+ r->x2 = (short)(xinnerr); \
+ r->y2 = (short)(r->y1); \
r++; \
\
if (lastTH != 0) { \
- r->x1 = xl; \
- r->y1 = yt + lastTH; \
- r->x2 = xr; \
- r->y2 = r->y1; \
+ r->x1 = (short)(xl); \
+ r->y1 = (short)(yt + lastTH); \
+ r->x2 = (short)(xr); \
+ r->y2 = (short)(r->y1); \
r++; \
} \
}
@@ -198,7 +198,7 @@ void MoveOutline(Window root, int x, int y, int width, int height, int bw, int t
if (r != outline)
{
- XDrawSegments(dpy, root, Scr->DrawGC, outline, r - outline);
+ XDrawSegments(dpy, root, Scr->DrawGC, outline, (int)(r - outline));
}
}
@@ -262,11 +262,11 @@ ExpandFilename(const char *name)
if (name[0] != '~') return strdup(name);
- newname = malloc (HomeLen + strlen(name) + 2);
+ newname = malloc ((size_t)HomeLen + strlen(name) + 2);
if (!newname) {
fprintf (stderr,
"%s: unable to allocate %ld bytes to expand filename %s/%s\n",
- ProgramName, HomeLen + (unsigned long)strlen(name) + 2,
+ ProgramName, (unsigned long)HomeLen + (unsigned long)strlen(name) + 2,
Home, &name[1]);
} else {
(void) sprintf (newname, "%s/%s", Home, &name[1]);
@@ -523,13 +523,13 @@ GetColor(int kind, Pixel *what, const char *name)
if (stdcmap) {
color.pixel = (stdcmap->base_pixel +
((Pixel)(((float)color.red / 65535.0) *
- stdcmap->red_max + 0.5) *
+ (double)stdcmap->red_max + 0.5) *
stdcmap->red_mult) +
((Pixel)(((float)color.green /65535.0) *
- stdcmap->green_max + 0.5) *
+ (double)stdcmap->green_max + 0.5) *
stdcmap->green_mult) +
((Pixel)(((float)color.blue / 65535.0) *
- stdcmap->blue_max + 0.5) *
+ (double)stdcmap->blue_max + 0.5) *
stdcmap->blue_mult));
} else {
fprintf (stderr, "%s: unable to allocate color \"%s\"\n",
@@ -670,25 +670,25 @@ MyFont_TextWidth(MyFont *font, const char *string, int len)
}
void
-MyFont_DrawImageString(Display *dpy, Drawable d, MyFont *font, GC gc,
+MyFont_DrawImageString(Display *dpy2, Drawable d, MyFont *font, GC gc,
int x, int y, const char *string, int len)
{
if (use_fontset) {
- XmbDrawImageString(dpy, d, font->fontset, gc, x, y, string, len);
+ XmbDrawImageString(dpy2, d, font->fontset, gc, x, y, string, len);
return;
}
- XDrawImageString (dpy, d, gc, x, y, string, len);
+ XDrawImageString (dpy2, d, gc, x, y, string, len);
}
void
-MyFont_DrawString(Display *dpy, Drawable d, MyFont *font, GC gc,
+MyFont_DrawString(Display *dpy2, Drawable d, MyFont *font, GC gc,
int x, int y, const char *string, int len)
{
if (use_fontset) {
- XmbDrawString(dpy, d, font->fontset, gc, x, y, string, len);
+ XmbDrawString(dpy2, d, font->fontset, gc, x, y, string, len);
return;
}
- XDrawString (dpy, d, gc, x, y, string, len);
+ XDrawString (dpy2, d, gc, x, y, string, len);
}
void
@@ -714,19 +714,19 @@ MyFont_ChangeGC(unsigned long fix_fore, unsigned long fix_back,
* not XFree().
*/
Status
-I18N_FetchName(Display *dpy, Window w, char **winname)
+I18N_FetchName(Display *dpy2, Window w, char **winname)
{
int status;
XTextProperty text_prop;
char **list;
int num;
- status = XGetWMName(dpy, w, &text_prop);
+ status = XGetWMName(dpy2, w, &text_prop);
if (!status || !text_prop.value || !text_prop.nitems) {
*winname = NULL;
return 0;
}
- status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num);
+ status = XmbTextPropertyToTextList(dpy2, &text_prop, &list, &num);
if (status < Success || !num || !*list) {
*winname = NULL;
return 0;
@@ -738,16 +738,16 @@ I18N_FetchName(Display *dpy, Window w, char **winname)
}
Status
-I18N_GetIconName(Display *dpy, Window w, char **iconname)
+I18N_GetIconName(Display *dpy2, Window w, char **iconname)
{
int status;
XTextProperty text_prop;
char **list;
int num;
- status = XGetWMIconName(dpy, w, &text_prop);
+ status = XGetWMIconName(dpy2, w, &text_prop);
if (!status || !text_prop.value || !text_prop.nitems) return 0;
- status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num);
+ status = XmbTextPropertyToTextList(dpy2, &text_prop, &list, &num);
if (status < Success || !num || !*list) return 0;
XFree(text_prop.value);
*iconname = (char *)strdup(*list);
@@ -786,10 +786,10 @@ CreateXLogoPixmap (unsigned *widthp, unsigned *heightp)
if (Scr->tbpm.xlogo == None) {
GC gc, gcBack;
- Scr->tbpm.xlogo = XCreatePixmap (dpy, Scr->Root, h, h, 1);
+ Scr->tbpm.xlogo = XCreatePixmap (dpy, Scr->Root, (unsigned)h, (unsigned)h, 1);
gc = XCreateGC (dpy, Scr->tbpm.xlogo, 0L, NULL);
XSetForeground (dpy, gc, 0);
- XFillRectangle (dpy, Scr->tbpm.xlogo, gc, 0, 0, h, h);
+ XFillRectangle (dpy, Scr->tbpm.xlogo, gc, 0, 0, (unsigned)h, (unsigned)h);
XSetForeground (dpy, gc, 1);
gcBack = XCreateGC (dpy, Scr->tbpm.xlogo, 0L, NULL);
XSetForeground (dpy, gcBack, 0);
@@ -798,8 +798,8 @@ CreateXLogoPixmap (unsigned *widthp, unsigned *heightp)
* draw the logo large so that it gets as dense as possible; then white
* out the edges so that they look crisp
*/
- XmuDrawLogo (dpy, Scr->tbpm.xlogo, gc, gcBack, -1, -1, h + 2, h + 2);
- XDrawRectangle (dpy, Scr->tbpm.xlogo, gcBack, 0, 0, h - 1, h - 1);
+ XmuDrawLogo (dpy, Scr->tbpm.xlogo, gc, gcBack, -1, -1, (unsigned)(h + 2), (unsigned)(h + 2));
+ XDrawRectangle (dpy, Scr->tbpm.xlogo, gcBack, 0, 0, (unsigned)(h - 1), (unsigned)(h - 1));
/*
* done drawing
@@ -827,34 +827,34 @@ CreateResizePixmap (unsigned *widthp, unsigned *heightp)
/*
* create the pixmap
*/
- Scr->tbpm.resize = XCreatePixmap (dpy, Scr->Root, h, h, 1);
+ Scr->tbpm.resize = XCreatePixmap (dpy, Scr->Root, (unsigned)h, (unsigned)h, 1);
gc = XCreateGC (dpy, Scr->tbpm.resize, 0L, NULL);
XSetForeground (dpy, gc, 0);
- XFillRectangle (dpy, Scr->tbpm.resize, gc, 0, 0, h, h);
+ XFillRectangle (dpy, Scr->tbpm.resize, gc, 0, 0, (unsigned)h, (unsigned)h);
XSetForeground (dpy, gc, 1);
lw = h / 16;
if (lw == 1)
lw = 0;
- XSetLineAttributes (dpy, gc, lw, LineSolid, CapButt, JoinMiter);
+ XSetLineAttributes (dpy, gc, (unsigned)lw, LineSolid, CapButt, JoinMiter);
/*
* draw the resize button,
*/
w = (h * 2) / 3;
- points[0].x = w;
+ points[0].x = (short)w;
points[0].y = 0;
- points[1].x = w;
- points[1].y = w;
+ points[1].x = (short)w;
+ points[1].y = (short)w;
points[2].x = 0;
- points[2].y = w;
+ points[2].y = (short)w;
XDrawLines (dpy, Scr->tbpm.resize, gc, points, 3, CoordModeOrigin);
w = w / 2;
- points[0].x = w;
+ points[0].x = (short)w;
points[0].y = 0;
- points[1].x = w;
- points[1].y = w;
+ points[1].x = (short)w;
+ points[1].y = (short)w;
points[2].x = 0;
- points[2].y = w;
+ points[2].y = (short)w;
XDrawLines (dpy, Scr->tbpm.resize, gc, points, 3, CoordModeOrigin);
/*
@@ -880,11 +880,11 @@ CreateDotPixmap (unsigned *widthp, unsigned *heightp)
GC gc;
Pixmap pix;
- pix = Scr->tbpm.delete = XCreatePixmap (dpy, Scr->Root, h, h, 1);
+ pix = Scr->tbpm.delete = XCreatePixmap (dpy, Scr->Root, (unsigned)h, (unsigned)h, 1);
gc = XCreateGC (dpy, pix, 0L, NULL);
- XSetLineAttributes (dpy, gc, h, LineSolid, CapRound, JoinRound);
+ XSetLineAttributes (dpy, gc, (unsigned)h, LineSolid, CapRound, JoinRound);
XSetForeground (dpy, gc, 0L);
- XFillRectangle (dpy, pix, gc, 0, 0, h, h);
+ XFillRectangle (dpy, pix, gc, 0, 0, (unsigned)h, (unsigned)h);
XSetForeground (dpy, gc, 1L);
XDrawLine (dpy, pix, gc, h/2, h/2, h/2, h/2);
XFreeGC (dpy, gc);
@@ -942,16 +942,16 @@ CreateMenuIcon (int height, unsigned *widthp, unsigned *heightp)
h = 1;
if (w < 1)
w = 1;
- *widthp = w;
- *heightp = h;
+ *widthp = (unsigned)w;
+ *heightp = (unsigned)h;
if (Scr->tbpm.menu == None) {
Pixmap pix;
GC gc;
- pix = Scr->tbpm.menu = XCreatePixmap (dpy, Scr->Root, w, h, 1);
+ pix = Scr->tbpm.menu = XCreatePixmap (dpy, Scr->Root, (unsigned)w, (unsigned)h, 1);
gc = XCreateGC (dpy, pix, 0L, NULL);
XSetForeground (dpy, gc, 0L);
- XFillRectangle (dpy, pix, gc, 0, 0, w, h);
+ XFillRectangle (dpy, pix, gc, 0, 0, (unsigned)w, (unsigned)h);
XSetForeground (dpy, gc, 1L);
ix = 1;
iy = 1;
@@ -965,10 +965,10 @@ CreateMenuIcon (int height, unsigned *widthp, unsigned *heightp)
bw = 1;
tw = mw - bw * 2;
th = mh - bw * 2;
- XFillRectangle (dpy, pix, gc, ix, iy, mw, mh);
- XFillRectangle (dpy, pix, gc, ix + iw - mw, iy + ih - mh, mw, mh);
+ XFillRectangle (dpy, pix, gc, ix, iy, (unsigned)mw, (unsigned)mh);
+ XFillRectangle (dpy, pix, gc, ix + iw - mw, iy + ih - mh, (unsigned)mw, (unsigned)mh);
XSetForeground (dpy, gc, 0L);
- XFillRectangle (dpy, pix, gc, ix+bw, iy+bw, tw, th);
+ XFillRectangle (dpy, pix, gc, ix+bw, iy+bw, (unsigned)tw, (unsigned)th);
XSetForeground (dpy, gc, 1L);
lw = tw / 2;
if ((tw & 1) ^ (lw & 1))
@@ -988,7 +988,7 @@ CreateMenuIcon (int height, unsigned *widthp, unsigned *heightp)
dly = lh / (lines - 1);
while (lines--)
{
- XFillRectangle (dpy, pix, gc, lx, ly, lw, bw);
+ XFillRectangle (dpy, pix, gc, lx, ly, (unsigned)lw, (unsigned)bw);
ly += dly;
}
XFreeGC (dpy, gc);