lib/argparse fix red
Change-Id: I7bbac6de6319bf86189f079b7330d650ea95de3c
This commit is contained in:
parent
c04a944c98
commit
a8253c57dd
|
@ -112,7 +112,7 @@ int bool_parse(const char **parameter, bool *choice)
|
||||||
return found;
|
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..
|
/* passes number and or decimal portion of number base 10 only..
|
||||||
fractional portion is scaled by ARGPARSE_FRAC_DEC_MULTIPLIER
|
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++;
|
digits++;
|
||||||
start++;
|
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--)
|
while (digits--)
|
||||||
dec *= 10;
|
dec *= 10;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,12 @@
|
||||||
|
|
||||||
#include "plugin.h"
|
#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_EXP(a, b) (a ##E## b)
|
||||||
#define ARGP_FRAC_DEC_MULTIPLIER(n) AP_EXP(1,n) /*1x10^n*/
|
#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
|
/* 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
|
* strings break on WS by default but can be enclosed in single or double quotes
|
||||||
|
|
Loading…
Reference in New Issue