1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-09 07:14:18 +01:00

WINGs: Properly mark 'const' some 'char*' in the public API

Update all the callers in our code to deal with the const qualifier
where the compiler reports an issue.
This commit is contained in:
John D Pell
2021-08-08 09:36:14 +02:00
committed by Carlos R. Mafra
parent 03ec24502d
commit a079544647
7 changed files with 15 additions and 13 deletions

View File

@@ -1324,7 +1324,7 @@ void WMSortBrowserColumnWithComparer(WMBrowser *bPtr, int column,
WMCompareDataProc *func); WMCompareDataProc *func);
/* Don't free the returned string. */ /* Don't free the returned string. */
char* WMSetBrowserPath(WMBrowser *bPtr, char *path); const char* WMSetBrowserPath(WMBrowser *bPtr, const char *path);
/* free the returned string */ /* free the returned string */
char* WMGetBrowserPath(WMBrowser *bPtr); char* WMGetBrowserPath(WMBrowser *bPtr);
@@ -1876,7 +1876,7 @@ void WMSetFilePanelCanChooseFiles(WMFilePanel *panel, Bool flag);
void WMSetFilePanelAutoCompletion(WMFilePanel *panel, Bool flag); void WMSetFilePanelAutoCompletion(WMFilePanel *panel, Bool flag);
void WMSetFilePanelDirectory(WMFilePanel *panel, char *path); void WMSetFilePanelDirectory(WMFilePanel *panel, const char *path);
/* you can free the returned string */ /* you can free the returned string */
char* WMGetFilePanelFileName(WMFilePanel *panel); char* WMGetFilePanelFileName(WMFilePanel *panel);
@@ -1884,7 +1884,7 @@ char* WMGetFilePanelFileName(WMFilePanel *panel);
void WMFreeFilePanel(WMFilePanel *panel); void WMFreeFilePanel(WMFilePanel *panel);
int WMRunModalFilePanelForDirectory(WMFilePanel *panel, WMWindow *owner, int WMRunModalFilePanelForDirectory(WMFilePanel *panel, WMWindow *owner,
char *path, const char *name, char **fileTypes); const char *path, const char *name, char **fileTypes);
void WMSetFilePanelAccessoryView(WMFilePanel *panel, WMView *view); void WMSetFilePanelAccessoryView(WMFilePanel *panel, WMView *view);

View File

@@ -249,7 +249,7 @@ char* wexpandpath(const char *path);
int wcopy_file(const char *toPath, const char *srcFile, const char *destFile); int wcopy_file(const char *toPath, const char *srcFile, const char *destFile);
/* don't free the returned string */ /* don't free the returned string */
char* wgethomedir(void); const char* wgethomedir(void);
/* ---[ WINGs/proplist.c ]------------------------------------------------ */ /* ---[ WINGs/proplist.c ]------------------------------------------------ */

View File

@@ -39,7 +39,7 @@
#endif #endif
char *wgethomedir() const char *wgethomedir(void)
{ {
static char *home = NULL; static char *home = NULL;
char *tmp; char *tmp;

View File

@@ -536,7 +536,7 @@ found_end_define_fname:
while (*src != '\0') { while (*src != '\0') {
idx = 0; idx = 0;
if (*src == '~') { if (*src == '~') {
char *home = wgethomedir(); const char *home = wgethomedir();
while (*home != '\0') { while (*home != '\0') {
if (idx < sizeof(buffer) - 2) if (idx < sizeof(buffer) - 2)
buffer[idx++] = *home; buffer[idx++] = *home;

View File

@@ -51,7 +51,8 @@ const char *wusergnusteppath()
{ {
static const char subdir[] = "/GNUstep"; static const char subdir[] = "/GNUstep";
static char *path = NULL; static char *path = NULL;
char *gspath, *h; char *gspath;
const char *h;
int pathlen; int pathlen;
if (path) if (path)

View File

@@ -619,11 +619,12 @@ void WMSetBrowserHasScroller(WMBrowser * bPtr, int hasScroller)
bPtr->flags.hasScroller = hasScroller; bPtr->flags.hasScroller = hasScroller;
} }
char *WMSetBrowserPath(WMBrowser * bPtr, char *path) const char *WMSetBrowserPath(WMBrowser * bPtr, const char *path)
{ {
int i; int i;
char *str; char *str;
char *tmp, *retPtr = NULL; char *tmp;
const char *retPtr = NULL;
int item; int item;
WMListItem *listItem; WMListItem *listItem;

View File

@@ -343,7 +343,7 @@ void WMFreeFilePanel(WMFilePanel * panel)
} }
int int
WMRunModalFilePanelForDirectory(WMFilePanel * panel, WMWindow * owner, char *path, const char *name, char **fileTypes) WMRunModalFilePanelForDirectory(WMFilePanel * panel, WMWindow * owner, const char *path, const char *name, char **fileTypes)
{ {
WMScreen *scr = WMWidgetScreen(panel->win); WMScreen *scr = WMWidgetScreen(panel->win);
@@ -387,12 +387,12 @@ WMRunModalFilePanelForDirectory(WMFilePanel * panel, WMWindow * owner, char *pat
return (panel->flags.canceled ? False : True); return (panel->flags.canceled ? False : True);
} }
void WMSetFilePanelDirectory(WMFilePanel * panel, char *path) void WMSetFilePanelDirectory(WMFilePanel * panel, const char *path)
{ {
WMList *list; WMList *list;
WMListItem *item; WMListItem *item;
int col; int col;
char *rest; const char *rest;
rest = WMSetBrowserPath(panel->browser, path); rest = WMSetBrowserPath(panel->browser, path);
if (strcmp(path, "/") == 0) if (strcmp(path, "/") == 0)
@@ -761,7 +761,7 @@ static void goFloppy(WMWidget *widget, void *p_panel)
static void goHome(WMWidget *widget, void *p_panel) static void goHome(WMWidget *widget, void *p_panel)
{ {
WMFilePanel *panel = p_panel; WMFilePanel *panel = p_panel;
char *home; const char *home;
/* Parameter not used, but tell the compiler that it is ok */ /* Parameter not used, but tell the compiler that it is ok */
(void) widget; (void) widget;