lib: cbprintf: improve coverage
Providing a literal width or precision that exceeds the non-negative range of int does not appear to be rejected by the standard, but it does produce a build diagnostic so we can't test it. Switch to an equivalent form that doesn't affect line coverage. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
9e5b50afc8
commit
0bc01822a2
1 changed files with 4 additions and 8 deletions
|
@ -360,10 +360,8 @@ static inline const char *extract_width(struct conversion *conv,
|
|||
if (sp != wp) {
|
||||
conv->width_present = true;
|
||||
conv->width_value = width;
|
||||
if (width != conv->width_value) {
|
||||
/* Lost width data */
|
||||
conv->unsupported = true;
|
||||
}
|
||||
conv->unsupported |= ((conv->width_value < 0)
|
||||
|| (width != (size_t)conv->width_value));
|
||||
}
|
||||
|
||||
return sp;
|
||||
|
@ -396,10 +394,8 @@ static inline const char *extract_prec(struct conversion *conv,
|
|||
size_t prec = extract_decimal(&sp);
|
||||
|
||||
conv->prec_value = prec;
|
||||
if (prec != conv->prec_value) {
|
||||
/* Lost precision data */
|
||||
conv->unsupported = true;
|
||||
}
|
||||
conv->unsupported |= ((conv->prec_value < 0)
|
||||
|| (prec != (size_t)conv->prec_value));
|
||||
|
||||
return sp;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue