Set warnings as errors.
Const correct massaging to lose the couple warnings that were there.
This commit is contained in:
parent
5cfb5bf2e7
commit
30e2e57a58
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
2017-09-30 Michael Small <smallm@sdf.org>
|
||||||
|
|
||||||
|
* src/Makefile.am (AM_CFLAGS): warnings as errors.
|
||||||
|
* src/menus.c (ExecuteFunction): ptr as const char* to prevent const
|
||||||
|
qualifier discard warnings when passed const char* action.
|
||||||
|
* src/util.c (ExpandFilename): use const char* for arg and return value.
|
||||||
|
(FindBitmap): cast return val of ExpandFilename to char* for bigname.
|
||||||
|
Should be harmless since it's used as constant data up to it being
|
||||||
|
assigned something else.
|
||||||
|
(GetFont): Similar case here but without ExpandFilename being involved.
|
||||||
|
* src/screen.h (ScreenInfo): IconDirectory can be const char* too,
|
||||||
|
avoiding warning in parse.c:771.
|
||||||
|
|
||||||
2017-09-27 Michael Small <smallm@sdf.org>
|
2017-09-27 Michael Small <smallm@sdf.org>
|
||||||
|
|
||||||
Preliminaries:
|
Preliminaries:
|
||||||
|
@ -32,7 +32,7 @@ AM_CPPFLAGS = \
|
|||||||
-DXORG_RELEASE=\"Release\ $(VERSION)\" \
|
-DXORG_RELEASE=\"Release\ $(VERSION)\" \
|
||||||
-DSYSTEM_INIT_FILE=\"${datadir}/X11/twmruined/system.twmruinedrc\"
|
-DSYSTEM_INIT_FILE=\"${datadir}/X11/twmruined/system.twmruinedrc\"
|
||||||
|
|
||||||
AM_CFLAGS = $(TWM_CFLAGS)
|
AM_CFLAGS = -Werror $(TWM_CFLAGS)
|
||||||
twmruined_LDADD = $(TWM_LIBS)
|
twmruined_LDADD = $(TWM_LIBS)
|
||||||
|
|
||||||
twmruined_SOURCES = \
|
twmruined_SOURCES = \
|
||||||
|
@ -366,7 +366,7 @@ AM_CPPFLAGS = \
|
|||||||
-DXORG_RELEASE=\"Release\ $(VERSION)\" \
|
-DXORG_RELEASE=\"Release\ $(VERSION)\" \
|
||||||
-DSYSTEM_INIT_FILE=\"${datadir}/X11/twmruined/system.twmruinedrc\"
|
-DSYSTEM_INIT_FILE=\"${datadir}/X11/twmruined/system.twmruinedrc\"
|
||||||
|
|
||||||
AM_CFLAGS = $(TWM_CFLAGS)
|
AM_CFLAGS = -Werror $(TWM_CFLAGS)
|
||||||
twmruined_LDADD = $(TWM_LIBS)
|
twmruined_LDADD = $(TWM_LIBS)
|
||||||
twmruined_SOURCES = \
|
twmruined_SOURCES = \
|
||||||
add_window.c \
|
add_window.c \
|
||||||
|
10
src/menus.c
10
src/menus.c
@ -1293,7 +1293,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
{
|
{
|
||||||
static Time last_time = 0;
|
static Time last_time = 0;
|
||||||
char tmp[200];
|
char tmp[200];
|
||||||
char *ptr;
|
const char *ptr;
|
||||||
char buff[MAX_FILE_SIZE];
|
char buff[MAX_FILE_SIZE];
|
||||||
int count, fd;
|
int count, fd;
|
||||||
Window rootw;
|
Window rootw;
|
||||||
@ -2007,7 +2007,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
ptr = XFetchBytes(dpy, &count);
|
ptr = XFetchBytes(dpy, &count);
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
if (sscanf(ptr, "%s", tmp) == 1) {
|
if (sscanf(ptr, "%s", tmp) == 1) {
|
||||||
XFree (ptr);
|
XFree((void*)ptr);
|
||||||
ptr = ExpandFilename(tmp);
|
ptr = ExpandFilename(tmp);
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
fd = open(ptr, O_RDONLY);
|
fd = open(ptr, O_RDONLY);
|
||||||
@ -2020,10 +2020,10 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
"%s: unable to open cut file \"%s\"\n",
|
"%s: unable to open cut file \"%s\"\n",
|
||||||
ProgramName, tmp);
|
ProgramName, tmp);
|
||||||
}
|
}
|
||||||
if (ptr != tmp) free (ptr);
|
if (ptr != tmp) free((void*)ptr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
XFree(ptr);
|
XFree((void*)ptr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s: cut buffer is empty\n", ProgramName);
|
fprintf(stderr, "%s: cut buffer is empty\n", ProgramName);
|
||||||
@ -2185,7 +2185,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
fprintf (stderr, "%s: unable to open file \"%s\"\n",
|
fprintf (stderr, "%s: unable to open file \"%s\"\n",
|
||||||
ProgramName, ptr);
|
ProgramName, ptr);
|
||||||
}
|
}
|
||||||
if (ptr != action) free(ptr);
|
if (ptr != action) free((void*)ptr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_REFRESH:
|
case F_REFRESH:
|
||||||
|
@ -195,7 +195,7 @@ typedef struct ScreenInfo
|
|||||||
IconMgr iconmgr; /* default icon manager */
|
IconMgr iconmgr; /* default icon manager */
|
||||||
struct IconRegion *FirstRegion; /* pointer to icon regions */
|
struct IconRegion *FirstRegion; /* pointer to icon regions */
|
||||||
struct IconRegion *LastRegion; /* pointer to the last icon region */
|
struct IconRegion *LastRegion; /* pointer to the last icon region */
|
||||||
char *IconDirectory; /* icon directory to search */
|
const char *IconDirectory; /* icon directory to search */
|
||||||
int SizeStringOffset; /* x offset in size window for drawing */
|
int SizeStringOffset; /* x offset in size window for drawing */
|
||||||
int SizeStringWidth; /* minimum width of size window */
|
int SizeStringWidth; /* minimum width of size window */
|
||||||
int BorderWidth; /* border width of twm windows */
|
int BorderWidth; /* border width of twm windows */
|
||||||
|
@ -255,8 +255,8 @@ Zoom(Window wf, Window wt)
|
|||||||
*
|
*
|
||||||
* \param name the filename to expand
|
* \param name the filename to expand
|
||||||
*/
|
*/
|
||||||
char *
|
const char *
|
||||||
ExpandFilename(char *name)
|
ExpandFilename(const char *name)
|
||||||
{
|
{
|
||||||
char *newname;
|
char *newname;
|
||||||
|
|
||||||
@ -341,7 +341,7 @@ FindBitmap (const char *name, unsigned *widthp, unsigned *heightp)
|
|||||||
* are used. If the bigname is different from name, bigname will need to
|
* are used. If the bigname is different from name, bigname will need to
|
||||||
* be freed.
|
* be freed.
|
||||||
*/
|
*/
|
||||||
bigname = ExpandFilename (name);
|
bigname = (char*)ExpandFilename(name);
|
||||||
if (!bigname) return None;
|
if (!bigname) return None;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -598,7 +598,7 @@ GetFont(MyFont *font)
|
|||||||
|
|
||||||
basename2 = malloc(strlen(font->name) + 3);
|
basename2 = malloc(strlen(font->name) + 3);
|
||||||
if (basename2) sprintf(basename2, "%s,*", font->name);
|
if (basename2) sprintf(basename2, "%s,*", font->name);
|
||||||
else basename2 = font->name;
|
else basename2 = (char*)font->name;
|
||||||
if( (font->fontset = XCreateFontSet(dpy, basename2,
|
if( (font->fontset = XCreateFontSet(dpy, basename2,
|
||||||
&missing_charset_list_return,
|
&missing_charset_list_return,
|
||||||
&missing_charset_count_return,
|
&missing_charset_count_return,
|
||||||
|
@ -64,7 +64,7 @@ in this Software without prior written authorization from The Open Group.
|
|||||||
extern void MoveOutline ( Window root, int x, int y, int width, int height,
|
extern void MoveOutline ( Window root, int x, int y, int width, int height,
|
||||||
int bw, int th );
|
int bw, int th );
|
||||||
extern void Zoom ( Window wf, Window wt );
|
extern void Zoom ( Window wf, Window wt );
|
||||||
extern char * ExpandFilename ( char *name );
|
extern const char * ExpandFilename ( const char *name );
|
||||||
extern void GetUnknownIcon ( const char *name );
|
extern void GetUnknownIcon ( const char *name );
|
||||||
extern Pixmap FindBitmap ( const char *name, unsigned int *widthp,
|
extern Pixmap FindBitmap ( const char *name, unsigned int *widthp,
|
||||||
unsigned int *heightp );
|
unsigned int *heightp );
|
||||||
|
Loading…
Reference in New Issue
Block a user