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) {
|
if (sp != wp) {
|
||||||
conv->width_present = true;
|
conv->width_present = true;
|
||||||
conv->width_value = width;
|
conv->width_value = width;
|
||||||
if (width != conv->width_value) {
|
conv->unsupported |= ((conv->width_value < 0)
|
||||||
/* Lost width data */
|
|| (width != (size_t)conv->width_value));
|
||||||
conv->unsupported = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sp;
|
return sp;
|
||||||
|
@ -396,10 +394,8 @@ static inline const char *extract_prec(struct conversion *conv,
|
||||||
size_t prec = extract_decimal(&sp);
|
size_t prec = extract_decimal(&sp);
|
||||||
|
|
||||||
conv->prec_value = prec;
|
conv->prec_value = prec;
|
||||||
if (prec != conv->prec_value) {
|
conv->unsupported |= ((conv->prec_value < 0)
|
||||||
/* Lost precision data */
|
|| (prec != (size_t)conv->prec_value));
|
||||||
conv->unsupported = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue