diff options
author | wlemb <wlemb> | 2004-04-19 06:17:40 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2004-04-19 06:17:40 +0000 |
commit | 85ef3aadf1f6f6a359d524543856fa9c799d2044 (patch) | |
tree | 7d4aacdaea5b60e99275b1b3fa9acfbed4d00b70 | |
parent | 3f3dc53655e90cb788123a78b30e000312f0ed02 (diff) | |
download | groff-85ef3aadf1f6f6a359d524543856fa9c799d2044.tar.gz |
* src/include/font.h (font): Use `int' for ch_index.
* src/libs/libgroff/font.cpp (font::alloc_ch_index,
font::compact): Updated.
* src/roff/groff/pipeline.c (run_pipeline) [_WIN32]: Fix compiler
warnings.
* src/roff/troff/div.cpp (begin_page), src/roff/troff/env.cpp
(hyphen_word): Fix compiler warnings.
* src/roff/troff/input.cpp (get_char_for_escape_name): Return
`char'.
Update all callers.
(get_delim_number, get_line_arg): Change second argument type to
`unsigned char'.
(macro_header::copy, token::next, do_define_string,
do_define_character, substring_request, asciify_macro,
unformat_macro, read_size, non_interpreted_node::interpret,
while_request, main: Fix compiler warnings.
(read_color_draw_node): Initialize `col'.
* src/preproc/tbl/table.cpp (horizontal_span, table_entry): Make
`start_col' and `end_col' of type `int'.
(vertical_rule): Make `col' of type `int'.
* src/preproc/grn/hdb.cpp (DBRead): Protect call to getc with check
for EOF.
* src/preproc/refer/label.y (uppercase_array, lowercase_array):
New arrays.
(format_serial): Use them to remove dependency on ASCII.
* src/devices/grops/ps.cpp (ps_printer::define_encoding): Fix
compiler warning.
* src/devices/grops/psrm.cpp (resource_manager::supply_resource):
Ditto.
* src/devices/grotty/tty.cpp (tty_font::load_tty_font): Fix
compiler warnings.
(glyph): Change type of `hpos' to `int'.
* src/devices/lbp/lbp.cpp (strsep): Removed. Unused.
* src/devices/lbp/lbp.h (splinerel): Fix compiler warnings.
* src/utils/tfmtodit.cpp (gf::load): Fix compiler warnings.
* src/utils/pfbtops/pfbtops.c (get_text): Fix compiler warning.
-rw-r--r-- | ChangeLog | 49 | ||||
-rw-r--r-- | src/devices/grohtml/post-html.cpp | 4 | ||||
-rw-r--r-- | src/devices/grolbp/lbp.cpp | 15 | ||||
-rw-r--r-- | src/devices/grolbp/lbp.h | 2 | ||||
-rw-r--r-- | src/devices/grops/ps.cpp | 4 | ||||
-rw-r--r-- | src/devices/grops/psrm.cpp | 4 | ||||
-rw-r--r-- | src/devices/grotty/tty.cpp | 7 | ||||
-rw-r--r-- | src/include/font.h | 5 | ||||
-rw-r--r-- | src/libs/libgroff/font.cpp | 14 | ||||
-rw-r--r-- | src/preproc/grn/hdb.cpp | 7 | ||||
-rw-r--r-- | src/preproc/refer/label.y | 17 | ||||
-rw-r--r-- | src/preproc/tbl/table.cpp | 10 | ||||
-rw-r--r-- | src/roff/groff/pipeline.c | 6 | ||||
-rw-r--r-- | src/roff/troff/div.cpp | 2 | ||||
-rw-r--r-- | src/roff/troff/env.cpp | 2 | ||||
-rw-r--r-- | src/roff/troff/input.cpp | 44 | ||||
-rw-r--r-- | src/utils/pfbtops/pfbtops.c | 2 | ||||
-rw-r--r-- | src/utils/tfmtodit/tfmtodit.cpp | 2 |
18 files changed, 125 insertions, 71 deletions
@@ -1,3 +1,52 @@ +2004-04-17 Werner LEMBERG <wl@gnu.org> + + * src/include/font.h (font): Use `int' for ch_index. + * src/libs/libgroff/font.cpp (font::alloc_ch_index, + font::compact): Updated. + + * src/roff/groff/pipeline.c (run_pipeline) [_WIN32]: Fix compiler + warnings. + + * src/roff/troff/div.cpp (begin_page), src/roff/troff/env.cpp + (hyphen_word): Fix compiler warnings. + * src/roff/troff/input.cpp (get_char_for_escape_name): Return + `char'. + Update all callers. + (get_delim_number, get_line_arg): Change second argument type to + `unsigned char'. + (macro_header::copy, token::next, do_define_string, + do_define_character, substring_request, asciify_macro, + unformat_macro, read_size, non_interpreted_node::interpret, + while_request, main: Fix compiler warnings. + (read_color_draw_node): Initialize `col'. + + * src/preproc/tbl/table.cpp (horizontal_span, table_entry): Make + `start_col' and `end_col' of type `int'. + (vertical_rule): Make `col' of type `int'. + + * src/preproc/grn/hdb.cpp (DBRead): Protect call to getc with check + for EOF. + + * src/preproc/refer/label.y (uppercase_array, lowercase_array): + New arrays. + (format_serial): Use them to remove dependency on ASCII. + + * src/devices/grops/ps.cpp (ps_printer::define_encoding): Fix + compiler warning. + * src/devices/grops/psrm.cpp (resource_manager::supply_resource): + Ditto. + + * src/devices/grotty/tty.cpp (tty_font::load_tty_font): Fix + compiler warnings. + (glyph): Change type of `hpos' to `int'. + + * src/devices/lbp/lbp.cpp (strsep): Removed. Unused. + * src/devices/lbp/lbp.h (splinerel): Fix compiler warnings. + + * src/utils/tfmtodit.cpp (gf::load): Fix compiler warnings. + + * src/utils/pfbtops/pfbtops.c (get_text): Fix compiler warning. + 2004-04-16 Werner LEMBERG <wl@gnu.org> * src/devices/grolbp/lbp.h, src/preproc/grn/gprint.h, diff --git a/src/devices/grohtml/post-html.cpp b/src/devices/grohtml/post-html.cpp index 18a1d8eb..1da74c2a 100644 --- a/src/devices/grohtml/post-html.cpp +++ b/src/devices/grohtml/post-html.cpp @@ -2886,8 +2886,8 @@ void html_printer::lookahead_for_tables (void) int found_col = FALSE; int seen_text = FALSE; int ncol = 0; - int colmin; - int colmax; + int colmin = 0; // pacify compiler + int colmax = 0; // pacify compiler html_table *tbl = new html_table(&html, -1); const char *tab_defs = NULL; char align = 'L'; diff --git a/src/devices/grolbp/lbp.cpp b/src/devices/grolbp/lbp.cpp index af5e2883..0f480843 100644 --- a/src/devices/grolbp/lbp.cpp +++ b/src/devices/grolbp/lbp.cpp @@ -91,21 +91,6 @@ private: int paperwidth; }; -// Compatibility section. -// -// Here we define some functions not present in some of the targets -// platforms -#ifndef HAVE_STRSEP -// Solaris 8 doesn't have the strsep function -static char *strsep(char **pcadena, const char *delim) -{ - char *p; - p = strtok(*pcadena, delim); - *pcadena = strtok(NULL, delim); - return p; -} -#endif - lbp_font::lbp_font(const char *nm) : font(nm) { diff --git a/src/devices/grolbp/lbp.h b/src/devices/grolbp/lbp.h index 548e4910..178ae584 100644 --- a/src/devices/grolbp/lbp.h +++ b/src/devices/grolbp/lbp.h @@ -350,7 +350,7 @@ splinerel(double px,double py,int flush) static int lx = 0 ,ly = 0; static double pend = 0.0; static int dy = 0, despx = 0, despy = 0, sigpend = 0; - int dxnew ,dynew, sg; + int dxnew = 0, dynew = 0, sg; char xcoord[4],ycoord[4]; double npend ; diff --git a/src/devices/grops/ps.cpp b/src/devices/grops/ps.cpp index 2ab1e077..41aece50 100644 --- a/src/devices/grops/ps.cpp +++ b/src/devices/grops/ps.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -797,7 +797,7 @@ void ps_printer::define_encoding(const char *encoding, int encoding_index) p++; if (*p != '#' && *p != '\0' && (p = strtok(buf, WS)) != 0) { char *q = strtok(0, WS); - int n; + int n = 0; // pacify compiler if (q == 0 || sscanf(q, "%d", &n) != 1 || n < 0 || n >= 256) fatal_with_file_and_line(path, lineno, "bad second field"); vec[n] = new char[strlen(p) + 1]; diff --git a/src/devices/grops/psrm.cpp b/src/devices/grops/psrm.cpp index 03e38bb4..faa140db 100644 --- a/src/devices/grops/psrm.cpp +++ b/src/devices/grops/psrm.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -347,7 +347,7 @@ void resource_manager::supply_resource(resource *r, int rank, FILE *outfp, r->flags |= resource::BUSY; if (rank > r->rank) r->rank = rank; - char *path; + char *path = 0; // pacify compiler FILE *fp = 0; if (r->filename != 0) { if (r->type == RESOURCE_FONT) { diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp index 20225c54..bdaa1de3 100644 --- a/src/devices/grotty/tty.cpp +++ b/src/devices/grotty/tty.cpp @@ -121,13 +121,14 @@ tty_font *tty_font::load_tty_font(const char *s) const char *num = f->get_internal_name(); long n; if (num != 0 && (n = strtol(num, 0, 0)) != 0) - f->mode = int(n & (BOLD_MODE|UNDERLINE_MODE)); + f->mode = (unsigned char)(n & (BOLD_MODE|UNDERLINE_MODE)); if (!underline_flag) f->mode &= ~UNDERLINE_MODE; if (!bold_flag) f->mode &= ~BOLD_MODE; if ((f->mode & (BOLD_MODE|UNDERLINE_MODE)) == (BOLD_MODE|UNDERLINE_MODE)) - f->mode = (f->mode & ~(BOLD_MODE|UNDERLINE_MODE)) | bold_underline_mode; + f->mode = (unsigned char)((f->mode & ~(BOLD_MODE|UNDERLINE_MODE)) + | bold_underline_mode); return f; } @@ -154,7 +155,7 @@ class glyph { static glyph *free_list; public: glyph *next; - short hpos; + int hpos; unsigned int code; unsigned char mode; schar back_color_idx; diff --git a/src/include/font.h b/src/include/font.h index 43bf1213..3d46138e 100644 --- a/src/include/font.h +++ b/src/include/font.h @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2004 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -87,7 +88,7 @@ private: unsigned ligatures; font_kern_list **kern_hash_table; int space_width; - short *ch_index; + int *ch_index; int nindices; font_char_metric *ch; int ch_used; diff --git a/src/libs/libgroff/font.cpp b/src/libs/libgroff/font.cpp index 582085d8..7883fdf6 100644 --- a/src/libs/libgroff/font.cpp +++ b/src/libs/libgroff/font.cpp @@ -403,7 +403,7 @@ void font::alloc_ch_index(int idx) nindices = 128; if (idx >= nindices) nindices = idx + 10; - ch_index = new short[nindices]; + ch_index = new int[nindices]; for (int i = 0; i < nindices; i++) ch_index[i] = -1; } @@ -412,9 +412,9 @@ void font::alloc_ch_index(int idx) nindices *= 2; if (idx >= nindices) nindices = idx + 10; - short *old_ch_index = ch_index; - ch_index = new short[nindices]; - memcpy(ch_index, old_ch_index, sizeof(short)*old_nindices); + int *old_ch_index = ch_index; + ch_index = new int[nindices]; + memcpy(ch_index, old_ch_index, sizeof(int)*old_nindices); for (int i = old_nindices; i < nindices; i++) ch_index[i] = -1; a_delete old_ch_index; @@ -443,9 +443,9 @@ void font::compact() break; i++; if (i < nindices) { - short *old_ch_index = ch_index; - ch_index = new short[i]; - memcpy(ch_index, old_ch_index, i*sizeof(short)); + int *old_ch_index = ch_index; + ch_index = new int[i]; + memcpy(ch_index, old_ch_index, i*sizeof(int)); a_delete old_ch_index; nindices = i; } diff --git a/src/preproc/grn/hdb.cpp b/src/preproc/grn/hdb.cpp index f65ccf5c..a9641ee2 100644 --- a/src/preproc/grn/hdb.cpp +++ b/src/preproc/grn/hdb.cpp @@ -1,4 +1,4 @@ -/* Last non-groff version: hdb.c 1.8 (Berkeley) 84/10/20 + /* Last non-groff version: hdb.c 1.8 (Berkeley) 84/10/20 * * Copyright -C- 1982 Barry S. Roitblat * @@ -181,7 +181,10 @@ DBRead(register FILE *file) (void) getc(file); /* eat blank */ txt = (char *) malloc((unsigned) len + 1); for (i = 0; i < len; ++i) { /* read text */ - txt[i] = getc(file); + int c = getc(file); + if (c == EOF) + break; + txt[i] = c; } txt[len] = '\0'; (void) DBCreateElt(type, plist, brush, size, txt, &elist); diff --git a/src/preproc/refer/label.y b/src/preproc/refer/label.y index 9446f19d..93993c8e 100644 --- a/src/preproc/refer/label.y +++ b/src/preproc/refer/label.y @@ -407,6 +407,20 @@ const char *spec_ptr; const char *spec_end; const char *spec_cur; +static char uppercase_array[] = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', + 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', +}; + +static char lowercase_array[] = { + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', + 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', + 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', + 'y', 'z', +}; + int yylex() { while (spec_ptr < spec_end && csspace(*spec_ptr)) @@ -590,7 +604,8 @@ static const char *format_serial(char c, int n) d = 26; n -= d; n /= 26; - *p++ = c + d - 1; // ASCII dependent + *p++ = c == 'a' ? lowercase_array[d - 1] : + uppercase_array[d - 1]; } *p-- = 0; // Reverse it. diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp index 4b58b47e..906d34ff 100644 --- a/src/preproc/tbl/table.cpp +++ b/src/preproc/tbl/table.cpp @@ -128,8 +128,8 @@ void prints(const string &s) struct horizontal_span { horizontal_span *next; - short start_col; - short end_col; + int start_col; + int end_col; horizontal_span(int, int, horizontal_span *); }; @@ -145,8 +145,8 @@ friend class table; protected: int start_row; int end_row; - short start_col; - short end_col; + int start_col; + int end_col; const entry_modifier *mod; public: void set_location(); @@ -1090,7 +1090,7 @@ struct vertical_rule { vertical_rule *next; int start_row; int end_row; - short col; + int col; char is_double; string top_adjust; string bot_adjust; diff --git a/src/roff/groff/pipeline.c b/src/roff/groff/pipeline.c index 952655f4..9bb7bdd8 100644 --- a/src/roff/groff/pipeline.c +++ b/src/roff/groff/pipeline.c @@ -213,9 +213,9 @@ int is_system_shell(const char *prog) int run_pipeline(int ncommands, char ***commands, int no_pipe) { int i; - int last_input; - int save_stdin; - int save_stdout; + int last_input = 0; /* pacify some compilers */ + int save_stdin = 0; + int save_stdout = 0; int ret = 0; char err_str[BUFSIZ]; PID_T pids[MAX_COMMANDS]; diff --git a/src/roff/troff/div.cpp b/src/roff/troff/div.cpp index ae8a30ce..578df24b 100644 --- a/src/roff/troff/div.cpp +++ b/src/roff/troff/div.cpp @@ -669,7 +669,7 @@ void when_request() void begin_page() { int got_arg = 0; - int n; + int n = 0; /* pacify compiler */ if (has_arg() && get_integer(&n, topdiv->get_page_number())) got_arg = 1; while (!tok.newline() && !tok.eof()) diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp index 9a3dc171..6ed13970 100644 --- a/src/roff/troff/env.cpp +++ b/src/roff/troff/env.cpp @@ -3371,7 +3371,7 @@ static void hyphen_word() pos[npos++] = i; } else { - int c = ci->get_hyphenation_code(); + unsigned char c = ci->get_hyphenation_code(); if (c == 0) break; buf[i++] = c; diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index 07e2cb1d..10037a03 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -141,10 +141,10 @@ static void interpolate_environment_variable(symbol); static symbol composite_glyph_name(symbol); static void interpolate_arg(symbol); static request_or_macro *lookup_request(symbol); -static int get_delim_number(units *, int); -static int get_delim_number(units *, int, units); +static int get_delim_number(units *, unsigned char); +static int get_delim_number(units *, unsigned char, units); static symbol do_get_long_name(int, char); -static int get_line_arg(units *res, int si, charinfo **cp); +static int get_line_arg(units *res, unsigned char si, charinfo **cp); static int read_size(int *); static symbol get_delim_name(); static void init_registers(); @@ -687,7 +687,7 @@ void shift() skip_line(); } -static int get_char_for_escape_name(int allow_space = 0) +static char get_char_for_escape_name(int allow_space = 0) { int c = get_copy(0); switch (c) { @@ -737,7 +737,7 @@ static symbol read_long_escape_name(read_mode mode) char *buf = abuf; int buf_size = ABUF_SIZE; int i = 0; - int c; + char c; int have_char = 0; for (;;) { c = get_char_for_escape_name(have_char && mode == WITH_ARGS); @@ -787,7 +787,7 @@ static symbol read_long_escape_name(read_mode mode) static symbol read_escape_name(read_mode mode) { - int c = get_char_for_escape_name(); + char c = get_char_for_escape_name(); if (c == 0) return NULL_SYMBOL; if (c == '(') @@ -802,7 +802,7 @@ static symbol read_escape_name(read_mode mode) static symbol read_increment_and_escape_name(int *incp) { - int c = get_char_for_escape_name(); + char c = get_char_for_escape_name(); switch (c) { case 0: *incp = 0; @@ -1552,7 +1552,7 @@ void token::next() } units x; for (;;) { - node *n; + node *n = 0; int cc = input_stack::get(&n); if (cc != escape_char || escape_char == 0) { handle_normal_char: @@ -3116,7 +3116,7 @@ macro_header *macro_header::copy(int n) bp = bp->next; ptr = bp->s; } - int c = *ptr++; + unsigned char c = *ptr++; p->cl.append(c); if (c == 0) { p->nl.append(nd->copy()); @@ -3833,7 +3833,7 @@ enum comp_mode { COMP_IGNORE, COMP_DISABLE }; void do_define_string(define_mode mode, comp_mode comp) { symbol nm; - node *n; + node *n = 0; // pacify compiler int c; nm = get_name(1); if (nm.is_null()) { @@ -3901,7 +3901,7 @@ void append_nocomp_string() void do_define_character(char_mode mode, const char *font_name) { - node *n; + node *n = 0; // pacify compiler int c; tok.skip(); charinfo *ci = tok.get_char(1); @@ -4419,7 +4419,7 @@ void substring_request() } macro mac; for (; i <= end; i++) { - node *nd; + node *nd = 0; // pacify compiler int c = iter.get(&nd); while (c == COMPATIBLE_SAVE || c == COMPATIBLE_RESTORE) c = iter.get(0); @@ -4487,7 +4487,7 @@ void asciify_macro() macro am; string_iterator iter(*m); for (;;) { - node *nd; + node *nd = 0; // pacify compiler int c = iter.get(&nd); if (c == EOF) break; @@ -4514,7 +4514,7 @@ void unformat_macro() macro am; string_iterator iter(*m); for (;;) { - node *nd; + node *nd = 0; // pacify compiler int c = iter.get(&nd); if (c == EOF) break; @@ -4555,7 +4555,7 @@ static void interpolate_number_format(symbol nm) input_stack::push(make_temp_iterator(r->get_format())); } -static int get_delim_number(units *n, int si, int prev_value) +static int get_delim_number(units *n, unsigned char si, int prev_value) { token start; start.next(); @@ -4570,7 +4570,7 @@ static int get_delim_number(units *n, int si, int prev_value) return 0; } -static int get_delim_number(units *n, int si) +static int get_delim_number(units *n, unsigned char si) { token start; start.next(); @@ -4585,7 +4585,7 @@ static int get_delim_number(units *n, int si) return 0; } -static int get_line_arg(units *n, int si, charinfo **cp) +static int get_line_arg(units *n, unsigned char si, charinfo **cp) { token start; start.next(); @@ -4622,7 +4622,7 @@ static int read_size(int *x) tok.next(); c = tok.ch(); } - int val; + int val = 0; // pacify compiler int bad = 0; if (c == '(') { tok.next(); @@ -4921,7 +4921,7 @@ node *non_interpreted_node::copy() int non_interpreted_node::interpret(macro *m) { string_iterator si(mac); - node *n; + node *n = 0; // pacify compiler for (;;) { int c = si.get(&n); if (c == EOF) @@ -5356,7 +5356,7 @@ void while_request() int level = 0; mac.append(new token_node(tok)); for (;;) { - node *n; + node *n = 0; // pacify compiler int c = input_stack::get(&n); if (c == EOF) break; @@ -6962,7 +6962,7 @@ int main(int argc, char **argv) int fflag = 0; int nflag = 0; int no_rc = 0; // don't process troffrc and troffrc-end - int next_page_number; + int next_page_number = 0; // pacify compiler opterr = 0; hresolution = vresolution = 1; // restore $PATH if called from groff @@ -7545,7 +7545,7 @@ static void read_color_draw_node(token &start) } unsigned char scheme = tok.ch(); tok.next(); - color *col; + color *col = 0; char end = start.ch(); switch (scheme) { case 'c': diff --git a/src/utils/pfbtops/pfbtops.c b/src/utils/pfbtops/pfbtops.c index 72a100e5..a614a7d7 100644 --- a/src/utils/pfbtops/pfbtops.c +++ b/src/utils/pfbtops/pfbtops.c @@ -52,7 +52,7 @@ static void usage(FILE *stream) static void get_text(int n) { - int c, c1; + int c = 0, c1; int in_string = 0; int is_comment = 0; int count = 0; diff --git a/src/utils/tfmtodit/tfmtodit.cpp b/src/utils/tfmtodit/tfmtodit.cpp index 2392f7b6..1c094b5a 100644 --- a/src/utils/tfmtodit/tfmtodit.cpp +++ b/src/utils/tfmtodit/tfmtodit.cpp @@ -412,7 +412,7 @@ int gf::load(const char *file) }; int got_an_adjustment = 0; int pending_adjustment = 0; - int left_adj, right_adj; + int left_adj = 0, right_adj = 0; // pacify compiler const int gf_id_byte = 131; errno = 0; FILE *fp = fopen(file, FOPEN_RB); |