Add some debugging code; the current code doesn't work when compiled
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 26 Oct 2011 23:41:15 +0000 (23:41 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 26 Oct 2011 23:41:15 +0000 (23:41 +0000)
with MSVC on Win32, and the fix will remove the debugging code as well.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@39624 f5534014-38df-0310-8fa8-9805f1628bb7

wiretap/aethra.c

index 2de82a0c6b0691628f823f51338136d382704af6..e7be877ffecd51e69552d5668ce3c261df688892 100644 (file)
@@ -130,6 +130,9 @@ int aethra_open(wtap *wth, int *err, gchar **err_info)
        wth->subtype_read = aethra_read;
        wth->subtype_seek_read = aethra_seek_read;
 
+fprintf(stderr, "sizeof hdr.magic %" G_GINT64_MODIFIER "u, sizeof hdr %" G_GINT64_MODIFIER "u, data_offset %" G_GINT64_MODIFIER "u\n",
+(guint64)sizeof hdr.magic, (guint64)sizeof hdr, wth->data_offset);
+
        /*
         * Convert the time stamp to a "time_t".
         */
@@ -172,7 +175,13 @@ static gboolean aethra_read(wtap *wth, int *err, gchar **err_info,
                /* Read record header. */
                if (!aethra_read_rec_header(wth->fh, &hdr, &wth->pseudo_header,
                    err, err_info))
+{
+if (*err == 0)
+fprintf(stderr, "aethra_read_rec_header() got an EOF\n");
+else
+fprintf(stderr, "aethra_read_rec_header() fails: err %d\n", *err);
                        return FALSE;
+}
 
                rec_size = pletohs(hdr.rec_size);
                if (rec_size < (sizeof hdr - sizeof hdr.rec_size)) {
@@ -184,18 +193,30 @@ static gboolean aethra_read(wtap *wth, int *err, gchar **err_info,
                }
                wth->data_offset += sizeof hdr;
 
+fprintf(stderr, "sizeof hdr %" G_GINT64_MODIFIER "u, data_offset %" G_GINT64_MODIFIER "u\n",
+(guint64)sizeof hdr, wth->data_offset);
+
                /*
                 * XXX - if this is big, we might waste memory by
                 * growing the buffer to handle it.
                 */
                packet_size = rec_size - (sizeof hdr - sizeof hdr.rec_size);
+fprintf(stderr, "rec_size %u, packet_size %u, sizeof hdr.rec_size %" G_GINT64_MODIFIER "u, delta %" G_GINT64_MODIFIER "u\n",
+rec_size, packet_size, (guint64)sizeof hdr.rec_size,
+(guint64)(sizeof hdr - sizeof hdr.rec_size));
                if (packet_size != 0) {
                        buffer_assure_space(wth->frame_buffer, packet_size);
                        if (!aethra_read_rec_data(wth->fh, buffer_start_ptr(wth->frame_buffer),
                            packet_size, err, err_info))
+{
+fprintf(stderr, "aethra_read_rec_data() fails\n");
                                return FALSE;   /* Read error */
+}
                        wth->data_offset += packet_size;
+fprintf(stderr, "data_offset %" G_GINT64_MODIFIER "u\n",
+wth->data_offset);
                }
+fprintf(stderr, "hdr.rec_type %u\n", hdr.rec_type);
        } while (hdr.rec_type != AETHRA_PACKET);
 
        msecs = pletohl(hdr.timestamp);