mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 09:17:58 +00:00
HV: Assignment should not mix with operator
Removed the postfix and prefix operation in assignment expression. Noncompliant code example: 1) *a++ = *b ++; 2) a = arr[--b]; Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
This commit is contained in:
@@ -366,7 +366,9 @@ void *memcpy_s(void *d, size_t dmax, const void *s, size_t slen)
|
||||
/*small data block*/
|
||||
if (slen < 8U) {
|
||||
while (slen != 0U) {
|
||||
*dest8++ = *src8++;
|
||||
*dest8 = *src8;
|
||||
dest8++;
|
||||
src8++;
|
||||
slen--;
|
||||
}
|
||||
|
||||
@@ -375,8 +377,11 @@ void *memcpy_s(void *d, size_t dmax, const void *s, size_t slen)
|
||||
|
||||
/*make sure 8bytes-aligned for at least one addr.*/
|
||||
if ((!MEM_ALIGNED_CHECK(src8, 8)) && (!MEM_ALIGNED_CHECK(dest8, 8))) {
|
||||
for (; slen != 0U && (((uint64_t)src8) & 7UL) != 0UL; slen--)
|
||||
*dest8++ = *src8++;
|
||||
for (; slen != 0U && (((uint64_t)src8) & 7UL) != 0UL; slen--) {
|
||||
*dest8 = *src8;
|
||||
dest8++;
|
||||
src8++;
|
||||
}
|
||||
}
|
||||
|
||||
/*copy main data blocks, with rep prefix*/
|
||||
@@ -393,7 +398,9 @@ void *memcpy_s(void *d, size_t dmax, const void *s, size_t slen)
|
||||
|
||||
/*tail bytes*/
|
||||
while (slen != 0U) {
|
||||
*dest8++ = *src8++;
|
||||
*dest8 = *src8;
|
||||
dest8++;
|
||||
src8++;
|
||||
slen--;
|
||||
}
|
||||
|
||||
@@ -413,8 +420,10 @@ void *memset(void *base, uint8_t v, size_t n)
|
||||
|
||||
/*do the few bytes to get uint64_t alignment*/
|
||||
count = n;
|
||||
for (; count != 0U && ((uint64_t)dest_p & 7UL) != 0UL; count--)
|
||||
*dest_p++ = v;
|
||||
for (; count != 0U && ((uint64_t)dest_p & 7UL) != 0UL; count--) {
|
||||
*dest_p = v;
|
||||
dest_p++;
|
||||
}
|
||||
|
||||
/*64-bit mode*/
|
||||
n_q = count >> 3U;
|
||||
|
@@ -93,8 +93,10 @@ static const char *get_int(const char *s, int *x)
|
||||
}
|
||||
|
||||
/* parse uint32_teger */
|
||||
while ((*s >= '0') && (*s <= '9'))
|
||||
*x = *x * 10 + (*s++ - '0');
|
||||
while ((*s >= '0') && (*s <= '9')) {
|
||||
*x = *x * 10 + (*s - '0');
|
||||
s++;
|
||||
}
|
||||
|
||||
/* apply sign to result */
|
||||
if (negative != 0)
|
||||
@@ -358,7 +360,8 @@ static int print_decimal(struct print_param *param, int64_t value)
|
||||
while (v.dwords.high != 0U) {
|
||||
/* determine digits from right to left */
|
||||
udiv64(v.qword, 10, &d);
|
||||
*--pos = d.r.dwords.low + '0';
|
||||
pos--;
|
||||
*pos = d.r.dwords.low + '0';
|
||||
v.qword = d.q.qword;
|
||||
}
|
||||
|
||||
@@ -472,7 +475,8 @@ int do_print(const char *fmt, struct print_param *param,
|
||||
/* continue only if the '%' character was found */
|
||||
if (*fmt == '%') {
|
||||
/* mark current position in the format string */
|
||||
start = fmt++;
|
||||
start = fmt;
|
||||
fmt++;
|
||||
|
||||
/* initialize the variables for the next argument */
|
||||
(void)memset(&(param->vars), 0, sizeof(param->vars));
|
||||
@@ -497,7 +501,8 @@ int do_print(const char *fmt, struct print_param *param,
|
||||
|
||||
fmt = get_length_modifier(fmt, &(param->vars.flags),
|
||||
&(param->vars.mask));
|
||||
ch = *fmt++;
|
||||
ch = *fmt;
|
||||
fmt++;
|
||||
|
||||
/* a single '%'? => print out a single '%' */
|
||||
if (ch == '%') {
|
||||
|
@@ -101,7 +101,8 @@ uint64_t strtoul_hex(const char *nptr)
|
||||
* See strtol for comments as to the logic used.
|
||||
*/
|
||||
do {
|
||||
c = *s++;
|
||||
c = *s;
|
||||
s++;
|
||||
} while (ISSPACE(c));
|
||||
|
||||
if (c == '0' && (*s == 'x' || *s == 'X')) {
|
||||
|
Reference in New Issue
Block a user