[PATCH libXi 1/2] Fix compiler warnings

Peter Hutterer peter.hutterer at who-t.net
Sun Dec 9 15:14:55 PST 2012


On Sat, Dec 08, 2012 at 10:17:13AM -0700, Dan Nicholson wrote:
> On Thu, Dec 6, 2012 at 9:38 PM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> > XIQueryVersion.c: In function '_xiQueryVersion':
> > XIQueryVersion.c:63:26: warning: declaration of 'info' shadows a parameter
> > [-Wshadow]
> > XIQueryVersion.c:53:73: warning: shadowed declaration is here [-Wshadow]
> >
> > XExtInt.c: In function 'XInputWireToEvent':
> > XExtInt.c:823:25: warning: declaration of 'i' shadows a previous local
> > [-Wshadow]
> > XExtInt.c:502:18: warning: shadowed declaration is here [-Wshadow]
> > XExtInt.c:850:25: warning: declaration of 'i' shadows a previous local
> > [-Wshadow]
> > XExtInt.c:502:18: warning: shadowed declaration is here [-Wshadow]
> >
> > In file included from XExtInt.c:64:0:
> > ../include/X11/extensions/XInput.h:166:17: note: previous declaration of
> > '_xidevicebusy' was here
> > XExtInt.c:101:12: warning: redundant redeclaration of
> > '_XiGetDevicePresenceNotifyEvent' [-Wredundant-decls]
> >
> > XExtInt.c:76:13: warning: redundant redeclaration of '_xibaddevice'
> > [-Wredundant-decls]
> > In file included from XExtInt.c:64:0:
> > ../include/X11/extensions/XInput.h:162:17: note: previous declaration of
> > '_xibaddevice' was here
> > XExtInt.c:81:13: warning: redundant redeclaration of '_xibadclass'
> > [-Wredundant-decls]
> > In file included from XExtInt.c:64:0:
> > ../include/X11/extensions/XInput.h:163:17: note: previous declaration of
> > '_xibadclass' was here
> > XExtInt.c:86:13: warning: redundant redeclaration of '_xibadevent'
> > [-Wredundant-decls]
> > In file included from XExtInt.c:64:0:
> > ../include/X11/extensions/XInput.h:164:17: note: previous declaration of
> > '_xibadevent' was here
> > XExtInt.c:91:13: warning: redundant redeclaration of '_xibadmode'
> > [-Wredundant-decls]
> > In file included from XExtInt.c:64:0:
> > ../include/X11/extensions/XInput.h:165:17: note: previous declaration of
> > '_xibadmode' was here
> > XExtInt.c:96:13: warning: redundant redeclaration of '_xidevicebusy'
> > [-Wredundant-decls]
> > In file included from XExtInt.c:64:0:
> > ../include/X11/extensions/XInput.h:166:17: note: previous declaration of
> > '_xidevicebusy' was here
> >
> > XListDev.c: In function 'ParseClassInfo':
> > XListDev.c:116:33: warning: declaration of 'k' shadows a previous local
> > [-Wshadow]
> > XListDev.c:109:12: warning: shadowed declaration is here [-Wshadow]
> >
> > XGetFCtl.c: In function 'XGetFeedbackControl':
> > XGetFCtl.c:184:26: warning: declaration of 'i' shadows a previous local
> > [-Wshadow]
> > XGetFCtl.c:72:17: warning: shadowed declaration is here [-Wshadow]
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> >  src/XExtInt.c        | 33 +++------------------------------
> >  src/XGetFCtl.c       | 14 +++++++-------
> >  src/XIQueryVersion.c |  6 +++---
> >  src/XListDev.c       |  3 ++-
> >  4 files changed, 15 insertions(+), 41 deletions(-)
> >
> > diff --git a/src/XExtInt.c b/src/XExtInt.c
> > index 27638bd..fd1ae6c 100644
> > --- a/src/XExtInt.c
> > +++ b/src/XExtInt.c
> > @@ -73,35 +73,6 @@ SOFTWARE.
> >  #define DONT_ENQUEUE   False
> >  #define FP1616toDBL(x) ((x) * 1.0 / (1 << 16))
> >
> > -extern void _xibaddevice(
> > -    Display *          /* dpy */,
> > -    int *              /* error */
> > -);
> > -
> > -extern void _xibadclass(
> > -    Display *          /* dpy */,
> > -    int *              /* error */
> > -);
> > -
> > -extern void _xibadevent(
> > -    Display *          /* dpy */,
> > -    int *              /* error */
> > -);
> > -
> > -extern void _xibadmode(
> > -    Display *          /* dpy */,
> > -    int *              /* error */
> > -);
> > -
> > -extern void _xidevicebusy(
> > -    Display *          /* dpy */,
> > -    int *              /* error */
> > -);
> > -
> > -extern int _XiGetDevicePresenceNotifyEvent(
> > -    Display *          /* dpy */
> > -);
> > -
> >  int copy_classes(XIDeviceInfo *to, xXIAnyInfo* from, int *nclasses);
> >  int size_classes(xXIAnyInfo* from, int nclasses);
> >
> > @@ -496,7 +467,6 @@ XInputWireToEvent(
> >      xEvent     *event)
> >  {
> >      unsigned int type, reltype;
> > -    unsigned int i, j;
> >      XExtDisplayInfo *info = XInput_find_display(dpy);
> >      XEvent *save = (XEvent *) info->data;
> >
> > @@ -621,6 +591,7 @@ XInputWireToEvent(
> >                  {
> >                      deviceValuator *xev = (deviceValuator *) event;
> >                      int save_type = save->type - info->codes->first_event;
> > +                    int i;
> >
> >                      if (save_type == XI_DeviceKeyPress || save_type == XI_DeviceKeyRelease) {
> >                          XDeviceKeyEvent *kev = (XDeviceKeyEvent *) save;
> > @@ -716,6 +687,7 @@ XInputWireToEvent(
> >                                  pev->axis_data[0] = xev->valuator0;
> >                          }
> >                      } else if (save_type == XI_DeviceStateNotify) {
> > +                        int j;
> >                          XDeviceStateNotifyEvent *sev = (XDeviceStateNotifyEvent *) save;
> >                          XInputClass *any = (XInputClass *) & sev->data[0];
> >                          XValuatorStatus *v;
> > @@ -760,6 +732,7 @@ XInputWireToEvent(
> >                  break;
> >              case XI_DeviceStateNotify:
> >                  {
> > +                    int j;
> >                      XDeviceStateNotifyEvent *stev = (XDeviceStateNotifyEvent *) save;
> >                      deviceStateNotify *sev = (deviceStateNotify *) event;
> >                      char *data;
> > diff --git a/src/XGetFCtl.c b/src/XGetFCtl.c
> > index 2961034..43afa00 100644
> > --- a/src/XGetFCtl.c
> > +++ b/src/XGetFCtl.c
> > @@ -181,18 +181,18 @@ XGetFeedbackControl(
> >             }
> >             case IntegerFeedbackClass:
> >             {
> > -               xIntegerFeedbackState *i;
> > +               xIntegerFeedbackState *ifs;
> >                 XIntegerFeedbackState *I;
> >
> > -               i = (xIntegerFeedbackState *) f;
> > +               ifs = (xIntegerFeedbackState *) f;
> >                 I = (XIntegerFeedbackState *) Feedback;
> >
> > -               I->class = i->class;
> > +               I->class = ifs->class;
> >                 I->length = sizeof(XIntegerFeedbackState);
> > -               I->id = i->id;
> > -               I->resolution = i->resolution;
> > -               I->minVal = i->min_value;
> > -               I->maxVal = i->max_value;
> > +               I->id = ifs->id;
> > +               I->resolution = ifs->resolution;
> > +               I->minVal = ifs->min_value;
> > +               I->maxVal = ifs->max_value;
> >                 break;
> >             }
> >             case StringFeedbackClass:
> > diff --git a/src/XIQueryVersion.c b/src/XIQueryVersion.c
> > index 225737f..1fbda50 100644
> > --- a/src/XIQueryVersion.c
> > +++ b/src/XIQueryVersion.c
> > @@ -60,15 +60,15 @@ _xiQueryVersion(Display * dpy, int *major, int *minor, XExtDisplayInfo *info)
> >      if (_XiCheckExtInit(dpy, XInput_2_0, info) == -1)
> >      {
> >          XExtensionVersion *ext;
> > -        XExtDisplayInfo *info = XInput_find_display(dpy);
> > +        XExtDisplayInfo *extinfo = XInput_find_display(dpy);
> >
> > -        if (!info || !info->data) {
> > +        if (!extinfo || !info->data) {
> 
> I believe this should be extinfo->data, right?

good catch, thanks. amended before pushing

Cheers,
   Peter
> 
> Looks good otherwise.
> 
> Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>


More information about the xorg-devel mailing list