From a8253c57ddec8a1dfb2f77e7be9c451595fb094a Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Tue, 31 Aug 2021 17:23:47 -0400 Subject: lib/argparse fix red Change-Id: I7bbac6de6319bf86189f079b7330d650ea95de3c --- apps/plugins/lib/arg_helper.c | 8 ++++---- apps/plugins/lib/arg_helper.h | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/plugins/lib/arg_helper.c b/apps/plugins/lib/arg_helper.c index 756549c2ad..d402300900 100644 --- a/apps/plugins/lib/arg_helper.c +++ b/apps/plugins/lib/arg_helper.c @@ -112,7 +112,7 @@ int bool_parse(const char **parameter, bool *choice) return found; } -int longnum_parse(const char **parameter, long *number, unsigned long *decimal) +int longnum_parse(const char **parameter, long *number, long *decimal) { /* passes number and or decimal portion of number base 10 only.. fractional portion is scaled by ARGPARSE_FRAC_DEC_MULTIPLIER @@ -159,11 +159,11 @@ int longnum_parse(const char **parameter, long *number, unsigned long *decimal) digits++; start++; } - if (decimal && digits <= AP_MAX_FRAC_DIGITS) + if (decimal && digits <= ARGPARSE_MAX_FRAC_DIGITS) { - if(digits < AP_MAX_FRAC_DIGITS) + if(digits < ARGPARSE_MAX_FRAC_DIGITS) { - digits = AP_MAX_FRAC_DIGITS - digits; + digits = ARGPARSE_MAX_FRAC_DIGITS - digits; while (digits--) dec *= 10; } diff --git a/apps/plugins/lib/arg_helper.h b/apps/plugins/lib/arg_helper.h index 248e8e4eaf..c7b14f7f7a 100644 --- a/apps/plugins/lib/arg_helper.h +++ b/apps/plugins/lib/arg_helper.h @@ -23,11 +23,12 @@ #include "plugin.h" -#define ARGP_MAX_FRAC_DIGITS 9 /* Uses 30 bits max (0.999999999) */ +#define ARGPARSE_MAX_FRAC_DIGITS 9 /* Uses 30 bits max (0.999999999) */ #define ARGP_EXP(a, b) (a ##E## b) #define ARGP_FRAC_DEC_MULTIPLIER(n) AP_EXP(1,n) /*1x10^n*/ -#define ARGPARSE_FRAC_DEC_MULTIPLIER (long) ARGP_FRAC_DEC_MULTIPLIER(ARGP_MAX_FRAC_DIGITS) +#define ARGPARSE_FRAC_DEC_MULTIPLIER \ + (long)ARGP_FRAC_DEC_MULTIPLIER(ARGPARSE_MAX_FRAC_DIGITS) /* fills buf with a string upto buf_sz, null terminates the buffer * strings break on WS by default but can be enclosed in single or double quotes -- cgit v1.2.3