aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathias Gumz <akira@fluxbox.org>2015-01-16 09:52:00 (GMT)
committerMathias Gumz <akira@fluxbox.org>2015-01-16 09:52:00 (GMT)
commit772ec145952bfddc7888504f22859df1f24f8d5e (patch)
tree58356cf14f52792db6fda3c482a5b9865f711e56 /src
parente37cad714c77b24e4421f5dc1b3d01fe685b637a (diff)
downloadfluxbox-772ec145952bfddc7888504f22859df1f24f8d5e.zip
fluxbox-772ec145952bfddc7888504f22859df1f24f8d5e.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/FbWindow.cc8
-rw-r--r--src/FbTk/FbWindow.hh2
-rw-r--r--src/FbTk/MenuItem.hh16
-rw-r--r--src/FbTk/StringUtil.cc36
-rw-r--r--src/FbTk/TypeAhead.hh2
-rw-r--r--src/Screen.cc22
-rw-r--r--src/Slit.hh5
-rw-r--r--src/main.cc22
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 {
491}; 491};
492} 492}
493 493
494long FbWindow::cardinalProperty(Atom prop,bool*exists) const { 494long FbWindow::cardinalProperty(Atom prop, bool* exists) const {
495 Atom type; 495 Atom type;
496 int format; 496 int format;
497 unsigned long nitems, bytes_after; 497 unsigned long nitems, bytes_after;
@@ -549,10 +549,8 @@ FbTk::FbString FbWindow::textProperty(Atom prop,bool*exists) const {
549 ret = FbStringUtil::LocaleStrToFb(stringlist[0]); 549 ret = FbStringUtil::LocaleStrToFb(stringlist[0]);
550 } 550 }
551 551
552 // they all use stringlist 552 XFreeStringList(stringlist);
553 if (stringlist) { 553
554 XFreeStringList(stringlist);
555 }
556 if (exists) *exists=true; 554 if (exists) *exists=true;
557 return ret; 555 return ret;
558} 556}
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:
170 170
171 void deleteProperty(Atom property); 171 void deleteProperty(Atom property);
172 172
173 long cardinalProperty(Atom property,bool*exists=NULL) const; 173 long cardinalProperty(Atom property, bool*exists=NULL) const;
174 FbTk::FbString textProperty(Atom property,bool*exists=NULL) const; 174 FbTk::FbString textProperty(Atom property,bool*exists=NULL) const;
175 175
176 void addToSaveSet(); 176 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:
47 m_enabled(true), 47 m_enabled(true),
48 m_selected(false), 48 m_selected(false),
49 m_close_on_click(true), 49 m_close_on_click(true),
50 m_toggle_item(false) 50 m_toggle_item(false),
51 m_index(0)
51 { } 52 { }
53
52 explicit MenuItem(const BiDiString &label) 54 explicit MenuItem(const BiDiString &label)
53 : m_label(label), 55 : m_label(label),
54 m_menu(0), 56 m_menu(0),
@@ -56,7 +58,8 @@ public:
56 m_enabled(true), 58 m_enabled(true),
57 m_selected(false), 59 m_selected(false),
58 m_close_on_click(true), 60 m_close_on_click(true),
59 m_toggle_item(false) 61 m_toggle_item(false),
62 m_index(0)
60 { } 63 { }
61 64
62 MenuItem(const BiDiString &label, Menu &host_menu) 65 MenuItem(const BiDiString &label, Menu &host_menu)
@@ -66,7 +69,8 @@ public:
66 m_enabled(true), 69 m_enabled(true),
67 m_selected(false), 70 m_selected(false),
68 m_close_on_click(true), 71 m_close_on_click(true),
69 m_toggle_item(false) 72 m_toggle_item(false),
73 m_index(0)
70 { } 74 { }
71 /// create a menu item with a specific command to be executed on click 75 /// create a menu item with a specific command to be executed on click
72 MenuItem(const BiDiString &label, RefCount<Command<void> > &cmd, Menu *menu = 0) 76 MenuItem(const BiDiString &label, RefCount<Command<void> > &cmd, Menu *menu = 0)
@@ -77,7 +81,8 @@ public:
77 m_enabled(true), 81 m_enabled(true),
78 m_selected(false), 82 m_selected(false),
79 m_close_on_click(true), 83 m_close_on_click(true),
80 m_toggle_item(false) 84 m_toggle_item(false),
85 m_index(0)
81 { } 86 { }
82 87
83 MenuItem(const BiDiString &label, Menu *submenu, Menu *host_menu = 0) 88 MenuItem(const BiDiString &label, Menu *submenu, Menu *host_menu = 0)
@@ -87,7 +92,8 @@ public:
87 m_enabled(true), 92 m_enabled(true),
88 m_selected(false), 93 m_selected(false),
89 m_close_on_click(true), 94 m_close_on_click(true),
90 m_toggle_item(false) 95 m_toggle_item(false),
96 m_index(0)
91 { } 97 { }
92 virtual ~MenuItem() { } 98 virtual ~MenuItem() { }
93 99
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 @@
21 21
22#include "StringUtil.hh" 22#include "StringUtil.hh"
23 23
24#ifdef HAVE_CSTDIO 24#include <cstdio>
25 #include <cstdio> 25#include <cctype>
26#else 26#include <cassert>
27 #include <stdio.h> 27#include <cstring>
28#endif 28#include <cerrno>
29#ifdef HAVE_CSTDLIB
30 #include <cstdlib>
31#else
32 #include <stdlib.h>
33#endif
34#ifdef HAVE_CCTYPE
35 #include <cctype>
36#else
37 #include <ctype.h>
38#endif
39#ifdef HAVE_CASSERT
40 #include <cassert>
41#else
42 #include <assert.h>
43#endif
44#ifdef HAVE_CSTRING
45 #include <cstring>
46#else
47 #include <string.h>
48#endif
49
50#ifdef HAVE_CERRNO
51 #include <cerrno>
52#else
53 #include <errno.h>
54#endif
55 29
56#ifndef _WIN32 30#ifndef _WIN32
57#include <unistd.h> 31#include <unistd.h>
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:
72 typedef std::vector < SearchResult > SearchResults; 72 typedef std::vector < SearchResult > SearchResults;
73 typedef typename Items::const_iterator ItemscIt; 73 typedef typename Items::const_iterator ItemscIt;
74 74
75 TypeAhead() : m_ref(0) { }
76
75 void init(Items const &items) { m_ref = &items; } 77 void init(Items const &items) { m_ref = &items; }
76 78
77 size_t stringSize() const { return m_searchstr.size(); } 79 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 @@
34#include "FocusControl.hh" 34#include "FocusControl.hh"
35#include "ScreenPlacement.hh" 35#include "ScreenPlacement.hh"
36 36
37// menu items
38#include "FbTk/BoolMenuItem.hh"
39#include "FbTk/IntMenuItem.hh"
40#include "FbTk/MenuSeparator.hh"
41#include "FocusModelMenuItem.hh"
42#include "FbTk/RadioMenuItem.hh"
43
44// menus 37// menus
45#include "ConfigMenu.hh" 38#include "ConfigMenu.hh"
46#include "FbMenu.hh" 39#include "FbMenu.hh"
@@ -101,15 +94,11 @@ class Toolbar {};
101#include <unistd.h> 94#include <unistd.h>
102#endif // HAVE_UNISTD_H 95#endif // HAVE_UNISTD_H
103 96
104#ifdef HAVE_STDARG_H
105#include <stdarg.h>
106#endif // HAVE_STDARG_H
107
108#ifdef TIME_WITH_SYS_TIME 97#ifdef TIME_WITH_SYS_TIME
109#include <sys/time.h> 98#include <sys/time.h>
110#include <time.h> 99#include <time.h>
111#else // !TIME_WITH_SYS_TIME 100#else // !TIME_WITH_SYS_TIME
112#ifdef HAVE_SYS_TIME_H 101#ifdef HAVE_SYS_TIME_H
113#include <sys/time.h> 102#include <sys/time.h>
114#else // !HAVE_SYS_TIME_H 103#else // !HAVE_SYS_TIME_H
115#include <time.h> 104#include <time.h>
@@ -134,11 +123,8 @@ extern "C" {
134#include <algorithm> 123#include <algorithm>
135#include <functional> 124#include <functional>
136#include <stack> 125#include <stack>
137#ifdef HAVE_CSTRING 126#include <cstdarg>
138 #include <cstring> 127#include <cstring>
139#else
140 #include <string.h>
141#endif
142 128
143using std::cerr; 129using std::cerr;
144using std::endl; 130using std::endl;
@@ -205,7 +191,9 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
205 const string &altscreenname, 191 const string &altscreenname,
206 int scrn, int num_layers) : 192 int scrn, int num_layers) :
207 m_layermanager(num_layers), 193 m_layermanager(num_layers),
194 root_colormap_installed(false),
208 m_image_control(0), 195 m_image_control(0),
196 m_current_workspace(0),
209 m_focused_windowtheme(new FbWinFrameTheme(scrn, ".focus", ".Focus")), 197 m_focused_windowtheme(new FbWinFrameTheme(scrn, ".focus", ".Focus")),
210 m_unfocused_windowtheme(new FbWinFrameTheme(scrn, ".unfocus", ".Unfocus")), 198 m_unfocused_windowtheme(new FbWinFrameTheme(scrn, ".unfocus", ".Unfocus")),
211 // the order of windowtheme and winbutton theme is important 199 // 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:
158 158
159 struct frame { 159 struct frame {
160 frame(const FbTk::FbWindow &parent): 160 frame(const FbTk::FbWindow &parent):
161 pixmap(0),
161 window(parent, 0, 0, 10, 10, 162 window(parent, 0, 0, 10, 10,
162 SubstructureRedirectMask | ButtonPressMask | 163 SubstructureRedirectMask | ButtonPressMask |
163 EnterWindowMask | LeaveWindowMask | ExposureMask, 164 EnterWindowMask | LeaveWindowMask | ExposureMask,
164 true), // override redirect 165 true), // override redirect
165 x(0), y(0), x_hidden(0), y_hidden(0), 166 x(0), y(0), x_hidden(0), y_hidden(0),
166 width(10), height(10) {} 167 width(10), height(10) { }
168
167 Pixmap pixmap; 169 Pixmap pixmap;
168 FbTk::FbWindow window; 170 FbTk::FbWindow window;
169
170 int x, y, x_hidden, y_hidden; 171 int x, y, x_hidden, y_hidden;
171 unsigned int width, height; 172 unsigned int width, height;
172 } frame; 173 } 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 @@
33#define _GNU_SOURCE 33#define _GNU_SOURCE
34#endif // _GNU_SOURCE 34#endif // _GNU_SOURCE
35 35
36#ifdef HAVE_CSTDLIB
37 #include <cstdlib>
38#else
39 #include <stdlib.h>
40#endif
41
42#ifdef HAVE_CSTRING
43 #include <cstring>
44#else
45 #include <string.h>
46#endif
47
48#ifdef HAVE_UNISTD_H 36#ifdef HAVE_UNISTD_H
49 #include <unistd.h> 37#include <unistd.h>
50#endif 38#endif
51 39
52#ifdef HAVE_SYS_WAIT_H 40#ifdef HAVE_SYS_WAIT_H
@@ -58,6 +46,8 @@
58#endif 46#endif
59 47
60 48
49#include <cstdlib>
50#include <cstring>
61#include <iostream> 51#include <iostream>
62#include <stdexcept> 52#include <stdexcept>
63#include <typeinfo> 53#include <typeinfo>
@@ -290,9 +280,9 @@ int main(int argc, char **argv) {
290 execvp(argv[0], argv); 280 execvp(argv[0], argv);
291 perror(argv[0]); 281 perror(argv[0]);
292 282
293 const char *basename = FbTk::StringUtil::basename(argv[0]).c_str(); 283 const std::string basename = FbTk::StringUtil::basename(argv[0]);
294 execvp(basename, argv); 284 execvp(basename.c_str(), argv);
295 perror(basename); 285 perror(basename.c_str());
296 } 286 }
297 287
298 return exitcode; 288 return exitcode;