forked from osmocom/wireshark
Qt: Omit calls without values on selector reload
When extcap is started for capture, the argument call is appended to extcap commandline if the associated value is not empty or the argument is boolflag. Unfortunately such rule did not apply when constructing the arguments list for selector reload action. This could lead to extcap being called with the argument calls without required values (eg. multicheck, selector, string). This change makes the --extcap-reload-option selector to not contain argument calls for which the value is not available. Bug: 15725 Change-Id: Ic2456c03b3eb7c7525d19e64ea02afd99ed5f6cb Reviewed-on: https://code.wireshark.org/review/32967 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
8bb8d5f86c
commit
6e5fade2da
|
@ -541,7 +541,7 @@ void ExtcapOptionsDialog::resetValues()
|
|||
}
|
||||
}
|
||||
|
||||
GHashTable *ExtcapOptionsDialog::getArgumentSettings(bool useCallsAsKey)
|
||||
GHashTable *ExtcapOptionsDialog::getArgumentSettings(bool useCallsAsKey, bool includeEmptyValues)
|
||||
{
|
||||
GHashTable * entries = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
ExtcapArgumentList::const_iterator iter;
|
||||
|
@ -552,6 +552,7 @@ GHashTable *ExtcapOptionsDialog::getArgumentSettings(bool useCallsAsKey)
|
|||
for(iter = extcapArguments.constBegin(); iter != extcapArguments.constEnd(); ++iter)
|
||||
{
|
||||
ExtcapArgument * argument = (ExtcapArgument *)(*iter);
|
||||
bool isBoolflag = false;
|
||||
|
||||
/* The dynamic casts are necessary, because we come here using the Signal/Slot system
|
||||
* of Qt, and -in short- Q_OBJECT classes cannot be multiple inherited. Another possibility
|
||||
|
@ -560,6 +561,7 @@ GHashTable *ExtcapOptionsDialog::getArgumentSettings(bool useCallsAsKey)
|
|||
if ( dynamic_cast<ExtArgBool *>((*iter)) != NULL)
|
||||
{
|
||||
value = ((ExtArgBool *)*iter)->prefValue();
|
||||
isBoolflag = true;
|
||||
}
|
||||
else if ( dynamic_cast<ExtArgRadio *>((*iter)) != NULL)
|
||||
{
|
||||
|
@ -596,7 +598,7 @@ GHashTable *ExtcapOptionsDialog::getArgumentSettings(bool useCallsAsKey)
|
|||
if ( useCallsAsKey )
|
||||
key = argument->call();
|
||||
|
||||
if (key.length() > 0)
|
||||
if ( ( key.length() > 0 ) && ( includeEmptyValues || isBoolflag || value.length() > 0 ) )
|
||||
{
|
||||
gchar * val = g_strdup(value.toStdString().c_str());
|
||||
|
||||
|
@ -633,7 +635,7 @@ ExtcapValueList ExtcapOptionsDialog::loadValuesFor(int argNum, QString argumentN
|
|||
if ( argcall.startsWith("--") )
|
||||
argcall = argcall.right(argcall.size()-2);
|
||||
|
||||
GHashTable * entries = getArgumentSettings(true);
|
||||
GHashTable * entries = getArgumentSettings(true, false);
|
||||
|
||||
values = extcap_get_if_configuration_values(this->device_name.toStdString().c_str(), argcall.toStdString().c_str(), entries);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ private:
|
|||
void loadArguments();
|
||||
|
||||
bool saveOptionToCaptureInfo();
|
||||
GHashTable * getArgumentSettings(bool useCallsAsKey = false);
|
||||
GHashTable * getArgumentSettings(bool useCallsAsKey = false, bool includeEmptyValues = true);
|
||||
void storeValues();
|
||||
void resetValues();
|
||||
|
||||
|
|
Loading…
Reference in New Issue