From 7517441ffa1aecb6f565217149762267d145e11e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 23 Mar 2020 08:55:53 -0700 Subject: Clean up compiler warnings Add (char *) casts to initializers in Xt structs. Remove unused variables. Signed-off-by: Keith Packard --- Eyes.c | 36 +++++++++++++++++------------------- xeyes.c | 22 +++++++++++----------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/Eyes.c b/Eyes.c index 541f085..3452635 100644 --- a/Eyes.c +++ b/Eyes.c @@ -58,34 +58,34 @@ extern double hypot(double, double); #define goffset(field) XtOffsetOf(WidgetRec, core.field) static XtResource resources[] = { - {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), + {(char *) XtNwidth, (char *) XtCWidth, XtRDimension, sizeof(Dimension), goffset(width), XtRImmediate, (XtPointer) 150}, - {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), + {(char *) XtNheight, (char *) XtCHeight, XtRDimension, sizeof(Dimension), goffset(height), XtRImmediate, (XtPointer) 100}, - {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), - offset(pixel[PART_PUPIL]), XtRString, XtDefaultForeground}, - {XtNbackgroundPixmap, XtCPixmap, XtRPixmap, sizeof(Pixmap), + {(char *) XtNforeground, (char *) XtCForeground, XtRPixel, sizeof(Pixel), + offset(pixel[PART_PUPIL]), XtRString, (char *) XtDefaultForeground}, + {(char *) XtNbackgroundPixmap, (char *) XtCPixmap, XtRPixmap, sizeof(Pixmap), XtOffsetOf(CoreRec,core.background_pixmap), XtRImmediate, (XtPointer)None}, - {XtNoutline, XtCForeground, XtRPixel, sizeof(Pixel), - offset(pixel[PART_OUTLINE]), XtRString, XtDefaultForeground}, - {XtNcenterColor, XtCBackground, XtRPixel, sizeof (Pixel), - offset(pixel[PART_CENTER]), XtRString, XtDefaultBackground}, - {XtNreverseVideo, XtCReverseVideo, XtRBoolean, sizeof (Boolean), + {(char *) XtNoutline, (char *) XtCForeground, XtRPixel, sizeof(Pixel), + offset(pixel[PART_OUTLINE]), XtRString, (char *) XtDefaultForeground}, + {(char *) XtNcenterColor, (char *) XtCBackground, XtRPixel, sizeof (Pixel), + offset(pixel[PART_CENTER]), XtRString, (char *) XtDefaultBackground}, + {(char *) XtNreverseVideo, (char *) XtCReverseVideo, XtRBoolean, sizeof (Boolean), offset (reverse_video), XtRImmediate, (XtPointer) FALSE}, - {XtNbackingStore, XtCBackingStore, XtRBackingStore, sizeof (int), - offset (backing_store), XtRString, "default"}, - {XtNshapeWindow, XtCShapeWindow, XtRBoolean, sizeof (Boolean), + {(char *) XtNbackingStore, (char *) XtCBackingStore, (char *) XtRBackingStore, sizeof (int), + offset (backing_store), XtRString, (char *) "default"}, + {(char *) XtNshapeWindow, (char *) XtCShapeWindow, XtRBoolean, sizeof (Boolean), offset (shape_window), XtRImmediate, (XtPointer) TRUE}, #ifdef XRENDER - {XtNrender, XtCBoolean, XtRBoolean, sizeof(Boolean), + {(char *) XtNrender, (char *) XtCBoolean, XtRBoolean, sizeof(Boolean), offset(render), XtRImmediate, (XtPointer) TRUE }, #endif #ifdef PRESENT - {XtNpresent, XtCBoolean, XtRBoolean, sizeof(Boolean), + {(char *) XtNpresent, (char *) XtCBoolean, XtRBoolean, sizeof(Boolean), offset(present), XtRImmediate, (XtPointer) TRUE }, #endif - {XtNdistance, XtCBoolean, XtRBoolean, sizeof(Boolean), + {(char *) XtNdistance, (char *) XtCBoolean, XtRBoolean, sizeof(Boolean), offset(distance), XtRImmediate, (XtPointer) FALSE }, }; @@ -183,7 +183,6 @@ static void CheckPresent(EyesWidget w) { } static void MakePresentData(EyesWidget w) { - xcb_generic_event_t *ev; if (!w->eyes.present) return; @@ -268,7 +267,6 @@ static void select_xi2_events(Widget w) { XIEventMask evmasks[1]; unsigned char mask1[(XI_LASTEVENT + 7)/8]; - unsigned char mask2[(XI_LASTEVENT + 7)/8]; memset(mask1, 0, sizeof(mask1)); @@ -869,7 +867,7 @@ static Boolean SetValues ( EyesClassRec eyesClassRec = { { /* core fields */ /* superclass */ &widgetClassRec, - /* class_name */ "Eyes", + /* class_name */ (char *) "Eyes", /* size */ sizeof(EyesRec), /* class_initialize */ ClassInitialize, /* class_part_initialize */ NULL, diff --git a/xeyes.c b/xeyes.c index 1c1f4b7..5fea24b 100644 --- a/xeyes.c +++ b/xeyes.c @@ -68,20 +68,20 @@ usage(void) pass over the remaining options after XtParseCommand is let loose. */ static XrmOptionDescRec options[] = { -{"-outline", "*eyes.outline", XrmoptionSepArg, NULL}, -{"-center", "*eyes.center", XrmoptionSepArg, NULL}, -{"-backing", "*eyes.backingStore", XrmoptionSepArg, NULL}, -{"-shape", "*eyes.shapeWindow", XrmoptionNoArg, "TRUE"}, -{"+shape", "*eyes.shapeWindow", XrmoptionNoArg, "FALSE"}, +{(char *)"-outline", (char *)"*eyes.outline", XrmoptionSepArg, NULL}, +{(char *)"-center", (char *)"*eyes.center", XrmoptionSepArg, NULL}, +{(char *)"-backing", (char *)"*eyes.backingStore", XrmoptionSepArg, NULL}, +{(char *)"-shape", (char *)"*eyes.shapeWindow", XrmoptionNoArg, (char *)"TRUE"}, +{(char *)"+shape", (char *)"*eyes.shapeWindow", XrmoptionNoArg, (char *)"FALSE"}, #ifdef XRENDER -{"-render", "*eyes.render", XrmoptionNoArg, "TRUE"}, -{"+render", "*eyes.render", XrmoptionNoArg, "FALSE"}, +{(char *)"-render", (char *)"*eyes.render", XrmoptionNoArg, (char *)"TRUE"}, +{(char *)"+render", (char *)"*eyes.render", XrmoptionNoArg, (char *)"FALSE"}, #endif #ifdef PRESENT -{"-present", "*eyes.present", XrmoptionNoArg, "TRUE"}, -{"+present", "*eyes.present", XrmoptionNoArg, "FALSE"}, +{(char *)"-present", (char *)"*eyes.present", XrmoptionNoArg, (char *)"TRUE"}, +{(char *)"+present", (char *)"*eyes.present", XrmoptionNoArg, (char *)"FALSE"}, #endif -{"-distance", "*eyes.distance", XrmoptionNoArg, "TRUE"}, +{(char *)"-distance", (char *)"*eyes.distance", XrmoptionNoArg, (char *)"TRUE"}, }; static Atom wm_delete_window; @@ -100,7 +100,7 @@ quit(Widget w, XEvent *event, String *params, Cardinal *num_params) } static XtActionsRec actions[] = { - {"quit", quit} + {(char *) "quit", quit} }; int -- cgit v1.2.3