libXmu: Branch 'master' - 2 commits

Alan Coopersmith alanc at kemper.freedesktop.org
Thu Nov 10 20:49:58 PST 2011


 include/X11/Xmu/EditresP.h |    2 -
 src/Atoms.c                |   12 ++--------
 src/DefErrMsg.c            |    2 -
 src/EditresCom.c           |   54 ++++++++++++++++++++++-----------------------
 src/StrToGrav.c            |    2 -
 src/sharedlib.c            |    6 -----
 6 files changed, 33 insertions(+), 45 deletions(-)

New commits:
commit ccd9e64515d6fc7b5367d6d98ecd3abf5b084026
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Nov 10 20:34:03 2011 -0800

    Fix gcc -Wwrite-strings warnings (some, not all)
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/include/X11/Xmu/EditresP.h b/include/X11/Xmu/EditresP.h
index 61ec51d..ed9dd41 100644
--- a/include/X11/Xmu/EditresP.h
+++ b/include/X11/Xmu/EditresP.h
@@ -335,7 +335,7 @@ _XFUNCPROTOBEGIN
 void _XEditResPutString8
 (
  ProtocolStream		*stream,
- char			*str
+ _Xconst char		*str
  );
 
 void _XEditResPut8
diff --git a/src/Atoms.c b/src/Atoms.c
index 6cc91a2..6f0ca64 100644
--- a/src/Atoms.c
+++ b/src/Atoms.c
@@ -50,7 +50,7 @@ typedef struct _DisplayRec {
 } DisplayRec;
 
 struct _AtomRec {
-    char *name;
+    _Xconst char *name;
     DisplayRec* head;
 };
 
@@ -99,7 +99,7 @@ AtomPtr
 XmuMakeAtom(_Xconst char *name)
 {
     AtomPtr ptr = XtNew(struct _AtomRec);
-    ptr->name = (char *) name;
+    ptr->name = name;
     ptr->head = NULL;
     return ptr;
 }
@@ -107,7 +107,7 @@ XmuMakeAtom(_Xconst char *name)
 char *
 XmuNameOfAtom(AtomPtr atom_ptr)
 {
-    return atom_ptr->name;
+    return (char *) atom_ptr->name;
 }
 
 
diff --git a/src/DefErrMsg.c b/src/DefErrMsg.c
index 091d2c4..3cb914a 100644
--- a/src/DefErrMsg.c
+++ b/src/DefErrMsg.c
@@ -43,7 +43,7 @@ XmuPrintDefaultErrorMessage(Display *dpy, XErrorEvent *event, FILE *fp)
     char buffer[BUFSIZ];
     char mesg[BUFSIZ];
     char number[32];
-    char *mtype = "XlibMessage";
+    _Xconst char *mtype = "XlibMessage";
     register _XExtension *ext = (_XExtension *)NULL;
     _XExtension *bext = (_XExtension *)NULL;
     XGetErrorText(dpy, event->error_code, buffer, BUFSIZ);
diff --git a/src/EditresCom.c b/src/EditresCom.c
index b4554e1..716a2b3 100644
--- a/src/EditresCom.c
+++ b/src/EditresCom.c
@@ -142,13 +142,13 @@ static Boolean CvtStringToBlock(Display*, XrmValue*, Cardinal*,
 				XrmValue*, XrmValue*, XtPointer*);
 static EditresEvent *BuildEvent(Widget, Atom, XtPointer, ResIdent,
 				unsigned long);
-static char *DoFindChild(Widget, EditresEvent*, ProtocolStream*);
-static char *DoGetGeometry(Widget, EditresEvent*, ProtocolStream*);
-static char *DoGetResources(Widget, EditresEvent*, ProtocolStream*);
-static char *DoSetValues(Widget, EditresEvent*, ProtocolStream*);
+static _Xconst char *DoFindChild(Widget, EditresEvent*, ProtocolStream*);
+static _Xconst char *DoGetGeometry(Widget, EditresEvent*, ProtocolStream*);
+static _Xconst char *DoGetResources(Widget, EditresEvent*, ProtocolStream*);
+static _Xconst char *DoSetValues(Widget, EditresEvent*, ProtocolStream*);
 static void DumpChildren(Widget, ProtocolStream*, unsigned short*);
-static char *DumpValues(Widget, EditresEvent*, ProtocolStream*);
-static char *DumpWidgets(Widget, EditresEvent*, ProtocolStream*);
+static _Xconst char *DumpValues(Widget, EditresEvent*, ProtocolStream*);
+static _Xconst char *DumpWidgets(Widget, EditresEvent*, ProtocolStream*);
 static void ExecuteCommand(Widget, Atom, ResIdent, EditresEvent*);
 static void ExecuteGetGeometry(Widget, ProtocolStream*);
 static void ExecuteGetResources(Widget w, ProtocolStream *stream);
@@ -167,8 +167,8 @@ static Bool PositionInChild(Widget, int, int);
 static int qcmp_widget_list(register _Xconst void*, register _Xconst void*);
 static void SendCommand(Widget, Atom, ResIdent, EditResError,
 			ProtocolStream*);
-static void SendFailure(Widget, Atom, ResIdent, char*);
-static char *VerifyWidget(Widget, WidgetInfo*);
+static void SendFailure(Widget, Atom, ResIdent, _Xconst char*);
+static _Xconst char *VerifyWidget(Widget, WidgetInfo*);
 
 /*
  * External
@@ -215,13 +215,13 @@ _XEditResCheckMessages(Widget w, XtPointer data, XEvent *event, Boolean *cont)
 	if (!first_time)
 	{
 	    Atom atoms[4];
-	    static char *names[] = {
+	    static _Xconst char *names[] = {
 		EDITRES_NAME, EDITRES_COMMAND_ATOM,
 		EDITRES_PROTOCOL_ATOM, EDITRES_CLIENT_VALUE
 	    };
 
 	    first_time = True;
-	    XInternAtoms(dpy, names, 4, False, atoms);
+	    XInternAtoms(dpy, (char **) names, 4, False, atoms);
 	    res_editor = atoms[0];
 	    res_editor_command = atoms[1];
 	    res_editor_protocol = atoms[2];
@@ -479,8 +479,8 @@ GetCommand(Widget w, XtPointer data, Atom *selection, Atom *type,
 static void
 ExecuteCommand(Widget w, Atom sel, ResIdent ident, EditresEvent *event)
 {
-    char *(*func)(Widget, EditresEvent*, ProtocolStream*);
-    char *str;
+    _Xconst char *(*func)(Widget, EditresEvent*, ProtocolStream*);
+    _Xconst char *str;
 
     if (globals.block == BlockAll)
     {
@@ -609,7 +609,7 @@ CommandDone(Widget widget, Atom *selection, Atom *target)
  *	Sends a failure message
  */
 static void
-SendFailure(Widget w, Atom sel, ResIdent ident, char *str)
+SendFailure(Widget w, Atom sel, ResIdent ident, _Xconst char *str)
 {
     _XEditResResetStream(&globals.stream);
     _XEditResPutString8(&globals.stream, str);
@@ -889,7 +889,7 @@ IsChild(Widget top, Widget parent, Widget child)
  * Description:
  *	Makes sure all the widgets still exist
  */
-static char *
+static _Xconst char *
 VerifyWidget(Widget w, WidgetInfo *info)
 {
     Widget top;
@@ -938,10 +938,10 @@ VerifyWidget(Widget w, WidgetInfo *info)
  * Returns:
  *	NULL
  */
-static char *
+static _Xconst char *
 DoSetValues(Widget w, EditresEvent *event, ProtocolStream *stream)
 {
-    char *str;
+    _Xconst char *str;
     register unsigned i;
     unsigned short count = 0;
     SetValuesEvent *sv_event = (SetValuesEvent *)event;
@@ -1078,7 +1078,7 @@ ExecuteSetValues(Widget w, SetValuesEvent *sv_event, WidgetInfo *entry,
  */
 #define TOOLKIT_TYPE ("Xt")
 /*ARGSUSED*/
-static char *
+static _Xconst char *
 DumpWidgets(Widget w, EditresEvent *event, ProtocolStream *stream)
 {
     unsigned short count = 0;
@@ -1201,11 +1201,11 @@ DumpChildren(Widget w, ProtocolStream *stream, unsigned short *count)
  * Returns:
  *	NULL
  */
-static char *
+static _Xconst char *
 DoGetGeometry(Widget w, EditresEvent *event, ProtocolStream *stream)
 {
     unsigned i;
-    char *str;
+    _Xconst char *str;
     GetGeomEvent *geom_event = (GetGeomEvent *)event;
 
     _XEditResPut16(stream, geom_event->num_entries);
@@ -1414,10 +1414,10 @@ _FindChild(Widget parent, int x, int y)
  *	  An allocated error message if something went horribly wrong and
  *	no set values were performed, else NULL.
  */
-static char *
+static _Xconst char *
 DoFindChild(Widget w, EditresEvent *event, ProtocolStream *stream)
 {
-    char *str;
+    _Xconst char *str;
     Widget parent, child;
     Position parent_x, parent_y;
     FindChildEvent *find_event = (FindChildEvent *)event;
@@ -1456,11 +1456,11 @@ DoFindChild(Widget w, EditresEvent *event, ProtocolStream *stream)
  * Returns:
  *	NULL
  */
-static char *
+static _Xconst char *
 DoGetResources(Widget w, EditresEvent *event, ProtocolStream *stream)
 {
     unsigned int i;
-    char *str;
+    _Xconst char *str;
     GetResEvent *res_event = (GetResEvent *)event;
 
     _XEditResPut16(stream, res_event->num_entries); /* number of replys */
@@ -1558,12 +1558,12 @@ ExecuteGetResources(Widget w, ProtocolStream *stream)
  *	NULL
  */
 /*ARGSUSED*/
-static char *
+static _Xconst char *
 DumpValues(Widget w, EditresEvent* event, ProtocolStream* stream)
 {
-    char *str;
+    _Xconst char *str;
     Arg warg[1];
-    String res_value = NULL;
+    _Xconst _XtString res_value = NULL;
     GetValuesEvent *gv_event = (GetValuesEvent *)event;
 
     /* put the count in the stream */
@@ -1645,7 +1645,7 @@ InsertWidget(ProtocolStream *stream, Widget w)
  *	Inserts a string into the protocol stream.
  */
 void
-_XEditResPutString8(ProtocolStream *stream, char *str)
+_XEditResPutString8(ProtocolStream *stream, _Xconst char *str)
 {
     int i, len = strlen(str);
 
diff --git a/src/StrToGrav.c b/src/StrToGrav.c
index 44cc13b..ca8bb53 100644
--- a/src/StrToGrav.c
+++ b/src/StrToGrav.c
@@ -39,7 +39,7 @@ in this Software without prior written authorization from The Open Group.
  */
 static struct _namepair {
     XrmQuark quark;
-    char *name;
+    _Xconst char *name;
     XtGravity gravity;
 } names[] = {
     { NULLQUARK, XtEForget, ForgetGravity },
commit 72ac4c4a464b3aec21cdbe367c9d465cbe0f3ff1
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Thu Nov 10 09:55:07 2011 -0800

    Drop support for pre-ANSI-C89 preprocessors
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/src/Atoms.c b/src/Atoms.c
index 412f399..6cc91a2 100644
--- a/src/Atoms.c
+++ b/src/Atoms.c
@@ -60,15 +60,9 @@ struct _AtomRec {
 #define STATIC static
 #endif
 
-#if !defined(UNIXCPP) || defined(ANSICPP)
 #define DeclareAtom(atom,text) \
 STATIC struct _AtomRec __##atom = { text, NULL }; \
 AtomPtr _##atom = &__##atom;
-#else
-#define DeclareAtom(atom,text) \
-STATIC struct _AtomRec __/**/atom = { text, NULL }; \
-AtomPtr _/**/atom = &__/**/atom;
-#endif
 
 DeclareAtom(XA_ATOM_PAIR,		"ATOM_PAIR"		)
 DeclareAtom(XA_CHARACTER_POSITION,	"CHARACTER_POSITION"	)
diff --git a/src/sharedlib.c b/src/sharedlib.c
index 4bb8c3b..b47213d 100644
--- a/src/sharedlib.c
+++ b/src/sharedlib.c
@@ -36,15 +36,9 @@ struct _AtomRec {
     struct _DisplayRec* head;
 };
 
-#if !defined(UNIXCPP) || defined(ANSICPP)
 #define DeclareAtom(atom) \
 extern struct _AtomRec __##atom; \
 AtomPtr _##atom = &__##atom;
-#else
-#define DeclareAtom(atom) \
-extern struct _AtomRec __/**/atom; \
-AtomPtr _/**/atom = &__/**/atom;
-#endif
 
 DeclareAtom(XA_ATOM_PAIR)
 DeclareAtom(XA_CHARACTER_POSITION)


More information about the xorg-commit mailing list