From 0ebce6201e7501b43adc95a394117d1060b3a65e Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 1 Aug 2014 12:07:51 +0200 Subject: Refactor protection handling for better readability --- src/ParserCmdline.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/ParserCmdline.cpp') diff --git a/src/ParserCmdline.cpp b/src/ParserCmdline.cpp index 98140de..9768d20 100644 --- a/src/ParserCmdline.cpp +++ b/src/ParserCmdline.cpp @@ -400,14 +400,14 @@ bool parse_cmdline(char **argv, (*subchannel)->startAddress = 0; if (c == 'A') { - protection->form = 0; + protection->form = UEP; protection->level = 2; - protection->shortForm.tableSwitch = 0; - protection->shortForm.tableIndex = 0; + protection->uep.tableSwitch = 0; + protection->uep.tableIndex = 0; } else { + protection->form = EEP; protection->level = 2; - protection->form = 1; - protection->longForm.option = 0; + protection->eep.profile = EEP_A; } break; case 'L': @@ -590,17 +590,18 @@ bool parse_cmdline(char **argv, goto EXIT; } level = strtoul(optarg, NULL, 0) - 1; - if (protection->form == 0) { + if (protection->form == UEP) { if ((level < 0) || (level > 4)) { etiLog.log(error, - "protection level must be between " + "UEP protection level must be between " "1 to 5 inclusively (current = %i)\n", level); goto EXIT; } - } else { + } + else if (protection->form == EEP) { if ((level < 0) || (level > 3)) { etiLog.log(error, - "protection level must be between " + "EEP protection level must be between " "1 to 4 inclusively (current = %i)\n", level); goto EXIT; } -- cgit v1.2.3