summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2019-06-02 11:35:43 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2019-06-02 11:35:43 -0700
commit43c19175385f98894c1633ed57ec6778e17a38a6 (patch)
tree106eae499b079accde836a99283f4f8e86daf9f7
parent2b838dbd23f2ae2a3ff479003b13e03563624009 (diff)
Clear 208 out of 210 -Wdiscarded-qualifiers warnings from gcc 7.3
Depends on building with a libXt version that defines String as a const char * if _CONST_X_STRING is defined. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--Makefile.am1
-rw-r--r--comm.c5
-rw-r--r--editres.c2
-rw-r--r--editresP.h14
-rw-r--r--handler.c6
-rw-r--r--utils.c8
-rw-r--r--widgets.c2
7 files changed, 20 insertions, 18 deletions
diff --git a/Makefile.am b/Makefile.am
index 874e0f7..b203753 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,6 +23,7 @@ SUBDIRS = man
bin_PROGRAMS = editres
AM_CFLAGS = $(CWARNFLAGS) $(EDITRES_CFLAGS)
+AM_CPPFLAGS = -D_CONST_X_STRING
editres_LDADD = $(EDITRES_LIBS)
editres_SOURCES = \
diff --git a/comm.c b/comm.c
index a19666b..251e9d3 100644
--- a/comm.c
+++ b/comm.c
@@ -180,7 +180,7 @@ GetClientWindow(Widget w, int *x, int *y)
/* ARGSUSED */
void
-SetCommand(Widget w, ResCommand command, char *msg)
+SetCommand(Widget w, ResCommand command, String msg)
{
XClientMessageEvent client_event;
Display * dpy = XtDisplay(w);
@@ -254,7 +254,8 @@ SetCommand(Widget w, ResCommand command, char *msg)
static void
TellUserAboutMessage(Widget label, ResCommand command)
{
- char msg[BUFSIZ], *str;
+ char msg[BUFSIZ];
+ const char *str;
switch(command) {
case LocalSendWidgetTree:
diff --git a/editres.c b/editres.c
index ac435c2..7b08a83 100644
--- a/editres.c
+++ b/editres.c
@@ -45,7 +45,7 @@ String res_labels[NUM_RES_LABELS];
int global_effective_protocol_version = CURRENT_PROTOCOL_VERSION;
/* toolkit type of client whose "resources" we are currently editing */
-char *global_effective_toolkit = "xt";
+String global_effective_toolkit = "xt";
int global_error_code;
unsigned long global_serial_num;
diff --git a/editresP.h b/editresP.h
index 5413365..9adffc0 100644
--- a/editresP.h
+++ b/editresP.h
@@ -192,7 +192,7 @@ typedef struct _AppResources {
*/
typedef struct _ApplyResourcesInfo {
- char * name, *class; /* name and class of this resource. */
+ const char * name, *class; /* name and class of this resource. */
unsigned short count;
ProtocolStream * stream;
XrmDatabase database;
@@ -203,7 +203,7 @@ typedef struct _ApplyResourcesInfo {
*/
typedef struct _ObtainResourcesInfo {
- char * name, *class; /* name and class of this resource. */
+ const char * name, *class; /* name and class of this resource. */
unsigned short count;
ProtocolStream * stream;
XrmDatabase database;
@@ -315,7 +315,7 @@ typedef union _Event {
* Global variables.
*/
extern int global_effective_protocol_version;
-extern char* global_effective_toolkit;
+extern String global_effective_toolkit;
extern int global_error_code;
extern unsigned long global_serial_num;
extern int (*global_old_error_handler)(Display *, XErrorEvent *);
@@ -360,7 +360,7 @@ extern Widget TM_entries[NUM_TM_ENTRIES];
*/
extern void ActivateResourceWidgets ( Widget w, XtPointer node_ptr, XtPointer junk );
extern void ActivateWidgetsAndSetResourceString ( Widget w, XtPointer node_ptr, XtPointer call_data );
-extern void AddString ( char ** str, char *add );
+extern void AddString ( char ** str, const char *add );
extern void AddTreeNode ( Widget tree, WNode * top );
extern void AnyChosen ( Widget w, XtPointer any_info_ptr, XtPointer state_ptr );
extern void ApplyResource ( Widget w, XtPointer node_ptr, XtPointer junk );
@@ -403,7 +403,7 @@ extern void PrepareToLayoutTree ( Widget tree );
extern void PrintNodes ( WNode * top );
extern char * PrintSetValuesError ( Event * event );
extern char * ProtocolFailure ( ProtocolStream * stream );
-extern XrmQuarkList Quarkify ( char ** list, char * ptr );
+extern XrmQuarkList Quarkify ( char ** list, const char * ptr );
extern void Quit ( Widget w, XtPointer client_data, XtPointer call_data ) _X_NORETURN;
extern void RebuildMenusAndLabel ( String toolkit );
extern void ResourceListCallback ( Widget list, XtPointer node_ptr, XtPointer junk );
@@ -411,10 +411,10 @@ extern void SaveResource ( Widget w, XtPointer res_box_ptr, XtPointer junk );
extern void SendTree ( Widget w, XtPointer value, XtPointer call_data );
extern void SetAndCenterTreeNode ( WNode * node );
extern void SetApplicationActions ( XtAppContext app_con );
-extern void SetCommand ( Widget w, ResCommand command, char * msg );
+extern void SetCommand ( Widget w, ResCommand command, String msg );
extern void SetEntriesSensitive ( Widget *entries, int num, Boolean sensitive );
extern void SetFile ( Widget w, XtPointer junk, XtPointer garbage );
-extern void SetMessage ( Widget w, char * str );
+extern void SetMessage ( Widget w, String str );
extern void SetResourceString ( Widget w, XtPointer node_ptr, XtPointer junk );
extern void TreeRelabel ( Widget w, XtPointer client_data, XtPointer call_data );
extern void TreeSelect ( Widget w, XtPointer client_data, XtPointer call_data );
diff --git a/handler.c b/handler.c
index c053868..7f45295 100644
--- a/handler.c
+++ b/handler.c
@@ -42,7 +42,7 @@ in this Software without prior written authorization from The Open Group.
/*
* Local function definitions.
*/
-static char * GetResourceName ( ResourceBoxInfo * res_box );
+static String GetResourceName ( ResourceBoxInfo * res_box );
static void _AppendResourceString ( Widget w, XtPointer res_box_ptr,
XtPointer filename_ptr );
static void _SetResourcesFile ( Widget w, XtPointer junk,
@@ -369,11 +369,11 @@ AnyChosen(Widget w, XtPointer any_info_ptr, XtPointer state_ptr)
*/
-static char *
+static String
GetResourceName(ResourceBoxInfo *res_box)
{
XawListReturnStruct * list_info;
- char * result;
+ String result;
list_info = XawListShowCurrent(res_box->norm_list);
if ((list_info->list_index == XAW_LIST_NONE) &&
diff --git a/utils.c b/utils.c
index de046d2..19a3474 100644
--- a/utils.c
+++ b/utils.c
@@ -56,7 +56,7 @@ static void FreeResources ( WidgetResources * resources );
*/
void
-SetMessage(Widget w, char *str)
+SetMessage(Widget w, String str)
{
Arg args[1];
@@ -132,7 +132,7 @@ GetAllStrings(char *in, char sep, char ***out, int *num)
*/
void
-AddString(char ** str, char *add)
+AddString(char ** str, const char *add)
{
int len_str, len_add;
char * ptr;
@@ -745,7 +745,7 @@ CheckDatabase(XrmDatabase db, XrmQuarkList names, XrmQuarkList classes)
*/
XrmQuarkList
-Quarkify(char **list, char *ptr)
+Quarkify(char **list, const char *ptr)
{
int i;
char ** tlist;
@@ -853,7 +853,7 @@ ProtocolFailure(ProtocolStream *stream)
{
char buf[BUFSIZ];
unsigned char version;
- char* old_version_string;
+ const char* old_version_string;
if (!_XEditResGet8(stream, &version))
return(XtNewString(res_labels[35]));
diff --git a/widgets.c b/widgets.c
index 0bee2db..f3ad877 100644
--- a/widgets.c
+++ b/widgets.c
@@ -323,7 +323,7 @@ CreateCommandMenu(Widget parent, String toolkit)
#define FLASH 5
struct tree_ops_menu {
- char * name;
+ const char * name;
int type;
XtPointer data;
};