diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-12-31 19:36:12 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-01-01 05:03:42 +0000 |
commit | 2d41b15495e245d9292ba42dd3954bdebc9f3290 (patch) | |
tree | 40282b7aab9f1347489126dd98974a681dca888f /ui/qt/bluetooth_att_server_attributes_dialog.cpp | |
parent | ba589a4e445a8ad8054073eff846087fc61c9ef8 (diff) |
Add a "failed" return for tap packet routines.
This allows taps that can fail to report an error and fail; a failed
tap's packet routine won't be called again, so they don't have to keep
track of whether they've failed themselves.
We make the return value from the packet routine an enum.
Don't have a separate type for the per-packet routine for "follow" taps;
they're expected to act like tap packet routines, so just use the type
for tap packet routines.
One tap packet routine returned -1; that's not a valid return value, and
wasn't one before this change (the return value was a boolean), so
presume the intent was "don't redraw".
Another tap routine's early return, without doing any work, returned
TRUE; this is presumably an error (no work done, no need to redraw), so
presumably it should be "don't redraw".
Clean up some white space while we're at it.
Change-Id: Ia7d2b717b2cace4b13c2b886e699aa4d79cc82c8
Reviewed-on: https://code.wireshark.org/review/31283
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/qt/bluetooth_att_server_attributes_dialog.cpp')
-rw-r--r-- | ui/qt/bluetooth_att_server_attributes_dialog.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ui/qt/bluetooth_att_server_attributes_dialog.cpp b/ui/qt/bluetooth_att_server_attributes_dialog.cpp index 973c09d5ee..d13aa91cf4 100644 --- a/ui/qt/bluetooth_att_server_attributes_dialog.cpp +++ b/ui/qt/bluetooth_att_server_attributes_dialog.cpp @@ -32,7 +32,7 @@ static const int column_number_handle = 0; static const int column_number_uuid = 1; static const int column_number_uuid_name = 2; -static gboolean +static tap_packet_status btatt_handle_tap_packet(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *edt, const void* data) { tapinfo_t *tapinfo = (tapinfo_t *) tapinfo_ptr; @@ -40,7 +40,7 @@ btatt_handle_tap_packet(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *e if (tapinfo->tap_packet) tapinfo->tap_packet(tapinfo, pinfo, edt, data); - return TRUE; + return TAP_PACKET_REDRAW; } static void @@ -225,7 +225,7 @@ void BluetoothAttServerAttributesDialog::tapReset(void *tapinfo_ptr) } -gboolean BluetoothAttServerAttributesDialog::tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *data) +tap_packet_status BluetoothAttServerAttributesDialog::tapPacket(void *tapinfo_ptr, packet_info *pinfo, epan_dissect_t *, const void *data) { tapinfo_t *tapinfo = static_cast<tapinfo_t *>(tapinfo_ptr); BluetoothAttServerAttributesDialog *dialog = static_cast<BluetoothAttServerAttributesDialog *>(tapinfo->ui); @@ -236,10 +236,10 @@ gboolean BluetoothAttServerAttributesDialog::tapPacket(void *tapinfo_ptr, packet gchar *addr = NULL; if (dialog->file_closed_) - return FALSE; + return TAP_PACKET_DONT_REDRAW; if (pinfo->rec->rec_type != REC_TYPE_PACKET) - return FALSE; + return TAP_PACKET_DONT_REDRAW; if (pinfo->rec->presence_flags & WTAP_HAS_INTERFACE_ID) { gchar *interface; @@ -253,7 +253,7 @@ gboolean BluetoothAttServerAttributesDialog::tapPacket(void *tapinfo_ptr, packet if (interface && dialog->ui->interfaceComboBox->currentIndex() > 0) { if (dialog->ui->interfaceComboBox->currentText() != interface) - return TRUE; + return TAP_PACKET_REDRAW; } } @@ -266,7 +266,7 @@ gboolean BluetoothAttServerAttributesDialog::tapPacket(void *tapinfo_ptr, packet if (addr && dialog->ui->deviceComboBox->currentIndex() > 0) { if (dialog->ui->deviceComboBox->currentText() != addr) - return TRUE; + return TAP_PACKET_REDRAW; } handle.sprintf("0x%04x", tap_handles->handle); @@ -282,7 +282,7 @@ gboolean BluetoothAttServerAttributesDialog::tapPacket(void *tapinfo_ptr, packet if (item->text(column_number_handle) == handle && item->text(column_number_uuid) == uuid && item->text(column_number_uuid_name) == uuid_name) - return TRUE; + return TAP_PACKET_REDRAW; ++i_item; } } @@ -297,7 +297,7 @@ gboolean BluetoothAttServerAttributesDialog::tapPacket(void *tapinfo_ptr, packet dialog->ui->tableTreeWidget->resizeColumnToContents(i); } - return TRUE; + return TAP_PACKET_REDRAW; } void BluetoothAttServerAttributesDialog::interfaceCurrentIndexChanged(int) |