forked from osmocom/wireshark
Fix no-ZLib builds.
Don't use ZLib routines or data types if we're built without ZLib. Don't support --compress-type=gzip, or a gzip check box in the Output pane of the Capture Options dialog, if we're built without ZLib. Fixes #17899.
This commit is contained in:
parent
d7d2994228
commit
125f5cbd88
|
@ -986,9 +986,18 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg_
|
||||||
if (strcmp(optarg_str_p, "none") == 0) {
|
if (strcmp(optarg_str_p, "none") == 0) {
|
||||||
;
|
;
|
||||||
} else if (strcmp(optarg_str_p, "gzip") == 0) {
|
} else if (strcmp(optarg_str_p, "gzip") == 0) {
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
;
|
;
|
||||||
|
#else
|
||||||
|
cmdarg_err("'gzip' compression is not supported");
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
cmdarg_err("parameter of --compress-type can be 'none' or 'gzip'");
|
cmdarg_err("parameter of --compress-type can be 'none' or 'gzip'");
|
||||||
|
#else
|
||||||
|
cmdarg_err("parameter of --compress-type can only be 'none'");
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
capture_opts->compress_type = g_strdup(optarg_str_p);
|
capture_opts->compress_type = g_strdup(optarg_str_p);
|
||||||
|
|
|
@ -124,6 +124,7 @@ static void CleanupOldCap(gchar* name)
|
||||||
g_mutex_unlock(&rb_data.mutex);
|
g_mutex_unlock(&rb_data.mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
/*
|
/*
|
||||||
* compress capture file
|
* compress capture file
|
||||||
*/
|
*/
|
||||||
|
@ -200,6 +201,7 @@ static int ringbuf_start_compress_file(rb_file* rfile)
|
||||||
g_thread_new("exec_compress", &exec_compress_thread, name);
|
g_thread_new("exec_compress", &exec_compress_thread, name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create the next filename and open a new binary file with that name
|
* create the next filename and open a new binary file with that name
|
||||||
|
@ -216,9 +218,11 @@ static int ringbuf_open_file(rb_file *rfile, int *err)
|
||||||
/* remove old file (if any, so ignore error) */
|
/* remove old file (if any, so ignore error) */
|
||||||
ws_unlink(rfile->name);
|
ws_unlink(rfile->name);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
else if (rb_data.compress_type != NULL && strcmp(rb_data.compress_type, "gzip") == 0) {
|
else if (rb_data.compress_type != NULL && strcmp(rb_data.compress_type, "gzip") == 0) {
|
||||||
ringbuf_start_compress_file(rfile);
|
ringbuf_start_compress_file(rfile);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
g_free(rfile->name);
|
g_free(rfile->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -549,7 +549,11 @@ void CaptureOptionsDialog::on_gbNewFileAuto_toggled(bool checked)
|
||||||
ui->stopMBComboBox->setEnabled(checked?false:true);
|
ui->stopMBComboBox->setEnabled(checked?false:true);
|
||||||
ui->gbCompression->setEnabled(checked);
|
ui->gbCompression->setEnabled(checked);
|
||||||
ui->rbCompressionNone->setEnabled(checked);
|
ui->rbCompressionNone->setEnabled(checked);
|
||||||
|
#ifdef HAVE_ZLIB
|
||||||
ui->rbCompressionGzip->setEnabled(checked);
|
ui->rbCompressionGzip->setEnabled(checked);
|
||||||
|
#else
|
||||||
|
ui->rbCompressionGzip->setEnabled(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CaptureOptionsDialog::on_cbUpdatePacketsRT_toggled(bool checked)
|
void CaptureOptionsDialog::on_cbUpdatePacketsRT_toggled(bool checked)
|
||||||
|
|
Loading…
Reference in New Issue