From 772ec145952bfddc7888504f22859df1f24f8d5e Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Fri, 16 Jan 2015 10:52:00 +0100 Subject: Fix uninitialized variables; cosmetics Note: I expect only modern compilers will hit the source of fluxbox. It seems futile to guard stdlib headers while demanding etc. This should trim down the noise in the source quite a bit. --- src/FbTk/FbWindow.cc | 8 +++----- src/FbTk/FbWindow.hh | 2 +- src/FbTk/MenuItem.hh | 16 +++++++++++----- src/FbTk/StringUtil.cc | 36 +++++------------------------------- src/FbTk/TypeAhead.hh | 2 ++ src/Screen.cc | 22 +++++----------------- src/Slit.hh | 5 +++-- src/main.cc | 22 ++++++---------------- 8 files changed, 36 insertions(+), 77 deletions(-) diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc index fb1c7af..1930d4e 100644 --- a/src/FbTk/FbWindow.cc +++ b/src/FbTk/FbWindow.cc @@ -491,7 +491,7 @@ struct TextPropPtr { }; } -long FbWindow::cardinalProperty(Atom prop,bool*exists) const { +long FbWindow::cardinalProperty(Atom prop, bool* exists) const { Atom type; int format; unsigned long nitems, bytes_after; @@ -549,10 +549,8 @@ FbTk::FbString FbWindow::textProperty(Atom prop,bool*exists) const { ret = FbStringUtil::LocaleStrToFb(stringlist[0]); } - // they all use stringlist - if (stringlist) { - XFreeStringList(stringlist); - } + XFreeStringList(stringlist); + if (exists) *exists=true; return ret; } diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh index 3e1c05b..4b6b02f 100644 --- a/src/FbTk/FbWindow.hh +++ b/src/FbTk/FbWindow.hh @@ -170,7 +170,7 @@ public: void deleteProperty(Atom property); - long cardinalProperty(Atom property,bool*exists=NULL) const; + long cardinalProperty(Atom property, bool*exists=NULL) const; FbTk::FbString textProperty(Atom property,bool*exists=NULL) const; void addToSaveSet(); diff --git a/src/FbTk/MenuItem.hh b/src/FbTk/MenuItem.hh index 2149559..320d065 100644 --- a/src/FbTk/MenuItem.hh +++ b/src/FbTk/MenuItem.hh @@ -47,8 +47,10 @@ public: m_enabled(true), m_selected(false), m_close_on_click(true), - m_toggle_item(false) + m_toggle_item(false), + m_index(0) { } + explicit MenuItem(const BiDiString &label) : m_label(label), m_menu(0), @@ -56,7 +58,8 @@ public: m_enabled(true), m_selected(false), m_close_on_click(true), - m_toggle_item(false) + m_toggle_item(false), + m_index(0) { } MenuItem(const BiDiString &label, Menu &host_menu) @@ -66,7 +69,8 @@ public: m_enabled(true), m_selected(false), m_close_on_click(true), - m_toggle_item(false) + m_toggle_item(false), + m_index(0) { } /// create a menu item with a specific command to be executed on click MenuItem(const BiDiString &label, RefCount > &cmd, Menu *menu = 0) @@ -77,7 +81,8 @@ public: m_enabled(true), m_selected(false), m_close_on_click(true), - m_toggle_item(false) + m_toggle_item(false), + m_index(0) { } MenuItem(const BiDiString &label, Menu *submenu, Menu *host_menu = 0) @@ -87,7 +92,8 @@ public: m_enabled(true), m_selected(false), m_close_on_click(true), - m_toggle_item(false) + m_toggle_item(false), + m_index(0) { } virtual ~MenuItem() { } diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc index d6f2c8f..63da383 100644 --- a/src/FbTk/StringUtil.cc +++ b/src/FbTk/StringUtil.cc @@ -21,37 +21,11 @@ #include "StringUtil.hh" -#ifdef HAVE_CSTDIO - #include -#else - #include -#endif -#ifdef HAVE_CSTDLIB - #include -#else - #include -#endif -#ifdef HAVE_CCTYPE - #include -#else - #include -#endif -#ifdef HAVE_CASSERT - #include -#else - #include -#endif -#ifdef HAVE_CSTRING - #include -#else - #include -#endif - -#ifdef HAVE_CERRNO - #include -#else - #include -#endif +#include +#include +#include +#include +#include #ifndef _WIN32 #include diff --git a/src/FbTk/TypeAhead.hh b/src/FbTk/TypeAhead.hh index 289587a..119e3af 100644 --- a/src/FbTk/TypeAhead.hh +++ b/src/FbTk/TypeAhead.hh @@ -72,6 +72,8 @@ public: typedef std::vector < SearchResult > SearchResults; typedef typename Items::const_iterator ItemscIt; + TypeAhead() : m_ref(0) { } + void init(Items const &items) { m_ref = &items; } size_t stringSize() const { return m_searchstr.size(); } diff --git a/src/Screen.cc b/src/Screen.cc index 6ddcded..b321d85 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -34,13 +34,6 @@ #include "FocusControl.hh" #include "ScreenPlacement.hh" -// menu items -#include "FbTk/BoolMenuItem.hh" -#include "FbTk/IntMenuItem.hh" -#include "FbTk/MenuSeparator.hh" -#include "FocusModelMenuItem.hh" -#include "FbTk/RadioMenuItem.hh" - // menus #include "ConfigMenu.hh" #include "FbMenu.hh" @@ -101,15 +94,11 @@ class Toolbar {}; #include #endif // HAVE_UNISTD_H -#ifdef HAVE_STDARG_H -#include -#endif // HAVE_STDARG_H - #ifdef TIME_WITH_SYS_TIME #include #include #else // !TIME_WITH_SYS_TIME -#ifdef HAVE_SYS_TIME_H +#ifdef HAVE_SYS_TIME_H #include #else // !HAVE_SYS_TIME_H #include @@ -134,11 +123,8 @@ extern "C" { #include #include #include -#ifdef HAVE_CSTRING - #include -#else - #include -#endif +#include +#include using std::cerr; using std::endl; @@ -205,7 +191,9 @@ BScreen::BScreen(FbTk::ResourceManager &rm, const string &altscreenname, int scrn, int num_layers) : m_layermanager(num_layers), + root_colormap_installed(false), m_image_control(0), + m_current_workspace(0), m_focused_windowtheme(new FbWinFrameTheme(scrn, ".focus", ".Focus")), m_unfocused_windowtheme(new FbWinFrameTheme(scrn, ".unfocus", ".Unfocus")), // the order of windowtheme and winbutton theme is important diff --git a/src/Slit.hh b/src/Slit.hh index 5753565..92eac35 100644 --- a/src/Slit.hh +++ b/src/Slit.hh @@ -158,15 +158,16 @@ private: struct frame { frame(const FbTk::FbWindow &parent): + pixmap(0), window(parent, 0, 0, 10, 10, SubstructureRedirectMask | ButtonPressMask | EnterWindowMask | LeaveWindowMask | ExposureMask, true), // override redirect x(0), y(0), x_hidden(0), y_hidden(0), - width(10), height(10) {} + width(10), height(10) { } + Pixmap pixmap; FbTk::FbWindow window; - int x, y, x_hidden, y_hidden; unsigned int width, height; } frame; diff --git a/src/main.cc b/src/main.cc index 92d04ce..66a5adb 100644 --- a/src/main.cc +++ b/src/main.cc @@ -33,20 +33,8 @@ #define _GNU_SOURCE #endif // _GNU_SOURCE -#ifdef HAVE_CSTDLIB - #include -#else - #include -#endif - -#ifdef HAVE_CSTRING - #include -#else - #include -#endif - #ifdef HAVE_UNISTD_H - #include +#include #endif #ifdef HAVE_SYS_WAIT_H @@ -58,6 +46,8 @@ #endif +#include +#include #include #include #include @@ -290,9 +280,9 @@ int main(int argc, char **argv) { execvp(argv[0], argv); perror(argv[0]); - const char *basename = FbTk::StringUtil::basename(argv[0]).c_str(); - execvp(basename, argv); - perror(basename); + const std::string basename = FbTk::StringUtil::basename(argv[0]); + execvp(basename.c_str(), argv); + perror(basename.c_str()); } return exitcode; -- cgit v0.11.2