1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-25 16:02:33 +01:00

Remove warnings

* Remove assigned but not used variables (GCC 4.6)
* Bump _XOPEN_SOURCE to 600, ridding of FreeBSD warnings (this probably need
  to be tweaked on a per-implementation basis as problems arise)
This commit is contained in:
Tamas TEVESZ
2011-03-24 16:07:20 +01:00
committed by Carlos R. Mafra
parent 43c7abe79f
commit f65b99e615
45 changed files with 83 additions and 174 deletions

View File

@@ -377,7 +377,6 @@ WApplication *wApplicationCreate(WWindow * wwin)
void wApplicationDestroy(WApplication * wapp)
{
Window main_window;
WWindow *wwin;
WScreen *scr;
@@ -400,7 +399,6 @@ void wApplicationDestroy(WApplication * wapp)
}
scr = wapp->main_window_desc->screen_ptr;
main_window = wapp->main_window;
if (wapp == scr->wapp_list) {
if (wapp->next)

View File

@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include <time.h>
#include <sys/types.h>
@@ -1009,14 +1010,12 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
{
WMPropList *plvalue, *old_value;
WDefaultEntry *entry;
unsigned int i, must_update;
unsigned int i;
int update_workspace_back = 0; /* kluge :/ */
unsigned int needs_refresh;
void *tdata;
WMPropList *old_dict = (WDWindowMaker->dictionary != new_dict ? WDWindowMaker->dictionary : NULL);
must_update = 0;
needs_refresh = 0;
for (i = 0; i < sizeof(optionList) / sizeof(WDefaultEntry); i++) {
@@ -1037,7 +1036,6 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
plvalue = entry->plvalue;
if (plvalue && new_dict) {
WMPutInPLDictionary(new_dict, entry->plkey, plvalue);
must_update = 1;
}
} else if (!plvalue) {
/* value was deleted from DB. Keep current value */

View File

@@ -808,7 +808,6 @@ static void keyPressHandler(XEvent * event, void *data)
{
IconPanel *panel = (IconPanel *) data;
char buffer[32];
int count;
KeySym ksym;
int iidx;
int didx;
@@ -819,7 +818,7 @@ static void keyPressHandler(XEvent * event, void *data)
return;
buffer[0] = 0;
count = XLookupString(&event->xkey, buffer, sizeof(buffer), &ksym, NULL);
XLookupString(&event->xkey, buffer, sizeof(buffer), &ksym, NULL);
iidx = WMGetListSelectedItemRow(panel->iconList);
didx = WMGetListSelectedItemRow(panel->dirList);
@@ -1103,7 +1102,6 @@ void wShowInfoPanel(WScreen * scr)
{
InfoPanel *panel;
WMPixmap *logo;
WMSize size;
WMFont *font;
char *strbuf = NULL;
char buffer[256];
@@ -1142,7 +1140,6 @@ void wShowInfoPanel(WScreen * scr)
logo = WMRetainPixmap(WMGetApplicationIconPixmap(scr->wmscreen));
}
if (logo) {
size = WMGetPixmapSize(logo);
panel->logoL = WMCreateLabel(panel->win);
WMResizeWidget(panel->logoL, 64, 64);
WMMoveWidget(panel->logoL, 30, 20);

View File

@@ -26,6 +26,7 @@
#include <X11/Xutil.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <math.h>
#include <limits.h>
@@ -2262,10 +2263,9 @@ Bool wDockSnapIcon(WDock * dock, WAppIcon * icon, int req_x, int req_y, int *ret
int i, offset = ICON_SIZE / 2;
WAppIcon *aicon = NULL;
WAppIcon *nicon = NULL;
int max_y_icons, max_x_icons;
int max_y_icons;
/* TODO: XINERAMA, for these */
max_x_icons = scr->scr_width / ICON_SIZE;
max_y_icons = scr->scr_height / ICON_SIZE - 1;
if (wPreferences.flags.noupdates)

View File

@@ -22,6 +22,7 @@
#include "wconfig.h"
#ifdef HAVE_INOTIFY
#include <sys/select.h>
#include <sys/inotify.h>
#endif
@@ -29,6 +30,8 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <time.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>

View File

@@ -625,7 +625,7 @@ void wIconUpdate(WIcon * icon)
int x, y;
unsigned int w, h;
Window jw;
int ji, dotitle;
int ji;
unsigned int ju, d;
Pixmap pixmap;
@@ -646,7 +646,6 @@ void wIconUpdate(WIcon * icon)
if (icon->show_title && (title_height < wPreferences.icon_size)) {
drawIconTitle(scr, pixmap, title_height);
dotitle = 1;
if (h > wPreferences.icon_size - title_height - 2) {
h = wPreferences.icon_size - title_height - 2;
@@ -655,7 +654,6 @@ void wIconUpdate(WIcon * icon)
y = (wPreferences.icon_size - h - title_height) / 2 + title_height + 1;
}
} else {
dotitle = 0;
if (w > wPreferences.icon_size)
w = wPreferences.icon_size;
y = (wPreferences.icon_size - h) / 2;

View File

@@ -592,10 +592,9 @@ int main(int argc, char **argv)
static int real_main(int argc, char **argv)
{
int i, restart = 0;
int i;
char *pos;
int d, s;
int flag;
setlocale(LC_ALL, "");
wsetabort(wAbort);
@@ -603,7 +602,6 @@ static int real_main(int argc, char **argv)
/* for telling WPrefs what's the name of the wmaker binary being ran */
setenv("WMAKER_BIN_NAME", argv[0], 1);
flag = 0;
ArgCount = argc;
Arguments = wmalloc(sizeof(char *) * (ArgCount + 1));
for (i = 0; i < argc; i++) {
@@ -619,8 +617,6 @@ static int real_main(int argc, char **argv)
else
ProgName++;
restart = 0;
if (argc > 1) {
for (i = 1; i < argc; i++) {
#ifdef USECPP

View File

@@ -802,7 +802,7 @@ static void move_menus(WMenu * menu, int x, int y)
static void makeVisible(WMenu * menu)
{
WScreen *scr = menu->frame->screen_ptr;
int x1, y1, x2, y2, new_x, new_y, move;
int x1, y1, x2, y2, new_x, new_y;
WMRect rect = wGetRectForHead(scr, wGetHeadForPointerLocation(scr));
if (menu->entry_no < 0)
@@ -815,22 +815,17 @@ static void makeVisible(WMenu * menu)
new_x = x1;
new_y = y1;
move = 0;
if (x1 < rect.pos.x) {
new_x = rect.pos.x;
move = 1;
} else if (x2 >= rect.pos.x + rect.size.width) {
new_x = rect.pos.x + rect.size.width - MENUW(menu) - 1;
move = 1;
}
if (y1 < rect.pos.y) {
new_y = rect.pos.y;
move = 1;
} else if (y2 >= rect.pos.y + rect.size.height) {
new_y = rect.pos.y + rect.size.height - menu->entry_height - 1;
move = 1;
}
new_y = new_y - menu->frame->top_width - menu->selected_entry * menu->entry_height;

View File

@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <stdarg.h>
#include <pwd.h>
@@ -92,14 +93,12 @@ static char *username(void)
char *MakeCPPArgs(char *path)
{
int i;
char buffer[MAXLINE], *buf, *line;
Visual *visual;
char *tmp;
line = wmalloc(MAXLINE);
*line = 0;
i = 1;
if ((buf = getenv("HOSTNAME")) != NULL) {
if (buf[0] == '(') {
wwarning(_("your machine is misconfigured. HOSTNAME is set to %s"), buf);

View File

@@ -902,14 +902,11 @@ updateWindowPosition(WWindow * wwin, MoveData * data, Bool doResistance,
int winL, winR, winT, winB; /* requested new window position */
int newX, newY; /* actual new window position */
Bool hresist, vresist;
Bool updateIndex;
Bool attract;
hresist = False;
vresist = False;
updateIndex = False;
/* check the direction of the movement */
dx = newMouseX - data->mouseX;
dy = newMouseY - data->mouseY;
@@ -1211,7 +1208,7 @@ int wKeyboardMoveResizeWindow(WWindow * wwin)
int done, off_x, off_y, ww, wh;
int kspeed = _KS;
Time lastTime = 0;
KeyCode shiftl, shiftr, ctrll, ctrlmode;
KeyCode shiftl, shiftr, ctrlmode;
KeySym keysym = NoSymbol;
int moment = 0;
int modes = ((IS_MOVABLE(wwin) ? MOVABLE_BIT : 0) | (IS_RESIZABLE(wwin) ? RESIZABLE_BIT : 0));
@@ -1221,7 +1218,6 @@ int wKeyboardMoveResizeWindow(WWindow * wwin)
shiftl = XKeysymToKeycode(dpy, XK_Shift_L);
shiftr = XKeysymToKeycode(dpy, XK_Shift_R);
ctrll = XKeysymToKeycode(dpy, XK_Control_L);
ctrlmode = done = off_x = off_y = 0;
if (modes == RESIZABLE_BIT) {
@@ -1851,7 +1847,6 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev)
int rx1, ry1, rx2, ry2;
int res = 0;
KeyCode shiftl, shiftr;
int h = 0;
int orig_fx = fx;
int orig_fy = fy;
int orig_fw = fw;
@@ -1878,11 +1873,7 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev)
ry2 = fy + fh - 1;
shiftl = XKeysymToKeycode(dpy, XK_Shift_L);
shiftr = XKeysymToKeycode(dpy, XK_Shift_R);
if (HAS_TITLEBAR(wwin))
h = WMFontHeight(wwin->screen_ptr->title_font) + (wPreferences.window_title_clearance +
TITLEBAR_EXTEND_SPACE) * 2;
else
h = 0;
while (1) {
WMMaskEvent(dpy, KeyPressMask | ButtonMotionMask
| ButtonReleaseMask | PointerMotionHintMask | ButtonPressMask | ExposureMask, &event);

View File

@@ -1,3 +1,10 @@
/*
* Until FreeBSD gets their act together;
* http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg69469.html
*/
#if defined( FREEBSD )
# undef _XOPEN_SOURCE
#endif
#if defined( FREEBSD ) || defined( DRAGONFLYBSD )
# include <sys/types.h>

View File

@@ -29,6 +29,7 @@
#include <sys/wait.h>
#include <sys/types.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include <time.h>
#include <dirent.h>
@@ -1151,7 +1152,7 @@ static WMenu *readMenuFile(WScreen * scr, char *file_name)
}
}
#ifdef CPP
#ifdef USECPP
if (cpp) {
if (pclose(file) == -1) {
werror(_("error reading preprocessed menu data"));
@@ -1183,7 +1184,6 @@ static WMenu *readMenuPipe(WScreen * scr, char **file_name)
int i;
#ifdef USECPP
char *args;
int cpp = 0;
#endif
flat_file[0] = '\0';
@@ -1206,8 +1206,6 @@ static WMenu *readMenuPipe(WScreen * scr, char **file_name)
file = popen(command, "r");
if (!file) {
werror(_("%s:could not open/preprocess menu file"), filename);
} else {
cpp = 1;
}
}
}

View File

@@ -65,6 +65,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <time.h>

View File

@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include <X11/Xlib.h>

View File

@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include "WindowMaker.h"
#include "screen.h"

View File

@@ -647,12 +647,11 @@ static void newWSCommand(WMenu * menu, WMenuEntry * foo)
static char *cropline(char *line)
{
char *start, *end;
char *end;
if (strlen(line) == 0)
return line;
start = line;
end = &(line[strlen(line)]) - 1;
while (isspace(*line) && *line != 0)
line++;
@@ -821,7 +820,7 @@ void wWorkspaceSaveState(WScreen * scr, WMPropList * old_state)
void wWorkspaceRestoreState(WScreen * scr)
{
WMPropList *parr, *pstr, *wks_state, *clip_state;
int i, j, wscount;
int i, j;
make_keys();
@@ -833,7 +832,6 @@ void wWorkspaceRestoreState(WScreen * scr)
if (!parr)
return;
wscount = scr->workspace_count;
for (i = 0; i < WMIN(WMGetPropListItemCount(parr), MAX_WORKSPACES); i++) {
wks_state = WMGetFromPLArray(parr, i);
if (WMIsPLDictionary(wks_state))

View File

@@ -30,6 +30,7 @@ Perpetrator: Sudish Joseph <sj@eng.mindspring.net>, Sept. 1997. */
#include "wconfig.h"
#include <string.h>
#include <strings.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
@@ -111,9 +112,6 @@ static const char *index_to_name(int indice)
static void x_reset_modifier_mapping(Display * display)
{
int modifier_index, modifier_key, column, mkpm;
int warned_about_overlapping_modifiers = 0;
int warned_about_predefined_modifiers = 0;
int warned_about_duplicate_modifiers = 0;
int meta_bit = 0;
int hyper_bit = 0;
int super_bit = 0;
@@ -123,26 +121,22 @@ static void x_reset_modifier_mapping(Display * display)
#define modwarn(name,old,other) \
wwarning ("%s (0x%x) generates %s, which is generated by %s.", \
name, code, index_to_name (old), other), \
warned_about_overlapping_modifiers = 1
name, code, index_to_name (old), other)
#define modbarf(name,other) \
wwarning ("%s (0x%x) generates %s, which is nonsensical.", \
name, code, other), \
warned_about_predefined_modifiers = 1
name, code, other)
#define check_modifier(name,mask) \
if ((1<<modifier_index) != mask) \
wwarning ("%s (0x%x) generates %s, which is nonsensical.", \
name, code, index_to_name (modifier_index)), \
warned_about_predefined_modifiers = 1
name, code, index_to_name (modifier_index))
#define store_modifier(name,old) \
if (old && old != modifier_index) \
wwarning ("%s (0x%x) generates both %s and %s, which is nonsensical.", \
name, code, index_to_name (old), \
index_to_name (modifier_index)), \
warned_about_duplicate_modifiers = 1; \
index_to_name (modifier_index)); \
if (modifier_index == ShiftMapIndex) modbarf (name,"ModShift"); \
else if (modifier_index == LockMapIndex) modbarf (name,"ModLock"); \
else if (modifier_index == ControlMapIndex) modbarf (name,"ModControl"); \
@@ -254,7 +248,7 @@ static void x_reset_modifier_mapping(Display * display)
warn = "Alt", alt_bit = 0;
if (warn) {
wwarning("%s is being used for both Mode_switch and %s.",
index_to_name(mode_bit), warn), warned_about_overlapping_modifiers = 1;
index_to_name(mode_bit), warn);
}
}
@@ -264,35 +258,6 @@ static void x_reset_modifier_mapping(Display * display)
AltMask = (alt_bit ? (1 << alt_bit) : 0);
ModeMask = (mode_bit ? (1 << mode_bit) : 0); /* unused */
#if 0
if (warned_about_overlapping_modifiers)
wwarning("\n"
" Two distinct modifier keys (such as Meta and Hyper) cannot generate\n"
" the same modifier bit, because Emacs won't be able to tell which\n"
" modifier was actually held down when some other key is pressed. It\n"
" won't be able to tell Meta-x and Hyper-x apart, for example. Change\n"
" one of these keys to use some other modifier bit. If you intend for\n"
" these keys to have the same behavior, then change them to have the\n"
" same keysym as well as the same modifier bit.\n");
if (warned_about_predefined_modifiers)
wwarning("\n"
" The semantics of the modifier bits ModShift, ModLock, and ModControl\n"
" are predefined. It does not make sense to assign ModControl to any\n"
" keysym other than Control_L or Control_R, or to assign any modifier\n"
" bits to the \"control\" keysyms other than ModControl. You can't\n"
" turn a \"control\" key into a \"meta\" key (or vice versa) by simply\n"
" assigning the key a different modifier bit. You must also make that\n"
" key generate an appropriate keysym (Control_L, Meta_L, etc).\n");
/* No need to say anything more for warned_about_duplicate_modifiers. */
if (warned_about_overlapping_modifiers || warned_about_predefined_modifiers)
wwarning("\n"
" The meanings of the modifier bits Mod1 through Mod5 are determined\n"
" by the keysyms used to control those bits. Mod1 does NOT always\n"
" mean Meta, although some non-ICCCM-compliant programs assume that.\n");
#endif
XFreeModifiermap(x_modifier_keymap);
}