Redo the block options APIs.
[metze/wireshark/wip.git] / wiretap / ngsniffer.c
index 4758c95da6fe8dd8db48b489c0b0bc4d193cee8d..3d78c3d57bd432bfc48d516b055bdb12333ca891 100644 (file)
@@ -597,7 +597,7 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info)
 
        if (type != REC_VERS) {
                *err = WTAP_ERR_BAD_FILE;
-               *err_info = g_strdup_printf("ngsniffer: Sniffer file doesn't start with a version record");
+               *err_info = g_strdup("ngsniffer: Sniffer file doesn't start with a version record");
                return WTAP_OPEN_ERROR;
        }
 
@@ -740,16 +740,21 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info)
        tm.tm_year = ((start_date&DOS_YEAR_MASK)>>DOS_YEAR_SHIFT) + DOS_YEAR_OFFSET;
        tm.tm_mon = ((start_date&DOS_MONTH_MASK)>>DOS_MONTH_SHIFT) + DOS_MONTH_OFFSET;
        tm.tm_mday = ((start_date&DOS_DAY_MASK)>>DOS_DAY_SHIFT);
+       /*
+        * The time does not appear to act as an offset; only the date.
+        * XXX - sometimes it does appear to act as an offset; is this
+        * version-dependent?
+        */
 #if 0
-       /* The time does not appear to act as an offset; only the date */
        start_time = pletoh16(&version.time);
        tm.tm_hour = (start_time&0xf800)>>11;
        tm.tm_min = (start_time&0x7e0)>>5;
        tm.tm_sec = (start_time&0x1f)<<1;
-#endif
+#else
        tm.tm_hour = 0;
        tm.tm_min = 0;
        tm.tm_sec = 0;
+#endif
        tm.tm_isdst = -1;
        ngsniffer->start = mktime(&tm);
        /*
@@ -887,7 +892,7 @@ process_rec_header2_v2(wtap *wth, unsigned char *buffer, guint16 length,
                 * There's not enough data to compare.
                 */
                *err = WTAP_ERR_UNSUPPORTED;
-               *err_info = g_strdup_printf("ngsniffer: WAN capture has too-short protocol list");
+               *err_info = g_strdup("ngsniffer: WAN capture has too-short protocol list");
                return -1;
        }
 
@@ -1293,6 +1298,11 @@ ngsniffer_process_record(wtap *wth, gboolean is_random, guint *padding,
                *err_info = g_strdup("ngsniffer: Record length is less than packet size");
                return -1;
        }
+       /*
+        * The maximum value of length is 65535, which is less than
+        * WTAP_MAX_PACKET_SIZE will ever be, so we don't need to check
+        * it.
+        */
 
        if (padding != NULL) {
                /*