Warning fixes for gcc-4.6.

SVN revision: 56392
This commit is contained in:
Kim Woelders 2011-01-30 00:07:50 +00:00
parent 72382b7b38
commit a87641f97e
19 changed files with 90 additions and 151 deletions

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors * 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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * 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 */ /* text.c */
void TextStateLoadFont(TextState * ts); void TextStateLoadFont(TextState * ts);
void TextSize(TextState * ts, const char *text, 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, void TextDraw(TextState * ts, Window win, char *text,
int x, int y, int w, int h, int fsize, int x, int y, int w, int h, int justification);
int justification);
/* file.c */ /* file.c */
int exists(char *s); int exists(char *s);

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors * 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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * of this software and associated documentation files (the "Software"), to
@ -55,7 +55,7 @@ void
word(char *s, int num, char *wd) word(char *s, int num, char *wd)
{ {
int cnt, i; int cnt, i;
char *start, *finish, *ss, *w; char *start, *finish, *ss;
if (!s) if (!s)
return; return;
@ -71,7 +71,6 @@ word(char *s, int num, char *wd)
start = NULL; start = NULL;
finish = NULL; finish = NULL;
ss = NULL; ss = NULL;
w = wd;
while (s[i]) while (s[i])
{ {

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors * 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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * 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; Link *ll = NULL;
Page *pg; Page *pg;
TextState ts; TextState ts;
int i, col_w, col_h; int i, col_w;
int x, y; int x, y;
int justification = 0; int justification = 0;
int firstp = 1; int firstp = 1;
@ -622,7 +622,7 @@ RenderPage(Window win, int page_num, int w, int h)
x = pg->padding; x = pg->padding;
y = pg->padding; y = pg->padding;
col_w = ((w - (pg->padding * (pg->columns + 1))) / pg->columns); col_w = ((w - (pg->padding * (pg->columns + 1))) / pg->columns);
col_h = h - (pg->padding * 2);
if (pg->background) if (pg->background)
{ {
im = ImageLoadDoc(pg->background); im = ImageLoadDoc(pg->background);
@ -756,7 +756,7 @@ RenderPage(Window win, int page_num, int w, int h)
link_link[0] = '\0'; link_link[0] = '\0';
islink = 1; islink = 1;
oldwc = wc; oldwc = wc;
TextSize(&ts, s, &lx, &th, 17); TextSize(&ts, s, &lx, &th);
} }
if (islink == 1) 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); CalcOffset(pg, col_w, x, y, ts.height, &xspace, &off);
TextSize(&ts, s, &tw, &th, 17); TextSize(&ts, s, &tw, &th);
txt_disp = ss; txt_disp = ss;
if (eot == 1) if (eot == 1)
txt_disp = s; txt_disp = s;
@ -857,7 +857,7 @@ RenderPage(Window win, int page_num, int w, int h)
for (ii = 0; ii < len; ii++, cnt++) for (ii = 0; ii < len; ii++, cnt++)
p1[cnt] = txt_disp[point + cnt]; p1[cnt] = txt_disp[point + cnt];
p1[cnt] = 0; p1[cnt] = 0;
TextSize(&ts, p1, &tw, &th, 17); TextSize(&ts, p1, &tw, &th);
if ((tw > xspace) if ((tw > xspace)
|| (!txt_disp[(point + cnt)])) || (!txt_disp[(point + cnt)]))
{ {
@ -875,8 +875,7 @@ RenderPage(Window win, int page_num, int w, int h)
} }
wastext = 1; wastext = 1;
TextDraw(&ts, win, p1, x + off, y, TextDraw(&ts, win, p1, x + off, y,
xspace, 99999, 17, xspace, 99999, justification);
justification);
y += ts.height; y += ts.height;
if (y >= if (y >=
(h - (h -
@ -897,7 +896,7 @@ RenderPage(Window win, int page_num, int w, int h)
wc--; wc--;
wastext = 1; wastext = 1;
TextDraw(&ts, win, txt_disp, x + off, y, TextDraw(&ts, win, txt_disp, x + off, y,
xspace, 99999, 17, justification); xspace, 99999, justification);
if (islink > 1 && linkwc > wc) if (islink > 1 && linkwc > wc)
{ {
islink = 0; islink = 0;
@ -919,12 +918,12 @@ RenderPage(Window win, int page_num, int w, int h)
pg->linkb); pg->linkb);
EAllocColor(&ts.fg_col); EAllocColor(&ts.fg_col);
XSetForeground(disp, gc, ts.fg_col.pixel); 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; extra = ((xspace - tw) * justification) >> 10;
TextDraw(&ts, win, link_txt, TextDraw(&ts, win, link_txt,
x + off + lx + extra, y, 99999, 99999, x + off + lx + extra, y, 99999, 99999,
17, 0); 0);
TextSize(&ts, link_txt, &lw, &th, 17); TextSize(&ts, link_txt, &lw, &th);
XDrawLine(disp, win, gc, XDrawLine(disp, win, gc,
x + off + lx + extra, x + off + lx + extra,
y + ts.xfontset_ascent, y + ts.xfontset_ascent,

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors * 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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * of this software and associated documentation files (the "Software"), to
@ -139,7 +139,7 @@ TextStateLoadFont(TextState * ts)
} }
void 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; char **lines;
int i, num_lines; int i, num_lines;
@ -211,13 +211,11 @@ TextSize(TextState * ts, const char *text, int *width, int *height, int fsize)
} }
#endif /* USE_XFONT */ #endif /* USE_XFONT */
freestrlist(lines, num_lines); freestrlist(lines, num_lines);
return;
fsize = 0;
} }
void void
TextDraw(TextState * ts, Window win, char *text, 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; char **lines;
int i, num_lines; int i, num_lines;
@ -395,6 +393,4 @@ TextDraw(TextState * ts, Window win, char *text,
} }
#endif /* USE_XFONT */ #endif /* USE_XFONT */
freestrlist(lines, num_lines); freestrlist(lines, num_lines);
return;
h = fsize = 0;
} }

View File

@ -3,6 +3,7 @@
* Written by Per Bothner, 1994. * Written by Per Bothner, 1994.
* Based on CCCP program by by Paul Rubin, June 1986 * Based on CCCP program by by Paul Rubin, June 1986
* Adapted to ANSI C, Richard Stallman, Jan 1987 * 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 * 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 * under the terms of the GNU General Public License as published by the

View File

@ -3,6 +3,7 @@
* Written by Per Bothner, 1994. * Written by Per Bothner, 1994.
* Based on CCCP program by by Paul Rubin, June 1986 * Based on CCCP program by by Paul Rubin, June 1986
* Adapted to ANSI C, Richard Stallman, Jan 1987 * 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 * 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 * 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 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) int line, int column)
{ {
pfile = NULL;
if (column > 0) if (column > 0)
{ {
fprintf(stderr, "%s:%d:%d: ", filename, line, column); fprintf(stderr, "%s:%d:%d: ", filename, line, column);

View File

@ -1,5 +1,6 @@
/* Parse C expressions for CCCP. /* Parse C expressions for CCCP.
* Copyright (C) 1987, 1992, 1994, 1995 Free Software Foundation. * 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 * 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 * 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 #ifdef MULTIBYTE_CHARS
char token_buffer[MAX_LONG_TYPE_SIZE / char token_buffer[MAX_LONG_TYPE_SIZE /
MAX_CHAR_TYPE_SIZE + MB_CUR_MAX]; MAX_CHAR_TYPE_SIZE + MB_CUR_MAX];
#else
char token_buffer[MAX_LONG_TYPE_SIZE /
MAX_CHAR_TYPE_SIZE + 1];
#endif #endif
if (*ptr == 'L') if (*ptr == 'L')
@ -378,11 +374,15 @@ cpp_lex(struct operation *op, cpp_reader * pfile)
result = (result << width) | (c & ((1 << width) - 1)); result = (result << width) | (c & ((1 << width) - 1));
else else
result = c; result = c;
#ifdef MULTIBYTE_CHARS
token_buffer[num_chars - 1] = c; token_buffer[num_chars - 1] = c;
#endif
} }
} }
#ifdef MULTIBYTE_CHARS
token_buffer[num_chars] = 0; token_buffer[num_chars] = 0;
#endif
if (c != '\'') if (c != '\'')
cpp_error(pfile, "malformatted character constant"); cpp_error(pfile, "malformatted character constant");
@ -617,9 +617,9 @@ left_shift(cpp_reader * pfile, long a, int unsignedp, unsigned long b)
} }
static long 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) if (b >= HOST_BITS_PER_LONG)
{ {
return unsignedp ? 0 : a >> (HOST_BITS_PER_LONG - 1); return unsignedp ? 0 : a >> (HOST_BITS_PER_LONG - 1);

View File

@ -3,6 +3,7 @@
* Written by Per Bothner, 1994. * Written by Per Bothner, 1994.
* Based on CCCP program by by Paul Rubin, June 1986 * Based on CCCP program by by Paul Rubin, June 1986
* Adapted to ANSI C, Richard Stallman, Jan 1987 * 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 * 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 * 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 * You are forbidden to forbid anyone else to use, share and improve
* what you give them. Help stamp out software-hoarding! */ * what you give them. Help stamp out software-hoarding! */
#include "config.h"
#include "cpplib.h" #include "cpplib.h"
#include "cpphash.h" #include "cpphash.h"
@ -181,11 +183,10 @@ install(const char *name, int len, enum node_type type, int ivalue, char *value,
} }
void void
cpp_hash_cleanup(cpp_reader * pfile) cpp_hash_cleanup(cpp_reader * pfile __UNUSED__)
{ {
int i; int i;
pfile = NULL;
for (i = HASHSIZE; --i >= 0;) for (i = HASHSIZE; --i >= 0;)
{ {
while (hashtab[i]) while (hashtab[i])

View File

@ -3,6 +3,7 @@
* Written by Per Bothner, 1994-95. * Written by Per Bothner, 1994-95.
* Based on CCCP program by by Paul Rubin, June 1986 * Based on CCCP program by by Paul Rubin, June 1986
* Adapted to ANSI C, Richard Stallman, Jan 1987 * 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 * 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 * 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 static void
make_assertion(cpp_reader * pfile, const char *option, const char *str) make_assertion(cpp_reader * pfile, const char *option, const char *str)
{ {
cpp_buffer *ip;
unsigned char *buf, *p, *q; unsigned char *buf, *p, *q;
/* Copy the entire option so we can modify it. */ /* 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); cpp_error(pfile, "malformed option `%s %s'", option, str);
return; return;
} }
ip = cpp_push_buffer(pfile, buf, strlen((char *)buf)); cpp_push_buffer(pfile, buf, strlen((char *)buf));
do_assert(pfile, NULL, NULL, NULL); do_assert(pfile, NULL, NULL, NULL);
cpp_pop_buffer(pfile); cpp_pop_buffer(pfile);
} }
@ -838,26 +838,22 @@ init_parse_options(struct cpp_options *opts)
} }
static enum cpp_token static enum cpp_token
null_underflow(cpp_reader * pfile) null_underflow(cpp_reader * pfile __UNUSED__)
{ {
pfile = NULL;
return CPP_EOF; return CPP_EOF;
} }
static int 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; return 0;
} }
static int static int
macro_cleanup(cpp_buffer * pbuf, cpp_reader * pfile) macro_cleanup(cpp_buffer * pbuf, cpp_reader * pfile __UNUSED__)
{ {
HASHNODE *macro = (HASHNODE *) pbuf->data; HASHNODE *macro = (HASHNODE *) pbuf->data;
pfile = NULL;
if (macro->type == T_DISABLED) if (macro->type == T_DISABLED)
macro->type = T_MACRO; macro->type = T_MACRO;
if (macro->type != T_MACRO || pbuf->buf != macro->value.defn->expansion) 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 static int
file_cleanup(cpp_buffer * pbuf, cpp_reader * pfile) file_cleanup(cpp_buffer * pbuf, cpp_reader * pfile __UNUSED__)
{ {
pfile = NULL;
if (pbuf->buf) if (pbuf->buf)
{ {
free(pbuf->buf); free(pbuf->buf);
@ -3167,12 +3162,11 @@ get_directive_token(cpp_reader * pfile)
static int static int
do_include(cpp_reader * pfile, struct directive *keyword, 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 importing = (keyword->type == T_IMPORT);
int skip_dirs = (keyword->type == T_INCLUDE_NEXT); int skip_dirs = (keyword->type == T_INCLUDE_NEXT);
char *fname; /* Dynamically allocated fname buffer */ char *fname; /* Dynamically allocated fname buffer */
char *pcftry;
unsigned char *fbeg, *fend; /* Beginning and end of fname */ unsigned char *fbeg, *fend; /* Beginning and end of fname */
enum cpp_token token; 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 dsp[1]; /* First in chain, if #include "..." */
file_name_list *searchptr = 0; file_name_list *searchptr = 0;
long old_written = CPP_WRITTEN(pfile); long old_written = CPP_WRITTEN(pfile);
int flen; int flen;
int f; /* file number */ int f; /* file number */
int angle_brackets = 0; /* 0 for "...", 1 for <...> */ int angle_brackets = 0; /* 0 for "...", 1 for <...> */
char *pcfbuf;
int pcfnum;
f = -1; /* JF we iz paranoid! */ f = -1; /* JF we iz paranoid! */
unused1 = NULL;
unused2 = NULL;
if (importing && CPP_OPTIONS(pfile)->warn_import if (importing && CPP_OPTIONS(pfile)->warn_import
&& !CPP_OPTIONS(pfile)->inhibit_warnings && !CPP_OPTIONS(pfile)->inhibit_warnings
&& !CPP_BUFFER(pfile)->system_header_p && !pfile->import_warning) && !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. */ /* Record file on "seen" list for #import. */
add_import(pfile, f, fname); add_import(pfile, f, fname);
pcftry = (char *)alloca(strlen(fname) + 30);
pcfbuf = 0;
pcfnum = 0;
/* Actually process the file */ /* Actually process the file */
cpp_push_buffer(pfile, NULL, 0); cpp_push_buffer(pfile, NULL, 0);
if (finclude(pfile, f, fname, is_system_include(pfile, fname), 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 #define FNAME_HASHSIZE 37
static int static int
do_line(cpp_reader * pfile, struct directive *keyword, do_line(cpp_reader * pfile, struct directive *keyword __UNUSED__,
unsigned char *unused1, unsigned char *unused2) unsigned char *unused1 __UNUSED__, unsigned char *unused2 __UNUSED__)
{ {
cpp_buffer *ip = CPP_BUFFER(pfile); cpp_buffer *ip = CPP_BUFFER(pfile);
int new_lineno; int new_lineno;
@ -3748,9 +3731,6 @@ do_line(cpp_reader * pfile, struct directive *keyword,
token = get_directive_token(pfile); token = get_directive_token(pfile);
keyword = NULL;
unused1 = unused2 = NULL;
if (token != CPP_NUMBER || !isdigit(pfile->token_buffer[old_written])) if (token != CPP_NUMBER || !isdigit(pfile->token_buffer[old_written]))
{ {
cpp_error(pfile, "invalid format `#line' command"); cpp_error(pfile, "invalid format `#line' command");
@ -3905,13 +3885,12 @@ do_undef(cpp_reader * pfile, struct directive *keyword, unsigned char *buf,
*/ */
static int static int
do_error(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, do_error(cpp_reader * pfile, struct directive *keyword __UNUSED__,
unsigned char *limit) unsigned char *buf, unsigned char *limit)
{ {
int length = limit - buf; int length = limit - buf;
unsigned char *copy = (unsigned char *)xmalloc(length + 1); unsigned char *copy = (unsigned char *)xmalloc(length + 1);
keyword = NULL;
memcpy(copy, buf, length); memcpy(copy, buf, length);
copy[length] = 0; copy[length] = 0;
SKIP_WHITE_SPACE(copy); SKIP_WHITE_SPACE(copy);
@ -3926,13 +3905,12 @@ do_error(cpp_reader * pfile, struct directive *keyword, unsigned char *buf,
*/ */
static int static int
do_warning(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, do_warning(cpp_reader * pfile, struct directive *keyword __UNUSED__,
unsigned char *limit) unsigned char *buf, unsigned char *limit)
{ {
int length = limit - buf; int length = limit - buf;
unsigned char *copy = (unsigned char *)xmalloc(length + 1); unsigned char *copy = (unsigned char *)xmalloc(length + 1);
keyword = NULL;
memcpy(copy, buf, length); memcpy(copy, buf, length);
copy[length] = 0; copy[length] = 0;
SKIP_WHITE_SPACE(copy); 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. */ /* #ident has already been copied to the output file, so just ignore it. */
static int static int
do_ident(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, do_ident(cpp_reader * pfile, struct directive *keyword __UNUSED__,
unsigned char *limit) unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
{ {
/* long old_written = CPP_WRITTEN (pfile); */ /* 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) if (CPP_PEDANTIC(pfile) && !CPP_BUFFER(pfile)->system_header_p)
cpp_pedwarn(pfile, "ANSI C does not allow `#ident'"); 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. */ /* Leave rest of line to be read by later calls to cpp_get_token. */
return 0; 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. */ * Just check for some recognized pragmas that need validation here. */
static int static int
do_pragma(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, do_pragma(cpp_reader * pfile, struct directive *keyword __UNUSED__,
unsigned char *limit) unsigned char *buf, unsigned char *limit __UNUSED__)
{ {
while (*buf == ' ' || *buf == '\t') while (*buf == ' ' || *buf == '\t')
buf++; buf++;
keyword = NULL;
limit = NULL;
if (!strncmp((const char *)buf, "once", 4)) if (!strncmp((const char *)buf, "once", 4))
{ {
/* Allow #pragma once in system headers, since that's not the user's /* 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 static int
do_if(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, do_if(cpp_reader * pfile, struct directive *keyword __UNUSED__,
unsigned char *limit) unsigned char *buf, unsigned char *limit)
{ {
HOST_WIDE_INT value = eval_if_expression(pfile, buf, limit - buf); HOST_WIDE_INT value = eval_if_expression(pfile, buf, limit - buf);
keyword = NULL;
conditional_skip(pfile, value == 0, T_IF, NULL); conditional_skip(pfile, value == 0, T_IF, NULL);
return 0; return 0;
} }
@ -4070,12 +4042,9 @@ do_if(cpp_reader * pfile, struct directive *keyword, unsigned char *buf,
*/ */
static int static int
do_elif(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, do_elif(cpp_reader * pfile, struct directive *keyword __UNUSED__,
unsigned char *limit) unsigned char *buf, unsigned char *limit)
{ {
keyword = NULL;
if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack) if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack)
{ {
cpp_error(pfile, "`#elif' not within a conditional"); 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. * then parse the result as a C expression and return the value as an int.
*/ */
static HOST_WIDE_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; HASHNODE *save_defined;
HOST_WIDE_INT value; HOST_WIDE_INT value;
long old_written = CPP_WRITTEN(pfile); long old_written = CPP_WRITTEN(pfile);
buf = NULL;
length = 0;
save_defined = install("defined", -1, T_SPEC_DEFINED, 0, 0, -1); save_defined = install("defined", -1, T_SPEC_DEFINED, 0, 0, -1);
pfile->pcp_inside_if = 1; pfile->pcp_inside_if = 1;
@ -4145,8 +4113,8 @@ eval_if_expression(cpp_reader * pfile, unsigned char *buf, int length)
*/ */
static int static int
do_xifdef(cpp_reader * pfile, struct directive *keyword, unsigned char *unused1, do_xifdef(cpp_reader * pfile, struct directive *keyword,
unsigned char *unused2) unsigned char *unused1 __UNUSED__, unsigned char *unused2 __UNUSED__)
{ {
int skip; int skip;
cpp_buffer *ip = CPP_BUFFER(pfile); 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; unsigned char *control_macro = 0;
int old_written = CPP_WRITTEN(pfile); int old_written = CPP_WRITTEN(pfile);
unused1 = NULL;
unused2 = NULL;
/* Detect a #ifndef at start of file (not counting comments). */ /* Detect a #ifndef at start of file (not counting comments). */
if (ip->fname != 0 && keyword->type == T_IFNDEF) if (ip->fname != 0 && keyword->type == T_IFNDEF)
start_of_file = pfile->only_seen_white == 2; start_of_file = pfile->only_seen_white == 2;
@ -4410,15 +4376,11 @@ skip_if_group(cpp_reader * pfile, int any)
*/ */
static int static int
do_else(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, do_else(cpp_reader * pfile, struct directive *keyword __UNUSED__,
unsigned char *limit) unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
{ {
cpp_buffer *ip = CPP_BUFFER(pfile); cpp_buffer *ip = CPP_BUFFER(pfile);
keyword = NULL;
buf = NULL;
limit = NULL;
if (CPP_PEDANTIC(pfile)) if (CPP_PEDANTIC(pfile))
validate_else(pfile, "#else"); validate_else(pfile, "#else");
skip_rest_of_line(pfile); skip_rest_of_line(pfile);
@ -4460,17 +4422,13 @@ do_else(cpp_reader * pfile, struct directive *keyword, unsigned char *buf,
*/ */
static int static int
do_endif(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, do_endif(cpp_reader * pfile, struct directive *keyword __UNUSED__,
unsigned char *limit) unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
{ {
if (CPP_PEDANTIC(pfile)) if (CPP_PEDANTIC(pfile))
validate_else(pfile, "#endif"); validate_else(pfile, "#endif");
skip_rest_of_line(pfile); skip_rest_of_line(pfile);
keyword = NULL;
buf = NULL;
limit = NULL;
if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack) if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack)
{ {
cpp_error(pfile, "unbalanced `#endif'"); cpp_error(pfile, "unbalanced `#endif'");
@ -5552,11 +5510,9 @@ open_include_file(cpp_reader * pfile, char *filename,
#else #else
static int static int
open_include_file(cpp_reader * pfile, char *filename, open_include_file(cpp_reader * pfile __UNUSED__, char *filename,
file_name_list * searchptr) file_name_list * searchptr __UNUSED__)
{ {
pfile = NULL;
searchptr = NULL;
return open(filename, O_RDONLY, 0666); return open(filename, O_RDONLY, 0666);
} }
@ -6742,8 +6698,8 @@ cpp_finish(cpp_reader * pfile)
} }
static int static int
do_assert(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, do_assert(cpp_reader * pfile, struct directive *keyword __UNUSED__,
unsigned char *limit) unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
{ {
long symstart; /* remember where symbol name starts */ long symstart; /* remember where symbol name starts */
int c; int c;
@ -6754,10 +6710,6 @@ do_assert(cpp_reader * pfile, struct directive *keyword, unsigned char *buf,
&& !CPP_BUFFER(pfile)->system_header_p) && !CPP_BUFFER(pfile)->system_header_p)
cpp_pedwarn(pfile, "ANSI C does not allow `#assert'"); cpp_pedwarn(pfile, "ANSI C does not allow `#assert'");
keyword = NULL;
buf = NULL;
limit = NULL;
cpp_skip_hspace(pfile); cpp_skip_hspace(pfile);
symstart = CPP_WRITTEN(pfile); /* remember where it starts */ symstart = CPP_WRITTEN(pfile); /* remember where it starts */
parse_name(pfile, GETC()); parse_name(pfile, GETC());
@ -6820,8 +6772,8 @@ do_assert(cpp_reader * pfile, struct directive *keyword, unsigned char *buf,
} }
static int static int
do_unassert(cpp_reader * pfile, struct directive *keyword, unsigned char *buf, do_unassert(cpp_reader * pfile, struct directive *keyword __UNUSED__,
unsigned char *limit) unsigned char *buf __UNUSED__, unsigned char *limit __UNUSED__)
{ {
long symstart; /* remember where symbol name starts */ long symstart; /* remember where symbol name starts */
int sym_length; /* and how long it is */ 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; struct arglist *tokens = NULL;
int tokens_specified = 0; int tokens_specified = 0;
keyword = NULL;
buf = NULL;
limit = NULL;
if (CPP_PEDANTIC(pfile) && CPP_OPTIONS(pfile)->done_initializing if (CPP_PEDANTIC(pfile) && CPP_OPTIONS(pfile)->done_initializing
&& !CPP_BUFFER(pfile)->system_header_p) && !CPP_BUFFER(pfile)->system_header_p)
cpp_pedwarn(pfile, "ANSI C does not allow `#unassert'"); cpp_pedwarn(pfile, "ANSI C does not allow `#unassert'");

View File

@ -1,6 +1,7 @@
/* CPP main program, using CPP Library. /* CPP main program, using CPP Library.
* Copyright (C) 1995 Free Software Foundation, Inc. * Copyright (C) 1995 Free Software Foundation, Inc.
* Written by Per Bothner, 1994-95. * 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 * 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 * under the terms of the GNU General Public License as published by the

View File

@ -969,8 +969,6 @@ AddToFamily(EWin * ewin, Window xwin, int startup)
} }
else if (doslide) else if (doslide)
{ {
Timer *slide_timer;
k = rand() % 4; k = rand() % 4;
if (k == 0) if (k == 0)
{ {
@ -1000,7 +998,7 @@ AddToFamily(EWin * ewin, Window xwin, int startup)
EwinShow(ewin); EwinShow(ewin);
ewin->req_x = x; ewin->req_x = x;
ewin->req_y = y; ewin->req_y = y;
TIMER_ADD(slide_timer, 50, EwinSlideIn, ewin); TIMER_ADD_NP(50, EwinSlideIn, ewin);
} }
else else
{ {

View File

@ -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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * of this software and associated documentation files (the "Software"), to
@ -640,7 +640,7 @@ EWMH_GetWindowIcons(EWin * ewin)
} }
static void static void
EWMH_GetWindowUserTime(EWin * ewin) EWMH_GetWindowUserTime(EWin * ewin __UNUSED__)
{ {
#if 0 /* TBD */ #if 0 /* TBD */
int num; int num;
@ -651,8 +651,6 @@ EWMH_GetWindowUserTime(EWin * ewin)
return; return;
Eprintf("EWMH_GetWindowUserTime %#x\n", ts); Eprintf("EWMH_GetWindowUserTime %#x\n", ts);
#else
ewin = NULL;
#endif #endif
} }

View File

@ -1019,14 +1019,12 @@ _FocusIdler(void *data __UNUSED__)
static void static void
FocusSighan(int sig, void *prm __UNUSED__) FocusSighan(int sig, void *prm __UNUSED__)
{ {
Timer *focus_init_timer;
switch (sig) switch (sig)
{ {
case ESIGNAL_START: case ESIGNAL_START:
/* Delay focusing a bit to allow things to settle down */ /* Delay focusing a bit to allow things to settle down */
IdlerAdd(_FocusIdler, NULL); IdlerAdd(_FocusIdler, NULL);
TIMER_ADD(focus_init_timer, 500, FocusInitTimeout, NULL); TIMER_ADD_NP(500, FocusInitTimeout, NULL);
break; break;
case ESIGNAL_EXIT: case ESIGNAL_EXIT:

View File

@ -1786,7 +1786,6 @@ void
EFuncDefer(EWin * ewin, const char *cmd) EFuncDefer(EWin * ewin, const char *cmd)
{ {
void **prm; void **prm;
Timer *defer_timer;
prm = EMALLOC(void *, 2); prm = EMALLOC(void *, 2);
@ -1795,7 +1794,7 @@ EFuncDefer(EWin * ewin, const char *cmd)
prm[0] = ewin; prm[0] = ewin;
prm[1] = Estrdup(cmd); prm[1] = Estrdup(cmd);
TIMER_ADD(defer_timer, 0, doEFuncDeferred, prm); TIMER_ADD_NP(0, doEFuncDeferred, prm);
} }
static int static int

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors * 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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * 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]; char buf[4096];
ICONV_CONST char *pi; ICONV_CONST char *pi;
char *po; char *po;
size_t err, ni, no; size_t ni, no;
pi = (ICONV_CONST char *)txt; pi = (ICONV_CONST char *)txt;
po = buf; po = buf;
@ -68,7 +68,7 @@ Eiconv(iconv_t icd, const char *txt, size_t len)
if (icd == BAD_CD) if (icd == BAD_CD)
return Estrndup(txt, ni); return Estrndup(txt, ni);
no = sizeof(buf); no = sizeof(buf);
err = iconv(icd, &pi, &ni, &po, &no); iconv(icd, &pi, &ni, &po, &no);
po = Estrndup(buf, sizeof(buf) - no); po = Estrndup(buf, sizeof(buf) - no);

View File

@ -2053,13 +2053,10 @@ MenusTimeout(void *data __UNUSED__)
static void static void
MenusSighan(int sig, void *prm __UNUSED__) MenusSighan(int sig, void *prm __UNUSED__)
{ {
Timer *menu_unload_timer;
switch (sig) switch (sig)
{ {
case ESIGNAL_START: case ESIGNAL_START:
TIMER_ADD(menu_unload_timer, 1000 * MENU_UNLOAD_CHECK_INTERVAL, TIMER_ADD_NP(1000 * MENU_UNLOAD_CHECK_INTERVAL, MenusTimeout, NULL);
MenusTimeout, NULL);
break; break;
case ESIGNAL_AREA_SWITCH_START: case ESIGNAL_AREA_SWITCH_START:

View File

@ -848,7 +848,6 @@ PagersCheckUpdate(void)
static unsigned int tms_last = 0; static unsigned int tms_last = 0;
unsigned int tms; unsigned int tms;
int dtms; int dtms;
Timer *pager_update_timer;
if (!Mode_pagers.update_pending || !Conf_pagers.enable) if (!Mode_pagers.update_pending || !Conf_pagers.enable)
return; return;
@ -862,7 +861,7 @@ PagersCheckUpdate(void)
/* The purpose of this timer is to trigger the idler */ /* The purpose of this timer is to trigger the idler */
if (Mode_pagers.timer_pending) if (Mode_pagers.timer_pending)
return; return;
TIMER_ADD(pager_update_timer, dtms, _PagersUpdateTimeout, NULL); TIMER_ADD_NP(dtms, _PagersUpdateTimeout, NULL);
Mode_pagers.timer_pending = 1; Mode_pagers.timer_pending = 1;
return; return;
} }
@ -1744,12 +1743,10 @@ _PagersReconfigureTimeout(void *data __UNUSED__)
static void static void
PagersReconfigure(void) PagersReconfigure(void)
{ {
Timer *pg_timer_cfg;
if (!Conf_pagers.enable) if (!Conf_pagers.enable)
return; return;
TIMER_ADD(pg_timer_cfg, 500, _PagersReconfigureTimeout, NULL); TIMER_ADD_NP(500, _PagersReconfigureTimeout, NULL);
} }
#if ENABLE_DIALOGS #if ENABLE_DIALOGS

View File

@ -36,6 +36,8 @@ unsigned int TimersRun(unsigned int t_ms);
#define TIMER_ADD(timer, in, func, prm) \ #define TIMER_ADD(timer, in, func, prm) \
timer = TimerAdd(in, func, prm) timer = TimerAdd(in, func, prm)
#define TIMER_ADD_NP(in, func, prm) \
TimerAdd(in, func, prm)
#define TIMER_DEL(timer) \ #define TIMER_DEL(timer) \
if (timer) { TimerDel(timer); timer = NULL; } if (timer) { TimerDel(timer); timer = NULL; }

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors * 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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * of this software and associated documentation files (the "Software"), to
@ -259,21 +259,27 @@ static Rotation ss_rot;
static RRMode static RRMode
FindMode(XRRScreenResources * xsr, int w, int h, int *dw, int *dh) FindMode(XRRScreenResources * xsr, int w, int h, int *dw, int *dh)
{ {
int i, ic, in, norm, best; int i, in, norm, best;
RRMode mode; RRMode mode;
#if DEBUG_ZOOM
int ic = 0;
#endif
if (Mode.screen.rotation & (RR_Rotate_90 | RR_Rotate_270)) if (Mode.screen.rotation & (RR_Rotate_90 | RR_Rotate_270))
SWAP(w, h); SWAP(w, h);
mode = 0;
best = 0x7fffffff; best = 0x7fffffff;
in = -1; in = -1;
ic = 0;
for (i = 0; i < xsr->nmode; i++) for (i = 0; i < xsr->nmode; i++)
{ {
Dprintf("Sz%2d: %dx%d\n", i, xsr->modes[i].width, xsr->modes[i].height); 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) if (ss_mode == xsr->modes[i].id)
ic = i; ic = i;
#endif
if ((int)xsr->modes[i].width < w || (int)xsr->modes[i].height < h) if ((int)xsr->modes[i].width < w || (int)xsr->modes[i].height < h)
continue; continue;
norm = xsr->modes[i].width - w + xsr->modes[i].height - h; norm = xsr->modes[i].width - w + xsr->modes[i].height - h;