diff options
author | Gerald Combs <gerald@wireshark.org> | 2012-11-01 21:17:29 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2012-11-01 21:17:29 +0000 |
commit | 606a7433ce70eb1cefd2f39d619cab536276b653 (patch) | |
tree | cca7134373742379c35694a63afea0b8e11bdb78 /print.c | |
parent | abf7f1c72429ca88b6203438d54fce6f41e95d04 (diff) | |
download | wireshark-606a7433ce70eb1cefd2f39d619cab536276b653.tar.gz wireshark-606a7433ce70eb1cefd2f39d619cab536276b653.tar.bz2 wireshark-606a7433ce70eb1cefd2f39d619cab536276b653.zip |
Add changes missing from the last commit.
svn path=/trunk/; revision=45862
Diffstat (limited to 'print.c')
-rw-r--r-- | print.c | 73 |
1 files changed, 25 insertions, 48 deletions
@@ -97,7 +97,7 @@ static const guint8 *get_field_data(GSList *src_list, field_info *fi); static void write_pdml_field_hex_value(write_pdml_data *pdata, field_info *fi); static gboolean print_hex_data_buffer(print_stream_t *stream, const guchar *cp, guint length, packet_char_enc encoding); -static void ps_clean_string(unsigned char *out, const unsigned char *in, +static void ps_clean_string(char *out, const char *in, int outbuf_size); static void print_escaped_xml(FILE *fh, const char *unescaped_string); @@ -106,7 +106,7 @@ static void print_pdml_geninfo(proto_tree *tree, FILE *fh); static void proto_tree_get_node_field_values(proto_node *node, gpointer data); static FILE * -open_print_dest(int to_file, const char *dest) +open_print_dest(gboolean to_file, const char *dest) { FILE *fh; @@ -120,7 +120,7 @@ open_print_dest(int to_file, const char *dest) } static gboolean -close_print_dest(int to_file, FILE *fh) +close_print_dest(gboolean to_file, FILE *fh) { /* Close the file or command */ if (to_file) @@ -945,10 +945,10 @@ print_hex_data_buffer(print_stream_t *stream, const guchar *cp, guint length, packet_char_enc encoding) { register unsigned int ad, i, j, k, l; - guchar c; - guchar line[MAX_LINE_LEN + 1]; + gchar c; + gchar line[MAX_LINE_LEN + 1]; unsigned int use_digits; - static guchar binhex[16] = { + static gchar binhex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; @@ -982,7 +982,7 @@ print_hex_data_buffer(print_stream_t *stream, const guchar *cp, do { l--; c = (ad >> (l*4)) & 0xF; - line[j++] = binhex[c]; + line[j++] = binhex[(unsigned int) c]; } while (l != 0); line[j++] = ' '; line[j++] = ' '; @@ -1019,8 +1019,7 @@ print_hex_data_buffer(print_stream_t *stream, const guchar *cp, } static -void ps_clean_string(unsigned char *out, const unsigned char *in, - int outbuf_size) +void ps_clean_string(char *out, const char *in, int outbuf_size) { int rd, wr; char c; @@ -1055,7 +1054,7 @@ void ps_clean_string(unsigned char *out, const unsigned char *in, gboolean print_preamble(print_stream_t *self, gchar *filename) { - return (self->ops->print_preamble)(self, filename); + return self->ops->print_preamble ? (self->ops->print_preamble)(self, filename) : TRUE; } gboolean @@ -1068,41 +1067,34 @@ print_line(print_stream_t *self, int indent, const char *line) gboolean print_bookmark(print_stream_t *self, const gchar *name, const gchar *title) { - return (self->ops->print_bookmark)(self, name, title); + return self->ops->print_bookmark ? (self->ops->print_bookmark)(self, name, title) : TRUE; } gboolean new_page(print_stream_t *self) { - return (self->ops->new_page)(self); + return self->ops->new_page ? (self->ops->new_page)(self) : TRUE; } /* Some formats need stuff at the end of the output */ gboolean print_finale(print_stream_t *self) { - return (self->ops->print_finale)(self); + return self->ops->print_finale ? (self->ops->print_finale)(self) : TRUE; } gboolean destroy_print_stream(print_stream_t *self) { - return (self->ops->destroy)(self); + return self->ops->destroy ? (self->ops->destroy)(self) : TRUE; } typedef struct { - int to_file; + gboolean to_file; FILE *fh; } output_text; static gboolean -print_preamble_text(print_stream_t *self _U_, gchar *filename _U_) -{ - /* do nothing */ - return TRUE; /* always succeeds */ -} - -static gboolean print_line_text(print_stream_t *self, int indent, const char *line) { output_text *output = (output_text *)self->data; @@ -1128,14 +1120,6 @@ print_line_text(print_stream_t *self, int indent, const char *line) } static gboolean -print_bookmark_text(print_stream_t *self _U_, const gchar *name _U_, - const gchar *title _U_) -{ - /* do nothing */ - return TRUE; -} - -static gboolean new_page_text(print_stream_t *self) { output_text *output = (output_text *)self->data; @@ -1145,13 +1129,6 @@ new_page_text(print_stream_t *self) } static gboolean -print_finale_text(print_stream_t *self _U_) -{ - /* do nothing */ - return TRUE; /* always succeeds */ -} - -static gboolean destroy_text(print_stream_t *self) { output_text *output = (output_text *)self->data; @@ -1164,16 +1141,16 @@ destroy_text(print_stream_t *self) } static const print_stream_ops_t print_text_ops = { - print_preamble_text, + NULL, /* preamble */ print_line_text, - print_bookmark_text, + NULL, /* bookmark */ new_page_text, - print_finale_text, + NULL, /* finale */ destroy_text }; static print_stream_t * -print_stream_text_alloc(int to_file, FILE *fh) +print_stream_text_alloc(gboolean to_file, FILE *fh) { print_stream_t *stream; output_text *output; @@ -1189,7 +1166,7 @@ print_stream_text_alloc(int to_file, FILE *fh) } print_stream_t * -print_stream_text_new(int to_file, const char *dest) +print_stream_text_new(gboolean to_file, const char *dest) { FILE *fh; @@ -1207,7 +1184,7 @@ print_stream_text_stdio_new(FILE *fh) } typedef struct { - int to_file; + gboolean to_file; FILE *fh; } output_ps; @@ -1215,7 +1192,7 @@ static gboolean print_preamble_ps(print_stream_t *self, gchar *filename) { output_ps *output = (output_ps *)self->data; - unsigned char psbuffer[MAX_PS_LINE_LENGTH]; /* static sized buffer! */ + char psbuffer[MAX_PS_LINE_LENGTH]; /* static sized buffer! */ print_ps_preamble(output->fh); @@ -1230,7 +1207,7 @@ static gboolean print_line_ps(print_stream_t *self, int indent, const char *line) { output_ps *output = (output_ps *)self->data; - unsigned char psbuffer[MAX_PS_LINE_LENGTH]; /* static sized buffer! */ + char psbuffer[MAX_PS_LINE_LENGTH]; /* static sized buffer! */ ps_clean_string(psbuffer, line, MAX_PS_LINE_LENGTH); fprintf(output->fh, "%d (%s) putline\n", indent, psbuffer); @@ -1241,7 +1218,7 @@ static gboolean print_bookmark_ps(print_stream_t *self, const gchar *name, const gchar *title) { output_ps *output = (output_ps *)self->data; - unsigned char psbuffer[MAX_PS_LINE_LENGTH]; /* static sized buffer! */ + char psbuffer[MAX_PS_LINE_LENGTH]; /* static sized buffer! */ /* * See the Adobe "pdfmark reference": @@ -1307,7 +1284,7 @@ static const print_stream_ops_t print_ps_ops = { }; static print_stream_t * -print_stream_ps_alloc(int to_file, FILE *fh) +print_stream_ps_alloc(gboolean to_file, FILE *fh) { print_stream_t *stream; output_ps *output; @@ -1323,7 +1300,7 @@ print_stream_ps_alloc(int to_file, FILE *fh) } print_stream_t * -print_stream_ps_new(int to_file, const char *dest) +print_stream_ps_new(gboolean to_file, const char *dest) { FILE *fh; |