diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-01-21 14:01:05 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-01-21 14:01:05 -0800 |
commit | 2525547dfd5fae9d820232af1ea1d3f517c399d4 (patch) | |
tree | 729f90499a131f3160fefe74ef17e3914c97e284 | |
parent | ab0228c679932b4f5439e9304db8c6a1b8f50909 (diff) |
Further reduce the number of -Wdiscarded-qualifiers warnings from 276 to 76
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | bbox.c | 14 | ||||
-rw-r--r-- | bbox.h | 12 | ||||
-rw-r--r-- | command.c | 16 | ||||
-rw-r--r-- | externs.h | 56 | ||||
-rw-r--r-- | folder.c | 12 | ||||
-rw-r--r-- | globals.h | 8 | ||||
-rw-r--r-- | menu.c | 4 | ||||
-rw-r--r-- | miscfuncs.c | 2 | ||||
-rw-r--r-- | msg.c | 7 | ||||
-rw-r--r-- | pick.c | 18 | ||||
-rw-r--r-- | screen.c | 2 | ||||
-rw-r--r-- | toc.c | 12 | ||||
-rw-r--r-- | toc.h | 8 | ||||
-rw-r--r-- | tocfuncs.c | 6 | ||||
-rw-r--r-- | tocutil.c | 4 | ||||
-rw-r--r-- | tocutil.h | 2 | ||||
-rw-r--r-- | util.c | 38 | ||||
-rw-r--r-- | xmh.h | 6 |
18 files changed, 114 insertions, 113 deletions
@@ -52,7 +52,7 @@ void BBoxInit(void) ButtonBox BBoxCreate( Scrn scrn, - char *name) /* name of the buttonbox widgets */ + const char *name) /* name of the buttonbox widgets */ { Cardinal n; ButtonBox buttonbox = XtNew(ButtonBoxRec); @@ -77,7 +77,7 @@ ButtonBox BBoxCreate( ButtonBox RadioBBoxCreate( Scrn scrn, - char *name) /* name of the buttonbox widgets */ + const char *name) /* name of the buttonbox widgets */ { return BBoxCreate(scrn, name); } @@ -87,7 +87,7 @@ ButtonBox RadioBBoxCreate( static void bboxAddButton( ButtonBox buttonbox, - char *name, + const char *name, WidgetClass kind, Boolean enabled, Boolean radio) @@ -137,7 +137,7 @@ static void bboxAddButton( void BBoxAddButton( ButtonBox buttonbox, - char *name, + const char *name, WidgetClass kind, Boolean enabled) { @@ -147,7 +147,7 @@ void BBoxAddButton( void RadioBBoxAddButton( ButtonBox buttonbox, - char *name, + const char *name, Boolean enabled) { bboxAddButton(buttonbox, name, toggleWidgetClass, enabled, True); @@ -261,7 +261,7 @@ void BBoxDisable( Button BBoxFindButtonNamed( ButtonBox buttonbox, - char *name) + const char *name) { register int i; for (i=0 ; i<buttonbox->numbuttons; i++) @@ -350,7 +350,7 @@ Boolean BBoxIsGrandparent( void BBoxMailFlag( ButtonBox buttonbox, - char* name, + const char* name, int up) { Arg args[1]; @@ -30,16 +30,16 @@ /* for radio button boxes only */ -extern ButtonBox RadioBBoxCreate (Scrn, char *); -extern void RadioBBoxAddButton (ButtonBox, char *, Boolean); +extern ButtonBox RadioBBoxCreate (Scrn, const char *); +extern void RadioBBoxAddButton (ButtonBox, const char *, Boolean); extern void RadioBBoxSet (Button); extern char * RadioBBoxGetCurrent (ButtonBox); extern void RadioBBoxDeleteButton(Button); /* for other kinds of button boxes */ -extern ButtonBox BBoxCreate (Scrn, char *); -extern void BBoxAddButton (ButtonBox, char *, WidgetClass, Boolean); +extern ButtonBox BBoxCreate (Scrn, const char *); +extern void BBoxAddButton (ButtonBox, const char *, WidgetClass, Boolean); extern void BBoxDeleteButton (Button); /* for all kinds of button boxes */ @@ -47,7 +47,7 @@ extern void BBoxDeleteButton (Button); extern void BBoxInit (void); extern void BBoxEnable (Button); extern void BBoxDisable (Button); -extern Button BBoxFindButtonNamed (ButtonBox, char *); +extern Button BBoxFindButtonNamed (ButtonBox, const char *); extern Button BBoxFindButton (ButtonBox, Widget); extern Button BBoxButtonNumber (ButtonBox, int); extern int BBoxNumButtons (ButtonBox); @@ -58,6 +58,6 @@ extern Boolean BBoxIsGrandparent (ButtonBox, Widget); /* operations upon folder buttons */ -extern void BBoxMailFlag (ButtonBox, char*, int); +extern void BBoxMailFlag (ButtonBox, const char*, int); #endif /* _bbox_h */ @@ -67,7 +67,7 @@ typedef char* Pointer; static void FreeStatus(XMH_CB_ARGS); static void CheckReadFromPipe(int, char **, int *, Bool); -static void SystemError(char* text) +static void SystemError(const char* text) { char msg[BUFSIZ]; snprintf( msg, sizeof(msg), "%s; errno = %d %s", text, errno, @@ -78,7 +78,7 @@ static void SystemError(char* text) /* Return the full path name of the given mh command. */ -static char *FullPathOfCommand(char *str) +static char *FullPathOfCommand(const char *str) { static char result[100]; snprintf(result, sizeof(result), "%s/%s", app_resources.mh_path, str); @@ -125,7 +125,7 @@ ChildDone(int n) long commands. Returns 0 if stderr empty, -1 otherwise. */ static int _DoCommandToFileOrPipe( - char **argv, /* The command to execute, and its args. */ + char * const *argv, /* The command to execute, and its args. */ int inputfd, /* Input stream for command. */ int outputfd, /* Output stream; /dev/null if == -1 */ char **bufP, /* output buffer ptr if outputfd == -2 */ @@ -417,9 +417,9 @@ static void FreeStatus( in the specified file path. Returns 0 if stderr empty, -1 otherwise */ int DoCommand( - char **argv, /* The command to execute, and its args. */ - char *inputfile, /* Input file for command. */ - char *outputfile) /* Output file for command. */ + char * const *argv, /* The command to execute, and its args. */ + const char *inputfile, /* Input file for command. */ + const char *outputfile) /* Output file for command. */ { int fd_in, fd_out; int status; @@ -448,7 +448,7 @@ int DoCommand( /* Execute the given command, waiting until it's finished. Put the output in a newly mallocced string, and return a pointer to that string. */ -char *DoCommandToString(char ** argv) +char *DoCommandToString(char * const *argv) { char *result = NULL; int len = 0; @@ -462,7 +462,7 @@ char *DoCommandToString(char ** argv) /* Execute the command to a temporary file, and return the name of the file. */ -char *DoCommandToFile(char **argv) +char *DoCommandToFile(char * const *argv) { char *name; FILEPTR file; @@ -36,9 +36,9 @@ /* from command.c */ -extern int DoCommand (char **, char *, char *); -extern char * DoCommandToFile (char **); -extern char * DoCommandToString (char **); +extern int DoCommand (char * const *, const char *, const char *); +extern char * DoCommandToFile (char * const *); +extern char * DoCommandToString (char * const *); /* from compfuncs.c */ @@ -54,8 +54,8 @@ extern void DoOpenFolderInNewWindow (XMH_CB_ARGS); extern void DoCreateFolder (XMH_CB_ARGS); extern void DoDeleteFolder (XMH_CB_ARGS); extern void DoSaveYourself (XMH_CB_ARGS); -extern void Push (Stack *, char *); -extern char * Pop (Stack *); +extern void Push (Stack *, const char *); +extern const char * Pop (Stack *); /* from init.c */ @@ -63,15 +63,15 @@ extern void InitializeWorld (int, char **); /* from menu.c */ -extern void AttachMenuToButton (Button, Widget, char *); -extern void AddMenuEntry (Widget, char *, ...); +extern void AttachMenuToButton (Button, Widget, const char *); extern void DoRememberMenuSelection (XMH_CB_ARGS); -extern void SendMenuEntryEnableMsg (Button, char *, int); +extern void SendMenuEntryEnableMsg (Button, const char *, int); extern void ToggleMenuItem (Widget, Boolean); /* from miscfuncs.c */ -extern int ScanDir (char *, char ***, int (*)(char *)); +extern int ScanDir (const char *, char ***, + int (*)(char *)); /* from msg.c */ @@ -81,7 +81,7 @@ extern char* MsgName (Msg); /* from pick.c */ extern void InitPick (void); -extern void AddPick (Scrn, Toc, char *, char *); +extern void AddPick (Scrn, Toc, const char *, const char *); /* from popup.c */ @@ -90,7 +90,7 @@ extern void WMDeletePopup (Widget, XEvent*); extern void PopupPrompt (Widget, String, XtCallbackProc); extern void PopupConfirm (Widget, String, XtCallbackList, XtCallbackList); -extern void PopupNotice (char *, XtCallbackProc, XtPointer); +extern void PopupNotice (String, XtCallbackProc, XtPointer); extern void PopupError (Widget, String); extern void PopupWarningHandler(String, String, String, String, String *, Cardinal *); @@ -139,37 +139,37 @@ extern void DoDeleteSeq (XMH_CB_ARGS); /* from util.c */ -extern void Punt (char *); -extern int myopen (char *, int, int); -extern FILE * myfopen (char *, char *); +extern void Punt (const char *); +extern int myopen (const char *, int, int); +extern FILE * myfopen (const char *, const char *); extern void myclose (int); extern void myfclose (FILE *); extern char * MakeNewTempFileName (void); extern char ** MakeArgv (int); extern char ** ResizeArgv (char **, int); -extern FILEPTR FOpenAndCheck (char *, char *); +extern FILEPTR FOpenAndCheck (const char *, const char *); extern char * ReadLine (FILE *); extern char * ReadLineWithCR (FILE *); -extern void DeleteFileAndCheck (char *); -extern void CopyFileAndCheck (char *, char *); -extern void RenameAndCheck (char *, char *); +extern void DeleteFileAndCheck (const char *); +extern void CopyFileAndCheck (const char *, const char *); +extern void RenameAndCheck (const char *, const char *); extern char * CreateGeometry (int, int, int, int, int); -extern int FileExists (char *); -extern long LastModifyDate (char *); -extern int GetFileLength (char *); -extern Boolean IsSubfolder (char *); -extern void SetCurrentFolderName (Scrn, char *); -extern void ChangeLabel (Widget, char *); -extern Widget CreateTextSW (Scrn, char *, ArgList, Cardinal); -extern Widget CreateTitleBar (Scrn, char *); +extern int FileExists (const char *); +extern long LastModifyDate (const char *); +extern int GetFileLength (const char *); +extern Boolean IsSubfolder (const char *); +extern void SetCurrentFolderName (Scrn, const char *); +extern void ChangeLabel (Widget, const char *); +extern Widget CreateTextSW (Scrn, const char *, ArgList, Cardinal); +extern Widget CreateTitleBar (Scrn, const char *); extern void Feep (int, int, Window); extern MsgList CurMsgListOrCurMsg (Toc); extern int GetWidth (Widget); extern int GetHeight (Widget); extern Toc SelectedToc (Scrn); extern Toc CurrentToc (Scrn); -extern int strncmpIgnoringCase(char *, char *, int); -extern void StoreWindowName (Scrn, char *); +extern int strncmpIgnoringCase (const char *, const char *, int); +extern void StoreWindowName (Scrn, const char *); extern void InitBusyCursor (Scrn); extern void ShowBusyCursor (void); extern void UnshowBusyCursor (void); @@ -841,7 +841,7 @@ void XmhLeaveFolderButton( void Push( Stack *stack_ptr, - char *data) + const char *data) { Stack new = XtNew(StackRec); new->data = data; @@ -849,11 +849,11 @@ void Push( *stack_ptr = new; } -char * Pop( +const char * Pop( Stack *stack_ptr) { Stack top; - char *data = NULL; + const char *data = NULL; if ((top = *stack_ptr) != NULL) { data = top->data; @@ -894,7 +894,7 @@ void XmhPopFolder( Cardinal *count) { Scrn scrn = ScrnFromWidget(w); - char *folder; + const char *folder; if ((folder = Pop(&scrn->folder_stack)) != NULL) SetCurrentFolderName(scrn, folder); @@ -922,8 +922,8 @@ void XmhWMProtocols( { Boolean dw = False; /* will we do delete window? */ Boolean sy = False; /* will we do save yourself? */ - static char*WM_DELETE_WINDOW = "WM_DELETE_WINDOW"; - static char*WM_SAVE_YOURSELF = "WM_SAVE_YOURSELF"; + static const char *WM_DELETE_WINDOW = "WM_DELETE_WINDOW"; + static const char *WM_SAVE_YOURSELF = "WM_SAVE_YOURSELF"; #define DO_DELETE_WINDOW InParams(WM_DELETE_WINDOW, params, *num_params) #define DO_SAVE_YOURSELF InParams(WM_SAVE_YOURSELF, params, *num_params) @@ -72,7 +72,7 @@ struct _resources { int mail_interval; /* how often to check for new mail */ int rescan_interval; /* how often to check viewed tocs */ int checkpoint_interval; /* how often to save edits */ - char * checkpoint_name_format; /* format of checkpoint file name */ + const char *checkpoint_name_format; /* format of checkpoint file name */ Pixmap flag_up; /* folder has new mail */ Pixmap flag_down; /* folder has no new mail */ Pixmap new_mail_icon; /* new mail icon for wm hints */ @@ -125,14 +125,14 @@ extern Boolean subProcessRunning; /* interlock for DoCommand/CheckMail */ typedef struct _XmhMenuEntry { - char *name; /* menu entry name */ + const char *name; /* menu entry name */ void (*function)(XMH_CB_ARGS); /* menu entry callback function */ } XmhMenuEntryRec, *XmhMenuEntry; typedef struct _XmhMenuButtonDesc { - char *button_name; /* menu button name */ - char *menu_name; /* menu name */ + const char *button_name; /* menu button name */ + const char *menu_name; /* menu name */ int id; /* an internal key */ XmhMenuEntry entry; /* list of menu entries */ Cardinal num_entries; /* count of menu entries in list */ @@ -34,7 +34,7 @@ in this Software without prior written authorization from the X Consortium. void AttachMenuToButton( Button button, Widget menu, - char *menu_name) + const char *menu_name) { Arg args[3]; @@ -62,7 +62,7 @@ void DoRememberMenuSelection( void SendMenuEntryEnableMsg( Button button, - char *entry_name, + const char *entry_name, int value) { Widget entry; diff --git a/miscfuncs.c b/miscfuncs.c index bead900..c6f1d18 100644 --- a/miscfuncs.c +++ b/miscfuncs.c @@ -37,7 +37,7 @@ static int StrCmp(char **a, char **b) int ScanDir( - char *Name, + const char *Name, char ***List, int (*Selector)(char *)) { @@ -719,7 +719,7 @@ void MsgSend(Msg msg) void MsgLoadComposition(Msg msg) { - static char *blankcomp = NULL; /* Array containing comp template */ + static const char *blankcomp = NULL; /* Array containing comp template */ static int compsize = 0; static XawTextPosition startPos; char *file, **argv; @@ -736,9 +736,10 @@ void MsgLoadComposition(Msg msg) XtFree((char *) argv); compsize = GetFileLength(file); if (compsize > 0) { - blankcomp = XtMalloc((Cardinal) compsize); + char *readcomp = XtMalloc((Cardinal) compsize); + blankcomp = readcomp; fid = myopen(file, O_RDONLY, 0666); - if (compsize != read(fid, blankcomp, compsize)) + if (compsize != read(fid, readcomp, compsize)) Punt("Error reading in MsgLoadComposition!"); myclose(fid); DeleteFileAndCheck(file); @@ -51,7 +51,7 @@ static int stdwidth = -1; /* Width to make text fields, and other things that want to be the same width as text fields. */ -static char *TypeName[NUMROWTYPE]; +static const char *TypeName[NUMROWTYPE]; static short true_data = 1; /* radio data */ static short false_data = 0; /* radio data */ @@ -129,7 +129,7 @@ static void ExecuteUpdate(FormBox form) XtManageChild(form->outer); } -static void AddLabel(RowList row, char *text, int usestd) +static void AddLabel(RowList row, const char *text, int usestd) { static Arg arglist[] = { {XtNlabel, (XtArgVal)NULL}, @@ -145,7 +145,7 @@ static void AddLabel(RowList row, char *text, int usestd) } -static void AddButton(RowList row, char *text, void (*func)(XMH_CB_ARGS)) +static void AddButton(RowList row, const char *text, void (*func)(XMH_CB_ARGS)) { FormEntry entry; static Arg args[] = { @@ -160,7 +160,7 @@ static void AddButton(RowList row, char *text, void (*func)(XMH_CB_ARGS)) static void AddToggle( RowList row, - char *text, + const char *text, int initial_state, Widget radio_group, XtPointer radio_data) @@ -180,7 +180,7 @@ static void AddToggle( } -static void AddTextEntry(RowList row, char *str) +static void AddTextEntry(RowList row, const char *str) { FormEntry entry; static Arg arglist[] = { @@ -197,7 +197,7 @@ static void AddTextEntry(RowList row, char *str) } -static void ChangeTextEntry(FormEntry entry, char *str) +static void ChangeTextEntry(FormEntry entry, const char *str) { Arg arglist[1]; char *ptr; @@ -247,7 +247,7 @@ static char **argv; static int argvsize; -static void AppendArgv(char *ptr) +static void AppendArgv(const char *ptr) { argvsize++; argv = ResizeArgv(argv, argvsize); @@ -654,7 +654,7 @@ static void AddGeneralGroup(FormBox form) } -static void InitGeneral(Pick pick, char *fromseq, char *toseq) +static void InitGeneral(Pick pick, const char *fromseq, const char *toseq) { RowList row; row = pick->general->glist[0]->rlist[0]; @@ -709,7 +709,7 @@ static FormBox MakeAForm(Pick pick) } -void AddPick(Scrn scrn, Toc toc, char *fromseq, char *toseq) +void AddPick(Scrn scrn, Toc toc, const char *fromseq, const char *toseq) { Pick pick; FormBox general, details; @@ -194,7 +194,7 @@ static void MakeTocAndView(Scrn scrn) register int i; XmhMenuButtonDesc mbd; ButtonBox buttonbox; - char *name; + const char *name; static XawTextSelectType sarray[] = {XawselectLine, XawselectPosition, XawselectAll, @@ -205,7 +205,7 @@ void TocInit(void) /* Create a toc and add a folder to the folderList. */ -Toc TocCreate(char *foldername) +Toc TocCreate(const char *foldername) { Toc toc = TUMalloc(); @@ -219,7 +219,7 @@ Toc TocCreate(char *foldername) /* Create a new folder with the given name. */ -Toc TocCreateFolder(char *foldername) +Toc TocCreateFolder(const char *foldername) { Toc toc; char str[500]; @@ -657,7 +657,7 @@ void TocChangeViewedSeq(Toc toc, Sequence seq) /* Return the sequence with the given name in the given toc. */ -Sequence TocGetSeqNamed(Toc toc, char *name) +Sequence TocGetSeqNamed(Toc toc, const char *name) { register int i; if (name == NULL) @@ -817,7 +817,7 @@ char *TocName(Toc toc) /* Given a foldername, return the corresponding toc. */ -Toc TocGetNamed(char *name) +Toc TocGetNamed(const char *name) { int i; for (i=0; i<numFolders ; i++) @@ -1204,7 +1204,7 @@ void XmhPopSequence( Cardinal *count) { Scrn scrn = ScrnFromWidget(w); - char *seqname; + const char *seqname; Widget sequenceMenu, selected, original; Button button; Sequence sequence; @@ -1223,6 +1223,6 @@ void XmhPopSequence( sequence = TocGetSeqNamed(scrn->toc, seqname); TocSetSelectedSequence(scrn->toc, sequence); } - XtFree(seqname); + XtFree((char *)seqname); } } @@ -30,8 +30,8 @@ #define _toc_h extern void TocInit (void); -extern Toc TocCreate (char *); -extern Toc TocCreateFolder (char *); +extern Toc TocCreate (const char *); +extern Toc TocCreateFolder (const char *); extern int TocHasMail (Toc); extern void TocCheckForNewMail (Boolean); extern Boolean TocTestAndSetDeletePending(Toc); @@ -51,7 +51,7 @@ extern void TocReloadSeqLists (Toc); extern int TocHasSequences (Toc); extern void TocChangeViewedSeq (Toc, Sequence); extern Sequence TocViewedSequence (Toc); -extern Sequence TocGetSeqNamed (Toc, char *); +extern Sequence TocGetSeqNamed (Toc, const char *); extern void TocSetSelectedSequence (Toc, Sequence); extern Sequence TocSelectedSequence (Toc); @@ -64,7 +64,7 @@ extern void TocSetCacheValid (Toc); extern char * TocMakeFolderName (Toc); extern char * TocName (Toc); -extern Toc TocGetNamed (char*); +extern Toc TocGetNamed (const char *); extern int TocConfirmCataclysm(Toc, XtCallbackList, XtCallbackList); extern void TocCommitChanges (Widget, XtPointer, XtPointer); @@ -519,9 +519,9 @@ void XmhPrint( if (! num_params || ! *num_params) { /* use the print command specified in application resources */ Cardinal argc = 1; - String *argv = MakeArgv(argc); + char **argv = MakeArgv(argc); argv[0] = app_resources.print_command; - XmhShellCommand(w, event, argv, &argc); + XmhShellCommand(w, event, (String *) argv, &argc); XtFree((char *) argv); } else { /* do whatever the user has specified as action parameters */ @@ -783,7 +783,7 @@ void DoPickMessages( Scrn scrn = (Scrn) client_data; Toc toc = scrn->toc; Scrn nscrn; - char * toseq; + const char *toseq; Sequence selectedseq; Boolean recycled; @@ -66,7 +66,7 @@ void TUCheckSequenceMenu(Toc toc) Scrn scrn; register int i, n; Arg query_args[2]; - char *name; + const char *name; Cardinal j; int numChildren; Widget menu, item; @@ -594,7 +594,7 @@ void TUGetFullFolderInfo(Toc toc) routine will figure out the message number, and change the scan line accordingly. */ -Msg TUAppendToc(Toc toc, char *ptr) +Msg TUAppendToc(Toc toc, const char *ptr) { Msg msg; int msgid; @@ -42,6 +42,6 @@ extern void TUSaveTocFile (Toc); extern void TUEnsureScanIsValidAndOpen (Toc, Boolean); extern void TURefigureTocPositions (Toc); extern void TUGetFullFolderInfo (Toc); -extern Msg TUAppendToc (Toc, char *); +extern Msg TUAppendToc (Toc, const char *); #endif /* _tocutil_h */ @@ -39,16 +39,16 @@ #define abs(x) ((x) < 0 ? (-(x)) : (x)) #endif -static char *SysErrorMsg (int n) +static const char *SysErrorMsg (int n) { - char *s = strerror(n); + const char *s = strerror(n); return (s ? s : "no such error"); } /* Something went wrong; panic and quit. */ -void Punt(char *str) +void Punt(const char *str) { (void) fprintf( stderr, "%s: %s\nerrno = %d; %s\007\n", progName, str, errno, SysErrorMsg(errno) ); @@ -65,7 +65,7 @@ void Punt(char *str) } -int myopen(char *path, int flags, int mode) +int myopen(const char *path, int flags, int mode) { int fid; fid = open(path, flags, mode); @@ -74,7 +74,7 @@ int myopen(char *path, int flags, int mode) } -FILE *myfopen(char *path, char *mode) +FILE *myfopen(const char *path, const char *mode) { FILE *result; result = fopen(path, mode); @@ -134,7 +134,7 @@ char **ResizeArgv(char **argv, int n) /* Open a file, and punt if we can't. */ -FILEPTR FOpenAndCheck(char *name, char *mode) +FILEPTR FOpenAndCheck(const char *name, const char *mode) { FILEPTR result; result = myfopen(name, mode); @@ -195,7 +195,7 @@ char *ReadLineWithCR(FILEPTR fid) /* Delete a file, and Punt if it fails. */ -void DeleteFileAndCheck(char *name) +void DeleteFileAndCheck(const char *name) { if (strcmp(name, "/dev/null") != 0 && unlink(name) == -1) { char str[500]; @@ -205,7 +205,7 @@ void DeleteFileAndCheck(char *name) } } -void CopyFileAndCheck(char *from, char *to) +void CopyFileAndCheck(const char *from, const char *to) { int fromfid, tofid, n; char buf[512]; @@ -225,7 +225,7 @@ void CopyFileAndCheck(char *from, char *to) } -void RenameAndCheck(char *from, char *to) +void RenameAndCheck(const char *from, const char *to) { if (rename(from, to) == -1) { if (errno != EXDEV) { @@ -266,38 +266,38 @@ char *CreateGeometry(int gbits, int x, int y, int width, int height) return result; } -int FileExists(char *file) +int FileExists(const char *file) { return (access(file, F_OK) == 0); } -long LastModifyDate(char *file) +long LastModifyDate(const char *file) { struct stat buf; if (stat(file, &buf)) return -1; return buf.st_mtime; } -int GetFileLength(char *file) +int GetFileLength(const char *file) { struct stat buf; if (stat(file, &buf)) return -1; return buf.st_size; } -Boolean IsSubfolder(char *foldername) +Boolean IsSubfolder(const char *foldername) { return (strchr(foldername, '/')) ? True : False; } -void SetCurrentFolderName(Scrn scrn, char *foldername) +void SetCurrentFolderName(Scrn scrn, const char *foldername) { scrn->curfolder = foldername; ChangeLabel((Widget) scrn->folderlabel, foldername); } -void ChangeLabel(Widget widget, char *str) +void ChangeLabel(Widget widget, const char *str) { static Arg arglist[] = {{XtNlabel, (XtArgVal)NULL}}; arglist[0].value = (XtArgVal) str; @@ -307,7 +307,7 @@ void ChangeLabel(Widget widget, char *str) Widget CreateTextSW( Scrn scrn, - char *name, + const char *name, ArgList args, Cardinal num_args) { @@ -318,7 +318,7 @@ Widget CreateTextSW( } -Widget CreateTitleBar(Scrn scrn, char *name) +Widget CreateTitleBar(Scrn scrn, const char *name) { Widget result; int height; @@ -398,7 +398,7 @@ Toc CurrentToc(Scrn scrn) } -int strncmpIgnoringCase(char *str1, char *str2, int length) +int strncmpIgnoringCase(const char *str1, const char *str2, int length) { int i, diff; for (i=0 ; i<length ; i++, str1++, str2++) { @@ -410,7 +410,7 @@ int strncmpIgnoringCase(char *str1, char *str2, int length) } -void StoreWindowName(Scrn scrn, char *str) +void StoreWindowName(Scrn scrn, const char *str) { static Arg arglist[] = { {XtNiconName, (XtArgVal) NULL}, @@ -102,7 +102,7 @@ typedef enum { } ScrnKind; typedef struct _StackRec { - char *data; + const char *data; struct _StackRec *next; } StackRec, *Stack; @@ -121,7 +121,7 @@ typedef struct _ScrnRec { Widget viewlabel; /* View titlebar. */ Widget viewwidget; /* View text. */ ButtonBox viewbuttons; /* View control buttons. */ - char * curfolder; /* Currently selected folder name */ + const char * curfolder; /* Currently selected folder name */ Toc toc; /* The table of contents. */ Msg msg; /* The message being viewed. */ Pick pick; /* Pick in this screen. */ @@ -140,7 +140,7 @@ typedef struct { typedef struct { - char *name; /* Name of this sequence. */ + const char *name; /* Name of this sequence. */ MsgList mlist; /* Messages in this sequence. */ } SequenceRec, *Sequence; |