forked from osmocom/wireshark
Fix indentation to match editor mode-lines (no tabs, correct indentation, etc);
Reformat some whitespace; Remove unneeded variable initialization. svn path=/trunk/; revision=44461
This commit is contained in:
parent
ad759c88f8
commit
e211327f65
77
file.c
77
file.c
|
@ -157,7 +157,7 @@ cf_callback_invoke(int event, gpointer data)
|
|||
/* there should be at least one interested */
|
||||
g_assert(cb_item != NULL);
|
||||
|
||||
while(cb_item != NULL) {
|
||||
while (cb_item != NULL) {
|
||||
cb = cb_item->data;
|
||||
cb->cb_fct(event, data, cb->user_data);
|
||||
cb_item = g_list_next(cb_item);
|
||||
|
@ -183,9 +183,9 @@ cf_callback_remove(cf_callback_t func)
|
|||
cf_callback_data_t *cb;
|
||||
GList *cb_item = cf_callbacks;
|
||||
|
||||
while(cb_item != NULL) {
|
||||
while (cb_item != NULL) {
|
||||
cb = cb_item->data;
|
||||
if(cb->cb_fct == func) {
|
||||
if (cb->cb_fct == func) {
|
||||
cf_callbacks = g_list_remove(cf_callbacks, cb);
|
||||
g_free(cb);
|
||||
return;
|
||||
|
@ -204,12 +204,12 @@ cf_timestamp_auto_precision(capture_file *cf)
|
|||
|
||||
|
||||
/* don't try to get the file's precision if none is opened */
|
||||
if(cf->state == FILE_CLOSED) {
|
||||
if (cf->state == FILE_CLOSED) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* if we are in auto mode, set precision of current file */
|
||||
if(prec == TS_PREC_AUTO ||
|
||||
if (prec == TS_PREC_AUTO ||
|
||||
prec == TS_PREC_AUTO_SEC ||
|
||||
prec == TS_PREC_AUTO_DSEC ||
|
||||
prec == TS_PREC_AUTO_CSEC ||
|
||||
|
@ -344,7 +344,7 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
|
|||
new_packet_list_queue_draw();
|
||||
fileset_file_opened(fname);
|
||||
|
||||
if(cf->cd_t == WTAP_FILE_BER) {
|
||||
if (cf->cd_t == WTAP_FILE_BER) {
|
||||
/* tell the BER dissector the file name */
|
||||
ber_set_filename(cf->filename);
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ cf_reset_state(capture_file *cf)
|
|||
void
|
||||
cf_close(capture_file *cf)
|
||||
{
|
||||
if(cf->state != FILE_CLOSED) {
|
||||
if (cf->state != FILE_CLOSED) {
|
||||
cf_callback_invoke(cf_cb_file_closing, cf);
|
||||
|
||||
/* close things, if not already closed before */
|
||||
|
@ -554,7 +554,7 @@ cf_read(capture_file *cf, gboolean reloading)
|
|||
progbar_nextstep = 0;
|
||||
/* When we reach the value that triggers a progress bar update,
|
||||
bump that value by this amount. */
|
||||
if (size >= 0){
|
||||
if (size >= 0) {
|
||||
progbar_quantum = size/N_PROGBAR_UPDATES;
|
||||
if (progbar_quantum < MIN_QUANTUM)
|
||||
progbar_quantum = MIN_QUANTUM;
|
||||
|
@ -577,7 +577,7 @@ cf_read(capture_file *cf, gboolean reloading)
|
|||
/* Create the progress bar if necessary.
|
||||
* Check whether it should be created or not every MIN_NUMBER_OF_PACKET
|
||||
*/
|
||||
if ((progbar == NULL) && !(count % MIN_NUMBER_OF_PACKET)){
|
||||
if ((progbar == NULL) && !(count % MIN_NUMBER_OF_PACKET)) {
|
||||
progbar_val = calc_progbar_val(cf, size, file_pos, status_str, sizeof(status_str));
|
||||
if (reloading)
|
||||
progbar = delayed_create_progress_dlg(cf->window, "Reloading", name_ptr,
|
||||
|
@ -642,7 +642,7 @@ cf_read(capture_file *cf, gboolean reloading)
|
|||
g_free(name_ptr);
|
||||
|
||||
/* Cleanup and release all dfilter resources */
|
||||
if (dfcode != NULL){
|
||||
if (dfcode != NULL) {
|
||||
dfilter_free(dfcode);
|
||||
}
|
||||
|
||||
|
@ -680,11 +680,11 @@ cf_read(capture_file *cf, gboolean reloading)
|
|||
|
||||
/* If we have any displayed packets to select, select the first of those
|
||||
packets by making the first row the selected row. */
|
||||
if (cf->first_displayed != 0){
|
||||
if (cf->first_displayed != 0) {
|
||||
new_packet_list_select_first_row();
|
||||
}
|
||||
|
||||
if(stop_flag) {
|
||||
if (stop_flag) {
|
||||
simple_message_box(ESD_TYPE_WARN, NULL,
|
||||
"The remaining packets in the file were discarded.\n"
|
||||
"\n"
|
||||
|
@ -832,7 +832,7 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
|
|||
cf->lnk_t = wtap_file_encap(cf->wth);
|
||||
|
||||
/* Cleanup and release all dfilter resources */
|
||||
if (dfcode != NULL){
|
||||
if (dfcode != NULL) {
|
||||
dfilter_free(dfcode);
|
||||
}
|
||||
|
||||
|
@ -844,7 +844,7 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
|
|||
/* With the new packet list the first packet
|
||||
* isn't automatically selected.
|
||||
*/
|
||||
if(!cf->current_frame)
|
||||
if (!cf->current_frame)
|
||||
new_packet_list_select_first_row();
|
||||
|
||||
/* moving to the end of the packet list - if the user requested so and
|
||||
|
@ -898,7 +898,7 @@ cf_finish_tail(capture_file *cf, int *err)
|
|||
/* Get the union of the flags for all tap listeners. */
|
||||
tap_flags = union_of_tap_listener_flags();
|
||||
|
||||
if(cf->wth == NULL) {
|
||||
if (cf->wth == NULL) {
|
||||
cf_close(cf);
|
||||
return CF_READ_ERROR;
|
||||
}
|
||||
|
@ -918,7 +918,7 @@ cf_finish_tail(capture_file *cf, int *err)
|
|||
}
|
||||
|
||||
/* Cleanup and release all dfilter resources */
|
||||
if (dfcode != NULL){
|
||||
if (dfcode != NULL) {
|
||||
dfilter_free(dfcode);
|
||||
}
|
||||
|
||||
|
@ -975,7 +975,7 @@ cf_get_display_name(capture_file *cf)
|
|||
/* Return a name to use in displays */
|
||||
if (!cf->is_tempfile) {
|
||||
/* Get the last component of the file name, and use that. */
|
||||
if (cf->filename){
|
||||
if (cf->filename) {
|
||||
displayname = g_filename_display_basename(cf->filename);
|
||||
} else {
|
||||
displayname=g_strdup("(No file)");
|
||||
|
@ -1140,7 +1140,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
|
|||
} else
|
||||
fdata->flags.passed_dfilter = 1;
|
||||
|
||||
if(fdata->flags.passed_dfilter || fdata->flags.ref_time)
|
||||
if (fdata->flags.passed_dfilter || fdata->flags.ref_time)
|
||||
cf->displayed_count++;
|
||||
|
||||
if (add_to_packet_list) {
|
||||
|
@ -1148,7 +1148,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
|
|||
row = new_packet_list_append(cinfo, fdata, &edt.pi);
|
||||
}
|
||||
|
||||
if(fdata->flags.passed_dfilter || fdata->flags.ref_time)
|
||||
if (fdata->flags.passed_dfilter || fdata->flags.ref_time)
|
||||
{
|
||||
frame_data_set_after_dissect(fdata, &cum_bytes, &prev_dis_ts);
|
||||
|
||||
|
@ -1300,7 +1300,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
|
|||
* We need something similar when merging pcapng files possibly with an option to say
|
||||
* the same interface(s) used in all in files. SHBs comments should be merged together.
|
||||
*/
|
||||
if((selected_frame_type == WTAP_ENCAP_PER_PACKET)&&(file_type == WTAP_FILE_PCAP)){
|
||||
if ((selected_frame_type == WTAP_ENCAP_PER_PACKET)&&(file_type == WTAP_FILE_PCAP)) {
|
||||
/* Write output in pcapng format */
|
||||
wtapng_section_t *shb_hdr;
|
||||
wtapng_iface_descriptions_t *idb_inf, *idb_inf_merge_file;
|
||||
|
@ -1322,9 +1322,12 @@ cf_merge_files(char **out_filenamep, int in_file_count,
|
|||
shb_hdr->section_length = -1;
|
||||
/* options */
|
||||
shb_hdr->opt_comment = g_string_free(comment_gstr, FALSE); /* NULL if not available */
|
||||
shb_hdr->shb_hardware = NULL; /* NULL if not available, UTF-8 string containing the description of the hardware used to create this section. */
|
||||
shb_hdr->shb_os = NULL; /* NULL if not available, UTF-8 string containing the name of the operating system used to create this section. */
|
||||
shb_hdr->shb_user_appl = "Wireshark"; /* NULL if not available, UTF-8 string containing the name of the application used to create this section. */
|
||||
shb_hdr->shb_hardware = NULL; /* NULL if not available, UTF-8 string containing the */
|
||||
/* description of the hardware used to create this section. */
|
||||
shb_hdr->shb_os = NULL; /* NULL if not available, UTF-8 string containing the name */
|
||||
/* of the operating system used to create this section. */
|
||||
shb_hdr->shb_user_appl = "Wireshark"; /* NULL if not available, UTF-8 string containing the name */
|
||||
/* of the application used to create this section. */
|
||||
|
||||
/* create fake IDB info */
|
||||
idb_inf = g_new(wtapng_iface_descriptions_t,1);
|
||||
|
@ -1375,7 +1378,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
|
|||
return CF_ERROR;
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
|
||||
pdh = wtap_dump_fdopen(out_fd, file_type,
|
||||
selected_frame_type,
|
||||
|
@ -1476,7 +1479,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
|
|||
* we need to set the interface id in the paket header = the interface index we used
|
||||
* in the IDBs interface description for this file(encapsulation type).
|
||||
*/
|
||||
if(fake_interface_ids){
|
||||
if (fake_interface_ids) {
|
||||
struct wtap_pkthdr *phdr;
|
||||
|
||||
phdr = wtap_phdr(in_file->wth);
|
||||
|
@ -1665,7 +1668,6 @@ cf_filter_packets(capture_file *cf, gchar *dftext, gboolean force)
|
|||
void
|
||||
cf_reftime_packets(capture_file *cf)
|
||||
{
|
||||
|
||||
ref_time_packets(cf);
|
||||
}
|
||||
|
||||
|
@ -2093,7 +2095,7 @@ ref_time_packets(capture_file *cf)
|
|||
}
|
||||
/* if this frames is marked as a reference time frame, reset
|
||||
firstsec and firstusec to this frame */
|
||||
if(fdata->flags.ref_time){
|
||||
if (fdata->flags.ref_time) {
|
||||
first_ts = fdata->abs_ts;
|
||||
}
|
||||
|
||||
|
@ -2118,7 +2120,7 @@ ref_time_packets(capture_file *cf)
|
|||
|
||||
/* If this frame is displayed, get the time elapsed between the
|
||||
previous displayed packet and this packet. */
|
||||
if( fdata->flags.passed_dfilter ) {
|
||||
if ( fdata->flags.passed_dfilter ) {
|
||||
nstime_delta(&fdata->del_dis_ts, &fdata->abs_ts, &prev_dis_ts);
|
||||
prev_dis_ts = fdata->abs_ts;
|
||||
}
|
||||
|
@ -2126,11 +2128,11 @@ ref_time_packets(capture_file *cf)
|
|||
/*
|
||||
* Byte counts
|
||||
*/
|
||||
if( (fdata->flags.passed_dfilter) || (fdata->flags.ref_time) ){
|
||||
if ( (fdata->flags.passed_dfilter) || (fdata->flags.ref_time) ) {
|
||||
/* This frame either passed the display filter list or is marked as
|
||||
a time reference frame. All time reference frames are displayed
|
||||
even if they dont pass the display filter */
|
||||
if(fdata->flags.ref_time){
|
||||
if (fdata->flags.ref_time) {
|
||||
/* if this was a TIME REF frame we should reset the cum_bytes field */
|
||||
cum_bytes = fdata->pkt_len;
|
||||
fdata->cum_bytes = cum_bytes;
|
||||
|
@ -2155,9 +2157,10 @@ process_specified_packets(capture_file *cf, packet_range_t *range,
|
|||
union wtap_pseudo_header *, const guint8 *, void *),
|
||||
void *callback_args)
|
||||
{
|
||||
union wtap_pseudo_header pseudo_header;
|
||||
|
||||
guint32 framenum;
|
||||
frame_data *fdata;
|
||||
union wtap_pseudo_header pseudo_header;
|
||||
guint8 pd[WTAP_MAX_PACKET_SIZE+1];
|
||||
psp_return_t ret = PSP_FINISHED;
|
||||
|
||||
|
@ -2490,7 +2493,7 @@ print_packet(capture_file *cf, frame_data *fdata,
|
|||
epan_dissect_cleanup(&edt);
|
||||
|
||||
/* do we want to have a formfeed between each packet from now on? */
|
||||
if(args->print_args->print_formfeed) {
|
||||
if (args->print_args->print_formfeed) {
|
||||
args->print_formfeed = TRUE;
|
||||
}
|
||||
|
||||
|
@ -3817,7 +3820,7 @@ cf_read_shb_comment(capture_file *cf)
|
|||
|
||||
/* Get info from SHB */
|
||||
shb_inf = wtap_file_get_shb_info(cf->wth);
|
||||
if(shb_inf == NULL)
|
||||
if (shb_inf == NULL)
|
||||
return NULL;
|
||||
temp_str = shb_inf->opt_comment;
|
||||
g_free(shb_inf);
|
||||
|
@ -4065,7 +4068,7 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
|
|||
progbar_nextstep = 0;
|
||||
/* When we reach the value that triggers a progress bar update,
|
||||
bump that value by this amount. */
|
||||
if (size >= 0){
|
||||
if (size >= 0) {
|
||||
progbar_quantum = size/N_PROGBAR_UPDATES;
|
||||
if (progbar_quantum < MIN_QUANTUM)
|
||||
progbar_quantum = MIN_QUANTUM;
|
||||
|
@ -4090,7 +4093,7 @@ rescan_file(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
|
|||
/* Create the progress bar if necessary.
|
||||
* Check whether it should be created or not every MIN_NUMBER_OF_PACKET
|
||||
*/
|
||||
if ((progbar == NULL) && !(count % MIN_NUMBER_OF_PACKET)){
|
||||
if ((progbar == NULL) && !(count % MIN_NUMBER_OF_PACKET)) {
|
||||
progbar_val = calc_progbar_val(cf, size, file_pos, status_str, sizeof(status_str));
|
||||
progbar = delayed_create_progress_dlg(cf->window, "Rescanning", name_ptr,
|
||||
TRUE, &stop_flag, &start_time, progbar_val);
|
||||
|
@ -4533,8 +4536,8 @@ cf_export_specified_packets(capture_file *cf, const char *fname,
|
|||
int err;
|
||||
wtap_dumper *pdh;
|
||||
save_callback_args_t callback_args;
|
||||
wtapng_section_t *shb_hdr = NULL;
|
||||
wtapng_iface_descriptions_t *idb_inf = NULL;
|
||||
wtapng_section_t *shb_hdr;
|
||||
wtapng_iface_descriptions_t *idb_inf;
|
||||
int encap;
|
||||
|
||||
cf_callback_invoke(cf_cb_file_export_specified_packets_started, (gpointer)fname);
|
||||
|
|
Loading…
Reference in New Issue