mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 01:07:57 +00:00
hv: add brackets to make operator expression more readable
v1-v2: Bypass this case: When binary arithmetic operators of different precedence (e.g. '+' and '*') are mixed in an expression, parentheses are added to the sub-expressions using the operator with a higher precedence. v1: The operator precedence rules are complicated and it is easy to make a mistake. So add brackets to make operator expression more readable. Tracked-On: #861 Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -167,7 +167,7 @@ int mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const unsigned char *prk,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
num_to_copy = i != n ? hash_len : okm_len - where;
|
||||
num_to_copy = (i != n) ? hash_len : (okm_len - where);
|
||||
memcpy_s( okm + where, num_to_copy, t, num_to_copy );
|
||||
where += hash_len;
|
||||
t_len = hash_len;
|
||||
|
@@ -567,7 +567,7 @@ charmem(size_t cmd, const char *s_arg, uint32_t sz, struct snprint_param *param)
|
||||
}
|
||||
/* fill mode */
|
||||
else {
|
||||
n = (sz < param->sz - param->wrtn) ? sz : 0U;
|
||||
n = (sz < (param->sz - param->wrtn)) ? sz : 0U;
|
||||
param->wrtn += sz;
|
||||
(void)memset(p, (uint8_t)*s, n);
|
||||
}
|
||||
|
Reference in New Issue
Block a user