From 92c8fbd691fccf1796420251c5b2978bcd748393 Mon Sep 17 00:00:00 2001 From: wlemb Date: Thu, 19 Apr 2001 14:01:50 +0000 Subject: * src/preproc/html/pre-html.cc (scanArguments): Use `troff_command' instead of hardwired `"troff"'. (char_buffer::read_file): Remove unused variables. (char_buffer::write_file_troff): Ditto. (char_buffer::write_file_html): Ditto. (generateImages): Ditto. (abs): Removed. * src/utils/addftinfo/addftinfo.cc (main): Fix compilation problem. * src/include/lib.h: Don't include `groff-getopt.h' for UWIN. * src/libs/libgroff/font.cc (font::load_desc): Fix compiler warning. * src/libs/libbib/index.cc (index_search_item_iterator::get_tag, index_search_item::search1): Ditto. * src/roff/troff/node.h (width_list): Reorder members. * src/roff/troff/input.cc (do_define_macro): Fix compiler warning. (lookup_warning): Ditto. (prepend_string): Commented out. * src/roff/troff/dictionary.cc (is_good_size): Fix compiler warning. * src/roff/troff/reg.cc (number_value_to_ascii): Ditto. * src/preproc/tbl/main.cc (process_format): Ditto. * src/preproc/pic/pic.y (define_variable, reset, reset_all): Fix compiler warnings. * src/preproc/pic/pic.cc: Updated. * src/preproc/eqn/lex.cc (init_table): Fix compiler warnings. * src/preproc/eqn/over.cc (over_box::compute_metrics): Ditto. * src/preproc/refer/command.cc (execute_command): Ditto. * src/preproc/refer/ref.cc (sortify_title, find_month): Ditto. * src/preproc/refer/token.cc (lookup_token): Ditto. * src/preproc/soelim/soelim.cc: Ditto. * src/preproc/html/pushbackbuffer.cc (ERROR): Ditto. (isHexDigit): Commented out. (pushBackBuffer::isString): Remove unused variable. * src/devices/grops/ps.cc (ps_printer::special): Fix compiler warning. * src/devices/grops/psrm.cc (resource_manager::lookup_font, resource_manager::read_resource_arg, read_one_of, parse_extensions): Ditto. * src/devices/grodvi/dvi.cc (dvi_printer::draw): Ditto. * src/devices/grolj4/lj4.cc (lj4_font::handle_unknown_font_command, lookup_paper_size): Ditto. * src/devices/grohtml/post-html.cc (is_subsection): Commented out. (text_glob, element_list): Reorder members. * src/devices/grohtml/html-text.cc (html_text::do_pre): Remove compiler warning. * src/devices/grohtml/html-text.h (html_text::emit_space): Change return value to `void'. * src/devices/grohtml/output.cc (word_list::word_list): Fix order of initializers. * src/devices/grohtml/html.h (simple_output::check_newline, simple_output::space_or_newline, simple_output::enable_newlines): Add return value. * src/devices/grolbp/lbp.cc (wp54charset, set_papersize): Remove compiler warnings. * src/utils/tfmtodit/tfmtodit.cc (tfm::load, gf::load, main): Ditto. * src/utils/hpftodit/hpftodit.cc (File::seek, read_symbol_sets, output_ligatures, output_charset, read_map): Ditto. * src/utils/lookbib/lookbib.cc (main): Ditto. * src/utils/indxbib/indxbib.cc (main, fwrite_or_die): Ditto. (do_file): Fix typo (`=' -> `=='). * src/utils/lkbib/lkbib.cc (main): Remove compiler warning. * src/utils/addftinfo/addftinfo.cc (main): Ditto. --- ChangeLog | 65 ++++++++++++++++++++++++++++++++++++++ src/devices/grodvi/dvi.cc | 4 +-- src/devices/grohtml/html-text.cc | 4 +-- src/devices/grohtml/html-text.h | 2 +- src/devices/grohtml/output.cc | 5 ++- src/devices/grohtml/post-html.cc | 14 ++++---- src/devices/grolbp/lbp.cc | 4 +-- src/devices/grolj4/lj4.cc | 6 ++-- src/devices/grops/ps.cc | 2 +- src/devices/grops/psrm.cc | 11 ++++--- src/include/lib.h | 8 +++-- src/libs/libbib/index.cc | 6 ++-- src/libs/libgroff/font.cc | 5 +-- src/preproc/eqn/lex.cc | 5 +-- src/preproc/eqn/over.cc | 4 +-- src/preproc/html/pre-html.cc | 24 ++------------ src/preproc/html/pushbackbuffer.cc | 5 +-- src/preproc/pic/pic.cc | 11 ++++--- src/preproc/pic/pic.y | 12 ++++--- src/preproc/refer/command.cc | 5 +-- src/preproc/refer/ref.cc | 8 ++--- src/preproc/refer/token.cc | 4 +-- src/preproc/soelim/soelim.cc | 12 +++---- src/preproc/tbl/main.cc | 2 +- src/roff/troff/dictionary.cc | 8 ++--- src/roff/troff/input.cc | 6 ++-- src/roff/troff/node.h | 2 +- src/roff/troff/reg.cc | 5 +-- src/utils/addftinfo/addftinfo.cc | 6 ++-- src/utils/hpftodit/hpftodit.cc | 18 +++++------ src/utils/indxbib/indxbib.cc | 7 ++-- src/utils/lkbib/lkbib.cc | 2 +- src/utils/lookbib/lookbib.cc | 2 +- src/utils/tfmtodit/tfmtodit.cc | 8 ++--- 34 files changed, 182 insertions(+), 110 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7cb7689..911739ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,68 @@ +2001-04-19 Werner LEMBERG + + * src/preproc/html/pre-html.cc (scanArguments): Use `troff_command' + instead of hardwired `"troff"'. + (char_buffer::read_file): Remove unused variables. + (char_buffer::write_file_troff): Ditto. + (char_buffer::write_file_html): Ditto. + (generateImages): Ditto. + (abs): Removed. + * src/utils/addftinfo/addftinfo.cc (main): Fix compilation problem. + + * src/include/lib.h: Don't include `groff-getopt.h' for UWIN. + + * src/libs/libgroff/font.cc (font::load_desc): Fix compiler warning. + * src/libs/libbib/index.cc (index_search_item_iterator::get_tag, + index_search_item::search1): Ditto. + * src/roff/troff/node.h (width_list): Reorder members. + * src/roff/troff/input.cc (do_define_macro): Fix compiler warning. + (lookup_warning): Ditto. + (prepend_string): Commented out. + * src/roff/troff/dictionary.cc (is_good_size): Fix compiler warning. + * src/roff/troff/reg.cc (number_value_to_ascii): Ditto. + * src/preproc/tbl/main.cc (process_format): Ditto. + * src/preproc/pic/pic.y (define_variable, reset, reset_all): Fix + compiler warnings. + * src/preproc/pic/pic.cc: Updated. + * src/preproc/eqn/lex.cc (init_table): Fix compiler warnings. + * src/preproc/eqn/over.cc (over_box::compute_metrics): Ditto. + * src/preproc/refer/command.cc (execute_command): Ditto. + * src/preproc/refer/ref.cc (sortify_title, find_month): Ditto. + * src/preproc/refer/token.cc (lookup_token): Ditto. + * src/preproc/soelim/soelim.cc: Ditto. + * src/preproc/html/pushbackbuffer.cc (ERROR): Ditto. + (isHexDigit): Commented out. + (pushBackBuffer::isString): Remove unused variable. + * src/devices/grops/ps.cc (ps_printer::special): Fix compiler + warning. + * src/devices/grops/psrm.cc (resource_manager::lookup_font, + resource_manager::read_resource_arg, read_one_of, parse_extensions): + Ditto. + * src/devices/grodvi/dvi.cc (dvi_printer::draw): Ditto. + * src/devices/grolj4/lj4.cc (lj4_font::handle_unknown_font_command, + lookup_paper_size): Ditto. + * src/devices/grohtml/post-html.cc (is_subsection): Commented out. + (text_glob, element_list): Reorder members. + * src/devices/grohtml/html-text.cc (html_text::do_pre): Remove + compiler warning. + * src/devices/grohtml/html-text.h (html_text::emit_space): Change + return value to `void'. + * src/devices/grohtml/output.cc (word_list::word_list): Fix order + of initializers. + * src/devices/grohtml/html.h (simple_output::check_newline, + simple_output::space_or_newline, simple_output::enable_newlines): + Add return value. + * src/devices/grolbp/lbp.cc (wp54charset, set_papersize): Remove + compiler warnings. + * src/utils/tfmtodit/tfmtodit.cc (tfm::load, gf::load, main): Ditto. + * src/utils/hpftodit/hpftodit.cc (File::seek, read_symbol_sets, + output_ligatures, output_charset, read_map): Ditto. + * src/utils/lookbib/lookbib.cc (main): Ditto. + * src/utils/indxbib/indxbib.cc (main, fwrite_or_die): Ditto. + (do_file): Fix typo (`=' -> `=='). + * src/utils/lkbib/lkbib.cc (main): Remove compiler warning. + * src/utils/addftinfo/addftinfo.cc (main): Ditto. + 2001-04-18 Ruslan Ermilov * src/roff/nroff/nroff.sh: Adding -p (pic) and -t (tbl) options. diff --git a/src/devices/grodvi/dvi.cc b/src/devices/grodvi/dvi.cc index 74422f80..ec227472 100644 --- a/src/devices/grodvi/dvi.cc +++ b/src/devices/grodvi/dvi.cc @@ -521,8 +521,8 @@ void dvi_printer::moveto(int h, int v) void dvi_printer::draw(int code, int *p, int np, const environment *env) { if (code == 'l') { - int x, y; - int height = 0, width; + int x = 0, y = 0; + int height = 0, width = 0; int thickness; if (line_thickness < 0) thickness = env->size*RES_7227*linewidth/1000; diff --git a/src/devices/grohtml/html-text.cc b/src/devices/grohtml/html-text.cc index 0b63aa0a..56d6c78d 100644 --- a/src/devices/grohtml/html-text.cc +++ b/src/devices/grohtml/html-text.cc @@ -350,7 +350,7 @@ void html_text::do_pre (void) done_bold(); done_italic(); done_tt(); - char *type = done_para(); + (void)done_para(); if (! is_present(PRE_TAG)) { push_para(PRE_TAG, ""); } @@ -661,7 +661,7 @@ int html_text::emitted_text (void) * emit_space - writes a space providing that text was written beforehand. */ -int html_text::emit_space (void) +void html_text::emit_space (void) { if (space_emitted) { if (is_present(PRE_TAG)) { diff --git a/src/devices/grohtml/html-text.h b/src/devices/grohtml/html-text.h index c8ab2ac5..5bbcd431 100644 --- a/src/devices/grohtml/html-text.h +++ b/src/devices/grohtml/html-text.h @@ -78,7 +78,7 @@ public: void done_big (void); void do_indent (char *arg, int indent, int pageoff, int linelen); int emitted_text (void); - int emit_space (void); + void emit_space (void); int is_in_pre (void); void remove_tag (HTML_TAG tag); void remove_sub_sup (void); diff --git a/src/devices/grohtml/output.cc b/src/devices/grohtml/output.cc index 4c72bba7..88ab7d6c 100644 --- a/src/devices/grohtml/output.cc +++ b/src/devices/grohtml/output.cc @@ -71,7 +71,7 @@ word::~word () */ word_list::word_list () - : head(0), tail(0), length(0) + : length(0), head(0), tail(0) { } @@ -208,6 +208,7 @@ simple_output &simple_output::check_newline(int n) fputc('\n', fp); col = last_word.flush(fp); } + return *this; } /* @@ -236,6 +237,7 @@ simple_output &simple_output::space_or_newline (void) col += last_word.flush(fp); } } + return *this; } /* @@ -303,6 +305,7 @@ simple_output &simple_output::enable_newlines (int auto_newlines) check_newline(0); newlines = auto_newlines; check_newline(0); + return *this; } /* diff --git a/src/devices/grohtml/post-html.cc b/src/devices/grohtml/post-html.cc index 0237bfc1..be681b8f 100644 --- a/src/devices/grohtml/post-html.cc +++ b/src/devices/grohtml/post-html.cc @@ -102,11 +102,13 @@ static int max (int a, int b) * is_subsection - returns TRUE if a1..a2 is within b1..b2 */ +#if 0 static int is_subsection (int a1, int a2, int b1, int b2) { // easier to see whether this is not the case return( !((a1 < b1) || (a1 > b2) || (a2 < b1) || (a2 > b2)) ); } +#endif /* * is_intersection - returns TRUE if range a1..a2 intersects with b1..b2 @@ -357,11 +359,11 @@ public: style text_style; char *text_string; unsigned int text_length; - int minv, maxv, minh, maxh; + int minv, minh, maxv, maxh; int is_raw_command; // should the text be sent directly to the device? int is_tag; // is this a .br, .sp, .tl etc - int is_line; // is the command a ? int is_img_auto; // image created by eqn delim + int is_line; // is the command a ? int thickness; // the thickness of a line }; @@ -379,7 +381,7 @@ text_glob::text_glob (style *s, char *string, unsigned int length, } text_glob::text_glob () - : text_string(0), text_length(0), minv(-1), maxv(-1), minh(-1), maxh(-1), + : text_string(0), text_length(0), minv(-1), minh(-1), maxv(-1), maxh(-1), is_raw_command(FALSE), is_tag(FALSE), is_line(FALSE), thickness(0) { } @@ -455,7 +457,7 @@ struct element_list { element_list *left; text_glob *datum; int lineno; - int minv, maxv, minh, maxh; + int minv, minh, maxv, maxh; element_list (text_glob *d, int line_number, @@ -465,7 +467,7 @@ struct element_list { }; element_list::element_list () - : right(0), left(0), datum(0), lineno(0), minv(-1), maxv(-1), minh(-1), maxh(-1) + : right(0), left(0), datum(0), lineno(0), minv(-1), minh(-1), maxv(-1), maxh(-1) { } @@ -2283,10 +2285,10 @@ html_printer::html_printer() end_tempindent(0), next_tag(INLINE), fill_on(TRUE), + linelength(0), pageoffset(0), indentation(0), prev_indent(0), - linelength(0), line_number(0) { #if defined(DEBUGGING) diff --git a/src/devices/grolbp/lbp.cc b/src/devices/grolbp/lbp.cc index 69196af4..c26d3bc1 100644 --- a/src/devices/grolbp/lbp.cc +++ b/src/devices/grolbp/lbp.cc @@ -151,7 +151,7 @@ void lbp_font::handle_unknown_font_command(const char *command, static void wp54charset() { - int i; + unsigned int i; lbpputs("\033[714;100;29;0;32;120.}"); for (i = 0; i < sizeof(symset) ; i++) lbpputc(symset[i]); @@ -561,7 +561,7 @@ static struct static int set_papersize(const char *papersize) { - int i; + unsigned int i; // First test for a standard (i.e. supported directly by the printer) // papersize diff --git a/src/devices/grolj4/lj4.cc b/src/devices/grolj4/lj4.cc index 9fbc6afa..e18298f8 100644 --- a/src/devices/grolj4/lj4.cc +++ b/src/devices/grolj4/lj4.cc @@ -123,7 +123,8 @@ void lj4_font::handle_unknown_font_command(const char *command, const char *arg, const char *filename, int lineno) { - for (int i = 0; i < sizeof(command_table)/sizeof(command_table[0]); i++) { + for (unsigned int i = 0; + i < sizeof(command_table)/sizeof(command_table[0]); i++) { if (strcmp(command, command_table[i].s) == 0) { if (arg == 0) fatal_with_file_and_line(filename, lineno, @@ -568,7 +569,8 @@ printer *make_printer() static int lookup_paper_size(const char *s) { - for (int i = 0; i < sizeof(paper_table)/sizeof(paper_table[0]); i++) { + for (unsigned int i = 0; + i < sizeof(paper_table)/sizeof(paper_table[0]); i++) { // FIXME Perhaps allow unique prefix. if (strcasecmp(s, paper_table[i].name) == 0) return i; diff --git a/src/devices/grops/ps.cc b/src/devices/grops/ps.cc index 98b1a910..8c8dabb1 100644 --- a/src/devices/grops/ps.cc +++ b/src/devices/grops/ps.cc @@ -1248,7 +1248,7 @@ void ps_printer::special(char *arg, const environment *env, char type) error("X command without `ps:' tag ignored"); return; } - for (int i = 0; i < sizeof(proc_table)/sizeof(proc_table[0]); i++) + for (unsigned int i = 0; i < sizeof(proc_table)/sizeof(proc_table[0]); i++) if (strncmp(command, proc_table[i].name, p - command) == 0) { (this->*(proc_table[i].proc))(p, env); return; diff --git a/src/devices/grops/psrm.cc b/src/devices/grops/psrm.cc index b816c6b2..5f232c02 100644 --- a/src/devices/grops/psrm.cc +++ b/src/devices/grops/psrm.cc @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -174,7 +175,7 @@ resource *resource_manager::lookup_font(const char *name) resource *r; for (r = resource_list; r; r = r->next) if (r->type == RESOURCE_FONT - && strlen(name) == r->name.length() + && strlen(name) == (size_t)r->name.length() && memcmp(name, r->name.contents(), r->name.length()) == 0) return r; string s(name); @@ -535,7 +536,7 @@ resource *resource_manager::read_resource_arg(const char **ptr) } int ri; for (ri = 0; ri < NRESOURCES; ri++) - if (strlen(resource_table[ri]) == *ptr - name + if (strlen(resource_table[ri]) == size_t(*ptr - name) && memcmp(resource_table[ri], name, *ptr - name) == 0) break; if (ri >= NRESOURCES) { @@ -717,7 +718,7 @@ int read_one_of(const char **ptr, const char **s, int n) ++(*ptr); } while (**ptr != '\0' && !white_space(**ptr)); for (int i = 0; i < n; i++) - if (strlen(s[i]) == *ptr - start + if (strlen(s[i]) == size_t(*ptr - start) && memcmp(s[i], start, *ptr - start) == 0) return i; return -1; @@ -859,7 +860,7 @@ static unsigned parse_extensions(const char *ptr) } while (*ptr != '\0' && !white_space(*ptr)); int i; for (i = 0; i < NEXTENSIONS; i++) - if (strlen(extension_table[i]) == ptr - name + if (strlen(extension_table[i]) == size_t(ptr - name) && memcmp(extension_table[i], name, ptr - name) == 0) { flags |= (1 << i); break; diff --git a/src/include/lib.h b/src/include/lib.h index ad416e0a..08643220 100644 --- a/src/include/lib.h +++ b/src/include/lib.h @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989-2000 Free Software Foundation, Inc. +/* Copyright (C) 1989-2000, 2001 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -26,9 +26,11 @@ extern "C" { const char *if_to_a(int, int); } -/* stdio.h on IRIX and OSF/1 include getopt.h */ +/* stdio.h on IRIX, OSF/1, and UWIN includes getopt.h */ -#if !(defined(__sgi) || (defined(__osf__) && defined(__alpha))) +#if !(defined(__sgi) \ + || (defined(__osf__) && defined(__alpha)) \ + || defined(_UWIN)) #include #endif diff --git a/src/libs/libbib/index.cc b/src/libs/libbib/index.cc index 55737717..4d836a0f 100644 --- a/src/libs/libbib/index.cc +++ b/src/libs/libbib/index.cc @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -408,7 +408,7 @@ int index_search_item_iterator::get_tag(int tagno, buflen = length + 2; buf = new char[buflen]; } - if (fread(buf + 1, 1, length, fp) != length) + if (fread(buf + 1, 1, length, fp) != (size_t)length) error("fread on `%1' failed: %2", filename, strerror(errno)); else { buf[0] = '\n'; @@ -487,7 +487,7 @@ const int *index_search_item::search1(const char **pp, const char *end) for (int h = hc % common_words_table_size; common_words_table[h]; --h) { - if (strlen(common_words_table[h]) == len + if (strlen(common_words_table[h]) == (size_t)len && memcmp(common_words_table[h], key_buffer, len) == 0) return 0; if (h == 0) diff --git a/src/libs/libgroff/font.cc b/src/libs/libgroff/font.cc index 6cdd6479..aa602b47 100644 --- a/src/libs/libgroff/font.cc +++ b/src/libs/libgroff/font.cc @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -751,7 +752,7 @@ int font::load_desc() while (t.next()) { char *p = strtok(t.buf, WS); int found = 0; - int idx; + unsigned int idx; for (idx = 0; !found && idx < sizeof(table)/sizeof(table[0]); idx++) if (strcmp(table[idx].command, p) == 0) found = 1; diff --git a/src/preproc/eqn/lex.cc b/src/preproc/eqn/lex.cc index 25faec2b..e14053d1 100644 --- a/src/preproc/eqn/lex.cc +++ b/src/preproc/eqn/lex.cc @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -251,7 +252,7 @@ static struct { void init_table(const char *device) { - int i; + unsigned int i; for (i = 0; i < sizeof(token_table)/sizeof(token_table[0]); i++) { definition *def = new definition; def->is_macro = 0; diff --git a/src/preproc/eqn/over.cc b/src/preproc/eqn/over.cc index 06b03212..4c544d1b 100644 --- a/src/preproc/eqn/over.cc +++ b/src/preproc/eqn/over.cc @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -65,7 +65,7 @@ int over_box::compute_metrics(int style) set_script_size(); printf(".nr " SMALL_SIZE_FORMAT " \\n[.s]\n", uid); } - int mark_uid; + int mark_uid = 0; int res = num->compute_metrics(style); if (res) mark_uid = num->uid; diff --git a/src/preproc/html/pre-html.cc b/src/preproc/html/pre-html.cc index 8357dd6e..c87612ef 100644 --- a/src/preproc/html/pre-html.cc +++ b/src/preproc/html/pre-html.cc @@ -187,8 +187,6 @@ char_buffer::~char_buffer() int char_buffer::read_file (FILE *fp) { - int i=0; - unsigned int old_used; int n; while (! feof(fp)) { @@ -456,7 +454,6 @@ void char_buffer::skip_to_newline (char_block **t, int *i) void char_buffer::write_file_troff (void) { char_block *t=head; - int r; int i=0; if (t != 0) { @@ -612,19 +609,6 @@ static void removeAllPages (void) #endif } -/* - * abs - returns the absolute value. - */ - -int abs (int x) -{ - if (x < 0) { - return( -x ); - } else { - return( x ); - } -} - /* * min - returns the minimum of two numbers. */ @@ -712,7 +696,6 @@ static imageList listOfImages; // list of images defined by the region file. void char_buffer::write_file_html (void) { char_block *t =head; - char *name; int i=0; if (t != 0) { @@ -760,7 +743,6 @@ void char_buffer::write_file_html (void) static void generateImages (char *regionFileName) { pushBackBuffer *f=new pushBackBuffer(regionFileName); - char ch; while (f->putPB(f->getPB()) != eof) { if (f->isString("grohtml-info:page")) { @@ -775,10 +757,10 @@ static void generateImages (char *regionFileName) listOfImages.add(x1, y1, x2, y2, page, res, maxx, name); while ((f->putPB(f->getPB()) != '\n') && (f->putPB(f->getPB()) != eof)) { - ch = f->getPB(); + (void)f->getPB(); } if (f->putPB(f->getPB()) == '\n') { - ch = f->getPB(); + (void)f->getPB(); } } else { /* @@ -1034,7 +1016,7 @@ int scanArguments (int argc, char **argv) || (strcmp(argv[i], "-?") == 0)) { usage(stdout); exit(0); - } else if (strcmp(argv[i], "troff") == 0) { + } else if (strcmp(argv[i], troff_command) == 0) { /* remember troff argument number */ troff_arg = i; #if defined(DEBUGGING) diff --git a/src/preproc/html/pushbackbuffer.cc b/src/preproc/html/pushbackbuffer.cc index 1d380f4d..4bea4516 100755 --- a/src/preproc/html/pushbackbuffer.cc +++ b/src/preproc/html/pushbackbuffer.cc @@ -48,7 +48,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # define FALSE (1==0) #endif -# define ERROR(X) (fprintf(stderr, "%s:%d error %s\n", __FILE__, __LINE__, X) && \ +# define ERROR(X) (void)(fprintf(stderr, "%s:%d error %s\n", __FILE__, __LINE__, X) && \ (fflush(stderr)) && localexit(1)) @@ -195,7 +195,6 @@ int pushBackBuffer::isString (char *s) { int length=strlen(s); int i=0; - int j; while ((i='a') && (ch<='f')) ); } +#endif /* * readInt - returns an integer from the input stream. diff --git a/src/preproc/pic/pic.cc b/src/preproc/pic/pic.cc index f6d97bb2..6e6c5270 100755 --- a/src/preproc/pic/pic.cc +++ b/src/preproc/pic/pic.cc @@ -1,6 +1,6 @@ #ifndef lint /*static char yysccsid[] = "from: @(#)yaccpar 1.9 (Berkeley) 02/21/93";*/ -static char yyrcsid[] = "$Id: pic.cc,v 1.3 2000/11/14 20:40:28 wlemb Exp $"; +static char yyrcsid[] = "$Id: pic.cc,v 1.4 2001/04/19 14:01:55 wlemb Exp $"; #endif #define YYBYACC 1 #define YYMAJOR 1 @@ -3217,7 +3217,8 @@ void define_variable(const char *name, double val) if (strcmp(name, "scale") == 0) { // When the scale changes, reset all scaled pre-defined variables to // their default values. - for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++) + for (unsigned int i = 0; + i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++) if (defaults_table[i].scaled) define_variable(defaults_table[i].name, val*defaults_table[i].val); } @@ -3236,7 +3237,8 @@ void parse_init() void reset(const char *nm) { - for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++) + for (unsigned int i = 0; + i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++) if (strcmp(nm, defaults_table[i].name) == 0) { double val = defaults_table[i].val; if (defaults_table[i].scaled) { @@ -3256,7 +3258,8 @@ void reset_all() // aren't scaled because `scale' is not scaled, and changing the // value of `scale' will reset all the pre-defined variables that // are scaled. - for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++) + for (unsigned int i = 0; + i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++) if (!defaults_table[i].scaled) define_variable(defaults_table[i].name, defaults_table[i].val); } diff --git a/src/preproc/pic/pic.y b/src/preproc/pic/pic.y index 38b960a6..c0a7315f 100644 --- a/src/preproc/pic/pic.y +++ b/src/preproc/pic/pic.y @@ -1,4 +1,5 @@ -/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -1622,7 +1623,8 @@ void define_variable(const char *name, double val) if (strcmp(name, "scale") == 0) { // When the scale changes, reset all scaled pre-defined variables to // their default values. - for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++) + for (unsigned int i = 0; + i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++) if (defaults_table[i].scaled) define_variable(defaults_table[i].name, val*defaults_table[i].val); } @@ -1641,7 +1643,8 @@ void parse_init() void reset(const char *nm) { - for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++) + for (unsigned int i = 0; + i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++) if (strcmp(nm, defaults_table[i].name) == 0) { double val = defaults_table[i].val; if (defaults_table[i].scaled) { @@ -1661,7 +1664,8 @@ void reset_all() // aren't scaled because `scale' is not scaled, and changing the // value of `scale' will reset all the pre-defined variables that // are scaled. - for (int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++) + for (unsigned int i = 0; + i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++) if (!defaults_table[i].scaled) define_variable(defaults_table[i].name, defaults_table[i].val); } diff --git a/src/preproc/refer/command.cc b/src/preproc/refer/command.cc index 004189ee..bf88c89d 100644 --- a/src/preproc/refer/command.cc +++ b/src/preproc/refer/command.cc @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -755,7 +755,8 @@ static int check_args(const char *types, const char *name, static void execute_command(const char *name, int argc, argument *argv) { - for (int i = 0; i < sizeof(command_table)/sizeof(command_table[0]); i++) + for (unsigned int i = 0; + i < sizeof(command_table)/sizeof(command_table[0]); i++) if (strcmp(name, command_table[i].name) == 0) { if (check_args(command_table[i].arg_types, name, argc, argv)) (*command_table[i].func)(argc, argv); diff --git a/src/preproc/refer/ref.cc b/src/preproc/refer/ref.cc index c3517b19..9c040789 100644 --- a/src/preproc/refer/ref.cc +++ b/src/preproc/refer/ref.cc @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -327,13 +327,13 @@ void sortify_title(const char *s, int len, string &key) break; } if (ptr < end) { - int first_word_len = ptr - s - 1; + unsigned int first_word_len = ptr - s - 1; const char *ae = articles.contents() + articles.length(); for (const char *a = articles.contents(); a < ae; a = strchr(a, '\0') + 1) if (first_word_len == strlen(a)) { - int j; + unsigned int j; for (j = 0; j < first_word_len; j++) if (a[j] != cmlower(s[j])) break; @@ -951,7 +951,7 @@ static int find_month(const char *start, const char *end) while (ptr < end && csalpha(*ptr)) ptr++; if (ptr - start >= 3) { - for (int i = 0; i < sizeof(months)/sizeof(months[0]); i++) { + for (unsigned int i = 0; i < sizeof(months)/sizeof(months[0]); i++) { const char *q = months[i]; const char *p = start; for (; p < ptr; p++, q++) diff --git a/src/preproc/refer/token.cc b/src/preproc/refer/token.cc index 1cf6890f..e9fac5df 100644 --- a/src/preproc/refer/token.cc +++ b/src/preproc/refer/token.cc @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -181,7 +181,7 @@ const token_info *lookup_token(const char *start, const char *end) for (;;) { if (token_table[n].tok == 0) break; - if (strlen(token_table[n].tok) == end - start + if (strlen(token_table[n].tok) == size_t(end - start) && memcmp(token_table[n].tok, start, end - start) == 0) return &(token_table[n].ti); if (n == 0) diff --git a/src/preproc/soelim/soelim.cc b/src/preproc/soelim/soelim.cc index e05f2406..90b8d1c7 100644 --- a/src/preproc/soelim/soelim.cc +++ b/src/preproc/soelim/soelim.cc @@ -30,7 +30,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "stringclass.h" #include "nonposix.h" -static int include_list_length; +static size_t include_list_length; static char **include_list; int compatible_flag = 0; @@ -183,18 +183,18 @@ int do_file(const char *filename) { char *path = include_list[j]; if (0 == strcmp(path, ".")) - whole_filename = filename; + whole_filename = filename; else - whole_filename = string(path) + "/" + filename; + whole_filename = string(path) + "/" + filename; whole_filename += '\0'; errno = 0; fp = fopen(whole_filename.contents(), "r"); if (fp != 0) - break; + break; if (errno != ENOENT) { - error("can't open `%1': %2", + error("can't open `%1': %2", whole_filename.contents(), strerror(errno)); - return 0; + return 0; } } if (j >= include_list_length) diff --git a/src/preproc/tbl/main.cc b/src/preproc/tbl/main.cc index a08ea0be..4031f434 100644 --- a/src/preproc/tbl/main.cc +++ b/src/preproc/tbl/main.cc @@ -731,7 +731,7 @@ format *process_format(table_input &in, options *opt, int pre_vline = 0; int got_format = 0; int got_period = 0; - format_type t; + format_type t = FORMAT_LEFT; for (;;) { if (c == EOF) { error("end of input while processing format"); diff --git a/src/roff/troff/dictionary.cc b/src/roff/troff/dictionary.cc index 169536c6..bca38451 100644 --- a/src/roff/troff/dictionary.cc +++ b/src/roff/troff/dictionary.cc @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -25,10 +25,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // is `p' a good size for a hash table -static int is_good_size(int p) +static int is_good_size(unsigned int p) { - const int SMALL = 10; - unsigned i; + const unsigned int SMALL = 10; + unsigned int i; for (i = 2; i <= p/2; i++) if (p % i == 0) return 0; diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc index 982e5bd5..26de4dd0 100644 --- a/src/roff/troff/input.cc +++ b/src/roff/troff/input.cc @@ -3505,7 +3505,7 @@ void do_define_macro(define_mode mode, int indirect) } if (bol && c == '.') { const char *s = term.contents(); - int d; + int d = 0; // see if it matches term int i; for (i = 0; s[i] != 0; i++) { @@ -6034,12 +6034,14 @@ struct string_list { string_list(const char *ss) : s(ss), next(0) {} }; +#if 0 static void prepend_string(const char *s, string_list **p) { string_list *l = new string_list(s); l->next = *p; *p = l; } +#endif static void add_string(const char *s, string_list **p) { @@ -6638,7 +6640,7 @@ static struct { static int lookup_warning(const char *name) { - for (int i = 0; + for (unsigned int i = 0; i < sizeof(warning_table)/sizeof(warning_table[0]); i++) if (strcmp(name, warning_table[i].name) == 0) diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h index 3e5f6159..48140c74 100644 --- a/src/roff/troff/node.h +++ b/src/roff/troff/node.h @@ -181,9 +181,9 @@ public: }; struct width_list { - width_list *next; hunits width; hunits sentence_width; + width_list *next; width_list(hunits, hunits); width_list(width_list *); }; diff --git a/src/roff/troff/reg.cc b/src/roff/troff/reg.cc index 254b0ff4..8ac20c9b 100644 --- a/src/roff/troff/reg.cc +++ b/src/roff/troff/reg.cc @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -87,7 +88,7 @@ static const char *number_value_to_ascii(int value, char format, int width) case '1': if (width <= 0) return i_to_a(value); - else if (width > sizeof(buf) - 2) + else if (width > int(sizeof(buf) - 2)) sprintf(buf, "%.*d", int(sizeof(buf) - 2), int(value)); else sprintf(buf, "%.*d", width, int(value)); diff --git a/src/utils/addftinfo/addftinfo.cc b/src/utils/addftinfo/addftinfo.cc index 43a81bcb..69fb8d48 100644 --- a/src/utils/addftinfo/addftinfo.cc +++ b/src/utils/addftinfo/addftinfo.cc @@ -67,7 +67,8 @@ static struct { int main(int argc, char **argv) { program_name = argv[0]; - for (int i = 1; i < argc; i++) { + int i; + for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-v") || !strcmp(argv[i],"--version")) version(); if (!strcmp(argv[i],"--help")) { @@ -99,7 +100,6 @@ int main(int argc, char **argv) param.comma_depth = DEFAULT_COMMA_DEPTH; param.desc_depth = DEFAULT_DESC_DEPTH; param.body_depth = DEFAULT_BODY_DEPTH; - int i; for (i = 1; i < argc && argv[i][0] == '-'; i++) { if (argv[i][1] == '-' && argv[i][2] == '\0') { i++; @@ -107,7 +107,7 @@ int main(int argc, char **argv) } if (i + 1 >= argc) usage(); - int j; + size_t j; for (j = 0;; j++) { if (j >= sizeof(param_table)/sizeof(param_table[0])) fatal("parameter `%1' not recognized", argv[i] + 1); diff --git a/src/utils/hpftodit/hpftodit.cc b/src/utils/hpftodit/hpftodit.cc index f81f5ad8..3034847a 100644 --- a/src/utils/hpftodit/hpftodit.cc +++ b/src/utils/hpftodit/hpftodit.cc @@ -163,10 +163,10 @@ entry tags[max_tag + 1 - min_tag]; char_info *char_table; uint32 nchars; -int msl_name_table_size = 0; +unsigned int msl_name_table_size = 0; name_list **msl_name_table = 0; -int n_symbol_sets; +unsigned int n_symbol_sets; symbol_set *symbol_set_table; static int special_flag = 0; @@ -337,7 +337,7 @@ void File::skip(int n) void File::seek(uint32 n) { - if (end_ - buf_ < n) + if ((uint32)(end_ - buf_) < n) fatal("unexpected end of file"); ptr_ = buf_ + n; } @@ -437,7 +437,7 @@ void read_symbol_sets(File &f) uint32 symbol_set_dir_length = tag_info(symbol_set_tag).count; n_symbol_sets = symbol_set_dir_length/14; symbol_set_table = new symbol_set[n_symbol_sets]; - int i; + unsigned int i; for (i = 0; i < n_symbol_sets; i++) { f.seek(tag_info(symbol_set_tag).value + i*14); (void)f.get_uint32(); @@ -445,7 +445,7 @@ void read_symbol_sets(File &f) uint32 off2 = f.get_uint32(); (void)f.get_uint16(); // what's this for? f.seek(off1); - int j; + unsigned int j; uint16 kind = 0; for (j = 0; j < off2 - off1; j++) { unsigned char c = f.get_byte(); @@ -465,7 +465,7 @@ void read_symbol_sets(File &f) ? special_symbol_sets : text_symbol_sets); for (i = 0; symbol_set_selectors[i] != 0; i++) { - int j; + unsigned int j; for (j = 0; j < n_symbol_sets; j++) if (symbol_set_table[j].select == symbol_set_selectors[i]) break; @@ -610,13 +610,13 @@ void output_ligatures() }; unsigned ligature_mask = 0; - int i; + unsigned int i; for (i = 0; i < nchars; i++) { uint16 msl = char_table[i].msl; if (msl < msl_name_table_size && char_table[i].symbol_set != NO_SYMBOL_SET) { for (name_list *p = msl_name_table[msl]; p; p = p->next) - for (int j = 0; j < SIZEOF(ligature_chars); j++) + for (unsigned int j = 0; j < SIZEOF(ligature_chars); j++) if (strcmp(p->name, ligature_chars[j]) == 0) { ligature_mask |= 1 << j; break; @@ -671,7 +671,7 @@ void output_charset() require_tag(lower_descent_tag); printf("charset\n"); - int i; + unsigned int i; for (i = 0; i < nchars; i++) { uint16 msl = char_table[i].msl; if (msl < msl_name_table_size diff --git a/src/utils/indxbib/indxbib.cc b/src/utils/indxbib/indxbib.cc index 99a6baf4..ee4543b5 100644 --- a/src/utils/indxbib/indxbib.cc +++ b/src/utils/indxbib/indxbib.cc @@ -232,7 +232,8 @@ int main(int argc, char **argv) else name_max = dir_name_max("."); const char *filename = p ? p + 1 : basename; - if (name_max >= 0 && strlen(filename) + sizeof(INDEX_SUFFIX) - 1 > name_max) + if (name_max >= 0 && + long(strlen(filename) + sizeof(INDEX_SUFFIX) - 1) > name_max) fatal("`%1.%2' is too long for a filename", filename, INDEX_SUFFIX); if (p) { p++; @@ -502,7 +503,7 @@ static int do_file(const char *filename) // every CR character before a Newline. if (c == '\r') { int peek = getc(fp); - if (peek = '\n') { + if (peek == '\n') { byte_count++; c = peek; } @@ -784,7 +785,7 @@ static void write_hash_table() static void fwrite_or_die(const void *ptr, int size, int nitems, FILE *fp) { - if (fwrite(ptr, size, nitems, fp) != nitems) + if (fwrite(ptr, size, nitems, fp) != (size_t)nitems) fatal("fwrite failed: %1", strerror(errno)); } diff --git a/src/utils/lkbib/lkbib.cc b/src/utils/lkbib/lkbib.cc index 4d3cadcb..ee6b05ed 100644 --- a/src/utils/lkbib/lkbib.cc +++ b/src/utils/lkbib/lkbib.cc @@ -126,7 +126,7 @@ int main(int argc, char **argv) int len; int count; for (count = 0; iter.next(&start, &len); count++) { - if (fwrite(start, 1, len, stdout) != len) + if (fwrite(start, 1, len, stdout) != (size_t)len) fatal("write error on stdout: %1", strerror(errno)); // Can happen for last reference in file. if (start[len - 1] != '\n') diff --git a/src/utils/lookbib/lookbib.cc b/src/utils/lookbib/lookbib.cc index dc55ed93..103cd0b5 100644 --- a/src/utils/lookbib/lookbib.cc +++ b/src/utils/lookbib/lookbib.cc @@ -120,7 +120,7 @@ int main(int argc, char **argv) int len; int count; for (count = 0; iter.next(&start, &len); count++) { - if (fwrite(start, 1, len, stdout) != len) + if (fwrite(start, 1, len, stdout) != (size_t)len) fatal("write error on stdout: %1", strerror(errno)); // Can happen for last reference in file. if (start[len - 1] != '\n') diff --git a/src/utils/tfmtodit/tfmtodit.cc b/src/utils/tfmtodit/tfmtodit.cc index 96768d2b..cb505e45 100644 --- a/src/utils/tfmtodit/tfmtodit.cc +++ b/src/utils/tfmtodit/tfmtodit.cc @@ -289,7 +289,7 @@ int tfm::load(const char *file) int lf = (c1 << 8) + c2; int toread = lf*4 - 2; unsigned char *buf = new unsigned char[toread]; - if (fread(buf, 1, toread, fp) != toread) { + if (fread(buf, 1, toread, fp) != (size_t)toread) { if (feof(fp)) error("unexpected end of file on `%1'", file); else @@ -491,7 +491,7 @@ int gf::load(const char *file) if (len == EOF) goto eof; char buf[256]; - if (fread(buf, 1, len, fp) != len) + if (fread(buf, 1, len, fp) != (size_t)len) goto eof; if (len == 10 /* strlen("adjustment") */ && memcmp(buf, "adjustment", len) == 0) { @@ -786,12 +786,12 @@ int main(int argc, char **argv) int xheight; if (!t.get_param(5, &xheight)) xheight = 0; - int i; + unsigned int i; // Print the list of ligatures. // First find the indices of each character that can participate in // a ligature. for (i = 0; i < 256; i++) - for (int j = 0; j < sizeof(lig_chars)/sizeof(lig_chars[0]); j++) + for (unsigned int j = 0; j < sizeof(lig_chars)/sizeof(lig_chars[0]); j++) for (char_list *p = table[i]; p; p = p->next) if (strcmp(lig_chars[j].ch, p->ch) == 0) lig_chars[j].i = i; -- cgit v1.2.1