summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--print.c73
-rw-r--r--print.h4
-rw-r--r--ui/gtk/print_dlg.c4
3 files changed, 29 insertions, 52 deletions
diff --git a/print.c b/print.c
index 57090fa1eb..438b0ab1e4 100644
--- a/print.c
+++ b/print.c
@@ -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;
diff --git a/print.h b/print.h
index 00907ea09a..fdb855eccc 100644
--- a/print.h
+++ b/print.h
@@ -59,9 +59,9 @@ typedef struct print_stream {
void *data;
} print_stream_t;
-extern print_stream_t *print_stream_text_new(int to_file, const char *dest);
+extern print_stream_t *print_stream_text_new(gboolean to_file, const char *dest);
extern print_stream_t *print_stream_text_stdio_new(FILE *fh);
-extern print_stream_t *print_stream_ps_new(int to_file, const char *dest);
+extern print_stream_t *print_stream_ps_new(gboolean to_file, const char *dest);
extern print_stream_t *print_stream_ps_stdio_new(FILE *fh);
extern gboolean print_preamble(print_stream_t *self, gchar *filename);
diff --git a/ui/gtk/print_dlg.c b/ui/gtk/print_dlg.c
index 50fd555e99..1d3f353d9e 100644
--- a/ui/gtk/print_dlg.c
+++ b/ui/gtk/print_dlg.c
@@ -32,7 +32,7 @@
#include <epan/epan_dissect.h>
#include <epan/filesystem.h>
-#include "../print.h"
+#include "print.h"
#include "ui/alert_box.h"
#include "ui/simple_dialog.h"
#include "ui/util.h"
@@ -53,7 +53,7 @@
#include <windows.h>
#include "ui/win32/file_dlg_win32.h"
#include "ui/win32/print_win32.h"
-#include "../tempfile.h"
+#include "tempfile.h"
#endif
/* dialog output action */