Fix some labels, and maintain overall frame count
[obnox/wireshark/wip.git] / print.c
diff --git a/print.c b/print.c
index 5632bcc5166e64f89411d8afb5bbe66243ed6e5e..0a4a56f0c825c463fb168f0b7cd4551de3edbdf4 100644 (file)
--- a/print.c
+++ b/print.c
@@ -56,7 +56,7 @@ typedef struct {
        GSList                  *src_list;
        print_dissections_e     print_dissections;
        gboolean                print_hex_for_data;
-       char_enc                encoding;
+       packet_char_enc         encoding;
        epan_dissect_t          *edt;
 } print_data;
 
@@ -82,13 +82,12 @@ struct _output_fields {
 };
 
 static const gchar* get_field_hex_value(GSList* src_list, field_info *fi);
-const gchar* get_node_field_value(field_info* fi, epan_dissect_t* edt);
 static void proto_tree_print_node(proto_node *node, gpointer data);
 static void proto_tree_write_node_pdml(proto_node *node, gpointer data);
 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, char_enc encoding);
+    guint length, packet_char_enc encoding);
 static void ps_clean_string(unsigned char *out, const unsigned char *in,
                        int outbuf_size);
 static void print_escaped_xml(FILE *fh, const char *unescaped_string);
@@ -551,7 +550,7 @@ print_pdml_geninfo(proto_tree *tree, FILE *fh)
        /* Print geninfo.timestamp */
        fprintf(fh,
 "    <field name=\"timestamp\" pos=\"0\" show=\"%s\" showname=\"Captured Time\" value=\"%d.%09d\" size=\"%u\"/>\n",
-               abs_time_to_str(timestamp), (int) timestamp->secs, timestamp->nsecs, frame_finfo->length);
+               abs_time_to_str(timestamp, FALSE), (int) timestamp->secs, timestamp->nsecs, frame_finfo->length);
 
        /* Print geninfo end */
        fprintf(fh,
@@ -576,9 +575,10 @@ void
 proto_tree_write_psml(epan_dissect_t *edt, FILE *fh)
 {
        gint    i;
+       static gboolean structure_written = FALSE;
 
        /* if this is the first packet, we have to create the PSML structure output */
-       if(edt->pi.fd->num == 1) {
+       if(!structure_written) {
            fprintf(fh, "<structure>\n");
 
            for(i=0; i < edt->pi.cinfo->num_cols; i++) {
@@ -588,6 +588,8 @@ proto_tree_write_psml(epan_dissect_t *edt, FILE *fh)
            }
 
            fprintf(fh, "</structure>\n\n");
+
+           structure_written = TRUE;
        }
 
        fprintf(fh, "<packet>\n");
@@ -843,7 +845,7 @@ print_hex_data(print_stream_t *stream, epan_dissect_t *edt)
 
 static gboolean
 print_hex_data_buffer(print_stream_t *stream, const guchar *cp,
-    guint length, char_enc encoding)
+    guint length, packet_char_enc encoding)
 {
        register unsigned int ad, i, j, k, l;
        guchar c;
@@ -882,7 +884,6 @@ print_hex_data_buffer(print_stream_t *stream, const guchar *cp,
                         * Start of a new line.
                         */
                        j = 0;
-                       k = 0;
                        l = use_digits;
                        do {
                                l--;
@@ -902,7 +903,7 @@ print_hex_data_buffer(print_stream_t *stream, const guchar *cp,
                line[j++] = binhex[c>>4];
                line[j++] = binhex[c&0xf];
                j++;
-               if (encoding == CHAR_EBCDIC) {
+               if (encoding == PACKET_CHAR_ENC_CHAR_EBCDIC) {
                        c = EBCDIC_to_ASCII1(c);
                }
                line[k++] = c >= ' ' && c < 0x7f ? c : '.';
@@ -1073,7 +1074,7 @@ static const print_stream_ops_t print_text_ops = {
 };
 
 static print_stream_t *
-print_stream_text_allow(int to_file, FILE *fh)
+print_stream_text_alloc(int to_file, FILE *fh)
 {
        print_stream_t *stream;
        output_text *output;
@@ -1097,13 +1098,13 @@ print_stream_text_new(int to_file, const char *dest)
        if (fh == NULL)
                return NULL;
 
-       return print_stream_text_allow(to_file, fh);
+       return print_stream_text_alloc(to_file, fh);
 }
 
 print_stream_t *
 print_stream_text_stdio_new(FILE *fh)
 {
-       return print_stream_text_allow(TRUE, fh);
+       return print_stream_text_alloc(TRUE, fh);
 }
 
 typedef struct {