summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowitz@users.sourceforge.net>2011-08-26 01:46:57 -0500
committerYaakov Selkowitz <yselkowitz@users.sourceforge.net>2011-08-26 17:31:58 -0500
commitfe2d2e640bf7a196fd1fe1f2efb7d4ba6382ce4f (patch)
treecb4061961e4785ce16720d360233a9ed24c34ab5
parent42123013118c42f40873b1b8785c7e5ce2734965 (diff)
Fix ambiguous 'else' warnings
Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/AsciiSink.c6
-rw-r--r--src/MultiSink.c6
-rw-r--r--src/Paned.c21
-rw-r--r--src/SimpleMenu.c3
-rw-r--r--src/Text.c12
-rw-r--r--src/TextPop.c3
-rw-r--r--src/Toggle.c3
-rw-r--r--src/Viewport.c6
8 files changed, 40 insertions, 20 deletions
diff --git a/src/AsciiSink.c b/src/AsciiSink.c
index 8d37db9..7a2d9b1 100644
--- a/src/AsciiSink.c
+++ b/src/AsciiSink.c
@@ -177,13 +177,14 @@ CharWidth (Widget w, int x, unsigned char c)
return 0;
}
- if ( (nonPrinting = (c < (unsigned char) XawSP)) )
+ if ( (nonPrinting = (c < (unsigned char) XawSP)) ) {
if (sink->ascii_sink.display_nonprinting)
c += '@';
else {
c = XawSP;
nonPrinting = False;
}
+ }
if (font->per_char &&
(c >= font->min_char_or_byte2 && c <= font->max_char_or_byte2))
@@ -629,12 +630,13 @@ SetTabs(Widget w, int tab_count, short *tabs)
XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", FALSE);
if ( (XA_FIGURE_WIDTH != None) &&
( (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)) ||
- (figure_width == 0)) )
+ (figure_width == 0)) ) {
if (font->per_char && font->min_char_or_byte2 <= '$' &&
font->max_char_or_byte2 >= '$')
figure_width = font->per_char['$' - font->min_char_or_byte2].width;
else
figure_width = font->max_bounds.width;
+ }
if (tab_count > sink->text_sink.tab_count) {
sink->text_sink.tabs = (Position *)
diff --git a/src/MultiSink.c b/src/MultiSink.c
index 1e60b92..1f37d10 100644
--- a/src/MultiSink.c
+++ b/src/MultiSink.c
@@ -195,12 +195,13 @@ CharWidth (
return 0;
}
- if (XwcTextEscapement (fontset, &c, 1) == 0)
+ if (XwcTextEscapement (fontset, &c, 1) == 0) {
if (sink->multi_sink.display_nonprinting)
c = _Xaw_atowc('@');
else {
c = _Xaw_atowc(XawSP);
}
+ }
/*
* if more efficiency(suppose one column is one ASCII char)
@@ -709,12 +710,13 @@ SetTabs(
XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", FALSE);
if ( (XA_FIGURE_WIDTH != None) &&
( (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)) ||
- (figure_width == 0)) )
+ (figure_width == 0)) ) {
if (font->per_char && font->min_char_or_byte2 <= '$' &&
font->max_char_or_byte2 >= '$')
figure_width = font->per_char['$' - font->min_char_or_byte2].width;
else
figure_width = font->max_bounds.width;
+ }
if (tab_count > sink->text_sink.tab_count) {
sink->text_sink.tabs = (Position *)
diff --git a/src/Paned.c b/src/Paned.c
index b9e6115..e72fd03 100644
--- a/src/Paned.c
+++ b/src/Paned.c
@@ -1117,11 +1117,12 @@ ManageAndUnmanageGrips(PanedWidget pw)
unmanagedP = unmanaged_grips = (WidgetList) XtMalloc(alloc_size);
ForAllChildren(pw, childP)
- if (IsPane(*childP) && HasGrip(*childP))
+ if (IsPane(*childP) && HasGrip(*childP)) {
if ( XtIsManaged(*childP) )
*managedP++ = PaneInfo(*childP)->grip;
else
*unmanagedP++ = PaneInfo(*childP)->grip;
+ }
if (managedP != managed_grips) {
*unmanagedP++ = *--managedP; /* Last grip is never managed */
@@ -1152,11 +1153,12 @@ CreateGrip(Widget child)
XtSetArg(arglist[num_args], XtNtranslations, pw->paned.grip_translations);
num_args++;
- if ( (cursor = pw->paned.grip_cursor) == None )
+ if ( (cursor = pw->paned.grip_cursor) == None ) {
if (IsVert(pw))
cursor = pw->paned.v_grip_cursor;
else
cursor = pw->paned.h_grip_cursor;
+ }
XtSetArg(arglist[num_args], XtNcursor, cursor);
num_args++;
@@ -1264,11 +1266,12 @@ ChangeAllGripCursors(PanedWidget pw)
Arg arglist[1];
Cursor cursor;
- if ( (cursor = pw->paned.grip_cursor) == None )
+ if ( (cursor = pw->paned.grip_cursor) == None ) {
if ( IsVert(pw) )
cursor = pw->paned.v_grip_cursor;
else
cursor = pw->paned.h_grip_cursor;
+ }
if (HasGrip (*childP)) {
XtSetArg(arglist[0], XtNcursor, cursor);
@@ -1434,11 +1437,12 @@ GeometryManager(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply)
* a different on_size;
*/
- if (result != XtGeometryNo)
+ if (result != XtGeometryNo) {
if (vert)
pw->core.height = on_size;
else
pw->core.width = on_size;
+ }
RefigureLocations(pw, PaneIndex(w), AnyPane);
@@ -1469,11 +1473,12 @@ GeometryManager(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply)
* THEN: set almost
*/
- if ( !((vert ? CWWidth : CWHeight) & mask))
+ if ( !((vert ? CWWidth : CWHeight) & mask)) {
if (vert)
request->width = w->core.width;
else
request->height = w->core.height;
+ }
almost = GetRequestInfo(request, !vert) != GetRequestInfo(reply, !vert);
almost |= (GetRequestInfo(request, vert) != GetRequestInfo(reply, vert));
@@ -1613,7 +1618,7 @@ ChangeManaged(Widget w)
pw->paned.num_panes = 0;
ForAllChildren(pw, childP)
- if ( IsPane(*childP) )
+ if ( IsPane(*childP) ) {
if ( XtIsManaged(*childP) ) {
Pane pane = PaneInfo(*childP);
if (HasGrip(*childP))
@@ -1623,6 +1628,7 @@ ChangeManaged(Widget w)
}
else
break; /* This list is already sorted. */
+ }
SetChildrenPrefSizes( (PanedWidget) w, size);
@@ -1735,7 +1741,7 @@ PaneSetValues(Widget old, Widget request, Widget new, ArgList args, Cardinal *nu
/* Check for change in XtNshowGrip. */
- if (old_pane->show_grip != new_pane->show_grip)
+ if (old_pane->show_grip != new_pane->show_grip) {
if (new_pane->show_grip == TRUE) {
CreateGrip(new);
if (XtIsRealized(XtParent(new))) {
@@ -1751,6 +1757,7 @@ PaneSetValues(Widget old, Widget request, Widget new, ArgList args, Cardinal *nu
new_pane->grip = NULL;
redisplay = TRUE;
}
+ }
/* ||| need to look at position changes */
diff --git a/src/SimpleMenu.c b/src/SimpleMenu.c
index 7104126..64fe3af 100644
--- a/src/SimpleMenu.c
+++ b/src/SimpleMenu.c
@@ -543,7 +543,7 @@ Cardinal *num_args;
XDefineCursor(XtDisplay(new),
XtWindow(new), smw_new->simple_menu.cursor);
- if (smw_old->simple_menu.label_string !=smw_new->simple_menu.label_string)
+ if (smw_old->simple_menu.label_string !=smw_new->simple_menu.label_string) {
if (smw_new->simple_menu.label_string == NULL) /* Destroy. */
XtDestroyWidget((Widget) smw_old->simple_menu.label);
else if (smw_old->simple_menu.label_string == NULL) /* Create. */
@@ -554,6 +554,7 @@ Cardinal *num_args;
XtSetArg(arglist[0], XtNlabel, smw_new->simple_menu.label_string);
XtSetValues((Widget) smw_new->simple_menu.label, arglist, ONE);
}
+ }
if (smw_old->simple_menu.label_class != smw_new->simple_menu.label_class)
XtAppWarning(XtWidgetToApplicationContext(new),
diff --git a/src/Text.c b/src/Text.c
index 75056d9..b1e4640 100644
--- a/src/Text.c
+++ b/src/Text.c
@@ -564,7 +564,7 @@ Cardinal *num_args; /* unused */
ctx->core.height += XawTextSinkMaxHeight(ctx->text.sink, 1);
}
- if (ctx->text.scroll_vert != XawtextScrollNever)
+ if (ctx->text.scroll_vert != XawtextScrollNever) {
if ( (ctx->text.resize == XawtextResizeHeight) ||
(ctx->text.resize == XawtextResizeBoth) ) {
(void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name,
@@ -575,8 +575,9 @@ Cardinal *num_args; /* unused */
}
else if (ctx->text.scroll_vert == XawtextScrollAlways)
CreateVScrollBar(ctx);
+ }
- if (ctx->text.scroll_horiz != XawtextScrollNever)
+ if (ctx->text.scroll_horiz != XawtextScrollNever) {
if (ctx->text.wrap != XawtextWrapNever) {
(void) sprintf(error_buf, "Xaw Text Widget %s:\n %s %s.", ctx->core.name,
"Horizontal scrolling not allowed with wrapping active.\n",
@@ -594,6 +595,7 @@ Cardinal *num_args; /* unused */
}
else if (ctx->text.scroll_horiz == XawtextScrollAlways)
CreateHScrollBar(ctx);
+ }
}
static void
@@ -1117,11 +1119,12 @@ TextWidget ctx;
_XawTextBuildLineTable (ctx, zeroPosition, FALSE);
}
}
- else if (ctx->text.vbar != NULL)
+ else if (ctx->text.vbar != NULL) {
if (ctx->text.scroll_vert == XawtextScrollWhenNeeded)
DestroyVScrollBar(ctx);
else if (ctx->text.scroll_vert == XawtextScrollAlways)
XawScrollbarSetThumb(ctx->text.vbar, 0.0, 1.0);
+ }
}
/*
@@ -1149,11 +1152,12 @@ TextWidget ctx;
else
widest = ctx->core.width - 2 * s;
widest /= (last = GetWidestLine(ctx));
- if (ctx->text.scroll_horiz == XawtextScrollWhenNeeded)
+ if (ctx->text.scroll_horiz == XawtextScrollWhenNeeded) {
if (widest < 1.0)
CreateHScrollBar(ctx);
else
DestroyHScrollBar(ctx);
+ }
if ( (ctx->text.hbar == NULL) != temp ) {
_XawTextBuildLineTable (ctx, ctx->text.lt.top, TRUE);
diff --git a/src/TextPop.c b/src/TextPop.c
index 9977bd4..7bf4536 100644
--- a/src/TextPop.c
+++ b/src/TextPop.c
@@ -1020,13 +1020,14 @@ Boolean once_only, show_current;
else
XawTextSetInsertionPoint( tw, pos);
- if (once_only)
+ if (once_only) {
if (show_current)
break;
else {
DoSearch(search);
return(TRUE);
}
+ }
count++;
}
diff --git a/src/Toggle.c b/src/Toggle.c
index 26c3573..6392e18 100644
--- a/src/Toggle.c
+++ b/src/Toggle.c
@@ -492,10 +492,11 @@ XawToggleChangeRadioGroup(Widget w, Widget radio_group)
if ( tw->command.set && radio_group != NULL )
XawToggleUnsetCurrent(radio_group);
- if (radio_group != NULL)
+ if (radio_group != NULL) {
if ((group = GetRadioGroup(radio_group)) == NULL)
CreateRadioGroup(w, radio_group);
else AddToRadioGroup(group, w);
+ }
}
/* Function Name: XawToggleGetCurrent
diff --git a/src/Viewport.c b/src/Viewport.c
index 6a46e36..e5076dc 100644
--- a/src/Viewport.c
+++ b/src/Viewport.c
@@ -822,17 +822,19 @@ int *clip_width, *clip_height;
if ( (w->viewport.allowvert || w->viewport.allowhoriz) ) {
XtQueryGeometry( child, intended, &preferred );
- if ( !(intended->request_mode & CWWidth) )
+ if ( !(intended->request_mode & CWWidth) ) {
if ( preferred.request_mode & CWWidth )
intended->width = preferred.width;
else
intended->width = child->core.width;
+ }
- if ( !(intended->request_mode & CWHeight) )
+ if ( !(intended->request_mode & CWHeight) ) {
if ( preferred.request_mode & CWHeight )
intended->height = preferred.height;
else
intended->height = child->core.height;
+ }
}
}
else {