diff options
author | William Wilgus <wilgus.william@gmail.com> | 2021-08-31 17:23:47 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2021-08-31 17:23:47 -0400 |
commit | a8253c57ddec8a1dfb2f77e7be9c451595fb094a (patch) | |
tree | 7638b14df6fa93950a031069d4367846a592d651 /apps/plugins | |
parent | c04a944c98c52b6364c8a50aee0ab4e6149e99de (diff) | |
download | rockbox-a8253c57ddec8a1dfb2f77e7be9c451595fb094a.tar.gz rockbox-a8253c57ddec8a1dfb2f77e7be9c451595fb094a.zip |
lib/argparse fix red
Change-Id: I7bbac6de6319bf86189f079b7330d650ea95de3c
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/lib/arg_helper.c | 8 | ||||
-rw-r--r-- | 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) | |||
112 | return found; | 112 | return found; |
113 | } | 113 | } |
114 | 114 | ||
115 | int longnum_parse(const char **parameter, long *number, unsigned long *decimal) | 115 | int longnum_parse(const char **parameter, long *number, long *decimal) |
116 | { | 116 | { |
117 | /* passes number and or decimal portion of number base 10 only.. | 117 | /* passes number and or decimal portion of number base 10 only.. |
118 | fractional portion is scaled by ARGPARSE_FRAC_DEC_MULTIPLIER | 118 | fractional portion is scaled by ARGPARSE_FRAC_DEC_MULTIPLIER |
@@ -159,11 +159,11 @@ int longnum_parse(const char **parameter, long *number, unsigned long *decimal) | |||
159 | digits++; | 159 | digits++; |
160 | start++; | 160 | start++; |
161 | } | 161 | } |
162 | if (decimal && digits <= AP_MAX_FRAC_DIGITS) | 162 | if (decimal && digits <= ARGPARSE_MAX_FRAC_DIGITS) |
163 | { | 163 | { |
164 | if(digits < AP_MAX_FRAC_DIGITS) | 164 | if(digits < ARGPARSE_MAX_FRAC_DIGITS) |
165 | { | 165 | { |
166 | digits = AP_MAX_FRAC_DIGITS - digits; | 166 | digits = ARGPARSE_MAX_FRAC_DIGITS - digits; |
167 | while (digits--) | 167 | while (digits--) |
168 | dec *= 10; | 168 | dec *= 10; |
169 | } | 169 | } |
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 @@ | |||
23 | 23 | ||
24 | #include "plugin.h" | 24 | #include "plugin.h" |
25 | 25 | ||
26 | #define ARGP_MAX_FRAC_DIGITS 9 /* Uses 30 bits max (0.999999999) */ | 26 | #define ARGPARSE_MAX_FRAC_DIGITS 9 /* Uses 30 bits max (0.999999999) */ |
27 | 27 | ||
28 | #define ARGP_EXP(a, b) (a ##E## b) | 28 | #define ARGP_EXP(a, b) (a ##E## b) |
29 | #define ARGP_FRAC_DEC_MULTIPLIER(n) AP_EXP(1,n) /*1x10^n*/ | 29 | #define ARGP_FRAC_DEC_MULTIPLIER(n) AP_EXP(1,n) /*1x10^n*/ |
30 | #define ARGPARSE_FRAC_DEC_MULTIPLIER (long) ARGP_FRAC_DEC_MULTIPLIER(ARGP_MAX_FRAC_DIGITS) | 30 | #define ARGPARSE_FRAC_DEC_MULTIPLIER \ |
31 | (long)ARGP_FRAC_DEC_MULTIPLIER(ARGPARSE_MAX_FRAC_DIGITS) | ||
31 | 32 | ||
32 | /* fills buf with a string upto buf_sz, null terminates the buffer | 33 | /* fills buf with a string upto buf_sz, null terminates the buffer |
33 | * strings break on WS by default but can be enclosed in single or double quotes | 34 | * strings break on WS by default but can be enclosed in single or double quotes |