change all file offsets from long to gint64 so we can - theoretically - handle files...
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 5 Nov 2006 22:46:44 +0000 (22:46 +0000)
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 5 Nov 2006 22:46:44 +0000 (22:46 +0000)
Please distclean Win32 builds!

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

54 files changed:
capinfos.c
capture_info.c
cfile.h
config.nmake
editcap.c
epan/dissectors/packet-frame.c
epan/frame_data.h
file.c
gtk/capture_file_dlg.c
gtk/gsm_map_summary.c
gtk/main.c
gtk/mtp3_summary.c
gtk/summary_dlg.c
gtk/win32-file-dlg.c
merge.h
summary.h
tshark.c
wiretap/5views.c
wiretap/airopeek9.c
wiretap/ascend-grammar.y
wiretap/ascend-int.h
wiretap/ascend.c
wiretap/ber.c
wiretap/catapult_dct2000.c
wiretap/cosine.c
wiretap/csids.c
wiretap/dbs-etherwatch.c
wiretap/erf.c
wiretap/etherpeek.c
wiretap/eyesdn.c
wiretap/file_access.c
wiretap/file_wrappers.c
wiretap/file_wrappers.h
wiretap/hcidump.c
wiretap/i4btrace.c
wiretap/iptrace.c
wiretap/iseries.c
wiretap/k12.c
wiretap/lanalyzer.c
wiretap/libpcap.c
wiretap/netmon.c
wiretap/nettl.c
wiretap/network_instruments.c
wiretap/netxray.c
wiretap/ngsniffer.c
wiretap/pppdump.c
wiretap/radcom.c
wiretap/snoop.c
wiretap/toshiba.c
wiretap/visual.c
wiretap/vms.c
wiretap/wtap-int.h
wiretap/wtap.c
wiretap/wtap.h

index d811a6210f833a527b738627e35f061b5112b580..4e6b7ca53070f9e9b00cef09537809e63a7f41bf 100644 (file)
@@ -118,7 +118,7 @@ process_cap_file(wtap *wth, const char *filename)
   int                  err;
   gchar                        *err_info;
   gint64               size;
-  long                 data_offset;
+  gint64               data_offset;
   
   guint32              packet = 0;
   gint64               bytes = 0;
index e9bc1d93165736f6cd0372259854bffb8088aea1..a5e9431d5faf27ca66cc4b359b517a7a1c6a529b 100644 (file)
@@ -224,7 +224,7 @@ void capture_info_new_packets(int to_read)
 {
     int err;
     gchar *err_info;
-    long data_offset;
+    gint64 data_offset;
     const struct wtap_pkthdr *phdr;
     union wtap_pseudo_header *pseudo_header;
     int wtap_linktype;
diff --git a/cfile.h b/cfile.h
index d70dd7d69ccf8f56341bc9992bb6ad6920913c6f..bc726ea2026d620d43743548fff68cf742bd463e 100644 (file)
--- a/cfile.h
+++ b/cfile.h
@@ -46,7 +46,7 @@ typedef struct _capture_file {
   gchar       *filename;  /* Name of capture file */
   gboolean     is_tempfile; /* Is capture file a temporary file? */
   gboolean     user_saved;/* If capture file is temporary, has it been saved by user yet? */
-  long         f_datalen; /* Size of capture file data (uncompressed) */
+  gint64       f_datalen; /* Size of capture file data (uncompressed) */
   guint16      cd_t;      /* File type of capture file */
   int          lnk_t;     /* Link-layer type with which to save capture */
   guint32      vers;      /* Version.  For tcpdump minor is appended to major */
index 39007c29d29d376367d95592cef622599e6200a7..3e6bf59c8b2d8fe854f9962db3c95b3ff09cb5fd 100644 (file)
@@ -19,6 +19,7 @@ VERSION_EXTRA=
 # The version of the wiretap library (recommended: leave unchanged)
 WTAP_VERSION_MAJOR=0
 WTAP_VERSION_MINOR=3
+WTAP_VERSION_MICRO=1
 
 
 
@@ -394,8 +395,8 @@ LINK_PLUGINS_WITH_LIBWIRESHARK=USE
 VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO)$(VERSION_EXTRA)
 RC_VERSION=$(VERSION_MAJOR),$(VERSION_MINOR),$(VERSION_MICRO)
 
-WTAP_VERSION=$(WTAP_VERSION_MAJOR).$(WTAP_VERSION_MINOR)
-RC_WTAP_VERSION=$(WTAP_VERSION_MAJOR),$(WTAP_VERSION_MINOR)
+WTAP_VERSION=$(WTAP_VERSION_MAJOR).$(WTAP_VERSION_MINOR).$(WTAP_VERSION_MICRO)
+RC_WTAP_VERSION=$(WTAP_VERSION_MAJOR),$(WTAP_VERSION_MINOR),$(WTAP_VERSION_MICRO)
 
 
 GLIB_CFLAGS=/I$(GLIB_DIR)\include\glib-$(GLIB_VERSION) \
index 923642f39bdba618caaaa5a994bae0fce7d651d2..f9e39ba532d4f2aa371917e14edf47302628730c 100644 (file)
--- a/editcap.c
+++ b/editcap.c
@@ -355,7 +355,7 @@ int main(int argc, char *argv[])
   unsigned int choplen = 0;             /* No chop                */
   wtap_dumper *pdh;
   int count = 1;
-  long data_offset;
+  gint64 data_offset;
   struct wtap_pkthdr snap_phdr;
   const struct wtap_pkthdr *phdr;
   int err_type;
index 1d8b4ef965e9863bb97553041052b2514ae75eac..65d50b3249702521ef996a447af768ccfa1c3eec 100644 (file)
@@ -252,9 +252,9 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
          }
 
          if (show_file_off) {
-                 proto_tree_add_int_format(fh_tree, hf_frame_file_off, tvb,
+                 proto_tree_add_int64_format(fh_tree, hf_frame_file_off, tvb,
                                  0, 0, pinfo->fd->file_off,
-                                 "File Offset: %ld (0x%lx)",
+                                 "File Offset: %lld (0x%llx)",
                                  pinfo->fd->file_off, pinfo->fd->file_off);
          }
 
@@ -477,7 +477,7 @@ proto_register_frame(void)
                        "", HFILL }},
 
                { &hf_frame_file_off,
-               { "File Offset",        "frame.file_off", FT_INT32, BASE_DEC, NULL, 0x0,
+               { "File Offset",        "frame.file_off", FT_INT64, BASE_DEC, NULL, 0x0,
                        "", HFILL }},
 
                { &hf_frame_marked,
index 15e6057191dd4a6620e392fd522daa431f9d8b9b..e6baff2ea5bf285d5efe449b149e2f06c0722b92 100644 (file)
@@ -47,7 +47,7 @@ typedef struct _frame_data {
   nstime_t     abs_ts;      /* Absolute timestamp */
   nstime_t     rel_ts;      /* Relative timestamp (yes, it can be negative) */
   nstime_t     del_ts;      /* Delta timestamp (yes, it can be negative) */
-  long         file_off;    /* File offset */
+  gint64       file_off;    /* File offset */
   int          lnk_t;       /* Per-packet encapsulation/data-link type */
   struct {
        unsigned int passed_dfilter     : 1; /* 1 = display, 0 = no display */
diff --git a/file.c b/file.c
index 2d9a281135fb48490fa45c0888687a29279a6b5b..e8c790c70d50861e29516773fcdb944ddb151681 100644 (file)
--- a/file.c
+++ b/file.c
@@ -87,7 +87,7 @@ static guint32 cum_bytes = 0;
 
 static void cf_reset_state(capture_file *cf);
 
-static int read_packet(capture_file *cf, long offset);
+static int read_packet(capture_file *cf, gint64 offset);
 
 static void rescan_packets(capture_file *cf, const char *action, const char *action_item,
        gboolean refilter, gboolean redissect);
@@ -366,7 +366,7 @@ cf_read(capture_file *cf)
   const char  *errmsg;
   char         errmsg_errno[1024+1];
   gchar        err_str[2048+1];
-  long         data_offset;
+  gint64       data_offset;
   progdlg_t   *progbar = NULL;
   gboolean     stop_flag;
   gint64       size, file_pos;
@@ -560,7 +560,7 @@ cf_start_tail(capture_file *cf, const char *fname, gboolean is_tempfile, int *er
 cf_read_status_t
 cf_continue_tail(capture_file *cf, int to_read, int *err)
 {
-  long data_offset = 0;
+  gint64 data_offset = 0;
   gchar *err_info;
   int newly_displayed_packets = 0;
 
@@ -620,7 +620,7 @@ cf_read_status_t
 cf_finish_tail(capture_file *cf, int *err)
 {
   gchar *err_info;
-  long data_offset;
+  gint64 data_offset;
 
   if(cf->wth == NULL) {
     cf_close(cf);
@@ -910,7 +910,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
 /* read in a new packet */
 /* returns the row of the new packet in the packet list or -1 if not displayed */
 static int
-read_packet(capture_file *cf, long offset)
+read_packet(capture_file *cf, gint64 offset)
 {
   const struct wtap_pkthdr *phdr = wtap_phdr(cf->wth);
   union wtap_pseudo_header *pseudo_header = wtap_pseudoheader(cf->wth);
@@ -994,7 +994,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
   gchar             err_str[2048+1];
   const char       *errmsg;
   gboolean          got_read_error = FALSE, got_write_error = FALSE;
-  long              data_offset;
+  gint64            data_offset;
   progdlg_t        *progbar = NULL;
   gboolean          stop_flag;
   gint64            f_len, file_pos;
index 282a9bf186ea9028f07014e75e48aa5dad80a9f6..dc0a7fbc1dfe6793cf78b859191b39ebf326bc0a 100644 (file)
@@ -200,7 +200,7 @@ preview_do(GtkWidget *prev, wtap *wth)
     time_t      time_current;
     int         err = 0;
     gchar      *err_info;
-    long        data_offset;
+    gint64      data_offset;
     const struct wtap_pkthdr *phdr;
     double      start_time = 0;        /* seconds, with nsec resolution */
     double      stop_time = 0; /* seconds, with nsec resolution */
index 7515bf808ed93a20c9c06498ea982936da68f57a..1ee3acc0465b9eae4fad22792d5a8305f08dc994 100644 (file)
@@ -110,7 +110,7 @@ gsm_map_stat_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_)
   add_string_to_box(string_buff, file_box);
 
   /* length */
-  g_snprintf(string_buff, SUM_STR_MAX, "Length: %lu", summary.file_length);
+  g_snprintf(string_buff, SUM_STR_MAX, "Length: %lld", summary.file_length);
   add_string_to_box(string_buff, file_box);
 
   /* format */
index 6d7f0bc477c4773cdb5da7d801fb155fb449a42c..4b6bb91790ea4ecba535643fc3247500c3d32565 100644 (file)
@@ -1401,11 +1401,11 @@ set_display_filename(capture_file *cf)
 
   /* convert file size */
   if (cf->f_datalen/1024/1024 > 10) {
-    size_str = g_strdup_printf("%ld MB", cf->f_datalen/1024/1024);
+    size_str = g_strdup_printf("%lld MB", cf->f_datalen/1024/1024);
   } else if (cf->f_datalen/1024 > 10) {
-    size_str = g_strdup_printf("%ld KB", cf->f_datalen/1024);
+    size_str = g_strdup_printf("%lld KB", cf->f_datalen/1024);
   } else {
-    size_str = g_strdup_printf("%ld Bytes", cf->f_datalen);
+    size_str = g_strdup_printf("%lld Bytes", cf->f_datalen);
   }
 
   /* statusbar */
@@ -1657,19 +1657,19 @@ main_cf_cb_live_capture_update_continue(capture_file *cf)
 #if 0
     /* XXX - don't show the highest expert level unless the TCP checksum offloading is "solved" */
     if (cf->f_datalen/1024/1024 > 10) {
-        capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %ld MB [Expert: %s]",
+        capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld MB [Expert: %s]",
             get_interface_descriptive_name(capture_opts->iface),
             capture_opts->save_file,
             cf->f_datalen/1024/1024,
             val_to_str(expert_get_highest_severity(), expert_severity_vals, "Unknown (%u)"));
     } else if (cf->f_datalen/1024 > 10) {
-        capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %ld KB [Expert: %s]",
+        capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld KB [Expert: %s]",
             get_interface_descriptive_name(capture_opts->iface),
             capture_opts->save_file,
             cf->f_datalen/1024,
             val_to_str(expert_get_highest_severity(), expert_severity_vals, "Unknown (%u)"));
     } else {
-        capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %ld Bytes [Expert: %s]",
+        capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld Bytes [Expert: %s]",
             get_interface_descriptive_name(capture_opts->iface),
             capture_opts->save_file,
             cf->f_datalen,
@@ -1677,17 +1677,17 @@ main_cf_cb_live_capture_update_continue(capture_file *cf)
     }
 #endif
     if (cf->f_datalen/1024/1024 > 10) {
-        capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %ld MB",
+        capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld MB",
             get_interface_descriptive_name(capture_opts->iface),
             capture_opts->save_file,
             cf->f_datalen/1024/1024);
     } else if (cf->f_datalen/1024 > 10) {
-        capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %ld KB",
+        capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld KB",
             get_interface_descriptive_name(capture_opts->iface),
             capture_opts->save_file,
             cf->f_datalen/1024);
     } else {
-        capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %ld Bytes",
+        capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld Bytes",
             get_interface_descriptive_name(capture_opts->iface),
             capture_opts->save_file,
             cf->f_datalen);
index a3872260ad2663d29cc3c37ae5f7553b1ad0fcee..f57ae06cd90c15a828a7634e5fabf7a1f77aa273 100644 (file)
@@ -276,7 +276,7 @@ mtp3_sum_gtk_sum_cb(GtkWidget *w _U_, gpointer d _U_)
   add_string_to_box(string_buff, file_box);
 
   /* length */
-  g_snprintf(string_buff, SUM_STR_MAX, "Length: %lu", summary.file_length);
+  g_snprintf(string_buff, SUM_STR_MAX, "Length: %lld", summary.file_length);
   add_string_to_box(string_buff, file_box);
 
   /* format */
index ae6af94a7f0550d3e8425026dd6bb0c4fc0a0cc0..d286f2740e01287e2f42903faf260878969a4c81 100644 (file)
@@ -144,7 +144,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
   add_string_to_table(table, &row, "Name:", string_buff);
 
   /* length */
-  g_snprintf(string_buff, SUM_STR_MAX, "%lu bytes", summary.file_length);
+  g_snprintf(string_buff, SUM_STR_MAX, "%lld bytes", summary.file_length);
   add_string_to_table(table, &row, "Length:", string_buff);
 
   /* format */
index fb24c61ac90a4821b0fa8be62c3a426ebebece05..bbaf9301726e031dea33eb1725095debfdcafd5c 100644 (file)
@@ -770,7 +770,7 @@ preview_set_filename(HWND of_hwnd, gchar *preview_file) {
     int         err = 0;
     gchar      *err_info;
     TCHAR       string_buff[PREVIEW_STR_MAX];
-    long        data_offset;
+    gint64      data_offset;
     guint       packet = 0;
     guint64     filesize;
     time_t      ti_time;
diff --git a/merge.h b/merge.h
index ae2faeffb19e8e808146b380961d90ab7f712d29..2a0a1bbd9a4f33973d0ab77e9025e8982fed2617 100644 (file)
--- a/merge.h
+++ b/merge.h
@@ -42,7 +42,7 @@ typedef enum {
 typedef struct merge_in_file_s {
   const char     *filename;
   wtap           *wth;
-  long            data_offset;
+  gint64          data_offset;
   in_file_state_e state;
   gint64          size;                /* file size */
 } merge_in_file_t;
index b18bde4ec13575314828ebb372f759a9ee51ba2a..dc28edced88dd7a0682d048b5f4b77dd89e0aaca 100644 (file)
--- a/summary.h
+++ b/summary.h
@@ -43,7 +43,7 @@ typedef struct _summary_tally {
     double     filtered_start; /* time in seconds, with msec resolution */
     double     filtered_stop;  /* time in seconds, with msec resolution */
     const char *filename;
-    long       file_length;    /* file length in bytes */
+    gint64     file_length;    /* file length in bytes */
     int                encap_type;     /* wiretap encapsulation type */
     gboolean   has_snap;       /* TRUE if maximum capture packet length is known */
     int                snap;           /* Maximum captured packet length */
index 79188bd7d6ae9eed88999f241dfa03d840bc30d4..9b59f86ea23617d16ae87d35f26514cd8b7088bd 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -178,7 +178,7 @@ static void report_counts_siginfo(int);
 #endif /* HAVE_LIBPCAP */
 
 static int load_cap_file(capture_file *, char *, int);
-static gboolean process_packet(capture_file *cf, long offset,
+static gboolean process_packet(capture_file *cf, gint64 offset,
     const struct wtap_pkthdr *whdr, union wtap_pseudo_header *pseudo_header,
     const guchar *pd);
 static void show_capture_file_io_error(const char *, int, gboolean);
@@ -2048,7 +2048,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type)
   wtap_dumper *pdh;
   int          err;
   gchar        *err_info;
-  long         data_offset;
+  gint64       data_offset;
   char         *save_file_string = NULL;
 
   linktype = wtap_file_encap(cf->wth);
@@ -2185,7 +2185,7 @@ out:
 
 static void
 fill_in_fdata(frame_data *fdata, capture_file *cf,
-              const struct wtap_pkthdr *phdr, long offset)
+              const struct wtap_pkthdr *phdr, gint64 offset)
 {
   fdata->next = NULL;
   fdata->prev = NULL;
@@ -2246,7 +2246,7 @@ clear_fdata(frame_data *fdata)
 }
 
 static gboolean
-process_packet(capture_file *cf, long offset, const struct wtap_pkthdr *whdr,
+process_packet(capture_file *cf, gint64 offset, const struct wtap_pkthdr *whdr,
                union wtap_pseudo_header *pseudo_header, const guchar *pd)
 {
   frame_data fdata;
index e44969fe4fccbe7e6613e1f1d71c1eaf44162743..edfb7b5c1338f95d2b4bed76003c38965ca385e5 100644 (file)
@@ -104,12 +104,12 @@ typedef struct
 #define CST_5VW_SYSTEM_RECORD          0x00000000
 
 static gboolean _5views_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
+    gint64 *data_offset);
 static gboolean _5views_read_rec_data(FILE_T fh, guchar *pd, int length,
     int *err);
 static int _5views_read_header(wtap *wth, FILE_T fh,
     t_5VW_TimeStamped_Header  *hdr, int *err);
-static gboolean _5views_seek_read(wtap *wth, long seek_off,
+static gboolean _5views_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info);
 
@@ -204,7 +204,7 @@ int _5views_open(wtap *wth, int *err, gchar **err_info)
 
 /* Read the next packet */
 static gboolean
-_5views_read(wtap *wth, int *err, gchar **err_info _U_, long *data_offset)
+_5views_read(wtap *wth, int *err, gchar **err_info _U_, gint64 *data_offset)
 {
        t_5VW_TimeStamped_Header TimeStamped_Header;
        int     bytes_read;
@@ -314,7 +314,7 @@ _5views_read_header(wtap *wth _U_, FILE_T fh, t_5VW_TimeStamped_Header  *hdr,
 }
 
 static gboolean
-_5views_seek_read(wtap *wth, long seek_off,
+_5views_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info _U_)
 {
index b716021e543a3a0642f2b806b0ab524f344bdd1f..9fa878f382253240a2f554178076cacda9fc1c0d 100644 (file)
@@ -78,8 +78,8 @@ typedef struct airopeek_utime {
 } airopeek_utime;
 
 static gboolean airopeekv9_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean airopeekv9_seek_read(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean airopeekv9_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info);
 static void airopeekv9_close(wtap *wth);
@@ -475,7 +475,7 @@ airopeekv9_process_header(FILE_T fh, hdr_info_t *hdr_info, int *err,
 #define TIME_FIXUP_CONSTANT (369.0*365.25*24*60*60-(3.0*24*60*60+6.0*60*60))
 
 static gboolean airopeekv9_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
     hdr_info_t hdr_info;
     int hdrlen;
@@ -551,7 +551,7 @@ static gboolean airopeekv9_read(wtap *wth, int *err, gchar **err_info,
 
 
 static gboolean
-airopeekv9_seek_read(wtap *wth, long seek_off,
+airopeekv9_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info)
 {
index 398d8c58522baee2b6f40fa2a2b034f3bafdbaad..27c5c5c4dddb13885bb4951e52411d266541b6fd 100644 (file)
@@ -154,7 +154,7 @@ static guint32 start_time, secs, usecs, caplen, wirelen;
 static ascend_pkthdr *header;
 struct ascend_phdr *pseudo_header;
 static guint8 *pkt_data;
-static long first_hexbyte;
+static gint64 first_hexbyte;
 static FILE_T *fh_ptr;
 
 %}
@@ -446,7 +446,7 @@ init_parse_ascend()
    if there is none. */
 int
 parse_ascend(FILE_T fh, guint8 *pd, struct ascend_phdr *phdr,
-               ascend_pkthdr *hdr, long *start_of_data)
+               ascend_pkthdr *hdr, gint64 *start_of_data)
 {
   /* yydebug = 1; */
   int retval;
index 2360b169e7d359e4c668c29c9b27927b7dc99214..ac4de11cb7784168ac2ecf7c6c20850d2031bdcd 100644 (file)
@@ -49,6 +49,6 @@ int ascendlex(void);
 void init_parse_ascend(void);
 void ascend_init_lexer(FILE_T fh);
 int parse_ascend(FILE_T fh, guint8 *pd, struct ascend_phdr *phdr,
-               ascend_pkthdr *hdr, long *start_of_data);
+               ascend_pkthdr *hdr, gint64 *start_of_data);
 
 #endif /* ! __ASCEND_INT_H__ */
index 5ead8142cd3c2632bd9f5fb4abb41f028a05d581..d2a94fd157056fddee069420f1535ab83c37e5fa 100644 (file)
@@ -79,8 +79,8 @@ static const ascend_magic_string ascend_magic[] = {
 };
 
 static gboolean ascend_read(wtap *wth, int *err, gchar **err_info,
-       long *data_offset);
-static gboolean ascend_seek_read(wtap *wth, long seek_off,
+       gint64 *data_offset);
+static gboolean ascend_seek_read(wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_head, guint8 *pd, int len,
        int *err, gchar **err_info);
 static void ascend_close(wtap *wth);
@@ -88,10 +88,10 @@ static void ascend_close(wtap *wth);
 /* Seeks to the beginning of the next packet, and returns the
    byte offset at which the header for that packet begins.
    Returns -1 on failure. */
-static long ascend_seek(wtap *wth, int *err)
+static gint64 ascend_seek(wtap *wth, int *err)
 {
   int byte;
-  long date_off = -1, cur_off, packet_off;
+  gint64 date_off = -1, cur_off, packet_off;
   guint string_level[ASCEND_MAGIC_STRINGS];
   guint string_i = 0, type = 0;
 
@@ -163,7 +163,7 @@ found:
 
 int ascend_open(wtap *wth, int *err, gchar **err_info _U_)
 {
-  long offset;
+  gint64 offset;
   struct stat statbuf;
 
   /* We haven't yet allocated a data structure for our private stuff;
@@ -247,9 +247,9 @@ static void config_pseudo_header(union wtap_pseudo_header *pseudo_head)
 
 /* Read the next packet; called from wtap_read(). */
 static gboolean ascend_read(wtap *wth, int *err, gchar **err_info,
-       long *data_offset)
+       gint64 *data_offset)
 {
-  long offset;
+  gint64 offset;
   guint8 *buf = buffer_start_ptr(wth->frame_buffer);
   ascend_pkthdr header;
 
@@ -303,7 +303,7 @@ static gboolean ascend_read(wtap *wth, int *err, gchar **err_info,
   return TRUE;
 }
 
-static gboolean ascend_seek_read(wtap *wth, long seek_off,
+static gboolean ascend_seek_read(wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_head, guint8 *pd, int len,
        int *err, gchar **err_info)
 {
index 27fb232da732cdbc27332e04d226f8c5b59f084b..6e37a6fe9e3914e5a8e1563268ded7e7d1eec730 100644 (file)
@@ -42,7 +42,7 @@
 #define BER_UNI_TAG_SEQ        16      /* SEQUENCE, SEQUENCE OF */
 #define BER_UNI_TAG_SET        17      /* SET, SET OF */
 
-static gboolean ber_read(wtap *wth, int *err, gchar **err_info, long *data_offset)
+static gboolean ber_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
 {
   guint8 *buf;
   gint64 file_size;
@@ -93,7 +93,7 @@ static gboolean ber_read(wtap *wth, int *err, gchar **err_info, long *data_offse
   return TRUE;
 }
 
-static gboolean ber_seek_read(wtap *wth, long seek_off, union wtap_pseudo_header *pseudo_header _U_,
+static gboolean ber_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header _U_,
                              guint8 *pd, int length, int *err, gchar **err_info _U_)
 {
   int packet_size = length;
index 05301d09f61e3127134603709dc64d9acfbc6356..348f7c96687fc17acd149c8c20951b4f2254ff58 100644 (file)
@@ -112,8 +112,8 @@ static gchar outhdr_name[MAX_OUTHDR_NAME+1];
 /************************************************************/
 /* Functions called from wiretap                            */
 static gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info,
-                                      long *data_offset);
-static gboolean catapult_dct2000_seek_read(wtap *wth, long seek_off,
+                                      gint64 *data_offset);
+static gboolean catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
                                            union wtap_pseudo_header *pseudo_header,
                                            guchar *pd, int length,
                                            int *err, gchar **err_info);
@@ -127,7 +127,7 @@ static gboolean catapult_dct2000_dump_close(wtap_dumper *wdh, int *err);
 
 /************************************************************/
 /* Private helper functions                                 */
-static gboolean read_new_line(FILE_T fh, long *offset, gint *length);
+static gboolean read_new_line(FILE_T fh, gint64 *offset, gint *length);
 static gboolean parse_line(gint line_length, gint *seconds, gint *useconds,
                            long *before_time_offset, long *after_time_offset,
                            long *data_offset,
@@ -141,7 +141,7 @@ static gchar char_from_hex(guchar hex);
 
 static void set_pseudo_header_info(wtap *wth,
                                    int pkt_encap,
-                                   long file_offset,
+                                   gint64 file_offset,
                                    union wtap_pseudo_header *pseudo_header,
                                    packet_direction_t direction);
 static void set_aal_info(union wtap_pseudo_header *pseudo_header,
@@ -164,7 +164,7 @@ static gboolean free_line_prefix_info(gpointer key, gpointer value, gpointer use
 /********************************************/
 int catapult_dct2000_open(wtap *wth, int *err, gchar **err_info _U_)
 {
-    long    offset = 0;
+    gint64  offset = 0;
     time_t  timestamp;
     guint32 usecs;
     gint firstline_length;
@@ -269,9 +269,9 @@ int catapult_dct2000_open(wtap *wth, int *err, gchar **err_info _U_)
 /* - return TRUE and details if found             */
 /**************************************************/
 gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_,
-                               long *data_offset)
+                               gint64 *data_offset)
 {
-    long offset = wth->data_offset;
+    gint64 offset = wth->data_offset;
     long dollar_offset, before_time_offset, after_time_offset;
     packet_direction_t direction;
     int encap;
@@ -290,7 +290,7 @@ gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_,
     while (1)
     {
         int line_length, seconds, useconds, data_chars;
-        long this_offset = offset;
+        gint64 this_offset = offset;
 
         /* Are looking for first packet after 2nd line */
         if (wth->data_offset == 0)
@@ -412,11 +412,11 @@ gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_,
 /* Read & seek function.                          */
 /**************************************************/
 static gboolean
-catapult_dct2000_seek_read(wtap *wth, long seek_off,
+catapult_dct2000_seek_read(wtap *wth, gint64 seek_off,
                            union wtap_pseudo_header *pseudo_header, guchar *pd,
                            int length, int *err, gchar **err_info)
 {
-    long offset = wth->data_offset;
+    gint64 offset = wth->data_offset;
     long dollar_offset, before_time_offset, after_time_offset;
     packet_direction_t direction;
     int encap;
@@ -476,7 +476,7 @@ catapult_dct2000_seek_read(wtap *wth, long seek_off,
     /* If get here, must have failed */
     *err = errno;
     *err_info = g_strdup_printf("catapult dct2000: seek_read failed to read/parse "
-                                "line at position %ld", seek_off);
+                                "line at position %lld", seek_off);
     return FALSE;
 }
 
@@ -700,7 +700,7 @@ static gboolean catapult_dct2000_dump_close(wtap_dumper *wdh _U_, int *err _U_)
 /* - on return 'offset' will point to the next position to read from  */
 /* - return TRUE if this read is successful                           */
 /**********************************************************************/
-gboolean read_new_line(FILE_T fh, long *offset, gint *length)
+gboolean read_new_line(FILE_T fh, gint64 *offset, gint *length)
 {
     char *result;
 
@@ -1176,7 +1176,7 @@ int write_stub_header(guchar *frame_buffer, char *timestamp_string,
 /**************************************************************/
 void set_pseudo_header_info(wtap *wth,
                             int pkt_encap,
-                            long file_offset,
+                            gint64 file_offset,
                             union wtap_pseudo_header *pseudo_header,
                             packet_direction_t direction)
 {
index 841d80bac9e9d0a7547b32adb0b9a1ea3e17b1ba..e43dc007d33aa89713a95fb25e9567dc0a36c353 100644 (file)
 #define COSINE_MAX_PACKET_LEN  65536
 
 static gboolean empty_line(const gchar *line);
-static long cosine_seek_next_packet(wtap *wth, int *err, char *hdr);
+static gint64 cosine_seek_next_packet(wtap *wth, int *err, char *hdr);
 static gboolean cosine_check_file_type(wtap *wth, int *err);
 static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,
-       long *data_offset);
-static gboolean cosine_seek_read(wtap *wth, long seek_off,
+       gint64 *data_offset);
+static gboolean cosine_seek_read(wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd,
        int len, int *err, gchar **err_info);
 static int parse_cosine_rec_hdr(wtap *wth, const char *line,
@@ -202,9 +202,9 @@ static gboolean empty_line(const gchar *line)
 /* Seeks to the beginning of the next packet, and returns the
    byte offset. Copy the header line to hdr. Returns -1 on failure,
    and sets "*err" to the error and set hdr as NULL. */
-static long cosine_seek_next_packet(wtap *wth, int *err, char *hdr)
+static gint64 cosine_seek_next_packet(wtap *wth, int *err, char *hdr)
 {
-       long cur_off;
+       gint64 cur_off;
        char buf[COSINE_LINE_LENGTH];
 
        while (1) {
@@ -306,9 +306,9 @@ int cosine_open(wtap *wth, int *err, gchar **err_info _U_)
 
 /* Find the next packet and parse it; called from wtap_read(). */
 static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
-       long    offset;
+       gint64  offset;
        guint8  *buf;
        int     pkt_len, caplen;
        char    line[COSINE_LINE_LENGTH];
@@ -341,7 +341,7 @@ static gboolean cosine_read(wtap *wth, int *err, gchar **err_info,
 
 /* Used to read packets in random-access fashion */
 static gboolean
-cosine_seek_read (wtap *wth, long seek_off,
+cosine_seek_read (wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
        int *err, gchar **err_info)
 {
index 86c0843a50da37a10d981704f248b8c66430bfb0..fc078c212905ad3a6c6ed782bbcbeacd52077e18 100644 (file)
@@ -45,8 +45,8 @@
  */
 
 static gboolean csids_read(wtap *wth, int *err, gchar **err_info,
-       long *data_offset);
-static gboolean csids_seek_read(wtap *wth, long seek_off,
+       gint64 *data_offset);
+static gboolean csids_seek_read(wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
        int *err, gchar **err_info);
 static void csids_close(wtap *wth);
@@ -145,7 +145,7 @@ int csids_open(wtap *wth, int *err, gchar **err_info _U_)
 
 /* Find the next packet and parse it; called from wtap_read(). */
 static gboolean csids_read(wtap *wth, int *err, gchar **err_info _U_,
-    long *data_offset)
+    gint64 *data_offset)
 {
   guint8 *buf;
   int bytesRead = 0;
@@ -200,7 +200,7 @@ static gboolean csids_read(wtap *wth, int *err, gchar **err_info _U_,
 /* Used to read packets in random-access fashion */
 static gboolean
 csids_seek_read (wtap *wth,
-                long seek_off,
+                gint64 seek_off,
                 union wtap_pseudo_header *pseudo_header _U_,
                 guint8 *pd,
                 int len,
index 984a5b28ed04e9c58efe319ededd64d1b8f14f2c..4230aebe077fcb67186ed40d5ca52795fb61eb25 100644 (file)
@@ -85,8 +85,8 @@ static const char dbs_etherwatch_rec_magic[]  =
 #define DBS_ETHERWATCH_MAX_PACKET_LEN  16384
 
 static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info,
-       long *data_offset);
-static gboolean dbs_etherwatch_seek_read(wtap *wth, long seek_off,
+       gint64 *data_offset);
+static gboolean dbs_etherwatch_seek_read(wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
        int *err, gchar **err_info);
 static int parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf,
@@ -97,11 +97,11 @@ static guint parse_hex_dump(char* dump, guint8 *buf, char seperator, char end);
 
 /* Seeks to the beginning of the next packet, and returns the
    byte offset.  Returns -1 on failure, and sets "*err" to the error. */
-static long dbs_etherwatch_seek_next_packet(wtap *wth, int *err)
+static gint64 dbs_etherwatch_seek_next_packet(wtap *wth, int *err)
 {
   int byte;
   unsigned int level = 0;
-  long cur_off;
+  gint64 cur_off;
 
   while ((byte = file_getc(wth->fh)) != EOF) {
     if (byte == dbs_etherwatch_rec_magic[level]) {
@@ -206,9 +206,9 @@ int dbs_etherwatch_open(wtap *wth, int *err, gchar **err_info _U_)
 
 /* Find the next packet and parse it; called from wtap_read(). */
 static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
-       long    offset;
+       gint64  offset;
        guint8  *buf;
        int     pkt_len;
 
@@ -238,7 +238,7 @@ static gboolean dbs_etherwatch_read(wtap *wth, int *err, gchar **err_info,
 
 /* Used to read packets in random-access fashion */
 static gboolean
-dbs_etherwatch_seek_read (wtap *wth, long seek_off,
+dbs_etherwatch_seek_read (wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header _U_,
        guint8 *pd, int len, int *err, gchar **err_info)
 {
index ae5fcc237cf911f442ea8612e78df78bb2b6658e..4961398b8db625fb4a75284586bae9b4e8ba199c 100644 (file)
@@ -69,8 +69,8 @@ static int erf_read_header(
                guint32 *bytes_read,
                guint32 *packet_size);
 static gboolean erf_read(wtap *wth, int *err, gchar **err_info,
-               long *data_offset);
-static gboolean erf_seek_read(wtap *wth, long seek_off,
+               gint64 *data_offset);
+static gboolean erf_seek_read(wtap *wth, gint64 seek_off,
                union wtap_pseudo_header *pseudo_header, guchar *pd,
                int length, int *err, gchar **err_info);
 static void erf_close(wtap *wth);
@@ -209,7 +209,7 @@ int erf_open(wtap *wth, int *err, gchar **err_info _U_)
 
 /* Read the next packet */
 static gboolean erf_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
        erf_header_t erf_header;
        guint32 packet_size, bytes_read;
@@ -249,7 +249,7 @@ static gboolean erf_read(wtap *wth, int *err, gchar **err_info,
        return TRUE;
 }
 
-static gboolean erf_seek_read(wtap *wth, long seek_off,
+static gboolean erf_seek_read(wtap *wth, gint64 seek_off,
                union wtap_pseudo_header *pseudo_header, guchar *pd,
                int length, int *err, gchar **err_info)
 {
index 6fc9ef15185d917c476e825803941ed4eac68eac..e7202f58a2329bbb790874ce482913bdc9e5b7a3 100644 (file)
@@ -143,15 +143,15 @@ static const etherpeek_encap_lookup_t etherpeek_encap[] = {
        (sizeof (etherpeek_encap) / sizeof (etherpeek_encap[0]))
 
 static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean etherpeek_seek_read_v7(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean etherpeek_seek_read_v7(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info);
 static void etherpeek_fill_pseudo_header_v7(
     union wtap_pseudo_header *pseudo_header, airopeek_radio_hdr_t *radio_hdr);
 static gboolean etherpeek_read_v56(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean etherpeek_seek_read_v56(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean etherpeek_seek_read_v56(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info);
 static void etherpeek_close(wtap *wth);
@@ -363,7 +363,7 @@ static void etherpeek_close(wtap *wth)
 }
 
 static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
        guchar ep_pkt[ETHERPEEK_V7_PKT_SIZE];
        guint16 protoNum;
@@ -468,7 +468,7 @@ static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
 }
 
 static gboolean
-etherpeek_seek_read_v7(wtap *wth, long seek_off,
+etherpeek_seek_read_v7(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info)
 {
@@ -533,7 +533,7 @@ etherpeek_fill_pseudo_header_v7(union wtap_pseudo_header *pseudo_header,
 }
 
 static gboolean etherpeek_read_v56(wtap *wth, int *err, gchar **err_info _U_,
-    long *data_offset)
+    gint64 *data_offset)
 {
        guchar ep_pkt[ETHERPEEK_V56_PKT_SIZE];
        guint16 length;
@@ -616,7 +616,7 @@ static gboolean etherpeek_read_v56(wtap *wth, int *err, gchar **err_info _U_,
 }
 
 static gboolean
-etherpeek_seek_read_v56(wtap *wth, long seek_off,
+etherpeek_seek_read_v56(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info _U_)
 {
index ba674d48f73b073e05b7a2c353f0eecc20e3e4bb..a8f768b824e71c8178f2b0c091243dbc9af2374c 100644 (file)
@@ -95,8 +95,8 @@ static const unsigned char eyesdn_hdr_magic[]  =
 #define EYESDN_MAX_PACKET_LEN  16384
 
 static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info,
-       long *data_offset);
-static gboolean eyesdn_seek_read(wtap *wth, long seek_off,
+       gint64 *data_offset);
+static gboolean eyesdn_seek_read(wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
        int *err, gchar **err_info);
 static gboolean parse_eyesdn_packet_data(FILE_T fh, int pkt_len, guint8* buf,
@@ -106,10 +106,10 @@ static int parse_eyesdn_rec_hdr(wtap *wth, FILE_T fh,
 
 /* Seeks to the beginning of the next packet, and returns the
    byte offset.  Returns -1 on failure, and sets "*err" to the error. */
-static long eyesdn_seek_next_packet(wtap *wth, int *err)
+static gint64 eyesdn_seek_next_packet(wtap *wth, int *err)
 {
   int byte;
-  long cur_off;
+  gint64 cur_off;
 
   while ((byte = file_getc(wth->fh)) != EOF) {
     if (byte == 0xff) {
@@ -163,9 +163,9 @@ int eyesdn_open(wtap *wth, int *err, gchar **err_info _U_)
 
 /* Find the next packet and parse it; called from wtap_read(). */
 static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
-       long    offset;
+       gint64  offset;
        guint8  *buf;
        int     pkt_len;
 
@@ -195,7 +195,7 @@ static gboolean eyesdn_read(wtap *wth, int *err, gchar **err_info,
 
 /* Used to read packets in random-access fashion */
 static gboolean
-eyesdn_seek_read (wtap *wth, long seek_off,
+eyesdn_seek_read (wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
        int *err, gchar **err_info)
 {
index 50f025b16701caa713d8bffe1f5b5f0425bd1bc8..cf8792c74a29d7355b0be39bebd73c5bcf43ba29 100644 (file)
@@ -859,12 +859,12 @@ gboolean wtap_dump_close(wtap_dumper *wdh, int *err)
        return ret;
 }
 
-long wtap_get_bytes_dumped(wtap_dumper *wdh)
+gint64 wtap_get_bytes_dumped(wtap_dumper *wdh)
 {
        return wdh->bytes_dumped;
 }
 
-void wtap_set_bytes_dumped(wtap_dumper *wdh, long bytes_dumped)
+void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped)
 {
        wdh->bytes_dumped = bytes_dumped;
 }
index 487aa397d863ba6e1fb68c1bf6151d420ff7f493..0e331eab6924abf549a2937fd47bc64ef75dd3fc 100644 (file)
 #include "file_wrappers.h"
 #include "file_util.h"
 
+
 #ifdef HAVE_LIBZ
+
 FILE_T
 file_open(const char *path, const char *mode)
 {
@@ -160,12 +162,13 @@ file_open(const char *path, const char *mode)
        return ft;
 }
 
-long
-file_seek(void *stream, long offset, int whence, int *err)
+int
+file_seek(void *stream, gint64 offset, int whence, int *err)
 {
-       long ret;
+       gint64 ret;
 
-       ret = gzseek(stream, (z_off_t)offset, whence);
+       /* XXX - z_off_t is usually long, won't work >= 2GB! */
+       ret = (gint64) gzseek(stream, (z_off_t)offset, whence);
        if (ret == -1) {
                /*
                 * XXX - "gzseek()", as of zlib 1.1.4, doesn't set
@@ -183,30 +186,18 @@ file_seek(void *stream, long offset, int whence, int *err)
        return ret;
 }
 
-long
+gint64
 file_tell(void *stream)
 {
-       return (long)gztell(stream);
+       /* XXX - z_off_t is usually long, won't work >= 2GB! */
+       return (gint64)gztell(stream);
 }
-#else /* HAVE_LIBZ */
-long
-file_seek(void *stream, long offset, int whence, int *err)
-{
-       long ret;
-
-       ret = fseek(stream, offset, whence);
-       if (ret == -1)
-               *err = file_error(stream);
-       return ret;
-}
-#endif /* HAVE_LIBZ */
 
 /*
  * Routine to return a Wiretap error code (0 for no error, an errno
  * for a file error, or a WTAP_ERR_ code for other errors) for an
  * I/O stream.
  */
-#ifdef HAVE_LIBZ
 int
 file_error(void *fh)
 {
@@ -228,13 +219,80 @@ file_error(void *fh)
                return WTAP_ERR_ZLIB + errnum;
        }
 }
+
 #else /* HAVE_LIBZ */
+
+gint64
+file_seek(void *stream, gint64 offset, int whence, int *err)
+{
+       gint64 ret;
+#ifdef _WIN32
+        gint64 pos;
+#endif
+
+#ifdef _WIN32
+        /* Win32 version using fsetpos/fgetpos */
+        /* XXX - using fsetpos/fgetpos this way is UNDOCUMENTED, but I don't see a any better way :-( */
+        /* _lseeki64(_fileno(stream)) doesn't work as this will mangle the internal FILE handling data */
+        switch(whence) {
+        case(SEEK_SET):
+            /* do nothing */
+            break;
+        case(SEEK_CUR):
+            /* adjust offset */
+            /* XXX - CURRENTLY UNTESTED!!! */
+           ret = fgetpos(stream, &pos);
+            if(ret != 0) {
+                *err = errno;
+                return ret;
+            }
+            offset += pos;
+            break;
+        case(SEEK_END):
+        default:
+            g_assert_not_reached();
+        }
+       ret = fsetpos(stream, &offset);
+       if(ret != 0) {
+               *err = errno;
+       }
+       /* XXX - won't work >= 2GB! */
+       /*ret = (gint64) fseek(stream, (long) offset, whence);
+       if(ret == -1) {
+               *err = errno;
+       }*/
+#else
+        /* "basic" version using fseek */
+       /* XXX - won't work >= 2GB! */
+       ret = (gint64) fseek(stream, (long) offset, whence);
+       if (ret == -1)
+               *err = file_error(stream);
+#endif
+        /*g_warning("Seek %lld whence %u ret %lld size %u", offset, whence, ret, sizeof(fpos_t));*/
+       return ret;
+}
+
+gint64
+file_tell(void *stream)
+{
+#ifdef _WIN32
+        /* Win32 version using _telli64 */
+        /* XXX - CURRENTLY UNTESTED!!! */
+       return _telli64(_fileno((FILE *)stream));
+#else
+        /* "basic" version using ftell */
+       /* XXX - ftell returns a long - won't work >= 2GB! */
+       return (gint64) ftell(stream);
+#endif
+}
+
 int
-file_error(FILE *fh)
+file_error(void *fh)
 {
-       if (ferror(fh))
+       if (ferror((FILE *) fh))
                return errno;
        else
                return 0;
 }
+
 #endif /* HAVE_LIBZ */
index c5ace299530a7733f1f52eb238e9d5c24842fb9a..9dcf643ff616ab22c04c2526516f7bfac2c3f6c4 100644 (file)
 #ifndef __FILE_H__
 #define __FILE_H__
 
+extern gint64 file_seek(void *stream, gint64 offset, int whence, int *err);
+extern gint64 file_tell(void *stream);
+extern int file_error(void *fh);
+
 #ifdef HAVE_LIBZ
 
 extern FILE_T file_open(const char *path, const char *mode);
 #define filed_open gzdopen
-extern long file_seek(void *stream, long offset, int whence, int *err);
 #define file_read(buf, bsize, count, file) gzread((file),(buf),((count)*(bsize)))
 #define file_write(buf, bsize, count, file) gzwrite((file),(buf),((count)*(bsize)))
 #define file_close gzclose
-extern long file_tell(void *stream);
 #define file_getc gzgetc
 #define file_gets(buf, len, file) gzgets((file), (buf), (len))
-extern int file_error(void *fh);
 #define file_eof gzeof
 
 #else /* No zLib */
+/* XXX - mixing eth_xxx and fxxx calls might not be a good idea with MSVC 2005! */
 #define file_open(path, mode) eth_fopen(path, mode)
 #define filed_open fdopen
-extern long file_seek(void *stream, long offset, int whence, int *err);
 #define file_read fread
 #define file_write fwrite
 #define file_close fclose
-extern int file_error(FILE *fh);
-#define file_tell ftell
 #define file_getc fgetc
 #define file_gets fgets
 #define file_eof feof
index be699200a195bd705ae46b11ad47f31697534ebe..c67b206efde0de66f09b62f901a3eab343ffb498 100644 (file)
@@ -39,7 +39,7 @@ struct dump_hdr {
 #define DUMP_HDR_SIZE (sizeof(struct dump_hdr))
 
 static gboolean hcidump_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
        struct dump_hdr dh;
        guint8 *buf;
@@ -90,7 +90,7 @@ static gboolean hcidump_read(wtap *wth, int *err, gchar **err_info,
        return TRUE;
 }
 
-static gboolean hcidump_seek_read(wtap *wth, long seek_off,
+static gboolean hcidump_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guint8 *pd, int length,
     int *err, gchar **err_info _U_)
 {
index 9b9d2d6a7ca9d5e92bc8ef716b2f90ff798286a6..97515ddf94bf1332af1f5ef70ce0a7b425bb640f 100644 (file)
@@ -34,8 +34,8 @@
 #include "i4btrace.h"
 
 static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean i4btrace_seek_read(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean i4btrace_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info);
 static int i4b_read_rec_header(FILE_T fh, i4b_trace_hdr_t *hdr, int *err);
@@ -116,7 +116,7 @@ int i4btrace_open(wtap *wth, int *err, gchar **err_info _U_)
 
 /* Read the next packet */
 static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
        int     ret;
        i4b_trace_hdr_t hdr;
@@ -182,7 +182,7 @@ static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info,
 }
 
 static gboolean
-i4btrace_seek_read(wtap *wth, long seek_off,
+i4btrace_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info _U_)
 {
index 409f509bdc0a0d0d2dbaffc6548c161f19b584e7..2a50dad1722f8e15a1342eb79cd92085198ad9c8 100644 (file)
 #include "iptrace.h"
 
 static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean iptrace_seek_read_1_0(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean iptrace_seek_read_1_0(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
     int *err, gchar **err_info);
 
 static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean iptrace_seek_read_2_0(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean iptrace_seek_read_2_0(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
     int *err, gchar **err_info);
 
@@ -124,7 +124,7 @@ typedef struct {
 
 /* Read the next packet */
 static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info _U_,
-    long *data_offset)
+    gint64 *data_offset)
 {
        int                     ret;
        guint32                 packet_size;
@@ -211,7 +211,7 @@ static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info _U_,
        return TRUE;
 }
 
-static gboolean iptrace_seek_read_1_0(wtap *wth, long seek_off,
+static gboolean iptrace_seek_read_1_0(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
     int *err, gchar **err_info _U_)
 {
@@ -303,7 +303,7 @@ typedef struct {
 
 /* Read the next packet */
 static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info _U_,
-    long *data_offset)
+    gint64 *data_offset)
 {
        int                     ret;
        guint32                 packet_size;
@@ -390,7 +390,7 @@ static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info _U_,
        return TRUE;
 }
 
-static gboolean iptrace_seek_read_2_0(wtap *wth, long seek_off,
+static gboolean iptrace_seek_read_2_0(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
     int *err, gchar **err_info _U_)
 {
index ba278c6437299a99e35019b0c199ceb68e8b8f05..1b93bcb9b705d26b9deb628b5ffde58176af5eb6 100644 (file)
 #define ISERIES_FORMAT_UNICODE  2
 
 static gboolean iseries_read (wtap * wth, int *err, gchar ** err_info,
-                             long *data_offset);
-static gboolean iseries_seek_read (wtap * wth, long seek_off,
+                             gint64 *data_offset);
+static gboolean iseries_seek_read (wtap * wth, gint64 seek_off,
                                   union wtap_pseudo_header *pseudo_header,
                                   guint8 * pd, int len, int *err,
                                   gchar ** err_info);
 static gboolean iseries_check_file_type (wtap * wth, int *err, int format);
-static long iseries_seek_next_packet (wtap * wth, int *err);
+static gint64 iseries_seek_next_packet (wtap * wth, int *err);
 static int iseries_parse_packet (wtap * wth, FILE_T fh,
                                 union wtap_pseudo_header *pseudo_header,
                                 guint8 * pd, int *err, gchar ** err_info);
@@ -332,9 +332,9 @@ iseries_check_file_type (wtap * wth, int *err, int format)
  * Find the next packet and parse it; called from wtap_read().
  */
 static gboolean
-iseries_read (wtap * wth, int *err, gchar ** err_info, long *data_offset)
+iseries_read (wtap * wth, int *err, gchar ** err_info, gint64 *data_offset)
 {
-  long offset;
+  gint64 offset;
   int pkt_len;
 
   /*
@@ -362,12 +362,13 @@ iseries_read (wtap * wth, int *err, gchar ** err_info, long *data_offset)
  * Seeks to the beginning of the next packet, and returns the
  * byte offset.  Returns -1 on failure, and sets "*err" to the error.
  */
-static long
+static gint64
 iseries_seek_next_packet (wtap * wth, int *err)
 {
   char buf[ISERIES_LINE_LENGTH];
   int line;
-  long cur_off, buflen;
+  gint64 cur_off;
+  long buflen;
 
   /*
    * Seeks to the beginning of the next packet, and returns the
@@ -432,7 +433,7 @@ iseries_seek_next_packet (wtap * wth, int *err)
  * Read packets in random-access fashion
  */
 static gboolean
-iseries_seek_read (wtap * wth, long seek_off,
+iseries_seek_read (wtap * wth, gint64 seek_off,
                   union wtap_pseudo_header *pseudo_header, guint8 * pd,
                   int len, int *err, gchar ** err_info)
 {
@@ -469,7 +470,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh,
                      union wtap_pseudo_header *pseudo_header, guint8 * pd,
                      int *err, gchar ** err_info)
 {
-  long cur_off;
+  gint64 cur_off;
   gboolean isValid, isCurrentPacket, IPread, TCPread, isDATA;
   int num_items_scanned, line, pktline, buflen;
   int pkt_len, cap_len, pktnum, month, day, year, hr, min, sec, csec;
index 4c9a67e525182637749b84e1b14ba00f74e94f06..5b4bf4446db32c1476a497d5da75d177a44c1c4e 100644 (file)
@@ -174,14 +174,14 @@ typedef struct _k12_src_desc_t {
  *
  * XXX: works at most with 0x1FFF bytes per record 
  */
-static gint get_record(guint8* buffer, FILE* fh, guint file_offset) {
+static gint get_record(guint8* buffer, FILE* fh, gint64 file_offset) {
        long read;
        long len;
-       int i;
-       long junky_offset = 0x2000 - ( (file_offset - 0x200) % 0x2000 );
+       gint64 i;
+       gint64 junky_offset = 0x2000 - ( (file_offset - 0x200) % 0x2000 );
     
 #ifdef DEBUG_K12
-    k12_dbg(5,"k12:get_record: ENTER offset=%u",file_offset);
+    k12_dbg(5,"k12:get_record: ENTER offset=%lld",file_offset);
 #endif
     
        if  ( junky_offset != 0x2000 ) {
@@ -289,10 +289,10 @@ static gint get_record(guint8* buffer, FILE* fh, guint file_offset) {
        }
 }
 
-static gboolean k12_read(wtap *wth, int *err, gchar **err_info _U_, long *data_offset) {
+static gboolean k12_read(wtap *wth, int *err, gchar **err_info _U_, gint64 *data_offset) {
        k12_src_desc_t* src_desc;
        guint8 buffer[0x2000];
-       long offset;
+       gint64 offset;
        long len;
        guint32 type;
        guint64 ts;
@@ -390,7 +390,7 @@ static gboolean k12_read(wtap *wth, int *err, gchar **err_info _U_, long *data_o
 }
 
 
-static gboolean k12_seek_read(wtap *wth, long seek_off, union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err _U_, gchar **err_info _U_) {
+static gboolean k12_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_header, guchar *pd, int length, int *err _U_, gchar **err_info _U_) {
        k12_src_desc_t* src_desc;
        guint8 buffer[0x2000];
     guint32 input;
index 49266d811c1081857aa70127e6ad6a216dffb721..c0a16ab98038eaea1ce6ec9f9a2f333d244ab7d2 100644 (file)
@@ -118,8 +118,8 @@ static const guint8 LA_CyclicInformationFake[] = {
       };
 
 static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean lanalyzer_seek_read(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info);
 static void     lanalyzer_close(wtap *wth);
@@ -274,7 +274,7 @@ int lanalyzer_open(wtap *wth, int *err, gchar **err_info)
 
 /* Read the next packet */
 static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
        int             packet_size = 0;
        int             bytes_read;
@@ -396,7 +396,7 @@ static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
        return TRUE;
 }
 
-static gboolean lanalyzer_seek_read(wtap *wth, long seek_off,
+static gboolean lanalyzer_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info _U_)
 {
index 0d782d3b5078752755383c8f6d32c26dc1c17388..997b63f8964b5aaecda46c8feba94bc0a3b38f91 100644 (file)
@@ -113,8 +113,8 @@ typedef enum {
 static libpcap_try_t libpcap_try(wtap *wth, int *err);
 
 static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean libpcap_seek_read(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean libpcap_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info);
 static int libpcap_read_header(wtap *wth, int *err, gchar **err_info,
@@ -1154,7 +1154,7 @@ static libpcap_try_t libpcap_try(wtap *wth, int *err)
 
 /* Read the next packet */
 static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
        struct pcaprec_ss990915_hdr hdr;
        guint packet_size;
@@ -1392,7 +1392,7 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
 }
 
 static gboolean
-libpcap_seek_read(wtap *wth, long seek_off,
+libpcap_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info)
 {
index 19eb125bcdc8b7a032f1ac2dc055faf61c26b1bc..7f21ac2d018e14f192310a7abc4f0bc0417ea5fd 100644 (file)
@@ -105,8 +105,8 @@ struct netmon_atm_hdr {
 };
 
 static gboolean netmon_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean netmon_seek_read(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean netmon_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info);
 static gboolean netmon_read_atm_pseudoheader(FILE_T fh,
@@ -306,7 +306,7 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
 
 /* Read the next packet */
 static gboolean netmon_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
        netmon_t *netmon = wth->capture.netmon;
        guint32 packet_size = 0;
@@ -471,7 +471,7 @@ static gboolean netmon_read(wtap *wth, int *err, gchar **err_info,
 }
 
 static gboolean
-netmon_seek_read(wtap *wth, long seek_off,
+netmon_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info _U_)
 {
index 0911388cec9ae16ebc724431266840f8c3a310c8..6aaf73219b8d777fc46e866a8285aa8d5bb9ca15 100644 (file)
@@ -175,8 +175,8 @@ struct nettlrec_ns_ls_drv_eth_hdr {
 /* header is followed by data and once again the total length (2 bytes) ! */
 
 static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
-               long *data_offset);
-static gboolean nettl_seek_read(wtap *wth, long seek_off,
+               gint64 *data_offset);
+static gboolean nettl_seek_read(wtap *wth, gint64 seek_off,
                union wtap_pseudo_header *pseudo_header, guchar *pd,
                int length, int *err, gchar **err_info);
 static int nettl_read_rec_header(wtap *wth, FILE_T fh,
@@ -285,7 +285,7 @@ int nettl_open(wtap *wth, int *err, gchar **err_info _U_)
 
 /* Read the next packet */
 static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
     int ret;
     gboolean fddihack=FALSE;
@@ -327,7 +327,7 @@ static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
 }
 
 static gboolean
-nettl_seek_read(wtap *wth, long seek_off,
+nettl_seek_read(wtap *wth, gint64 seek_off,
                union wtap_pseudo_header *pseudo_header, guchar *pd,
                int length, int *err, gchar **err_info)
 {
index 6a7952fcf636a41c82f34d4ecd5c6ff05d52f1ea..c36611ec3a7d349f1aca3594faa05c94a0be116c 100644 (file)
@@ -89,8 +89,8 @@ static void init_time_offset(void)
 }
 
 static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean observer_seek_read(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean observer_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info);
 static int read_packet_header(FILE_T fh, packet_entry_header *packet_header,
@@ -230,7 +230,7 @@ int network_instruments_open(wtap *wth, int *err, gchar **err_info)
 
 /* reads the next packet */
 static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
        int offset;
        packet_entry_header packet_header;
@@ -280,7 +280,7 @@ static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
            GUINT64_FROM_LE(packet_header.nano_seconds_since_2000);
        wth->phdr.ts.secs =
            (time_t) (packet_header.nano_seconds_since_2000/1000000000 + seconds1970to2000);
-       wth->phdr.ts.nsecs = packet_header.nano_seconds_since_2000%1000000000;
+       wth->phdr.ts.nsecs = (int) (packet_header.nano_seconds_since_2000%1000000000);
 
        /* set-up the packet buffer */
        buffer_assure_space(wth->frame_buffer, packet_header.captured_size);
@@ -306,7 +306,7 @@ static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
 }
 
 /* reads a packet at an offset */
-static gboolean observer_seek_read(wtap *wth, long seek_off,
+static gboolean observer_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info)
 {
index c7d3b05f417357f6feafe94abade3746c8d63aa5..aadf4fb05e4e1340e9903f668968d6bc0b8b74e8 100644 (file)
@@ -274,8 +274,8 @@ union netxrayrec_hdr {
 };
 
 static gboolean netxray_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean netxray_seek_read(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean netxray_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info);
 static int netxray_read_rec_header(wtap *wth, FILE_T fh,
@@ -833,7 +833,7 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
 
 /* Read the next packet */
 static gboolean netxray_read(wtap *wth, int *err, gchar **err_info _U_,
-    long *data_offset)
+    gint64 *data_offset)
 {
        guint32 packet_size;
        union netxrayrec_hdr hdr;
@@ -961,7 +961,7 @@ reread:
 }
 
 static gboolean
-netxray_seek_read(wtap *wth, long seek_off,
+netxray_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info _U_)
 {
index 4ec972408cddd14d7a8134598b55fef8160b66f2..3d6ea5cf81ac2fef6973ebd1333e6a5971a54456 100644 (file)
@@ -430,8 +430,8 @@ static int process_rec_header2_v2(wtap *wth, unsigned char *buffer,
 static int process_rec_header2_v145(wtap *wth, unsigned char *buffer,
     guint16 length, gint16 maj_vers, int *err, gchar **err_info);
 static gboolean ngsniffer_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean ngsniffer_seek_read(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean ngsniffer_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
     int *err, gchar **err_info);
 static int ngsniffer_read_rec_header(wtap *wth, gboolean is_random,
@@ -464,8 +464,8 @@ static int ng_file_read(void *buffer, size_t elementsize, size_t numelements,
     wtap *wth, gboolean is_random, int *err);
 static int read_blob(FILE_T infile, ngsniffer_comp_stream_t *comp_stream,
     int *err);
-static long ng_file_seek_seq(wtap *wth, long offset, int whence, int *err);
-static long ng_file_seek_rand(wtap *wth, long offset, int whence, int *err);
+static gint64 ng_file_seek_seq(wtap *wth, gint64 offset, int whence, int *err);
+static gint64 ng_file_seek_rand(wtap *wth, gint64 offset, int whence, int *err);
 
 int ngsniffer_open(wtap *wth, int *err, gchar **err_info)
 {
@@ -967,7 +967,7 @@ process_rec_header2_v145(wtap *wth, unsigned char *buffer, guint16 length,
 
 /* Read the next packet */
 static gboolean ngsniffer_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
        int     ret;
        guint16 type, length;
@@ -1156,7 +1156,7 @@ found:
        return TRUE;
 }
 
-static gboolean ngsniffer_seek_read(wtap *wth, long seek_off,
+static gboolean ngsniffer_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
     int *err, gchar **err_info _U_)
 {
@@ -2335,8 +2335,8 @@ SnifferDecompress( unsigned char * inbuf, size_t inlen,
    underlying compressed file, and the offset in the uncompressed data
    stream, of the blob. */
 typedef struct {
-       long    blob_comp_offset;
-       long    blob_uncomp_offset;
+       gint64  blob_comp_offset;
+       gint64  blob_uncomp_offset;
 } blob_info_t;
 
 static int
@@ -2504,10 +2504,10 @@ read_blob(FILE_T infile, ngsniffer_comp_stream_t *comp_stream, int *err)
 
 /* Seek in the sequential data stream; we can only seek forward, and we
    do it on compressed files by skipping forward. */
-static long
-ng_file_seek_seq(wtap *wth, long offset, int whence, int *err)
+static gint64
+ng_file_seek_seq(wtap *wth, gint64 offset, int whence, int *err)
 {
-    long delta;
+    gint64 delta;
     char buf[65536];
     long amount_to_read;
 
@@ -2533,7 +2533,7 @@ ng_file_seek_seq(wtap *wth, long offset, int whence, int *err)
 
     /* Ok, now read and discard "delta" bytes. */
     while (delta != 0) {
-       amount_to_read = delta;
+       amount_to_read = (long) delta;
        if ((unsigned long)amount_to_read > sizeof buf)
            amount_to_read = sizeof buf;
        if (ng_file_read(buf, 1, amount_to_read, wth, FALSE, err) < 0)
@@ -2551,11 +2551,11 @@ ng_file_seek_seq(wtap *wth, long offset, int whence, int *err)
    we're seeking, and read that blob in.  We can then move to the appropriate
    position within the blob we have in memory (whether it's the blob we
    already had in memory or, if necessary, the one we read in). */
-static long
-ng_file_seek_rand(wtap *wth, long offset, int whence, int *err)
+static gint64
+ng_file_seek_rand(wtap *wth, gint64 offset, int whence, int *err)
 {
     ngsniffer_t *ngsniffer;
-    long delta;
+    gint64 delta;
     GList *new, *next;
     blob_info_t *next_blob, *new_blob;
 
@@ -2662,7 +2662,7 @@ ng_file_seek_rand(wtap *wth, long offset, int whence, int *err)
        "ngsniffer->rand.nextout" to point to the place to which
        we're seeking, and adjust "ngsniffer->rand.uncomp_offset" to be
        the destination offset. */
-    ngsniffer->rand.nextout += delta;
+    ngsniffer->rand.nextout += (int) delta;
     ngsniffer->rand.uncomp_offset += delta;
 
     return offset;
index 9513d6ab8fdfbb45286a8e93a9041915be4f06a6..3e19a59529d63e48874019f86bcf3dd929146dfa 100644 (file)
@@ -100,8 +100,8 @@ typedef enum {
 } direction_enum;
 
 static gboolean pppdump_read(wtap *wth, int *err, gchar **err_info,
-       long *data_offset);
-static gboolean pppdump_seek_read(wtap *wth, long seek_off,
+       gint64 *data_offset);
+static gboolean pppdump_seek_read(wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
        int *err, gchar **err_info);
 
@@ -313,7 +313,7 @@ pppdump_open(wtap *wth, int *err, gchar **err_info _U_)
 
 /* Find the next packet and parse it; called from wtap_read(). */
 static gboolean
-pppdump_read(wtap *wth, int *err, gchar **err_info, long *data_offset)
+pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
 {
        int             num_bytes;
        direction_enum  direction;
@@ -702,7 +702,7 @@ done:
 /* Used to read packets in random-access fashion */
 static gboolean
 pppdump_seek_read(wtap *wth,
-                long seek_off,
+                gint64 seek_off,
                 union wtap_pseudo_header *pseudo_header,
                 guint8 *pd,
                 int len,
index c32bfbaa3bd9c13c8aaf82c4459b31b925835ac3..16ccd6bb40253c1e3591489bb2ac35d91c7a98c8 100644 (file)
@@ -90,8 +90,8 @@ struct radcomrec_hdr {
 };
 
 static gboolean radcom_read(wtap *wth, int *err, gchar **err_info,
-       long *data_offset);
-static gboolean radcom_seek_read(wtap *wth, long seek_off,
+       gint64 *data_offset);
+static gboolean radcom_seek_read(wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
        int *err, gchar **err_info);
 static int radcom_read_rec_header(FILE_T fh, struct radcomrec_hdr *hdr,
@@ -267,7 +267,7 @@ read_error:
 
 /* Read the next packet */
 static gboolean radcom_read(wtap *wth, int *err, gchar **err_info _U_,
-    long *data_offset)
+    gint64 *data_offset)
 {
        int     ret;
        struct radcomrec_hdr hdr;
@@ -373,7 +373,7 @@ static gboolean radcom_read(wtap *wth, int *err, gchar **err_info _U_,
 }
 
 static gboolean
-radcom_seek_read(wtap *wth, long seek_off,
+radcom_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info _U_)
 {
index 1c0125c159c888e9c423b4eb6c689ac1d4f71427..cc6d62afdce6d4d780eff6394ac53e48d478afd9 100644 (file)
@@ -89,8 +89,8 @@ struct shomiti_trailer {
 #define RX_STATUS_TRIGGERED            0x0001  /* frame did trigger */
 
 static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean snoop_seek_read(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean snoop_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info);
 static gboolean snoop_read_atm_pseudoheader(FILE_T fh,
@@ -404,7 +404,7 @@ int snoop_open(wtap *wth, int *err, gchar **err_info)
 
 /* Read the next packet */
 static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
        guint32 rec_size;
        guint32 packet_size;
@@ -554,7 +554,7 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
 }
 
 static gboolean
-snoop_seek_read(wtap *wth, long seek_off,
+snoop_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int length,
     int *err, gchar **err_info _U_)
 {
index 824b0a15910a0219f1f6a4a114ba5cac431b1780..a6d67900fef4419eabad29cbced6eca9a70b783e 100644 (file)
@@ -110,8 +110,8 @@ static const char toshiba_rec_magic[]  = { '[', 'N', 'o', '.' };
 #define TOSHIBA_MAX_PACKET_LEN 16384
 
 static gboolean toshiba_read(wtap *wth, int *err, gchar **err_info,
-       long *data_offset);
-static gboolean toshiba_seek_read(wtap *wth, long seek_off,
+       gint64 *data_offset);
+static gboolean toshiba_seek_read(wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
        int *err, gchar **err_info);
 static gboolean parse_single_hex_dump_line(char* rec, guint8 *buf,
@@ -123,11 +123,11 @@ static int parse_toshiba_rec_hdr(wtap *wth, FILE_T fh,
 
 /* Seeks to the beginning of the next packet, and returns the
    byte offset.  Returns -1 on failure, and sets "*err" to the error. */
-static long toshiba_seek_next_packet(wtap *wth, int *err)
+static gint64 toshiba_seek_next_packet(wtap *wth, int *err)
 {
   int byte;
   guint level = 0;
-  long cur_off;
+  gint64 cur_off;
 
   while ((byte = file_getc(wth->fh)) != EOF) {
     if (byte == toshiba_rec_magic[level]) {
@@ -233,9 +233,9 @@ int toshiba_open(wtap *wth, int *err, gchar **err_info _U_)
 
 /* Find the next packet and parse it; called from wtap_read(). */
 static gboolean toshiba_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
-       long    offset;
+       gint64  offset;
        guint8  *buf;
        int     pkt_len;
 
@@ -265,7 +265,7 @@ static gboolean toshiba_read(wtap *wth, int *err, gchar **err_info,
 
 /* Used to read packets in random-access fashion */
 static gboolean
-toshiba_seek_read (wtap *wth, long seek_off,
+toshiba_seek_read (wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
        int *err, gchar **err_info)
 {
index 2f4b23678bc56e0f799a1c23f6331d1b6457d241..332f985f262cb84dcf85899dbab86cac02649ea5 100644 (file)
@@ -113,9 +113,9 @@ struct visual_write_info
 
 /* Local functions to handle file reads and writes */
 static gboolean visual_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
+    gint64 *data_offset);
 static void visual_close(wtap *wth);
-static gboolean visual_seek_read(wtap *wth, long seek_off,
+static gboolean visual_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guchar *pd, int packet_size,
     int *err, gchar **err_info);
 static void visual_set_pseudo_header(int encap, struct visual_pkt_hdr *vpkt_hdr,
@@ -233,7 +233,7 @@ int visual_open(wtap *wth, int *err, gchar **err_info)
    the file has been read once, any Future access to the packets is
    done through seek_read. */
 static gboolean visual_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
     struct visual_read_info *visual = wth->capture.generic;
     guint32 packet_size = 0;
@@ -330,7 +330,7 @@ static void visual_close(wtap *wth)
 /* Read packet data for random access.
    This gets the packet data and rebuilds the pseudo header so that
    the direction flag works. */
-static gboolean visual_seek_read (wtap *wth, long seek_off,
+static gboolean visual_seek_read (wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
     int *err, gchar **err_info _U_)
 {
index 81b00986dc50ffe2ced1198f85bea80d6246b289..38fbb9e124efa761b0ee5c283cf4224d17850fea 100644 (file)
@@ -144,8 +144,8 @@ to handle them.
 #define VMS_LINE_LENGTH              240
 
 static gboolean vms_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
-static gboolean vms_seek_read(wtap *wth, long seek_off,
+    gint64 *data_offset);
+static gboolean vms_seek_read(wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
     int *err, gchar **err_info);
 static gboolean parse_single_hex_dump_line(char* rec, guint8 *buf,
@@ -210,7 +210,7 @@ static gboolean vms_check_file_type(wtap *wth, int *err)
 {
   char buf[VMS_LINE_LENGTH];
   guint        reclen, line;
-  long mpos;
+  gint64 mpos;
   
   buf[VMS_LINE_LENGTH-1] = '\0';
   
@@ -278,9 +278,9 @@ int vms_open(wtap *wth, int *err, gchar **err_info _U_)
 
 /* Find the next packet and parse it; called from wtap_read(). */
 static gboolean vms_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset)
+    gint64 *data_offset)
 {
-    long   offset = 0;
+    gint64   offset = 0;
     guint8    *buf;
     int    pkt_len;
 
@@ -313,7 +313,7 @@ static gboolean vms_read(wtap *wth, int *err, gchar **err_info,
 
 /* Used to read packets in random-access fashion */
 static gboolean
-vms_seek_read (wtap *wth, long seek_off,
+vms_seek_read (wtap *wth, gint64 seek_off,
     union wtap_pseudo_header *pseudo_header _U_,
     guint8 *pd, int len, int *err, gchar **err_info)
 {
index 847ed8d2dfcba9e94c1969f9d062df5732610d5b..dabd8905c82560b27d8a328227ddc99bb8c704bf 100644 (file)
@@ -48,8 +48,8 @@ typedef struct {
        unsigned char *buf;     /* buffer into which we uncompress data */
        size_t  nbytes;         /* number of bytes of data in that buffer */
        int     nextout;        /* offset in that buffer of stream's current position */
-       long    comp_offset;    /* current offset in compressed data stream */
-       long    uncomp_offset;  /* current offset in uncompressed data stream */
+       gint64  comp_offset;    /* current offset in compressed data stream */
+       gint64  uncomp_offset;  /* current offset in uncompressed data stream */
 } ngsniffer_comp_stream_t;
 
 typedef struct {
@@ -111,8 +111,8 @@ typedef struct {
        double          start_timestamp;
        gboolean        wrapped;
        guint32         nframes;
-       long            start_offset;
-       long            end_offset;
+       gint64          start_offset;
+       gint64          end_offset;
        int             version_major;
        gboolean        fcs_valid;      /* if packets have valid FCS at the end */
        guint           isdn_type;      /* 1 = E1 PRI, 2 = T1 PRI, 3 = BRI */
@@ -121,7 +121,7 @@ typedef struct {
 typedef struct {
        time_t inittime;
        int adjusted;
-       long next_packet_seek_start;
+       gint64 next_packet_seek_start;
 } ascend_t;
 
 typedef struct {
@@ -149,8 +149,8 @@ typedef struct {
        guint32 start_usecs;
 } catapult_dct2000_t;
 
-typedef gboolean (*subtype_read_func)(struct wtap*, int*, char**, long*);
-typedef gboolean (*subtype_seek_read_func)(struct wtap*, long, union wtap_pseudo_header*,
+typedef gboolean (*subtype_read_func)(struct wtap*, int*, char**, gint64*);
+typedef gboolean (*subtype_seek_read_func)(struct wtap*, gint64, union wtap_pseudo_header*,
                                        guint8*, int, int *, char **);
 struct wtap {
        FILE_T                  fh;
@@ -162,7 +162,7 @@ struct wtap {
        struct wtap_pkthdr      phdr;
        union wtap_pseudo_header pseudo_header;
 
-       long                    data_offset;
+       gint64                  data_offset;
 
        union {
                libpcap_t               *pcap;
@@ -248,7 +248,7 @@ struct wtap_dumper {
        int                     snaplen;
        int                     encap;
        gboolean        compressed;
-       long                    bytes_dumped;
+       gint64          bytes_dumped;
 
        union {
                void                    *opaque;
index 05246628b8adfb81ad0c5ee3f49a6321a4168ad2..2648e1dfc1c068ac6d5c5d3361f5bb4b5fa8a8cf 100644 (file)
@@ -492,7 +492,7 @@ wtap_close(wtap *wth)
 }
 
 gboolean
-wtap_read(wtap *wth, int *err, gchar **err_info, long *data_offset)
+wtap_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
 {
        /*
         * Set the packet encapsulation to the file's encapsulation
@@ -562,7 +562,7 @@ wtap_buf_ptr(wtap *wth)
 }
 
 gboolean
-wtap_seek_read(wtap *wth, long seek_off,
+wtap_seek_read(wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
        int *err, gchar **err_info)
 {
index ebae43f763b6ef22a5a3ff041d4232b64a244c58..eadee8d6df5f54665569759f21a92663f234edee 100644 (file)
@@ -513,7 +513,7 @@ struct catapult_dct2000_phdr
                struct atm_phdr   atm;
                struct p2p_phdr   p2p;
        } inner_pseudo_header;
-       long seek_off;
+       gint64 seek_off;
        struct wtap *wth;
 };
 
@@ -574,11 +574,11 @@ struct wtap* wtap_open_offline(const char *filename, int *err,
  * set the the offset in the file where the data for the read packet is
  * located. */
 gboolean wtap_read(wtap *wth, int *err, gchar **err_info,
-    long *data_offset);
+    gint64 *data_offset);
 
 /*
  * Return an approximation of the amount of data we've read sequentially
- * from the file so far.  (gint64, in case that's 64 bits.)
+ * from the file so far.
  */
 gint64 wtap_read_so_far(wtap *wth, int *err);
 
@@ -606,7 +606,7 @@ int wtap_short_string_to_encap(const char *short_name);
 const char *wtap_strerror(int err);
 void wtap_sequential_close(wtap *wth);
 void wtap_close(wtap *wth);
-gboolean wtap_seek_read (wtap *wth, long seek_off,
+gboolean wtap_seek_read (wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
        int *err, gchar **err_info);
 
@@ -621,8 +621,8 @@ gboolean wtap_dump(wtap_dumper *, const struct wtap_pkthdr *,
        const union wtap_pseudo_header *pseudo_header, const guchar *, int *err);
 void wtap_dump_flush(wtap_dumper *);
 gboolean wtap_dump_close(wtap_dumper *, int *);
-long wtap_get_bytes_dumped(wtap_dumper *);
-void wtap_set_bytes_dumped(wtap_dumper *wdh, long bytes_dumped);
+gint64 wtap_get_bytes_dumped(wtap_dumper *);
+void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped);
 
 /*
  * Wiretap error codes.