From 2b99cfe8877cabb059ff1d5129bd7227a34855d5 Mon Sep 17 00:00:00 2001 From: Arjen Baart Date: Thu, 2 May 2019 19:42:30 +0200 Subject: [PATCH] Fixed compiler warnings --- demos/timesheet.cpp | 2 +- src/Makefile.am | 2 +- src/String.h | 2 +- src/button.h | 8 ++++---- src/color.h | 2 +- src/font.h | 4 ++-- src/frame.h | 4 ++-- src/parsedate.c | 7 ++++--- src/xappl.cpp | 5 ++++- src/xwindow.cpp | 2 +- src/xwindow.h | 2 +- 11 files changed, 22 insertions(+), 18 deletions(-) diff --git a/demos/timesheet.cpp b/demos/timesheet.cpp index fc34ecf..82f03fc 100644 --- a/demos/timesheet.cpp +++ b/demos/timesheet.cpp @@ -1,4 +1,4 @@ -#include +#include "date.h" class activity { diff --git a/src/Makefile.am b/src/Makefile.am index 80fbaf2..10b96ab 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,8 +6,8 @@ lib_LIBRARIES = libAXE.a libAXE_a_SOURCES = xappl.cpp xwindow.cpp font.cpp menu.cpp frame.cpp \ filedialog.cpp \ - parsedate.c datelex.c dateyacc.y \ button.cpp edit.cpp scroll.cpp table.cpp geometry.cpp icon.cpp \ + parsedate.c datelex.c dateyacc.y \ string.cpp regex.cpp integer.cpp date.cpp hour.cpp utc.cpp \ amount.cpp out.cpp \ configuration.cpp diff --git a/src/String.h b/src/String.h index 6369fa8..a9b7177 100644 --- a/src/String.h +++ b/src/String.h @@ -351,7 +351,7 @@ class substring public: String& operator=(const String &); - String& operator=(char *s) + String& operator=(const char *s) { *this = String(s); return *str; diff --git a/src/button.h b/src/button.h index 25d02c8..61f80cb 100644 --- a/src/button.h +++ b/src/button.h @@ -54,7 +54,7 @@ class button : public frame public: - button(window &par, int x, int y,char *label) : frame(par, x, y, label) + button(window &par, int x, int y, const char label[]) : frame(par, x, y, label) { SelectInput(ButtonReleaseMask|ButtonPressMask, 1); } @@ -77,7 +77,7 @@ class touch_button : public button public: - touch_button(window &par, int x, int y, char *label) + touch_button(window &par, int x, int y, const char label[]) : button(par, x, y, label) { } @@ -95,7 +95,7 @@ class toggle_button : public touch_button public: - toggle_button(window &par, int x, int y, char *label) + toggle_button(window &par, int x, int y, const char label[]) : touch_button(par, x, y, label) { state = State_Off; @@ -112,7 +112,7 @@ class command_button : public button public: - command_button(window &par, int x, int y, char *label, int cc = 0) + command_button(window &par, int x, int y, const char label[], int cc = 0) : button(par, x, y, label) { command_code = cc; diff --git a/src/color.h b/src/color.h index e0f4852..f52a290 100644 --- a/src/color.h +++ b/src/color.h @@ -70,7 +70,7 @@ public: XAllocColor(stddpy, stddpy.ColMap(), &xcol); } - color(char *colorname) + color(const char colorname[]) { XColor exact; diff --git a/src/font.h b/src/font.h index c4455d9..401f28c 100644 --- a/src/font.h +++ b/src/font.h @@ -65,7 +65,7 @@ public: fs = 0; } - font(char *name) + font(const char name[]) { fs = XLoadQueryFont(stddpy.Dpy(), name); if (fs == NULL) @@ -85,7 +85,7 @@ public: return fs != 0; } - void Load(char *name) + void Load(const char name[]) { if (fs) XFreeFont(stddpy.Dpy(), fs); diff --git a/src/frame.h b/src/frame.h index f7242c1..29f4080 100644 --- a/src/frame.h +++ b/src/frame.h @@ -70,7 +70,7 @@ enum ver_alignment { Top, Middle, Bottom }; class frame : public window { - char *text; + const char *text; hor_alignment halign; ver_alignment valign; @@ -98,7 +98,7 @@ public: SelectInput(ExposureMask, 1); } - frame(window &par, int x, int y, char *t) : window(par, x, y, 80, 30) + frame(window &par, int x, int y, const char t[]) : window(par, x, y, 80, 30) { Background(inside_3D); strength = 5; diff --git a/src/parsedate.c b/src/parsedate.c index 61de4b1..dd83de4 100644 --- a/src/parsedate.c +++ b/src/parsedate.c @@ -58,13 +58,14 @@ */ #include +#include #include "parsedate.h" static char *RCSID = "$Id: parsedate.c,v 1.2 2002-09-28 06:58:45 arjen Exp $"; extern int yyparse(); -compute_unixtime (register struct parseddate *pd); +void compute_unixtime (register struct parseddate *pd); /* Number of seconds in various time intervals. */ #define SEC_PER_MIN 60 @@ -141,7 +142,7 @@ struct parseddate * parsedate (char *date) * far future may turn out to be incorrect if any changes are made * to the calendar between now and then. */ -compute_unixtime (register struct parseddate *pd) +void compute_unixtime (register struct parseddate *pd) { register int weekday, n, l, a; @@ -206,7 +207,7 @@ compute_unixtime (register struct parseddate *pd) * ute", "second", and "weekday" fields. The "dst" and "error" * fields of the structure are not used or modified. */ -break_down_unixtime (pd) +void break_down_unixtime (pd) register struct parseddate *pd; { register unsigned long timevalue; register int m, n; diff --git a/src/xappl.cpp b/src/xappl.cpp index 684bbba..67fa65b 100644 --- a/src/xappl.cpp +++ b/src/xappl.cpp @@ -36,10 +36,13 @@ static const char *RCSID = "$Id: xappl.cpp,v 1.1 2002-07-25 08:01:27 arjen Exp $ static char dim_bits[] = { - 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA + '\x55', '\xAA', '\x55', '\xAA', '\x55', '\xAA', '\x55', '\xAA' }; +extern "C" +{ #include "nopicture.xpm" +} xapplication *XApp; display stddpy; diff --git a/src/xwindow.cpp b/src/xwindow.cpp index cc6aae9..19d9225 100644 --- a/src/xwindow.cpp +++ b/src/xwindow.cpp @@ -332,7 +332,7 @@ int window::ParentResized(int w, int h) confused with event masks above. They start from 2 because 0 and 1 are reserved in the protocol for errors and replies. */ -static char * event_names[] = +static const char *event_names[] = { " Undefined(0)", " Undefined(1)", diff --git a/src/xwindow.h b/src/xwindow.h index 36f8e42..b3471a8 100644 --- a/src/xwindow.h +++ b/src/xwindow.h @@ -333,7 +333,7 @@ public: } - managed_window(char *name) + managed_window(const char name[]) { WM_Delete_Command = 0; Atom wm_delete; -- 2.11.0