From: Jeremy Tan Date: Sat, 12 Oct 2013 14:13:33 +0000 (+0800) Subject: Remove old lock/release cases from control.c + hopefully silence warnings on 64 bit... X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=edad5a0843f04356039a27a0e169bb949bc91e3f;p=matches%2FMCTX3420.git Remove old lock/release cases from control.c + hopefully silence warnings on 64 bit compilers for True_Stub Those lock/release cases were a login loophole, woops... ================================================================= control.c:61:11: warning: variable 'desired_mode' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] else if (!strcmp(action, "release")) { ^~~~~~~~~~~~~~~~~~~~~~~~~~ control.c:77:6: note: uninitialized use occurs here if (desired_mode == CONTROL_START) { ^~~~~~~~~~~~ control.c:61:7: note: remove the 'if' if its condition is always false else if (!strcmp(action, "release")) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ control.c:38:2: note: variable 'desired_mode' is declared here ControlModes desired_mode; ^ ==================================================================== Why, thank you clang :P --- diff --git a/server/bbb_pin.c b/server/bbb_pin.c index 2d98b39..2ffc9e5 100644 --- a/server/bbb_pin.c +++ b/server/bbb_pin.c @@ -510,7 +510,7 @@ bool ADC_Read(int id, int *value) #ifndef _BBB //For running on systems that are not the BBB -bool True_Stub(void *arg, ...) { return true; } +bool True_Stub(int arg, ...) { return true; } bool ADC_Read_Stub(int *val, ...) { *val = 0; return true; } bool GPIO_Read_Stub(bool *val, ...) { *val = false; return true; } #endif diff --git a/server/bbb_pin.h b/server/bbb_pin.h index 97e7f9b..658b95a 100644 --- a/server/bbb_pin.h +++ b/server/bbb_pin.h @@ -32,26 +32,26 @@ extern bool PWM_Stop(int pin); #else //Horrible hacks to silence gcc when compiling on systems that are not the BBB -extern bool True_Stub(void *arg, ...); +extern bool True_Stub(int arg, ...); extern bool ADC_Read_Stub(int *val, ...); extern bool GPIO_Read_Stub(bool *val, ...); -#define GPIO_Export(pin) True_Stub((void*)pin) +#define GPIO_Export(pin) True_Stub((int)pin) #define GPIO_Unexport(pin) (void)0 -#define PWM_Export(pin) True_Stub((void*)pin) +#define PWM_Export(pin) True_Stub((int)pin) #define PWM_Unexport(pin) (void)0 -#define ADC_Export(pin) True_Stub((void*)pin) +#define ADC_Export(pin) True_Stub((int)pin) #define ADC_Unexport(pin) (void)0 #define GPIO_Read(pin, result) GPIO_Read_Stub(result, pin) -#define GPIO_Set(pin, value) True_Stub((void*)pin, value) +#define GPIO_Set(pin, value) True_Stub((int)pin, value) #define ADC_Read(id, value) ADC_Read_Stub(value, id) -#define PWM_Set(pin, polarity, period, duty) True_Stub((void*)pin, polarity, period, duty) -#define PWM_Stop(pin) True_Stub((void*)(int)pin) +#define PWM_Set(pin, polarity, period, duty) True_Stub((int)pin, polarity, period, duty) +#define PWM_Stop(pin) True_Stub((int)pin) //yuck #endif //_BBB diff --git a/server/control.c b/server/control.c index 820c37c..0242a3b 100644 --- a/server/control.c +++ b/server/control.c @@ -52,14 +52,8 @@ void Control_Handler(FCGIContext *context, char *params) { if (!FCGI_ParseRequest(context, params, values, 4)) return; - if (!strcmp(action, "lock")) { - FCGI_LockControl(context, force); - return; - } else if (!strcmp(action, "emergency")) { + if (!strcmp(action, "emergency")) { desired_mode = CONTROL_EMERGENCY; - } - else if (!strcmp(action, "release")) { - FCGI_ReleaseControl(context); } else if (!strcmp(action, "start")) { desired_mode = CONTROL_START; } else if (!strcmp(action, "pause")) {