all repos — fluxbox @ 772ec145952bfddc7888504f22859df1f24f8d5e

custom fork of the fluxbox windowmanager

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 <algorithm> etc. This
should trim down the noise in the source quite a bit.
Mathias Gumz akira@fluxbox.org
commit

772ec145952bfddc7888504f22859df1f24f8d5e

parent

e37cad714c77b24e4421f5dc1b3d01fe685b637a

M src/FbTk/FbWindow.ccsrc/FbTk/FbWindow.cc

@@ -491,7 +491,7 @@ XTextProperty& m_prop;

}; } -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 @@ }

ret = FbStringUtil::LocaleStrToFb(stringlist[0]); } - // they all use stringlist - if (stringlist) { - XFreeStringList(stringlist); - } + XFreeStringList(stringlist); + if (exists) *exists=true; return ret; }
M src/FbTk/FbWindow.hhsrc/FbTk/FbWindow.hh

@@ -170,7 +170,7 @@ int nelements);

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();
M src/FbTk/MenuItem.hhsrc/FbTk/MenuItem.hh

@@ -47,8 +47,10 @@ m_submenu(0),

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 @@ m_submenu(0),

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 @@ m_submenu(0),

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<Command<void> > &cmd, Menu *menu = 0)

@@ -77,7 +81,8 @@ m_command(cmd),

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 @@ m_submenu(submenu),

m_enabled(true), m_selected(false), m_close_on_click(true), - m_toggle_item(false) + m_toggle_item(false), + m_index(0) { } virtual ~MenuItem() { }
M src/FbTk/StringUtil.ccsrc/FbTk/StringUtil.cc

@@ -21,37 +21,11 @@ // DEALINGS IN THE SOFTWARE.

#include "StringUtil.hh" -#ifdef HAVE_CSTDIO - #include <cstdio> -#else - #include <stdio.h> -#endif -#ifdef HAVE_CSTDLIB - #include <cstdlib> -#else - #include <stdlib.h> -#endif -#ifdef HAVE_CCTYPE - #include <cctype> -#else - #include <ctype.h> -#endif -#ifdef HAVE_CASSERT - #include <cassert> -#else - #include <assert.h> -#endif -#ifdef HAVE_CSTRING - #include <cstring> -#else - #include <string.h> -#endif - -#ifdef HAVE_CERRNO - #include <cerrno> -#else - #include <errno.h> -#endif +#include <cstdio> +#include <cctype> +#include <cassert> +#include <cstring> +#include <cerrno> #ifndef _WIN32 #include <unistd.h>
M src/FbTk/TypeAhead.hhsrc/FbTk/TypeAhead.hh

@@ -72,6 +72,8 @@ typedef BaseItems::const_iterator BaseItemscIt;

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(); }
M src/Screen.ccsrc/Screen.cc

@@ -34,13 +34,6 @@ #include "Layer.hh"

#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"

@@ -100,16 +93,12 @@ #ifdef HAVE_UNISTD_H

#include <sys/types.h> #include <unistd.h> #endif // HAVE_UNISTD_H - -#ifdef HAVE_STDARG_H -#include <stdarg.h> -#endif // HAVE_STDARG_H #ifdef TIME_WITH_SYS_TIME #include <sys/time.h> #include <time.h> #else // !TIME_WITH_SYS_TIME -#ifdef HAVE_SYS_TIME_H +#ifdef HAVE_SYS_TIME_H #include <sys/time.h> #else // !HAVE_SYS_TIME_H #include <time.h>

@@ -134,11 +123,8 @@ #include <iostream>

#include <algorithm> #include <functional> #include <stack> -#ifdef HAVE_CSTRING - #include <cstring> -#else - #include <string.h> -#endif +#include <cstdarg> +#include <cstring> using std::cerr; using std::endl;

@@ -205,7 +191,9 @@ const string &screenname,

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
M src/Slit.hhsrc/Slit.hh

@@ -158,15 +158,16 @@ std::string m_filename;

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;
M src/main.ccsrc/main.cc

@@ -33,20 +33,8 @@ #ifndef _GNU_SOURCE

#define _GNU_SOURCE #endif // _GNU_SOURCE -#ifdef HAVE_CSTDLIB - #include <cstdlib> -#else - #include <stdlib.h> -#endif - -#ifdef HAVE_CSTRING - #include <cstring> -#else - #include <string.h> -#endif - #ifdef HAVE_UNISTD_H - #include <unistd.h> +#include <unistd.h> #endif #ifdef HAVE_SYS_WAIT_H

@@ -58,6 +46,8 @@ #include <signal.h>

#endif +#include <cstdlib> +#include <cstring> #include <iostream> #include <stdexcept> #include <typeinfo>

@@ -290,9 +280,9 @@ // fall back in case the above execlp doesn't work

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;