Blame SOURCES/0002-Apply-standard-X.Org-formatting-bracketing-to-StrToW.patch

976f67
From 5bd4eb821bd9e88c3a131de9a8b781f5184e22b1 Mon Sep 17 00:00:00 2001
976f67
From: Alan Coopersmith <alan.coopersmith@oracle.com>
976f67
Date: Sat, 5 May 2018 11:32:12 -0700
976f67
Subject: [PATCH 2/2] Apply standard X.Org formatting & bracketing to
976f67
 StrToWidg.c
976f67
MIME-Version: 1.0
976f67
Content-Type: text/plain; charset=UTF-8
976f67
Content-Transfer-Encoding: 8bit
976f67
976f67
Makes code easier for humans to read and gets rid of gcc warning:
976f67
976f67
StrToWidg.c: In function ‘XmuCvtStringToWidget’:
976f67
StrToWidg.c:107:3: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
976f67
   for (widgetP = parent->core.popup_list; i; i--, widgetP++)
976f67
   ^~~
976f67
StrToWidg.c:114:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
976f67
     XtStringConversionWarning(fromVal->addr, XtRWidget);
976f67
     ^~~~~~~~~~~~~~~~~~~~~~~~~
976f67
976f67
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
976f67
---
976f67
 src/StrToWidg.c | 150 ++++++++++++++++++++++++------------------------
976f67
 1 file changed, 74 insertions(+), 76 deletions(-)
976f67
976f67
diff --git a/src/StrToWidg.c b/src/StrToWidg.c
976f67
index 6aace95..b6288d4 100644
976f67
--- a/src/StrToWidg.c
976f67
+++ b/src/StrToWidg.c
976f67
@@ -59,57 +59,54 @@ XmuCvtStringToWidget(XrmValuePtr args, Cardinal *num_args,
976f67
     XrmName name = XrmStringToName(fromVal->addr);
976f67
     Cardinal i;
976f67
 
976f67
-    if (*num_args != 1)
976f67
-    {
976f67
+    if (*num_args != 1) {
976f67
         i = 0;
976f67
         XtErrorMsg("wrongParameters", "cvtStringToWidget", "xtToolkitError",
976f67
                    "StringToWidget conversion needs parent arg", NULL, &i);
976f67
     }
976f67
 
976f67
-    parent = *(Widget*)args[0].addr;
976f67
+    parent = *(Widget *) args[0].addr;
976f67
     /* try to match names of normal children */
976f67
-  if (XtIsComposite(parent))
976f67
-    {
976f67
-        i = ((CompositeWidget)parent)->composite.num_children;
976f67
-        for (widgetP = ((CompositeWidget)parent)->composite.children;
976f67
-           i; i--, widgetP++)
976f67
-        if ((*widgetP)->core.xrm_name == name)
976f67
-          {
976f67
+    if (XtIsComposite(parent)) {
976f67
+        i = ((CompositeWidget) parent)->composite.num_children;
976f67
+        for (widgetP = ((CompositeWidget) parent)->composite.children;
976f67
+             i; i--, widgetP++) {
976f67
+            if ((*widgetP)->core.xrm_name == name) {
976f67
                 widget = *widgetP;
976f67
                 done(&widget, Widget);
976f67
             }
976f67
         }
976f67
+    }
976f67
 
976f67
     /* try to match names of popup children */
976f67
     i = parent->core.num_popups;
976f67
-  for (widgetP = parent->core.popup_list; i; i--, widgetP++)
976f67
-    if ((*widgetP)->core.xrm_name == name)
976f67
-      {
976f67
+    for (widgetP = parent->core.popup_list; i; i--, widgetP++) {
976f67
+        if ((*widgetP)->core.xrm_name == name) {
976f67
             widget = *widgetP;
976f67
             done(&widget, Widget);
976f67
         }
976f67
+    }
976f67
 
976f67
     /* try to match classes of normal children */
976f67
-  if (XtIsComposite(parent))
976f67
-    {
976f67
-        i = ((CompositeWidget)parent)->composite.num_children;
976f67
-        for (widgetP = ((CompositeWidget)parent)->composite.children;
976f67
-           i; i--, widgetP++)
976f67
-        if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
976f67
-          {
976f67
+    if (XtIsComposite(parent)) {
976f67
+        i = ((CompositeWidget) parent)->composite.num_children;
976f67
+        for (widgetP = ((CompositeWidget) parent)->composite.children;
976f67
+             i; i--, widgetP++) {
976f67
+            if ((*widgetP)->core.widget_class->core_class.xrm_class == name) {
976f67
                 widget = *widgetP;
976f67
                 done(&widget, Widget);
976f67
             }
976f67
         }
976f67
+    }
976f67
 
976f67
     /* try to match classes of popup children */
976f67
     i = parent->core.num_popups;
976f67
-  for (widgetP = parent->core.popup_list; i; i--, widgetP++)
976f67
-    if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
976f67
-      {
976f67
+    for (widgetP = parent->core.popup_list; i; i--, widgetP++) {
976f67
+        if ((*widgetP)->core.widget_class->core_class.xrm_class == name) {
976f67
             widget = *widgetP;
976f67
             done(&widget, Widget);
976f67
         }
976f67
+    }
976f67
 
976f67
     XtStringConversionWarning(fromVal->addr, XtRWidget);
976f67
     toVal->addr = NULL;
976f67
@@ -149,77 +146,78 @@ XmuNewCvtStringToWidget(Display *dpy, XrmValue *args, Cardinal *num_args,
976f67
 
976f67
     if (*num_args != 1)
976f67
         XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
976f67
-                        "wrongParameters","cvtStringToWidget","xtToolkitError",
976f67
+                        "wrongParameters", "cvtStringToWidget",
976f67
+                        "xtToolkitError",
976f67
                         "String To Widget conversion needs parent argument",
976f67
-                        (String *)NULL, (Cardinal *)NULL);
976f67
+                        (String *) NULL, (Cardinal *) NULL);
976f67
 
976f67
-    parent = *(Widget*)args[0].addr;
976f67
+    parent = *(Widget *) args[0].addr;
976f67
     /* try to match names of normal children */
976f67
-  if (XtIsComposite(parent))
976f67
-    {
976f67
-        i = ((CompositeWidget)parent)->composite.num_children;
976f67
-        for (widgetP = ((CompositeWidget)parent)->composite.children;
976f67
-	   i; i--, widgetP++)
976f67
-	    if ((*widgetP)->core.xrm_name == name)
976f67
-		newDone(Widget, *widgetP);
976f67
-	}
976f67
+    if (XtIsComposite(parent)) {
976f67
+        i = ((CompositeWidget) parent)->composite.num_children;
976f67
+        for (widgetP = ((CompositeWidget) parent)->composite.children;
976f67
+             i; i--, widgetP++) {
976f67
+            if ((*widgetP)->core.xrm_name == name)
976f67
+                newDone(Widget, *widgetP);
976f67
+        }
976f67
+    }
976f67
 
976f67
     /* try to match names of popup children */
976f67
     i = parent->core.num_popups;
976f67
-  for (widgetP = parent->core.popup_list; i; i--, widgetP++)
976f67
-	if ((*widgetP)->core.xrm_name == name)
976f67
-	    newDone(Widget, *widgetP);
976f67
+    for (widgetP = parent->core.popup_list; i; i--, widgetP++) {
976f67
+        if ((*widgetP)->core.xrm_name == name)
976f67
+            newDone(Widget, *widgetP);
976f67
+    }
976f67
 
976f67
     /* try to match classes of normal children */
976f67
-  if (XtIsComposite(parent))
976f67
-    {
976f67
-	i = ((CompositeWidget)parent)->composite.num_children;
976f67
-	for (widgetP = ((CompositeWidget)parent)->composite.children;
976f67
-	   i; i--, widgetP++)
976f67
-	    if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
976f67
-		newDone(Widget, *widgetP);
976f67
-	}
976f67
+    if (XtIsComposite(parent)) {
976f67
+        i = ((CompositeWidget) parent)->composite.num_children;
976f67
+        for (widgetP = ((CompositeWidget) parent)->composite.children;
976f67
+             i; i--, widgetP++) {
976f67
+            if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
976f67
+                newDone(Widget, *widgetP);
976f67
+        }
976f67
+    }
976f67
 
976f67
     /* try to match classes of popup children */
976f67
     i = parent->core.num_popups;
976f67
-  for (widgetP = parent->core.popup_list; i; i--, widgetP++)
976f67
-	if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
976f67
-	    newDone(Widget, *widgetP);
976f67
+    for (widgetP = parent->core.popup_list; i; i--, widgetP++) {
976f67
+        if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
976f67
+            newDone(Widget, *widgetP);
976f67
+    }
976f67
 
976f67
-    XtDisplayStringConversionWarning(dpy, (String)fromVal->addr, XtRWidget);
976f67
-  return (False);
976f67
+    XtDisplayStringConversionWarning(dpy, (String) fromVal->addr, XtRWidget);
976f67
+    return (False);
976f67
 }
976f67
 
976f67
 /*ARGSUSED*/
976f67
 Boolean
976f67
 XmuCvtWidgetToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
976f67
-		     XrmValuePtr fromVal, XrmValuePtr toVal,
976f67
-		     XtPointer *data)
976f67
+                     XrmValuePtr fromVal, XrmValuePtr toVal, XtPointer *data)
976f67
 {
976f67
-  static String buffer;
976f67
-  Cardinal size;
976f67
-  Widget widget;
976f67
-
976f67
-  widget = *(Widget *)fromVal->addr;
976f67
-
976f67
-  if (widget)
976f67
-    buffer = XrmQuarkToString(widget->core.xrm_name);
976f67
-  else
976f67
-    buffer = "(null)";
976f67
-
976f67
-  size = strlen(buffer) + 1;
976f67
-  if (toVal->addr != NULL)
976f67
-    {
976f67
-      if (toVal->size < size)
976f67
-	{
976f67
-	  toVal->size = size;
976f67
-	  return (False);
976f67
-	}
976f67
-      strcpy((char *)toVal->addr, buffer);
976f67
+    static String buffer;
976f67
+    Cardinal size;
976f67
+    Widget widget;
976f67
+
976f67
+    widget = *(Widget *) fromVal->addr;
976f67
+
976f67
+    if (widget)
976f67
+        buffer = XrmQuarkToString(widget->core.xrm_name);
976f67
+    else
976f67
+        buffer = "(null)";
976f67
+
976f67
+    size = strlen(buffer) + 1;
976f67
+    if (toVal->addr != NULL) {
976f67
+        if (toVal->size < size) {
976f67
+            toVal->size = size;
976f67
+            return (False);
976f67
+        }
976f67
+        strcpy((char *) toVal->addr, buffer);
976f67
+    }
976f67
+    else {
976f67
+        toVal->addr = (XPointer) buffer;
976f67
     }
976f67
-  else
976f67
-    toVal->addr = (XPointer)buffer;
976f67
-  toVal->size = sizeof(String);
976f67
+    toVal->size = sizeof(String);
976f67
 
976f67
-  return (True);
976f67
+    return (True);
976f67
 }
976f67
-- 
976f67
2.17.1
976f67