summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2018-05-05 11:32:12 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2018-05-05 11:32:12 -0700
commit5bd4eb821bd9e88c3a131de9a8b781f5184e22b1 (patch)
tree248842f2788fc6769d2dad89f55d13010dca5781
parentbc78541e9a9a95bbd5413d62bfc114ddc9265c36 (diff)
downloadxorg-lib-libXmu-5bd4eb821bd9e88c3a131de9a8b781f5184e22b1.tar.gz
Apply standard X.Org formatting & bracketing to StrToWidg.c
Makes code easier for humans to read and gets rid of gcc warning: StrToWidg.c: In function ‘XmuCvtStringToWidget’: StrToWidg.c:107:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] for (widgetP = parent->core.popup_list; i; i--, widgetP++) ^~~ StrToWidg.c:114:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ XtStringConversionWarning(fromVal->addr, XtRWidget); ^~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/StrToWidg.c150
1 files changed, 74 insertions, 76 deletions
diff --git a/src/StrToWidg.c b/src/StrToWidg.c
index 6aace95..b6288d4 100644
--- a/src/StrToWidg.c
+++ b/src/StrToWidg.c
@@ -59,57 +59,54 @@ XmuCvtStringToWidget(XrmValuePtr args, Cardinal *num_args,
XrmName name = XrmStringToName(fromVal->addr);
Cardinal i;
- if (*num_args != 1)
- {
+ if (*num_args != 1) {
i = 0;
XtErrorMsg("wrongParameters", "cvtStringToWidget", "xtToolkitError",
"StringToWidget conversion needs parent arg", NULL, &i);
}
- parent = *(Widget*)args[0].addr;
+ parent = *(Widget *) args[0].addr;
/* try to match names of normal children */
- if (XtIsComposite(parent))
- {
- i = ((CompositeWidget)parent)->composite.num_children;
- for (widgetP = ((CompositeWidget)parent)->composite.children;
- i; i--, widgetP++)
- if ((*widgetP)->core.xrm_name == name)
- {
+ if (XtIsComposite(parent)) {
+ i = ((CompositeWidget) parent)->composite.num_children;
+ for (widgetP = ((CompositeWidget) parent)->composite.children;
+ i; i--, widgetP++) {
+ if ((*widgetP)->core.xrm_name == name) {
widget = *widgetP;
done(&widget, Widget);
}
}
+ }
/* try to match names of popup children */
i = parent->core.num_popups;
- for (widgetP = parent->core.popup_list; i; i--, widgetP++)
- if ((*widgetP)->core.xrm_name == name)
- {
+ for (widgetP = parent->core.popup_list; i; i--, widgetP++) {
+ if ((*widgetP)->core.xrm_name == name) {
widget = *widgetP;
done(&widget, Widget);
}
+ }
/* try to match classes of normal children */
- if (XtIsComposite(parent))
- {
- i = ((CompositeWidget)parent)->composite.num_children;
- for (widgetP = ((CompositeWidget)parent)->composite.children;
- i; i--, widgetP++)
- if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
- {
+ if (XtIsComposite(parent)) {
+ i = ((CompositeWidget) parent)->composite.num_children;
+ for (widgetP = ((CompositeWidget) parent)->composite.children;
+ i; i--, widgetP++) {
+ if ((*widgetP)->core.widget_class->core_class.xrm_class == name) {
widget = *widgetP;
done(&widget, Widget);
}
}
+ }
/* try to match classes of popup children */
i = parent->core.num_popups;
- for (widgetP = parent->core.popup_list; i; i--, widgetP++)
- if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
- {
+ for (widgetP = parent->core.popup_list; i; i--, widgetP++) {
+ if ((*widgetP)->core.widget_class->core_class.xrm_class == name) {
widget = *widgetP;
done(&widget, Widget);
}
+ }
XtStringConversionWarning(fromVal->addr, XtRWidget);
toVal->addr = NULL;
@@ -149,77 +146,78 @@ XmuNewCvtStringToWidget(Display *dpy, XrmValue *args, Cardinal *num_args,
if (*num_args != 1)
XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "wrongParameters","cvtStringToWidget","xtToolkitError",
+ "wrongParameters", "cvtStringToWidget",
+ "xtToolkitError",
"String To Widget conversion needs parent argument",
- (String *)NULL, (Cardinal *)NULL);
+ (String *) NULL, (Cardinal *) NULL);
- parent = *(Widget*)args[0].addr;
+ parent = *(Widget *) args[0].addr;
/* try to match names of normal children */
- if (XtIsComposite(parent))
- {
- i = ((CompositeWidget)parent)->composite.num_children;
- for (widgetP = ((CompositeWidget)parent)->composite.children;
- i; i--, widgetP++)
- if ((*widgetP)->core.xrm_name == name)
- newDone(Widget, *widgetP);
- }
+ if (XtIsComposite(parent)) {
+ i = ((CompositeWidget) parent)->composite.num_children;
+ for (widgetP = ((CompositeWidget) parent)->composite.children;
+ i; i--, widgetP++) {
+ if ((*widgetP)->core.xrm_name == name)
+ newDone(Widget, *widgetP);
+ }
+ }
/* try to match names of popup children */
i = parent->core.num_popups;
- for (widgetP = parent->core.popup_list; i; i--, widgetP++)
- if ((*widgetP)->core.xrm_name == name)
- newDone(Widget, *widgetP);
+ for (widgetP = parent->core.popup_list; i; i--, widgetP++) {
+ if ((*widgetP)->core.xrm_name == name)
+ newDone(Widget, *widgetP);
+ }
/* try to match classes of normal children */
- if (XtIsComposite(parent))
- {
- i = ((CompositeWidget)parent)->composite.num_children;
- for (widgetP = ((CompositeWidget)parent)->composite.children;
- i; i--, widgetP++)
- if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
- newDone(Widget, *widgetP);
- }
+ if (XtIsComposite(parent)) {
+ i = ((CompositeWidget) parent)->composite.num_children;
+ for (widgetP = ((CompositeWidget) parent)->composite.children;
+ i; i--, widgetP++) {
+ if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
+ newDone(Widget, *widgetP);
+ }
+ }
/* try to match classes of popup children */
i = parent->core.num_popups;
- for (widgetP = parent->core.popup_list; i; i--, widgetP++)
- if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
- newDone(Widget, *widgetP);
+ for (widgetP = parent->core.popup_list; i; i--, widgetP++) {
+ if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
+ newDone(Widget, *widgetP);
+ }
- XtDisplayStringConversionWarning(dpy, (String)fromVal->addr, XtRWidget);
- return (False);
+ XtDisplayStringConversionWarning(dpy, (String) fromVal->addr, XtRWidget);
+ return (False);
}
/*ARGSUSED*/
Boolean
XmuCvtWidgetToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal,
- XtPointer *data)
+ XrmValuePtr fromVal, XrmValuePtr toVal, XtPointer *data)
{
- static String buffer;
- Cardinal size;
- Widget widget;
-
- widget = *(Widget *)fromVal->addr;
-
- if (widget)
- buffer = XrmQuarkToString(widget->core.xrm_name);
- else
- buffer = "(null)";
-
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL)
- {
- if (toVal->size < size)
- {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
+ static String buffer;
+ Cardinal size;
+ Widget widget;
+
+ widget = *(Widget *) fromVal->addr;
+
+ if (widget)
+ buffer = XrmQuarkToString(widget->core.xrm_name);
+ else
+ buffer = "(null)";
+
+ size = strlen(buffer) + 1;
+ if (toVal->addr != NULL) {
+ if (toVal->size < size) {
+ toVal->size = size;
+ return (False);
+ }
+ strcpy((char *) toVal->addr, buffer);
+ }
+ else {
+ toVal->addr = (XPointer) buffer;
}
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
+ toVal->size = sizeof(String);
- return (True);
+ return (True);
}