[PATCH:libXaw3d 1/2] Fix several unused variable warnings

Matt Turner mattst88 at gmail.com
Sat Sep 17 08:46:54 PDT 2011


On Sat, Sep 17, 2011 at 3:57 AM, Alan Coopersmith
<alan.coopersmith at oracle.com> wrote:
> All but one are due to variables defined outside #ifdef's but only
> used inside #ifdef'ed code blocks.
>
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  src/Label.c      |    2 ++
>  src/SmeBSB.c     |    2 +-
>  src/Text.c       |    2 +-
>  src/TextAction.c |   10 ++++++----
>  4 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/src/Label.c b/src/Label.c
> index c3f8e17..46b0465 100644
> --- a/src/Label.c
> +++ b/src/Label.c
> @@ -528,7 +528,9 @@ Redisplay(Widget gw, XEvent *event, Region region)
>        int len = w->label.label_len;
>        char *label = w->label.label;
>        Position y = w->label.label_y + w->label.font->max_bounds.ascent;
> +#ifdef XAW_INTERNATIONALIZATION
>         Position ksy = w->label.label_y;
> +#endif
>
>        /* display left bitmap */
>        if (w->label.left_bitmap && w->label.lbm_width != 0) {
> diff --git a/src/SmeBSB.c b/src/SmeBSB.c
> index 5a18003..f8bf987 100644
> --- a/src/SmeBSB.c
> +++ b/src/SmeBSB.c
> @@ -475,7 +475,7 @@ static XtGeometryResult
>  QueryGeometry(Widget w, XtWidgetGeometry *intended, XtWidgetGeometry *return_val)
>  {
>     SmeBSBObject entry = (SmeBSBObject) w;
> -    Dimension width, height, h;
> +    Dimension width, height;
>     XtGeometryResult ret_val = XtGeometryYes;
>     XtGeometryMask mode = intended->request_mode;
>
> diff --git a/src/Text.c b/src/Text.c
> index 1873016..36bef53 100644
> --- a/src/Text.c
> +++ b/src/Text.c
> @@ -804,12 +804,12 @@ _XawTextGetSTRING(TextWidget ctx, XawTextPosition left, XawTextPosition right)
>   unsigned char *s;
>   unsigned char c;
>   long i, j, n;
> -  wchar_t *ws, wc;
>
>   /* allow ESC in accordance with ICCCM */
>  #ifdef XAW_INTERNATIONALIZATION
>   if (_XawTextFormat(ctx) == XawFmtWide) {
>      MultiSinkObject sink = (MultiSinkObject) ctx->text.sink;
> +     wchar_t *ws, wc;
>      ws = (wchar_t *)_XawTextGetText(ctx, left, right);
>      n = wcslen(ws);
>      for (j = 0, i = 0; j < n; j++) {
> diff --git a/src/TextAction.c b/src/TextAction.c
> index 1de645a..7d1afcb 100644
> --- a/src/TextAction.c
> +++ b/src/TextAction.c
> @@ -1278,9 +1278,9 @@ TextFocusOut(Widget w, XEvent *event, String *p, Cardinal *n)
>  static void
>  TextEnterWindow(Widget w, XEvent *event, String *params, Cardinal *num_params)
>  {
> +#ifdef XAW_INTERNATIONALIZATION
>   TextWidget ctx = (TextWidget) w;
>
> -#ifdef XAW_INTERNATIONALIZATION
>   if ((event->xcrossing.detail != NotifyInferior) && event->xcrossing.focus &&
>       !ctx->text.hasfocus) {
>        _XawImSetFocusValues(w, NULL, 0);
> @@ -1292,9 +1292,9 @@ TextEnterWindow(Widget w, XEvent *event, String *params, Cardinal *num_params)
>  static void
>  TextLeaveWindow(Widget w, XEvent *event, String *params, Cardinal *num_params)
>  {
> +#ifdef XAW_INTERNATIONALIZATION
>   TextWidget ctx = (TextWidget) w;
>
> -#ifdef XAW_INTERNATIONALIZATION
>   if ((event->xcrossing.detail != NotifyInferior) && event->xcrossing.focus &&
>       !ctx->text.hasfocus) {
>        _XawImUnsetFocus(w);
> @@ -1509,7 +1509,9 @@ static void
>  InsertString(Widget w, XEvent *event, String *params, Cardinal *num_params)
>  {
>   TextWidget ctx = (TextWidget) w;
> +#ifdef XAW_INTERNATIONALIZATION
>   XtAppContext app_con = XtWidgetToApplicationContext(w);
> +#endif
>   XawTextBlock text;
>   int     i;
>
> @@ -1663,7 +1665,6 @@ StripOutOldCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to)
>   Widget src = ctx->text.source;
>   XawTextBlock text;
>   char *buf;
> -  static wchar_t wc_two_spaces[ 3 ];
>
>   /* Initialize our TextBlock with two spaces. */
>
> @@ -1673,6 +1674,7 @@ StripOutOldCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to)
>       text.ptr= "  ";
>  #ifdef XAW_INTERNATIONALIZATION
>   else {
> +      static wchar_t wc_two_spaces[ 3 ];
>       wc_two_spaces[0] = _Xaw_atowc(XawSP);
>       wc_two_spaces[1] = _Xaw_atowc(XawSP);
>       wc_two_spaces[2] = 0;
> @@ -1761,7 +1763,6 @@ InsertNewCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to)
>   XawTextBlock text;
>   int i, width, height, len;
>   char * buf;
> -  static wchar_t wide_CR[ 2 ];
>
>   text.firstPos = 0;
>   text.length = 1;
> @@ -1771,6 +1772,7 @@ InsertNewCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to)
>       text.ptr = "\n";
>  #ifdef XAW_INTERNATIONALIZATION
>   else {
> +      static wchar_t wide_CR[ 2 ];
>       wide_CR[0] = _Xaw_atowc(XawLF);
>       wide_CR[1] = 0;
>       text.ptr = (char*) wide_CR;

Reviewed-by: Matt Turner <mattst88 at gmail.com>

I did this the other day but then forgot to send the patch out :-)


More information about the xorg-devel mailing list