Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/libXaw/dist/src fix casts and types to make i...



details:   https://anonhg.NetBSD.org/xsrc/rev/fbaea2b95db8
branches:  trunk
changeset: 10715:fbaea2b95db8
user:      christos <christos%NetBSD.org@localhost>
date:      Sun May 09 16:58:57 2021 +0000

description:
fix casts and types to make it compile with clang

diffstat:

 external/mit/libXaw/dist/src/TextAction.c |  20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diffs (74 lines):

diff -r 3a7748c1877e -r fbaea2b95db8 external/mit/libXaw/dist/src/TextAction.c
--- a/external/mit/libXaw/dist/src/TextAction.c Sun May 09 16:58:19 2021 +0000
+++ b/external/mit/libXaw/dist/src/TextAction.c Sun May 09 16:58:57 2021 +0000
@@ -89,7 +89,7 @@
 static int FormRegion(TextWidget, XawTextPosition, XawTextPosition,
                      XawTextPosition*, int);
 static void GetSelection(Widget, Time, String*, Cardinal);
-static char *IfHexConvertHexElseReturnParam(char*, int*);
+static char *IfHexConvertHexElseReturnParam(const char*, int*);
 static void InsertNewCRs(TextWidget, XawTextPosition, XawTextPosition,
                         XawTextPosition*, int);
 static int InsertNewLineAndBackupInternal(TextWidget);
@@ -421,7 +421,7 @@
            fprintf(stderr, "Xaw Text Widget: An attempt was made to insert "
                    "an illegal selection.\n");
 
-           textprop.value = (const unsigned char *)" >> ILLEGAL SELECTION << ";
+           textprop.value = (unsigned char *)" >> ILLEGAL SELECTION << ";
            textprop.nitems = strlen((char *) textprop.value);
            if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count)
                !=  Success
@@ -3215,9 +3215,9 @@
  *
  * NOTE:    In neither case will there be strings to free. */
 static char *
-IfHexConvertHexElseReturnParam(char *param, int *len_return)
+IfHexConvertHexElseReturnParam(const char *param, int *len_return)
 {
-    char *p;           /* steps through param char by char */
+    const char *p;     /* steps through param char by char */
     char c;            /* holds the character pointed to by p */
     int ind;           /* steps through hexval buffer char by char */
     static char hexval[XawTextActionMaxHexChars];
@@ -3225,8 +3225,7 @@
 
     /* reject if it doesn't begin with 0x and at least one more character. */
     if ((param[0] != '0') || (param[1] != 'x') || (param[2] == '\0')) {
-       *len_return = (int)strlen(param);
-       return(param);
+       goto out;
     }
 
     /* Skip the 0x; go character by character shifting and adding. */
@@ -3253,8 +3252,7 @@
            if (++ind < XawTextActionMaxHexChars)
                hexval[ind] = '\0';
            else {
-               *len_return = (int)strlen(param);
-               return(param);
+               goto out;
            }
        }
     }
@@ -3266,9 +3264,9 @@
     }
 
     /* Else, there were non-hex chars or odd digit count, so... */
-
+out:
     *len_return = (int)strlen(param);
-    return (param);                       /* ...return the verbatim string. */
+    return ((char *)param);                       /* ...return the verbatim string. */
 }
 
 /* InsertString() - action
@@ -3370,7 +3368,7 @@
 
     if (*num_params > 0) {     /* default arg is "True" */
        XrmValue from, to;
-       from.size = (unsigned)strlen(from.addr = params[0]);
+       from.size = (unsigned)strlen(from.addr = (char *)params[0]);
        XtConvert(w, XtRString, &from, XtRBoolean, &to);
 
        if (to.addr != NULL)



Home | Main Index | Thread Index | Old Index