Qt: add conditional compilation in switches.

Compiling without pcap, the lack of all the cases causes an error.

../ui/qt/main_window_slots.cpp:756:13: error: enumeration values 'Capture',
'Update', and 'Fixed' not handled in switch [-Werror,-Wswitch]
    switch (ev->captureContext()) {
            ^
1 error generated.

Change-Id: I36c0bc854b1d864ebf54ac59ca15743918bc7d2b
Reviewed-on: https://code.wireshark.org/review/25127
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
This commit is contained in:
Dario Lombardo 2018-01-03 15:05:03 +01:00
parent 5a9edf2a91
commit ba3830e03b
3 changed files with 6 additions and 0 deletions

View File

@ -40,9 +40,11 @@ class CaptureEvent : public QObject
Q_OBJECT
public:
enum Context {
#ifdef HAVE_LIBPCAP
Capture = 0x0001,
Update = 0x0100 | Capture,
Fixed = 0x0200 | Capture,
#endif
File = 0x0002,
Reload = 0x0100 | File,
Rescan = 0x0200 | File,

View File

@ -649,6 +649,7 @@ void MainStatusBar::captureEventHandler(CaptureEvent * ev)
{
switch(ev->captureContext())
{
#ifdef HAVE_LIBPCAP
case CaptureEvent::Update:
switch ( ev->eventType() )
{
@ -669,6 +670,7 @@ void MainStatusBar::captureEventHandler(CaptureEvent * ev)
break;
}
break;
#endif
case CaptureEvent::Save:
switch ( ev->eventType() )
{

View File

@ -1334,6 +1334,7 @@ void WiresharkApplication::captureEventHandler(CaptureEvent * ev)
{
switch(ev->captureContext())
{
#ifdef HAVE_LIBPCAP
case CaptureEvent::Update:
case CaptureEvent::Fixed:
switch ( ev->eventType() )
@ -1350,6 +1351,7 @@ void WiresharkApplication::captureEventHandler(CaptureEvent * ev)
break;
}
break;
#endif
case CaptureEvent::File:
switch ( ev->eventType() )
{