From a87641f97eafbcf13ef5eeee8d8e7e2f1d245e3c Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Sun, 30 Jan 2011 00:07:50 +0000 Subject: [PATCH] Warning fixes for gcc-4.6. SVN revision: 56392 --- dox/dox.h | 7 ++- dox/file.c | 5 +- dox/format.c | 23 +++++----- dox/text.c | 10 ++-- epp/cppalloc.c | 1 + epp/cpperror.c | 4 +- epp/cppexp.c | 14 +++--- epp/cpphash.c | 5 +- epp/cpplib.c | 122 ++++++++++++++----------------------------------- epp/cppmain.c | 1 + src/ewins.c | 4 +- src/ewmh.c | 6 +-- src/focus.c | 4 +- src/ipc.c | 3 +- src/lang.c | 6 +-- src/menus.c | 5 +- src/pager.c | 7 +-- src/timers.h | 2 + src/zoom.c | 12 +++-- 19 files changed, 90 insertions(+), 151 deletions(-) diff --git a/dox/dox.h b/dox/dox.h index d2aedc82..1c15e6a8 100644 --- a/dox/dox.h +++ b/dox/dox.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2007-2010 Kim Woelders + * Copyright (C) 2007-2011 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -86,10 +86,9 @@ void EFont_draw_string(Display * disp, Drawable win, GC gc, /* text.c */ void TextStateLoadFont(TextState * ts); void TextSize(TextState * ts, const char *text, - int *width, int *height, int fsize); + int *width, int *height); void TextDraw(TextState * ts, Window win, char *text, - int x, int y, int w, int h, int fsize, - int justification); + int x, int y, int w, int h, int justification); /* file.c */ int exists(char *s); diff --git a/dox/file.c b/dox/file.c index fcd9c7a8..23bc13ce 100644 --- a/dox/file.c +++ b/dox/file.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2008-2010 Kim Woelders + * Copyright (C) 2008-2011 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -55,7 +55,7 @@ void word(char *s, int num, char *wd) { int cnt, i; - char *start, *finish, *ss, *w; + char *start, *finish, *ss; if (!s) return; @@ -71,7 +71,6 @@ word(char *s, int num, char *wd) start = NULL; finish = NULL; ss = NULL; - w = wd; while (s[i]) { diff --git a/dox/format.c b/dox/format.c index 5a3155bd..19ce1e77 100644 --- a/dox/format.c +++ b/dox/format.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2007-2010 Kim Woelders + * Copyright (C) 2007-2011 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -610,7 +610,7 @@ RenderPage(Window win, int page_num, int w, int h) Link *ll = NULL; Page *pg; TextState ts; - int i, col_w, col_h; + int i, col_w; int x, y; int justification = 0; int firstp = 1; @@ -622,7 +622,7 @@ RenderPage(Window win, int page_num, int w, int h) x = pg->padding; y = pg->padding; col_w = ((w - (pg->padding * (pg->columns + 1))) / pg->columns); - col_h = h - (pg->padding * 2); + if (pg->background) { im = ImageLoadDoc(pg->background); @@ -756,7 +756,7 @@ RenderPage(Window win, int page_num, int w, int h) link_link[0] = '\0'; islink = 1; oldwc = wc; - TextSize(&ts, s, &lx, &th, 17); + TextSize(&ts, s, &lx, &th); } if (islink == 1) @@ -830,7 +830,7 @@ RenderPage(Window win, int page_num, int w, int h) CalcOffset(pg, col_w, x, y, ts.height, &xspace, &off); - TextSize(&ts, s, &tw, &th, 17); + TextSize(&ts, s, &tw, &th); txt_disp = ss; if (eot == 1) txt_disp = s; @@ -857,7 +857,7 @@ RenderPage(Window win, int page_num, int w, int h) for (ii = 0; ii < len; ii++, cnt++) p1[cnt] = txt_disp[point + cnt]; p1[cnt] = 0; - TextSize(&ts, p1, &tw, &th, 17); + TextSize(&ts, p1, &tw, &th); if ((tw > xspace) || (!txt_disp[(point + cnt)])) { @@ -875,8 +875,7 @@ RenderPage(Window win, int page_num, int w, int h) } wastext = 1; TextDraw(&ts, win, p1, x + off, y, - xspace, 99999, 17, - justification); + xspace, 99999, justification); y += ts.height; if (y >= (h - @@ -897,7 +896,7 @@ RenderPage(Window win, int page_num, int w, int h) wc--; wastext = 1; TextDraw(&ts, win, txt_disp, x + off, y, - xspace, 99999, 17, justification); + xspace, 99999, justification); if (islink > 1 && linkwc > wc) { islink = 0; @@ -919,12 +918,12 @@ RenderPage(Window win, int page_num, int w, int h) pg->linkb); EAllocColor(&ts.fg_col); XSetForeground(disp, gc, ts.fg_col.pixel); - TextSize(&ts, txt_disp, &tw, &th, 17); + TextSize(&ts, txt_disp, &tw, &th); extra = ((xspace - tw) * justification) >> 10; TextDraw(&ts, win, link_txt, x + off + lx + extra, y, 99999, 99999, - 17, 0); - TextSize(&ts, link_txt, &lw, &th, 17); + 0); + TextSize(&ts, link_txt, &lw, &th); XDrawLine(disp, win, gc, x + off + lx + extra, y + ts.xfontset_ascent, diff --git a/dox/text.c b/dox/text.c index 60e7239a..e0e7e5e9 100644 --- a/dox/text.c +++ b/dox/text.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2007-2010 Kim Woelders + * Copyright (C) 2007-2011 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -139,7 +139,7 @@ TextStateLoadFont(TextState * ts) } void -TextSize(TextState * ts, const char *text, int *width, int *height, int fsize) +TextSize(TextState * ts, const char *text, int *width, int *height) { char **lines; int i, num_lines; @@ -211,13 +211,11 @@ TextSize(TextState * ts, const char *text, int *width, int *height, int fsize) } #endif /* USE_XFONT */ freestrlist(lines, num_lines); - return; - fsize = 0; } void TextDraw(TextState * ts, Window win, char *text, - int x, int y, int w, int h, int fsize, int justification) + int x, int y, int w, int h __UNUSED__, int justification) { char **lines; int i, num_lines; @@ -395,6 +393,4 @@ TextDraw(TextState * ts, Window win, char *text, } #endif /* USE_XFONT */ freestrlist(lines, num_lines); - return; - h = fsize = 0; } diff --git a/epp/cppalloc.c b/epp/cppalloc.c index 80a2a26c..2106e1cb 100644 --- a/epp/cppalloc.c +++ b/epp/cppalloc.c @@ -3,6 +3,7 @@ * Written by Per Bothner, 1994. * Based on CCCP program by by Paul Rubin, June 1986 * Adapted to ANSI C, Richard Stallman, Jan 1987 + * Copyright (C) 2003-2011 Kim Woelders * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/epp/cpperror.c b/epp/cpperror.c index a9e7233e..caaa5136 100644 --- a/epp/cpperror.c +++ b/epp/cpperror.c @@ -3,6 +3,7 @@ * Written by Per Bothner, 1994. * Based on CCCP program by by Paul Rubin, June 1986 * Adapted to ANSI C, Richard Stallman, Jan 1987 + * Copyright (C) 2003-2011 Kim Woelders * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -72,10 +73,9 @@ cpp_print_containing_files(cpp_reader * pfile) } void -cpp_file_line_for_message(cpp_reader * pfile, const char *filename, +cpp_file_line_for_message(cpp_reader * pfile __UNUSED__, const char *filename, int line, int column) { - pfile = NULL; if (column > 0) { fprintf(stderr, "%s:%d:%d: ", filename, line, column); diff --git a/epp/cppexp.c b/epp/cppexp.c index 91a9f96f..507fec35 100644 --- a/epp/cppexp.c +++ b/epp/cppexp.c @@ -1,5 +1,6 @@ /* Parse C expressions for CCCP. * Copyright (C) 1987, 1992, 1994, 1995 Free Software Foundation. + * Copyright (C) 2003-2011 Kim Woelders * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -335,11 +336,6 @@ cpp_lex(struct operation *op, cpp_reader * pfile) #ifdef MULTIBYTE_CHARS char token_buffer[MAX_LONG_TYPE_SIZE / MAX_CHAR_TYPE_SIZE + MB_CUR_MAX]; - -#else - char token_buffer[MAX_LONG_TYPE_SIZE / - MAX_CHAR_TYPE_SIZE + 1]; - #endif if (*ptr == 'L') @@ -378,11 +374,15 @@ cpp_lex(struct operation *op, cpp_reader * pfile) result = (result << width) | (c & ((1 << width) - 1)); else result = c; +#ifdef MULTIBYTE_CHARS token_buffer[num_chars - 1] = c; +#endif } } +#ifdef MULTIBYTE_CHARS token_buffer[num_chars] = 0; +#endif if (c != '\'') cpp_error(pfile, "malformatted character constant"); @@ -617,9 +617,9 @@ left_shift(cpp_reader * pfile, long a, int unsignedp, unsigned long b) } static long -right_shift(cpp_reader * pfile, long a, int unsignedp, unsigned long b) +right_shift(cpp_reader * pfile __UNUSED__, long a, int unsignedp, + unsigned long b) { - pfile = NULL; if (b >= HOST_BITS_PER_LONG) { return unsignedp ? 0 : a >> (HOST_BITS_PER_LONG - 1); diff --git a/epp/cpphash.c b/epp/cpphash.c index 2cbf112d..8545b9a9 100644 --- a/epp/cpphash.c +++ b/epp/cpphash.c @@ -3,6 +3,7 @@ * Written by Per Bothner, 1994. * Based on CCCP program by by Paul Rubin, June 1986 * Adapted to ANSI C, Richard Stallman, Jan 1987 + * Copyright (C) 2003-2011 Kim Woelders * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -22,6 +23,7 @@ * You are forbidden to forbid anyone else to use, share and improve * what you give them. Help stamp out software-hoarding! */ +#include "config.h" #include "cpplib.h" #include "cpphash.h" @@ -181,11 +183,10 @@ install(const char *name, int len, enum node_type type, int ivalue, char *value, } void -cpp_hash_cleanup(cpp_reader * pfile) +cpp_hash_cleanup(cpp_reader * pfile __UNUSED__) { int i; - pfile = NULL; for (i = HASHSIZE; --i >= 0;) { while (hashtab[i]) diff --git a/epp/cpplib.c b/epp/cpplib.c index d9848ba2..cb9e094a 100644 --- a/epp/cpplib.c +++ b/epp/cpplib.c @@ -3,6 +3,7 @@ * Written by Per Bothner, 1994-95. * Based on CCCP program by by Paul Rubin, June 1986 * Adapted to ANSI C, Richard Stallman, Jan 1987 + * Copyright (C) 2003-2011 Kim Woelders * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -642,7 +643,6 @@ cpp_define(cpp_reader * pfile, unsigned char *str) static void make_assertion(cpp_reader * pfile, const char *option, const char *str) { - cpp_buffer *ip; unsigned char *buf, *p, *q; /* Copy the entire option so we can modify it. */ @@ -671,7 +671,7 @@ make_assertion(cpp_reader * pfile, const char *option, const char *str) cpp_error(pfile, "malformed option `%s %s'", option, str); return; } - ip = cpp_push_buffer(pfile, buf, strlen((char *)buf)); + cpp_push_buffer(pfile, buf, strlen((char *)buf)); do_assert(pfile, NULL, NULL, NULL); cpp_pop_buffer(pfile); } @@ -838,26 +838,22 @@ init_parse_options(struct cpp_options *opts) } static enum cpp_token -null_underflow(cpp_reader * pfile) +null_underflow(cpp_reader * pfile __UNUSED__) { - pfile = NULL; return CPP_EOF; } static int -null_cleanup(cpp_buffer * pbuf, cpp_reader * pfile) +null_cleanup(cpp_buffer * pbuf __UNUSED__, cpp_reader * pfile __UNUSED__) { - pbuf = NULL; - pfile = NULL; return 0; } static int -macro_cleanup(cpp_buffer * pbuf, cpp_reader * pfile) +macro_cleanup(cpp_buffer * pbuf, cpp_reader * pfile __UNUSED__) { HASHNODE *macro = (HASHNODE *) pbuf->data; - pfile = NULL; if (macro->type == T_DISABLED) macro->type = T_MACRO; if (macro->type != T_MACRO || pbuf->buf != macro->value.defn->expansion) @@ -866,9 +862,8 @@ macro_cleanup(cpp_buffer * pbuf, cpp_reader * pfile) } static int -file_cleanup(cpp_buffer * pbuf, cpp_reader * pfile) +file_cleanup(cpp_buffer * pbuf, cpp_reader * pfile __UNUSED__) { - pfile = NULL; if (pbuf->buf) { free(pbuf->buf); @@ -3167,12 +3162,11 @@ get_directive_token(cpp_reader * pfile) static int do_include(cpp_reader * pfile, struct directive *keyword, - unsigned char *unused1, unsigned char *unused2) + unsigned char *unused1 __UNUSED__, unsigned char *unused2 __UNUSED__) { int importing = (keyword->type == T_IMPORT); int skip_dirs = (keyword->type == T_INCLUDE_NEXT); char *fname; /* Dynamically allocated fname buffer */ - char *pcftry; unsigned char *fbeg, *fend; /* Beginning and end of fname */ enum cpp_token token; @@ -3181,19 +3175,12 @@ do_include(cpp_reader * pfile, struct directive *keyword, file_name_list dsp[1]; /* First in chain, if #include "..." */ file_name_list *searchptr = 0; long old_written = CPP_WRITTEN(pfile); - int flen; - int f; /* file number */ - int angle_brackets = 0; /* 0 for "...", 1 for <...> */ - char *pcfbuf; - int pcfnum; f = -1; /* JF we iz paranoid! */ - unused1 = NULL; - unused2 = NULL; if (importing && CPP_OPTIONS(pfile)->warn_import && !CPP_OPTIONS(pfile)->inhibit_warnings && !CPP_BUFFER(pfile)->system_header_p && !pfile->import_warning) @@ -3530,10 +3517,6 @@ do_include(cpp_reader * pfile, struct directive *keyword, /* Record file on "seen" list for #import. */ add_import(pfile, f, fname); - pcftry = (char *)alloca(strlen(fname) + 30); - pcfbuf = 0; - pcfnum = 0; - /* Actually process the file */ cpp_push_buffer(pfile, NULL, 0); if (finclude(pfile, f, fname, is_system_include(pfile, fname), @@ -3737,8 +3720,8 @@ convert_string(cpp_reader * pfile, char *result, char *in, char *limit, #define FNAME_HASHSIZE 37 static int -do_line(cpp_reader * pfile, struct directive *keyword, - unsigned char *unused1, unsigned char *unused2) +do_line(cpp_reader * pfile, struct directive *keyword __UNUSED__, + unsigned char *unused1 __UNUSED__, unsigned char *unused2 __UNUSED__) { cpp_buffer *ip = CPP_BUFFER(pfile); int new_lineno; @@ -3748,9 +3731,6 @@ do_line(cpp_reader * pfile, struct directive *keyword, token = get_directive_token(pfile); - keyword = NULL; - unused1 = unused2 = NULL; - if (token != CPP_NUMBER || !isdigit(pfile->token_buffer[old_written])) { cpp_error(pfile, "invalid format `#line' command"); @@ -3905,13 +3885,12 @@ do_undef(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, */ static int -do_error(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, - unsigned char *limit) +do_error(cpp_reader * pfile, struct directive *keyword __UNUSED__, + unsigned char *buf, unsigned char *limit) { int length = limit - buf; unsigned char *copy = (unsigned char *)xmalloc(length + 1); - keyword = NULL; memcpy(copy, buf, length); copy[length] = 0; SKIP_WHITE_SPACE(copy); @@ -3926,13 +3905,12 @@ do_error(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, */ static int -do_warning(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, - unsigned char *limit) +do_warning(cpp_reader * pfile, struct directive *keyword __UNUSED__, + unsigned char *buf, unsigned char *limit) { int length = limit - buf; unsigned char *copy = (unsigned char *)xmalloc(length + 1); - keyword = NULL; memcpy(copy, buf, length); copy[length] = 0; SKIP_WHITE_SPACE(copy); @@ -3972,8 +3950,8 @@ do_once(cpp_reader * pfile) /* #ident has already been copied to the output file, so just ignore it. */ static int -do_ident(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, - unsigned char *limit) +do_ident(cpp_reader * pfile, struct directive *keyword __UNUSED__, + unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__) { /* long old_written = CPP_WRITTEN (pfile); */ @@ -3981,9 +3959,6 @@ do_ident(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, if (CPP_PEDANTIC(pfile) && !CPP_BUFFER(pfile)->system_header_p) cpp_pedwarn(pfile, "ANSI C does not allow `#ident'"); - keyword = NULL; - buf = NULL; - limit = NULL; /* Leave rest of line to be read by later calls to cpp_get_token. */ return 0; @@ -3993,14 +3968,12 @@ do_ident(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, * Just check for some recognized pragmas that need validation here. */ static int -do_pragma(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, - unsigned char *limit) +do_pragma(cpp_reader * pfile, struct directive *keyword __UNUSED__, + unsigned char *buf, unsigned char *limit __UNUSED__) { while (*buf == ' ' || *buf == '\t') buf++; - keyword = NULL; - limit = NULL; if (!strncmp((const char *)buf, "once", 4)) { /* Allow #pragma once in system headers, since that's not the user's @@ -4054,12 +4027,11 @@ do_pragma(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, */ static int -do_if(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, - unsigned char *limit) +do_if(cpp_reader * pfile, struct directive *keyword __UNUSED__, + unsigned char *buf, unsigned char *limit) { HOST_WIDE_INT value = eval_if_expression(pfile, buf, limit - buf); - keyword = NULL; conditional_skip(pfile, value == 0, T_IF, NULL); return 0; } @@ -4070,12 +4042,9 @@ do_if(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, */ static int -do_elif(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, - unsigned char *limit) +do_elif(cpp_reader * pfile, struct directive *keyword __UNUSED__, + unsigned char *buf, unsigned char *limit) { - - keyword = NULL; - if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack) { cpp_error(pfile, "`#elif' not within a conditional"); @@ -4118,14 +4087,13 @@ do_elif(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, * then parse the result as a C expression and return the value as an int. */ static HOST_WIDE_INT -eval_if_expression(cpp_reader * pfile, unsigned char *buf, int length) +eval_if_expression(cpp_reader * pfile, unsigned char *buf __UNUSED__, + int length __UNUSED__) { HASHNODE *save_defined; HOST_WIDE_INT value; long old_written = CPP_WRITTEN(pfile); - buf = NULL; - length = 0; save_defined = install("defined", -1, T_SPEC_DEFINED, 0, 0, -1); pfile->pcp_inside_if = 1; @@ -4145,8 +4113,8 @@ eval_if_expression(cpp_reader * pfile, unsigned char *buf, int length) */ static int -do_xifdef(cpp_reader * pfile, struct directive *keyword, unsigned char *unused1, - unsigned char *unused2) +do_xifdef(cpp_reader * pfile, struct directive *keyword, + unsigned char *unused1 __UNUSED__, unsigned char *unused2 __UNUSED__) { int skip; cpp_buffer *ip = CPP_BUFFER(pfile); @@ -4157,8 +4125,6 @@ do_xifdef(cpp_reader * pfile, struct directive *keyword, unsigned char *unused1, unsigned char *control_macro = 0; int old_written = CPP_WRITTEN(pfile); - unused1 = NULL; - unused2 = NULL; /* Detect a #ifndef at start of file (not counting comments). */ if (ip->fname != 0 && keyword->type == T_IFNDEF) start_of_file = pfile->only_seen_white == 2; @@ -4410,15 +4376,11 @@ skip_if_group(cpp_reader * pfile, int any) */ static int -do_else(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, - unsigned char *limit) +do_else(cpp_reader * pfile, struct directive *keyword __UNUSED__, + unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__) { cpp_buffer *ip = CPP_BUFFER(pfile); - keyword = NULL; - buf = NULL; - limit = NULL; - if (CPP_PEDANTIC(pfile)) validate_else(pfile, "#else"); skip_rest_of_line(pfile); @@ -4460,17 +4422,13 @@ do_else(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, */ static int -do_endif(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, - unsigned char *limit) +do_endif(cpp_reader * pfile, struct directive *keyword __UNUSED__, + unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__) { if (CPP_PEDANTIC(pfile)) validate_else(pfile, "#endif"); skip_rest_of_line(pfile); - keyword = NULL; - buf = NULL; - limit = NULL; - if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack) { cpp_error(pfile, "unbalanced `#endif'"); @@ -5552,11 +5510,9 @@ open_include_file(cpp_reader * pfile, char *filename, #else static int -open_include_file(cpp_reader * pfile, char *filename, - file_name_list * searchptr) +open_include_file(cpp_reader * pfile __UNUSED__, char *filename, + file_name_list * searchptr __UNUSED__) { - pfile = NULL; - searchptr = NULL; return open(filename, O_RDONLY, 0666); } @@ -6742,8 +6698,8 @@ cpp_finish(cpp_reader * pfile) } static int -do_assert(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, - unsigned char *limit) +do_assert(cpp_reader * pfile, struct directive *keyword __UNUSED__, + unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__) { long symstart; /* remember where symbol name starts */ int c; @@ -6754,10 +6710,6 @@ do_assert(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, && !CPP_BUFFER(pfile)->system_header_p) cpp_pedwarn(pfile, "ANSI C does not allow `#assert'"); - keyword = NULL; - buf = NULL; - limit = NULL; - cpp_skip_hspace(pfile); symstart = CPP_WRITTEN(pfile); /* remember where it starts */ parse_name(pfile, GETC()); @@ -6820,8 +6772,8 @@ do_assert(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, } static int -do_unassert(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, - unsigned char *limit) +do_unassert(cpp_reader * pfile, struct directive *keyword __UNUSED__, + unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__) { long symstart; /* remember where symbol name starts */ int sym_length; /* and how long it is */ @@ -6830,10 +6782,6 @@ do_unassert(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, struct arglist *tokens = NULL; int tokens_specified = 0; - keyword = NULL; - buf = NULL; - limit = NULL; - if (CPP_PEDANTIC(pfile) && CPP_OPTIONS(pfile)->done_initializing && !CPP_BUFFER(pfile)->system_header_p) cpp_pedwarn(pfile, "ANSI C does not allow `#unassert'"); diff --git a/epp/cppmain.c b/epp/cppmain.c index 1b6cf70c..0cf2d94d 100644 --- a/epp/cppmain.c +++ b/epp/cppmain.c @@ -1,6 +1,7 @@ /* CPP main program, using CPP Library. * Copyright (C) 1995 Free Software Foundation, Inc. * Written by Per Bothner, 1994-95. + * Copyright (C) 2003-2011 Kim Woelders * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/src/ewins.c b/src/ewins.c index af83735b..47e0f3ff 100644 --- a/src/ewins.c +++ b/src/ewins.c @@ -969,8 +969,6 @@ AddToFamily(EWin * ewin, Window xwin, int startup) } else if (doslide) { - Timer *slide_timer; - k = rand() % 4; if (k == 0) { @@ -1000,7 +998,7 @@ AddToFamily(EWin * ewin, Window xwin, int startup) EwinShow(ewin); ewin->req_x = x; ewin->req_y = y; - TIMER_ADD(slide_timer, 50, EwinSlideIn, ewin); + TIMER_ADD_NP(50, EwinSlideIn, ewin); } else { diff --git a/src/ewmh.c b/src/ewmh.c index e86bb68d..3e95082c 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2010 Kim Woelders + * Copyright (C) 2003-2011 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -640,7 +640,7 @@ EWMH_GetWindowIcons(EWin * ewin) } static void -EWMH_GetWindowUserTime(EWin * ewin) +EWMH_GetWindowUserTime(EWin * ewin __UNUSED__) { #if 0 /* TBD */ int num; @@ -651,8 +651,6 @@ EWMH_GetWindowUserTime(EWin * ewin) return; Eprintf("EWMH_GetWindowUserTime %#x\n", ts); -#else - ewin = NULL; #endif } diff --git a/src/focus.c b/src/focus.c index bb2871ba..bf5efd88 100644 --- a/src/focus.c +++ b/src/focus.c @@ -1019,14 +1019,12 @@ _FocusIdler(void *data __UNUSED__) static void FocusSighan(int sig, void *prm __UNUSED__) { - Timer *focus_init_timer; - switch (sig) { case ESIGNAL_START: /* Delay focusing a bit to allow things to settle down */ IdlerAdd(_FocusIdler, NULL); - TIMER_ADD(focus_init_timer, 500, FocusInitTimeout, NULL); + TIMER_ADD_NP(500, FocusInitTimeout, NULL); break; case ESIGNAL_EXIT: diff --git a/src/ipc.c b/src/ipc.c index 132dfc10..7ab60394 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -1786,7 +1786,6 @@ void EFuncDefer(EWin * ewin, const char *cmd) { void **prm; - Timer *defer_timer; prm = EMALLOC(void *, 2); @@ -1795,7 +1794,7 @@ EFuncDefer(EWin * ewin, const char *cmd) prm[0] = ewin; prm[1] = Estrdup(cmd); - TIMER_ADD(defer_timer, 0, doEFuncDeferred, prm); + TIMER_ADD_NP(0, doEFuncDeferred, prm); } static int diff --git a/src/lang.c b/src/lang.c index 1f7d1730..67d549ac 100644 --- a/src/lang.c +++ b/src/lang.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2009 Kim Woelders + * Copyright (C) 2004-2011 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -60,7 +60,7 @@ Eiconv(iconv_t icd, const char *txt, size_t len) char buf[4096]; ICONV_CONST char *pi; char *po; - size_t err, ni, no; + size_t ni, no; pi = (ICONV_CONST char *)txt; po = buf; @@ -68,7 +68,7 @@ Eiconv(iconv_t icd, const char *txt, size_t len) if (icd == BAD_CD) return Estrndup(txt, ni); no = sizeof(buf); - err = iconv(icd, &pi, &ni, &po, &no); + iconv(icd, &pi, &ni, &po, &no); po = Estrndup(buf, sizeof(buf) - no); diff --git a/src/menus.c b/src/menus.c index 214be55b..768a186e 100644 --- a/src/menus.c +++ b/src/menus.c @@ -2053,13 +2053,10 @@ MenusTimeout(void *data __UNUSED__) static void MenusSighan(int sig, void *prm __UNUSED__) { - Timer *menu_unload_timer; - switch (sig) { case ESIGNAL_START: - TIMER_ADD(menu_unload_timer, 1000 * MENU_UNLOAD_CHECK_INTERVAL, - MenusTimeout, NULL); + TIMER_ADD_NP(1000 * MENU_UNLOAD_CHECK_INTERVAL, MenusTimeout, NULL); break; case ESIGNAL_AREA_SWITCH_START: diff --git a/src/pager.c b/src/pager.c index 4538f252..dd0c5f17 100644 --- a/src/pager.c +++ b/src/pager.c @@ -848,7 +848,6 @@ PagersCheckUpdate(void) static unsigned int tms_last = 0; unsigned int tms; int dtms; - Timer *pager_update_timer; if (!Mode_pagers.update_pending || !Conf_pagers.enable) return; @@ -862,7 +861,7 @@ PagersCheckUpdate(void) /* The purpose of this timer is to trigger the idler */ if (Mode_pagers.timer_pending) return; - TIMER_ADD(pager_update_timer, dtms, _PagersUpdateTimeout, NULL); + TIMER_ADD_NP(dtms, _PagersUpdateTimeout, NULL); Mode_pagers.timer_pending = 1; return; } @@ -1744,12 +1743,10 @@ _PagersReconfigureTimeout(void *data __UNUSED__) static void PagersReconfigure(void) { - Timer *pg_timer_cfg; - if (!Conf_pagers.enable) return; - TIMER_ADD(pg_timer_cfg, 500, _PagersReconfigureTimeout, NULL); + TIMER_ADD_NP(500, _PagersReconfigureTimeout, NULL); } #if ENABLE_DIALOGS diff --git a/src/timers.h b/src/timers.h index f799bc10..9fa16fcc 100644 --- a/src/timers.h +++ b/src/timers.h @@ -36,6 +36,8 @@ unsigned int TimersRun(unsigned int t_ms); #define TIMER_ADD(timer, in, func, prm) \ timer = TimerAdd(in, func, prm) +#define TIMER_ADD_NP(in, func, prm) \ + TimerAdd(in, func, prm) #define TIMER_DEL(timer) \ if (timer) { TimerDel(timer); timer = NULL; } diff --git a/src/zoom.c b/src/zoom.c index 70fab46d..b3caab3c 100644 --- a/src/zoom.c +++ b/src/zoom.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2010 Kim Woelders + * Copyright (C) 2004-2011 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -259,21 +259,27 @@ static Rotation ss_rot; static RRMode FindMode(XRRScreenResources * xsr, int w, int h, int *dw, int *dh) { - int i, ic, in, norm, best; + int i, in, norm, best; RRMode mode; +#if DEBUG_ZOOM + int ic = 0; +#endif + if (Mode.screen.rotation & (RR_Rotate_90 | RR_Rotate_270)) SWAP(w, h); + mode = 0; best = 0x7fffffff; in = -1; - ic = 0; for (i = 0; i < xsr->nmode; i++) { Dprintf("Sz%2d: %dx%d\n", i, xsr->modes[i].width, xsr->modes[i].height); +#if DEBUG_ZOOM if (ss_mode == xsr->modes[i].id) ic = i; +#endif if ((int)xsr->modes[i].width < w || (int)xsr->modes[i].height < h) continue; norm = xsr->modes[i].width - w + xsr->modes[i].height - h;