Don't use switch with just one case

This should be an if statement.

Gets rid of build warning.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-10-02 07:23:45 -07:00
parent e0b60167f2
commit f61ee20ba3

View file

@ -57,9 +57,8 @@ void ReadSettingsThread::run()
rc = rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
if (rc == DC_STATUS_SUCCESS) {
DeviceDetails *m_deviceDetails = new DeviceDetails(0);
switch (dc_device_get_type(m_data->device)) {
#if DC_VERSION_CHECK(0, 5, 0)
case DC_FAMILY_HW_OSTC3:
if (dc_device_get_type(m_data->device) == DC_FAMILY_HW_OSTC3) {
supported = true;
m_deviceDetails->setBrightness(0);
m_deviceDetails->setCustomText("");
@ -295,9 +294,8 @@ void ReadSettingsThread::run()
}
emit devicedetails(m_deviceDetails);
break;
#endif // divecomputer 0.5.0
}
#endif // divecomputer 0.5.0
dc_device_close(m_data->device);
if (!supported) {
@ -327,9 +325,8 @@ void WriteSettingsThread::run()
dc_status_t rc;
rc = rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
if (rc == DC_STATUS_SUCCESS) {
switch (dc_device_get_type(m_data->device)) {
#if DC_VERSION_CHECK(0,5,0)
case DC_FAMILY_HW_OSTC3:
if (dc_device_get_type(m_data->device) == DC_FAMILY_HW_OSTC3) {
supported = true;
//write gas values
unsigned char gas1Data[4] = {m_deviceDetails->gas1().oxygen,
@ -492,10 +489,8 @@ void WriteSettingsThread::run()
time.second = timeToSet.time().second();
hw_ostc3_device_clock(m_data->device, &time);
}
break;
#endif // divecomputer 0.5.0
}
#endif // divecomputer 0.5.0
dc_device_close(m_data->device);
if (!supported) {
@ -522,14 +517,12 @@ void FirmwareUpdateThread::run()
dc_status_t rc;
rc = rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
if (rc == DC_STATUS_SUCCESS) {
switch (dc_device_get_type(m_data->device)) {
#if DC_VERSION_CHECK(0, 5, 0)
case DC_FAMILY_HW_OSTC3:
if (dc_device_get_type(m_data->device) == DC_FAMILY_HW_OSTC3) {
supported = true;
//hw_ostc3_device_fwupdate(m_data->device, m_fileName.toUtf8().data());
break;
#endif // divecomputer 0.5.0
}
#endif // divecomputer 0.5.0
dc_device_close(m_data->device);
if (!supported) {