From 7e3c4d3945f52a79b3cdc546fa9dd0bb1bae1b12 Mon Sep 17 00:00:00 2001 From: krcroft Date: Fri, 29 Nov 2019 16:33:43 -0800 Subject: [PATCH] Harmonize refactoring of switch statement --- src/hardware/serialport/softmodem.cpp | 19 +++++++++---------- src/hardware/serialport/softmodem.h | 11 ++++++++--- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/hardware/serialport/softmodem.cpp b/src/hardware/serialport/softmodem.cpp index 9da0519f..10867909 100644 --- a/src/hardware/serialport/softmodem.cpp +++ b/src/hardware/serialport/softmodem.cpp @@ -146,17 +146,16 @@ void CSerialModem::SendNumber(Bitu val) { void CSerialModem::SendRes(ResTypes response) { char const * string = nullptr; Bitu code = -1; - switch (response) - { + switch (response) { + case ResOK: code = 0; string = "OK"; break; + case ResCONNECT: code = 1; string = "CONNECT 57600"; break; + case ResRING: code = 2; string = "RING"; break; + case ResNOCARRIER: code = 3; string = "NO CARRIER"; break; + case ResERROR: code = 4; string = "ERROR"; break; + case ResNODIALTONE: code = 6; string = "NO DIALTONE"; break; + case ResBUSY: code = 7; string = "BUSY"; break; + case ResNOANSWER: code = 8; string = "NO ANSWER"; break; case ResNONE: return; - case ResOK: string = "OK"; code = 0; break; - case ResERROR: string = "ERROR"; code = 4; break; - case ResRING: string = "RING"; code = 2; break; - case ResNODIALTONE: string = "NO DIALTONE"; code = 6; break; - case ResNOCARRIER: string = "NO CARRIER"; code = 3; break; - case ResCONNECT: string = "CONNECT 57600"; code = 1; break; - case ResBUSY: string = "BUSY"; code = 7; break; - // case ResNOANSWER: string = "NO ANSWER"; code = 8; break; } if(doresponse != 1) { diff --git a/src/hardware/serialport/softmodem.h b/src/hardware/serialport/softmodem.h index 09607c17..9f6376aa 100644 --- a/src/hardware/serialport/softmodem.h +++ b/src/hardware/serialport/softmodem.h @@ -41,9 +41,14 @@ enum ResTypes { ResNONE, - ResOK,ResERROR, - ResCONNECT,ResRING, - ResBUSY,ResNODIALTONE,ResNOCARRIER + ResOK, + ResERROR, + ResCONNECT, + ResRING, + ResBUSY, + ResNODIALTONE, + ResNOCARRIER, + ResNOANSWER }; #define TEL_CLIENT 0