Skip to content

Commit

Permalink
change all file offsets from long to gint64 so we can - theoretically…
Browse files Browse the repository at this point in the history
… - handle files > 2GB correct.

Please distclean Win32 builds!

svn path=/trunk/; revision=19814
  • Loading branch information
ulflulfl committed Nov 5, 2006
1 parent ed837bc commit 59d6c8e
Show file tree
Hide file tree
Showing 54 changed files with 313 additions and 254 deletions.
2 changes: 1 addition & 1 deletion capinfos.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion capture_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
5 changes: 3 additions & 2 deletions config.nmake
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down Expand Up @@ -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) \
Expand Down
2 changes: 1 addition & 1 deletion editcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions epan/dissectors/packet-frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion epan/frame_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
12 changes: 6 additions & 6 deletions file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion gtk/capture_file_dlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion gtk/gsm_map_summary.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
18 changes: 9 additions & 9 deletions gtk/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -1657,37 +1657,37 @@ 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,
val_to_str(expert_get_highest_severity(), expert_severity_vals, "Unknown (%u)"));
}
#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);
Expand Down
2 changes: 1 addition & 1 deletion gtk/mtp3_summary.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion gtk/summary_dlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion gtk/win32-file-dlg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion merge.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion summary.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
8 changes: 4 additions & 4 deletions tshark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -2185,7 +2185,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type)

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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions wiretap/5views.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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_)
{
Expand Down
8 changes: 4 additions & 4 deletions wiretap/airopeek9.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions wiretap/ascend-grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -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;

%}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion wiretap/ascend-int.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
Loading

0 comments on commit 59d6c8e

Please sign in to comment.