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.
This commit is contained in:
Mathias Gumz 2015-01-16 10:52:00 +01:00
parent e37cad714c
commit 772ec14595
8 changed files with 36 additions and 77 deletions

View file

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

View file

@ -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();

View file

@ -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<Command<void> > &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() { }

View file

@ -21,37 +21,11 @@
#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>

View file

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

View file

@ -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 <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 @@ extern "C" {
#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 @@ 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

View file

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

View file

@ -33,20 +33,8 @@
#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 @@
#endif
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <stdexcept>
#include <typeinfo>
@ -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;