From nobody Wed May 14 13:45:29 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524487615330448.5434918936097; Mon, 23 Apr 2018 05:46:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 504413002A74; Mon, 23 Apr 2018 12:46:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B55384D74D; Mon, 23 Apr 2018 12:46:52 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EC0F0180BAD7; Mon, 23 Apr 2018 12:46:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3NCjDFh011985 for ; Mon, 23 Apr 2018 08:45:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id EA0E810FFE73; Mon, 23 Apr 2018 12:45:12 +0000 (UTC) Received: from caroline.localdomain (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 16FEE1102E28 for ; Mon, 23 Apr 2018 12:45:12 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline.localdomain (Postfix) with ESMTP id 4FF5612007F for ; Mon, 23 Apr 2018 14:45:08 +0200 (CEST) From: Martin Kletzander To: libvir-list@redhat.com Date: Mon, 23 Apr 2018 14:44:47 +0200 Message-Id: <19ade03d345cc6194881310c9a21df93b2261128.1524487472.git.mkletzan@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 19/29] util: Add spaces after casts X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 23 Apr 2018 12:46:54 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Martin Kletzander --- src/util/viralloc.c | 16 ++++---- src/util/viralloc.h | 2 +- src/util/virarptable.c | 2 +- src/util/viratomic.h | 64 +++++++++++++++---------------- src/util/vircgroup.c | 4 +- src/util/vircommand.c | 4 +- src/util/virconf.c | 30 +++++++-------- src/util/virdbus.c | 66 ++++++++++++++++---------------- src/util/virdnsmasq.c | 6 +-- src/util/virfdstream.c | 2 +- src/util/virfile.c | 8 ++-- src/util/virfilecache.c | 2 +- src/util/virfirewall.c | 2 +- src/util/virhash.c | 2 +- src/util/virhostmem.c | 10 ++--- src/util/viridentity.c | 4 +- src/util/viriscsi.c | 2 +- src/util/virjson.c | 22 +++++------ src/util/virlockspace.c | 12 +++--- src/util/virlog.c | 14 +++---- src/util/virnetdev.c | 20 +++++----- src/util/virnetdevbridge.c | 6 +-- src/util/virnetdevip.c | 6 +-- src/util/virnetdevmacvlan.c | 18 ++++----- src/util/virnetdevtap.c | 4 +- src/util/virnetdevvportprofile.c | 4 +- src/util/virnetlink.c | 18 ++++----- src/util/virnodesuspend.c | 4 +- src/util/virobject.c | 2 +- src/util/virpidfile.c | 2 +- src/util/virpolkit.c | 4 +- src/util/virprobe.h | 2 +- src/util/virprocess.c | 22 +++++------ src/util/virrandom.c | 2 +- src/util/virrotatingfile.c | 4 +- src/util/virstoragefile.c | 16 ++++---- src/util/virsystemd.c | 6 +-- src/util/virtime.c | 2 +- src/util/viruri.c | 2 +- src/util/virutil.c | 2 +- src/util/virutil.h | 6 +-- src/util/virxml.c | 18 ++++----- 42 files changed, 222 insertions(+), 222 deletions(-) diff --git a/src/util/viralloc.c b/src/util/viralloc.c index 81f99d9e1ff4..03b532226da7 100644 --- a/src/util/viralloc.c +++ b/src/util/viralloc.c @@ -133,7 +133,7 @@ int virAlloc(void *ptrptr, { #if TEST_OOM if (virAllocTestFail()) { - *(void **)ptrptr =3D NULL; + *(void **) ptrptr =3D NULL; if (report) virReportOOMErrorFull(domcode, filename, funcname, linenr); errno =3D ENOMEM; @@ -141,8 +141,8 @@ int virAlloc(void *ptrptr, } #endif =20 - *(void **)ptrptr =3D calloc(1, size); - if (*(void **)ptrptr =3D=3D NULL) { + *(void **) ptrptr =3D calloc(1, size); + if (*(void **) ptrptr =3D=3D NULL) { if (report) virReportOOMErrorFull(domcode, filename, funcname, linenr); return -1; @@ -180,7 +180,7 @@ int virAllocN(void *ptrptr, { #if TEST_OOM if (virAllocTestFail()) { - *(void **)ptrptr =3D NULL; + *(void **) ptrptr =3D NULL; if (report) virReportOOMErrorFull(domcode, filename, funcname, linenr); errno =3D ENOMEM; @@ -294,7 +294,7 @@ int virExpandN(void *ptrptr, ret =3D virReallocN(ptrptr, size, *countptr + add, report, domcode, filename, funcname, linenr); if (ret =3D=3D 0) { - memset(*(char **)ptrptr + (size * *countptr), 0, size * add); + memset(*(char **) ptrptr + (size * *countptr), 0, size * add); *countptr +=3D add; } return ret; @@ -557,8 +557,8 @@ int virAllocVar(void *ptrptr, } =20 alloc_size =3D struct_size + (element_size * count); - *(void **)ptrptr =3D calloc(1, alloc_size); - if (*(void **)ptrptr =3D=3D NULL) { + *(void **) ptrptr =3D calloc(1, alloc_size); + if (*(void **) ptrptr =3D=3D NULL) { if (report) virReportOOMErrorFull(domcode, filename, funcname, linenr); return -1; @@ -610,7 +610,7 @@ void virDispose(void *ptrptr, count =3D *countptr; =20 if (*(void**)ptrptr && count > 0) - memset(*(void **)ptrptr, 0, count * element_size); + memset(*(void **) ptrptr, 0, count * element_size); =20 free(*(void**)ptrptr); *(void**)ptrptr =3D NULL; diff --git a/src/util/viralloc.h b/src/util/viralloc.h index 69d0f904f1e4..69045ecd846b 100644 --- a/src/util/viralloc.h +++ b/src/util/viralloc.h @@ -491,7 +491,7 @@ void virDispose(void *ptrptr, size_t count, size_t elem= ent_size, size_t *countpt * arithmetic overflow in the allocation size. The check is * essentially the same as that in gnulib's xalloc_oversized. */ -# define VIR_ALLOC_VAR_OVERSIZED(M, N, S) ((((size_t)-1) - (M)) / (S) < (N= )) +# define VIR_ALLOC_VAR_OVERSIZED(M, N, S) ((((size_t) -1) - (M)) / (S) < (= N)) =20 /** * VIR_ALLOC_VAR: diff --git a/src/util/virarptable.c b/src/util/virarptable.c index c0e90dc4bbf6..6ea5b8c733f8 100644 --- a/src/util/virarptable.c +++ b/src/util/virarptable.c @@ -129,7 +129,7 @@ virArpTableGet(void) bzero(&virAddr, sizeof(virAddr)); virAddr.len =3D sizeof(virAddr.data.inet4); virAddr.data.inet4.sin_family =3D AF_INET; - virAddr.data.inet4.sin_addr =3D *(struct in_addr *)addr; + virAddr.data.inet4.sin_addr =3D *(struct in_addr *) addr; ipstr =3D virSocketAddrFormat(&virAddr); =20 if (VIR_STRDUP(table->t[num].ipaddr, ipstr) < 0) diff --git a/src/util/viratomic.h b/src/util/viratomic.h index febe401f7704..509852565428 100644 --- a/src/util/viratomic.h +++ b/src/util/viratomic.h @@ -158,58 +158,58 @@ VIR_STATIC unsigned int virAtomicIntXor(volatile unsi= gned int *atomic, =20 # define virAtomicIntGet(atomic) \ (__extension__ ({ \ - (void)verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ - (void)(0 ? *(atomic) ^ *(atomic) : 0); \ + (void) verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ + (void) (0 ? *(atomic) ^ *(atomic) : 0); \ __sync_synchronize(); \ - (int)*(atomic); \ + (int) *(atomic); \ })) # define virAtomicIntSet(atomic, newval) \ (__extension__ ({ \ - (void)verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ - (void)(0 ? *(atomic) ^ (newval) : 0); \ + (void) verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ + (void) (0 ? *(atomic) ^ (newval) : 0); \ *(atomic) =3D (newval); \ __sync_synchronize(); \ })) # define virAtomicIntInc(atomic) \ (__extension__ ({ \ - (void)verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ - (void)(0 ? *(atomic) ^ *(atomic) : 0); \ + (void) verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ + (void) (0 ? *(atomic) ^ *(atomic) : 0); \ __sync_add_and_fetch((atomic), 1); \ })) # define virAtomicIntDecAndTest(atomic) \ (__extension__ ({ \ - (void)verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ - (void)(0 ? *(atomic) ^ *(atomic) : 0); \ + (void) verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ + (void) (0 ? *(atomic) ^ *(atomic) : 0); \ __sync_fetch_and_sub((atomic), 1) =3D=3D 1; \ })) # define virAtomicIntCompareExchange(atomic, oldval, newval) \ (__extension__ ({ \ - (void)verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ - (void)(0 ? *(atomic) ^ (newval) ^ (oldval) : 0); \ + (void) verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ + (void) (0 ? *(atomic) ^ (newval) ^ (oldval) : 0); \ (bool)__sync_bool_compare_and_swap((atomic), \ (oldval), (newval)); \ })) # define virAtomicIntAdd(atomic, val) \ (__extension__ ({ \ - (void)verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ - (void)(0 ? *(atomic) ^ (val) : 0); \ + (void) verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ + (void) (0 ? *(atomic) ^ (val) : 0); \ (int) __sync_fetch_and_add((atomic), (val)); \ })) # define virAtomicIntAnd(atomic, val) \ (__extension__ ({ \ - (void)verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ + (void) verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ (void) (0 ? *(atomic) ^ (val) : 0); \ (unsigned int) __sync_fetch_and_and((atomic), (val)); \ })) # define virAtomicIntOr(atomic, val) \ (__extension__ ({ \ - (void)verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ + (void) verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ (void) (0 ? *(atomic) ^ (val) : 0); \ (unsigned int) __sync_fetch_and_or((atomic), (val)); \ })) # define virAtomicIntXor(atomic, val) \ (__extension__ ({ \ - (void)verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ + (void) verify_true(sizeof(*(atomic)) =3D=3D sizeof(int)); \ (void) (0 ? *(atomic) ^ (val) : 0); \ (unsigned int) __sync_fetch_and_xor((atomic), (val)); \ })) @@ -249,13 +249,13 @@ virAtomicIntSet(volatile int *atomic, static inline int virAtomicIntInc(volatile int *atomic) { - return InterlockedIncrement((volatile LONG *)atomic); + return InterlockedIncrement((volatile LONG *) atomic); } =20 static inline bool virAtomicIntDecAndTest(volatile int *atomic) { - return InterlockedDecrement((volatile LONG *)atomic) =3D=3D 0; + return InterlockedDecrement((volatile LONG *) atomic) =3D=3D 0; } =20 static inline bool @@ -263,35 +263,35 @@ virAtomicIntCompareExchange(volatile int *atomic, int oldval, int newval) { - return InterlockedCompareExchange((volatile LONG *)atomic, newval, old= val) =3D=3D oldval; + return InterlockedCompareExchange((volatile LONG *) atomic, newval, ol= dval) =3D=3D oldval; } =20 static inline int virAtomicIntAdd(volatile int *atomic, int val) { - return InterlockedExchangeAdd((volatile LONG *)atomic, val); + return InterlockedExchangeAdd((volatile LONG *) atomic, val); } =20 static inline unsigned int virAtomicIntAnd(volatile unsigned int *atomic, unsigned int val) { - return InterlockedAnd((volatile LONG *)atomic, val); + return InterlockedAnd((volatile LONG *) atomic, val); } =20 static inline unsigned int virAtomicIntOr(volatile unsigned int *atomic, unsigned int val) { - return InterlockedOr((volatile LONG *)atomic, val); + return InterlockedOr((volatile LONG *) atomic, val); } =20 static inline unsigned int virAtomicIntXor(volatile unsigned int *atomic, unsigned int val) { - return InterlockedXor((volatile LONG *)atomic, val); + return InterlockedXor((volatile LONG *) atomic, val); } =20 =20 @@ -431,23 +431,23 @@ virAtomicIntXor(volatile unsigned int *atomic, * atomic op helpers. */ # define virAtomicIntGet(atomic) \ - virAtomicIntGet((int *)atomic) + virAtomicIntGet((int *) atomic) # define virAtomicIntSet(atomic, val) \ - virAtomicIntSet((int *)atomic, val) + virAtomicIntSet((int *) atomic, val) # define virAtomicIntInc(atomic) \ - virAtomicIntInc((int *)atomic) + virAtomicIntInc((int *) atomic) # define virAtomicIntDecAndTest(atomic) \ - virAtomicIntDecAndTest((int *)atomic) + virAtomicIntDecAndTest((int *) atomic) # define virAtomicIntCompareExchange(atomic, oldval, newval) \ - virAtomicIntCompareExchange((int *)atomic, oldval, newval) + virAtomicIntCompareExchange((int *) atomic, oldval, newval) # define virAtomicIntAdd(atomic, val) \ - virAtomicIntAdd((int *)atomic, val) + virAtomicIntAdd((int *) atomic, val) # define virAtomicIntAnd(atomic, val) \ - virAtomicIntAnd((unsigned int *)atomic, val) + virAtomicIntAnd((unsigned int *) atomic, val) # define virAtomicIntOr(atomic, val) \ - virAtomicIntOr((unsigned int *)atomic, val) + virAtomicIntOr((unsigned int *) atomic, val) # define virAtomicIntXor(atomic, val) \ - virAtomicIntXor((unsigned int *)atomic, val) + virAtomicIntXor((unsigned int *) atomic, val) =20 # endif =20 diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 0a31947b0d54..dc4080b93f65 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1310,7 +1310,7 @@ virCgroupSetPartitionSuffix(const char *path, char **= res) goto cleanup; } =20 - if (!(*res =3D virStringListJoin((const char **)tokens, "/"))) + if (!(*res =3D virStringListJoin((const char **) tokens, "/"))) goto cleanup; =20 ret =3D 0; @@ -3623,7 +3623,7 @@ virCgroupKillInternal(virCgroupPtr group, int signum,= virHashTablePtr pids) static uint32_t virCgroupPidCode(const void *name, uint32_t seed) { - long pid_value =3D (long)(intptr_t)name; + long pid_value =3D (long) (intptr_t)name; return virHashCodeGen(&pid_value, sizeof(pid_value), seed); } =20 diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 6dab105f568d..b8f915e3991b 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -471,7 +471,7 @@ virExecCommon(virCommandPtr cmd, gid_t *groups, int ngr= oups) if (cmd->uid !=3D (uid_t)-1 || cmd->gid !=3D (gid_t)-1 || cmd->capabilities || (cmd->flags & VIR_EXEC_CLEAR_CAPS)) { VIR_DEBUG("Setting child uid:gid to %d:%d with caps %llx", - (int)cmd->uid, (int)cmd->gid, cmd->capabilities); + (int) cmd->uid, (int) cmd->gid, cmd->capabilities); if (virSetUIDGIDWithCaps(cmd->uid, cmd->gid, groups, ngroups, cmd->capabilities, !!(cmd->flags & VIR_EXEC_CLEAR_CAPS)) < 0) @@ -2476,7 +2476,7 @@ virCommandRunAsync(virCommandPtr cmd, pid_t *pid) VIR_DEBUG("About to run %s", str ? str : cmd->args[0]); ret =3D virExec(cmd); VIR_DEBUG("Command result %d, with PID %d", - ret, (int)cmd->pid); + ret, (int) cmd->pid); =20 for (i =3D 0; i < cmd->npassfd; i++) { if (cmd->passfd[i].flags & VIR_COMMAND_PASS_FD_CLOSE_PARENT) diff --git a/src/util/virconf.c b/src/util/virconf.c index e0a3fd12c04f..d811957241d7 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -1042,7 +1042,7 @@ int virConfGetValueBool(virConfPtr conf, return -1; } =20 - if (((unsigned long long)cval->l) > 1) { + if (((unsigned long long) cval->l) > 1) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: value for '%s' parameter must be 0 or 1"), conf->filename, setting); @@ -1098,7 +1098,7 @@ int virConfGetValueInt(virConfPtr conf, return -1; } =20 - *value =3D (int)cval->l; + *value =3D (int) cval->l; =20 return 1; } @@ -1139,14 +1139,14 @@ int virConfGetValueUInt(virConfPtr conf, return -1; } =20 - if (((unsigned long long)cval->l) > UINT_MAX) { + if (((unsigned long long) cval->l) > UINT_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: value for '%s' parameter must be in range 0:= %u"), conf->filename, setting, UINT_MAX); return -1; } =20 - *value =3D (unsigned int)cval->l; + *value =3D (unsigned int) cval->l; =20 return 1; } @@ -1188,7 +1188,7 @@ int virConfGetValueSizeT(virConfPtr conf, } =20 #if ULLONG_MAX > SIZE_MAX - if (((unsigned long long)cval->l) > SIZE_MAX) { + if (((unsigned long long) cval->l) > SIZE_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: value for '%s' parameter must be in range 0:= %zu"), conf->filename, setting, SIZE_MAX); @@ -1196,7 +1196,7 @@ int virConfGetValueSizeT(virConfPtr conf, } #endif =20 - *value =3D (size_t)cval->l; + *value =3D (size_t) cval->l; =20 return 1; } @@ -1231,10 +1231,10 @@ int virConfGetValueSSizeT(virConfPtr conf, return 0; =20 if (cval->type =3D=3D VIR_CONF_ULLONG) { - if (((unsigned long long)cval->l) > SSIZE_MAX) { + if (((unsigned long long) cval->l) > SSIZE_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: value for '%s' parameter must be in rang= e %zd:%zd"), - conf->filename, setting, (ssize_t)-SSIZE_MAX - = 1, (ssize_t)SSIZE_MAX); + conf->filename, setting, (ssize_t) -SSIZE_MAX -= 1, (ssize_t) SSIZE_MAX); return -1; } } else if (cval->type =3D=3D VIR_CONF_LLONG) { @@ -1242,7 +1242,7 @@ int virConfGetValueSSizeT(virConfPtr conf, if (cval->l < (-SSIZE_MAX - 1) || cval->l > SSIZE_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: value for '%s' parameter must be in rang= e %zd:%zd"), - conf->filename, setting, (ssize_t)-SSIZE_MAX - = 1, (ssize_t)SSIZE_MAX); + conf->filename, setting, (ssize_t) -SSIZE_MAX -= 1, (ssize_t) SSIZE_MAX); return -1; } #endif @@ -1253,7 +1253,7 @@ int virConfGetValueSSizeT(virConfPtr conf, return -1; } =20 - *value =3D (ssize_t)cval->l; + *value =3D (ssize_t) cval->l; =20 return 1; } @@ -1288,7 +1288,7 @@ int virConfGetValueLLong(virConfPtr conf, return 0; =20 if (cval->type =3D=3D VIR_CONF_ULLONG) { - if (((unsigned long long)cval->l) > LLONG_MAX) { + if (((unsigned long long) cval->l) > LLONG_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: value for '%s' parameter must be in rang= e %lld:%lld"), conf->filename, setting, LLONG_MIN, LLONG_MAX); @@ -1341,7 +1341,7 @@ int virConfGetValueULLong(virConfPtr conf, return -1; } =20 - *value =3D (unsigned long long)cval->l; + *value =3D (unsigned long long) cval->l; =20 return 1; } @@ -1478,7 +1478,7 @@ virConfWriteFile(const char *filename, virConfPtr con= f) ret =3D safewrite(fd, content, use); VIR_FREE(content); VIR_FORCE_CLOSE(fd); - if (ret !=3D (int)use) { + if (ret !=3D (int) use) { virConfError(NULL, VIR_ERR_WRITE_FAILED, _("failed to save content= ")); return -1; } @@ -1522,8 +1522,8 @@ virConfWriteMem(char *memory, int *len, virConfPtr co= nf) use =3D virBufferUse(&buf); content =3D virBufferContentAndReset(&buf); =20 - if ((int)use >=3D *len) { - *len =3D (int)use; + if ((int) use >=3D *len) { + *len =3D (int) use; VIR_FREE(content); return -1; } diff --git a/src/util/virdbus.c b/src/util/virdbus.c index ba8b684f17f1..a04559170fe9 100644 --- a/src/util/virdbus.c +++ b/src/util/virdbus.c @@ -196,7 +196,7 @@ static void virDBusWatchCallback(int fdatch ATTRIBUTE_U= NUSED, if (events & VIR_EVENT_HANDLE_HANGUP) dbus_flags |=3D DBUS_WATCH_HANGUP; =20 - (void)dbus_watch_handle(watch, dbus_flags); + (void) dbus_watch_handle(watch, dbus_flags); =20 while (dbus_connection_dispatch(info->bus) =3D=3D DBUS_DISPATCH_DATA_R= EMAINS) /* keep dispatching while data remains */; @@ -243,7 +243,7 @@ static dbus_bool_t virDBusAddWatch(DBusWatch *watch, fd =3D dbus_watch_get_fd(watch); # endif dbus_watch_set_data(watch, info, virDBusWatchFree); - info->bus =3D (DBusConnection *)data; + info->bus =3D (DBusConnection *) data; info->watch =3D virEventAddHandle(fd, flags, virDBusWatchCallback, watch, NULL); @@ -263,7 +263,7 @@ static void virDBusRemoveWatch(DBusWatch *watch, =20 info =3D dbus_watch_get_data(watch); =20 - (void)virEventRemoveHandle(info->watch); + (void) virEventRemoveHandle(info->watch); } =20 =20 @@ -278,7 +278,7 @@ static void virDBusToggleWatch(DBusWatch *watch, =20 info =3D dbus_watch_get_data(watch); =20 - (void)virEventUpdateHandle(info->watch, flags); + (void) virEventUpdateHandle(info->watch, flags); } =20 # define VIR_DBUS_TYPE_STACK_MAX_DEPTH 32 @@ -510,7 +510,7 @@ static int virDBusTypeStackPush(virDBusTypeStack **stac= k, (*stack)[(*nstack) - 1].nstruct =3D nstruct; (*stack)[(*nstack) - 1].narray =3D narray; VIR_DEBUG("Pushed types=3D'%s' nstruct=3D%zu narray=3D%zd", - types, nstruct, (ssize_t)narray); + types, nstruct, (ssize_t) narray); return 0; } =20 @@ -533,7 +533,7 @@ static int virDBusTypeStackPop(virDBusTypeStack **stack, *nstruct =3D (*stack)[(*nstack) - 1].nstruct; *narray =3D (*stack)[(*nstack) - 1].narray; VIR_DEBUG("Popped types=3D'%s' nstruct=3D%zu narray=3D%zd", - *types, *nstruct, (ssize_t)*narray); + *types, *nstruct, (ssize_t) *narray); VIR_SHRINK_N(*stack, *nstack, 1); =20 return 0; @@ -624,16 +624,16 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter, if (!types) return 0; =20 - narray =3D (size_t)-1; + narray =3D (size_t) -1; nstruct =3D strlen(types); =20 for (;;) { const char *t; =20 VIR_DEBUG("Loop nstack=3D%zu narray=3D%zd nstruct=3D%zu types=3D'%= s'", - nstack, (ssize_t)narray, nstruct, types); + nstack, (ssize_t) narray, nstruct, types); if (narray =3D=3D 0 || - (narray =3D=3D (size_t)-1 && + (narray =3D=3D (size_t) -1 && nstruct =3D=3D 0)) { DBusMessageIter *thisiter =3D iter; if (*types !=3D '}') { @@ -662,7 +662,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter, } =20 t =3D types; - if (narray !=3D (size_t)-1) { + if (narray !=3D (size_t) -1) { narray--; } else { types++; @@ -739,7 +739,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter, goto cleanup; } =20 - if (narray =3D=3D (size_t)-1) { + if (narray =3D=3D (size_t) -1) { types +=3D skiplen; nstruct -=3D skiplen; } @@ -761,7 +761,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter, newiter =3D NULL; types =3D t + 1; nstruct =3D skiplen; - narray =3D (size_t)va_arg(args, int); + narray =3D (size_t) va_arg(args, int); if (arrayref) arrayptr =3D va_arg(args, void *); break; @@ -788,7 +788,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter, newiter =3D NULL; types =3D vsig; nstruct =3D strlen(types); - narray =3D (size_t)-1; + narray =3D (size_t) -1; break; =20 case DBUS_STRUCT_BEGIN_CHAR: @@ -804,7 +804,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter, DBUS_TYPE_STRUCT : DBUS_= TYPE_DICT_ENTRY, NULL, newiter)) goto cleanup; - if (narray =3D=3D (size_t)-1) { + if (narray =3D=3D (size_t) -1) { types +=3D skiplen - 1; nstruct -=3D skiplen - 1; } @@ -820,14 +820,14 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter, newiter =3D NULL; types =3D t + 1; nstruct =3D skiplen - 2; - narray =3D (size_t)-1; + narray =3D (size_t) -1; =20 break; =20 default: virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown type '%x' in signature '%s'"), - (int)*t, types); + (int) *t, types); goto cleanup; } } @@ -857,7 +857,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter, # define GET_NEXT_VAL(dbustype, member, vargtype, fmt) \ do { \ DBusBasicValue v; \ - dbustype *x =3D (dbustype *)&v.member; \ + dbustype *x =3D (dbustype *) &v.member; \ vargtype *y; \ if (arrayref) { \ VIR_DEBUG("Use arrayref"); \ @@ -901,7 +901,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, if (!types) return 0; =20 - narray =3D (size_t)-1; + narray =3D (size_t) -1; nstruct =3D strlen(types); =20 for (;;) { @@ -909,9 +909,9 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, bool advanceiter =3D true; =20 VIR_DEBUG("Loop nstack=3D%zu narray=3D%zd nstruct=3D%zu type=3D'%s= '", - nstack, (ssize_t)narray, nstruct, types); + nstack, (ssize_t) narray, nstruct, types); if (narray =3D=3D 0 || - (narray =3D=3D (size_t)-1 && + (narray =3D=3D (size_t) -1 && nstruct =3D=3D 0)) { DBusMessageIter *thisiter =3D iter; VIR_DEBUG("Popping iter=3D%p", iter); @@ -933,10 +933,10 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, narray =3D 0; else narray =3D 1; - VIR_DEBUG("Pop set narray=3D%zd", (ssize_t)narray); + VIR_DEBUG("Pop set narray=3D%zd", (ssize_t) narray); } if (!(narray =3D=3D 0 || - (narray =3D=3D (size_t)-1 && + (narray =3D=3D (size_t) -1 && nstruct =3D=3D 0)) && !dbus_message_iter_next(iter)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -947,7 +947,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, } =20 t =3D types; - if (narray !=3D (size_t)-1) { + if (narray !=3D (size_t) -1) { if (!arrayref) narray--; } else { @@ -1001,10 +1001,10 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, char ***xptrptr =3D arrayptr; if (VIR_EXPAND_N(*xptrptr, *narrayptr, 1) < 0) goto cleanup; - x =3D (char **)(*xptrptr + (*narrayptr - 1)); + x =3D (char **) (*xptrptr + (*narrayptr - 1)); VIR_DEBUG("Expanded to %zu", *narrayptr); } else { - x =3D (char **)va_arg(args, char **); + x =3D (char **) va_arg(args, char **); } char *s; dbus_message_iter_get_basic(iter, &s); @@ -1039,7 +1039,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, goto cleanup; } =20 - if (narray =3D=3D (size_t)-1) { + if (narray =3D=3D (size_t) -1) { types +=3D skiplen; nstruct -=3D skiplen; } @@ -1062,7 +1062,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, narrayptr =3D va_arg(args, size_t *); arrayptr =3D va_arg(args, void *); *narrayptr =3D 0; - *(char **)arrayptr =3D NULL; + *(char **) arrayptr =3D NULL; } else { narray =3D va_arg(args, int); } @@ -1089,7 +1089,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, newiter =3D NULL; types =3D vsig; nstruct =3D strlen(types); - narray =3D (size_t)-1; + narray =3D (size_t) -1; break; =20 case DBUS_STRUCT_BEGIN_CHAR: @@ -1103,7 +1103,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, VIR_DEBUG("Dict/struct contsig=3D'%s' skip=3D'%zu' len=3D'%zu'= types=3D'%s'", contsig, skiplen, siglen, types); dbus_message_iter_recurse(iter, newiter); - if (narray =3D=3D (size_t)-1) { + if (narray =3D=3D (size_t) -1) { types +=3D skiplen - 1; nstruct -=3D skiplen - 1; } @@ -1117,7 +1117,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, newiter =3D NULL; types =3D t + 1; nstruct =3D skiplen - 2; - narray =3D (size_t)-1; + narray =3D (size_t) -1; =20 break; =20 @@ -1129,7 +1129,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, } =20 VIR_DEBUG("After nstack=3D%zu narray=3D%zd nstruct=3D%zu types=3D'= %s'", - nstack, (ssize_t)narray, nstruct, types); + nstack, (ssize_t) narray, nstruct, types); =20 if (arrayref) { if (dbus_message_iter_get_arg_type(iter) =3D=3D DBUS_TYPE_INVA= LID) { @@ -1143,11 +1143,11 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, narray =3D 1; } } - VIR_DEBUG("Set narray=3D%zd", (ssize_t)narray); + VIR_DEBUG("Set narray=3D%zd", (ssize_t) narray); } else { if (advanceiter && !(narray =3D=3D 0 || - (narray =3D=3D (size_t)-1 && + (narray =3D=3D (size_t) -1 && nstruct =3D=3D 0)) && !dbus_message_iter_next(iter)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c index 492dcadc96a9..8bb6290b2d5b 100644 --- a/src/util/virdnsmasq.c +++ b/src/util/virdnsmasq.c @@ -103,7 +103,7 @@ addnhostsAdd(dnsmasqAddnHostsfile *addnhostsfile, return -1; =20 for (i =3D 0; i < addnhostsfile->nhosts; i++) { - if (STREQ((const char *)addnhostsfile->hosts[i].ip, (const char *)= ipstr)) { + if (STREQ((const char *) addnhostsfile->hosts[i].ip, (const char *= ) ipstr)) { idx =3D i; break; } @@ -689,8 +689,8 @@ dnsmasqCapsSetFromBuffer(dnsmasqCapsPtr caps, const cha= r *buf) =20 VIR_INFO("dnsmasq version is %d.%d, --bind-dynamic is %spresent, " "SO_BINDTODEVICE is %sin use, --ra-param is %spresent", - (int)caps->version / 1000000, - (int)(caps->version % 1000000) / 1000, + (int) caps->version / 1000000, + (int) (caps->version % 1000000) / 1000, dnsmasqCapsGet(caps, DNSMASQ_CAPS_BIND_DYNAMIC) ? "" : "NOT ", dnsmasqCapsGet(caps, DNSMASQ_CAPS_BINDTODEVICE) ? "" : "NOT ", dnsmasqCapsGet(caps, DNSMASQ_CAPS_RA_PARAM) ? "" : "NOT "); diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c index e4973a2bd015..8ac794796ee6 100644 --- a/src/util/virfdstream.c +++ b/src/util/virfdstream.c @@ -1176,7 +1176,7 @@ int virFDStreamConnectUNIX(virStreamPtr st, if (virTimeBackOffStart(&timeout, 1, 3*1000 /* ms */) < 0) goto error; while (virTimeBackOffWait(&timeout)) { - ret =3D connect(fd, (struct sockaddr *)&sa, sizeof(sa)); + ret =3D connect(fd, (struct sockaddr *) &sa, sizeof(sa)); if (ret =3D=3D 0) break; =20 diff --git a/src/util/virfile.c b/src/util/virfile.c index 5e9bd2007a52..1feea06cc44a 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -1048,7 +1048,7 @@ saferead(int fd, void *buf, size_t count) return r; if (r =3D=3D 0) return nread; - buf =3D (char *)buf + r; + buf =3D (char *) buf + r; count -=3D r; nread +=3D r; } @@ -1073,7 +1073,7 @@ safewrite(int fd, const void *buf, size_t count) return r; if (r =3D=3D 0) return nwritten; - buf =3D (const char *)buf + r; + buf =3D (const char *) buf + r; count -=3D r; nwritten +=3D r; } @@ -1401,7 +1401,7 @@ virFileReadLimFD(int fd, int maxlen, char **buf) s =3D saferead_lim(fd, maxlen+1, &len); if (s =3D=3D NULL) return -1; - if (len > maxlen || (int)len !=3D len) { + if (len > maxlen || (int) len !=3D len) { VIR_FREE(s); /* There was at least one byte more than MAXLEN. Set errno accordingly. */ @@ -3418,7 +3418,7 @@ virFileIsSharedFSType(const char *path, } =20 VIR_DEBUG("Check if path %s with FS magic %lld is shared", - path, (long long int)sb.f_type); + path, (long long int) sb.f_type); =20 if ((fstypes & VIR_FILE_SHFS_NFS) && (sb.f_type =3D=3D NFS_SUPER_MAGIC)) diff --git a/src/util/virfilecache.c b/src/util/virfilecache.c index dab72163ddb4..a5e8011779dd 100644 --- a/src/util/virfilecache.c +++ b/src/util/virfilecache.c @@ -351,7 +351,7 @@ virFileCacheLookupByFunc(virFileCachePtr cache, =20 virObjectLock(cache); =20 - data =3D virHashSearch(cache->table, iter, iterData, (void **)&name); + data =3D virHashSearch(cache->table, iter, iterData, (void **) &name); virFileCacheValidate(cache, name, &data); =20 virObjectRef(data); diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index 10c370a2aec0..c0c1dc3b4fd6 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -753,7 +753,7 @@ virFirewallApplyRuleFirewallD(virFirewallRulePtr rule, "passthrough", "sa&s", ipv, - (int)rule->argsLen, + (int) rule->argsLen, rule->args) < 0) goto cleanup; =20 diff --git a/src/util/virhash.c b/src/util/virhash.c index ecda55dba514..84c591874465 100644 --- a/src/util/virhash.c +++ b/src/util/virhash.c @@ -758,7 +758,7 @@ struct virHashEqualData static int virHashEqualSearcher(const void *payload, const void *name, const void *data) { - struct virHashEqualData *vhed =3D (void *)data; + struct virHashEqualData *vhed =3D (void *) data; const void *value; =20 value =3D virHashLookup(vhed->table2, name); diff --git a/src/util/virhostmem.c b/src/util/virhostmem.c index 11efe8c5029f..a88a9cb7a819 100644 --- a/src/util/virhostmem.c +++ b/src/util/virhostmem.c @@ -110,7 +110,7 @@ virHostMemGetStatsFreeBSD(virNodeMemoryStatsPtr params, sysctl_map[i].field); return -1; } - param->value =3D (unsigned long long)value * pagesize; + param->value =3D (unsigned long long) value * pagesize; } =20 { @@ -128,7 +128,7 @@ virHostMemGetStatsFreeBSD(virNodeMemoryStatsPtr params, VIR_NODE_MEMORY_STATS_BUFFERS); return -1; } - param->value =3D (unsigned long long)bufpages >> 10; + param->value =3D (unsigned long long) bufpages >> 10; } =20 return 0; @@ -454,13 +454,13 @@ virHostMemGetParameterValue(const char *field, if (STREQ(field, "pages_to_scan") || STREQ(field, "sleep_millisecs") || STREQ(field, "merge_across_nodes")) - rc =3D virStrToLong_ui(buf, NULL, 10, (unsigned int *)value); + rc =3D virStrToLong_ui(buf, NULL, 10, (unsigned int *) value); else if (STREQ(field, "pages_shared") || STREQ(field, "pages_sharing") || STREQ(field, "pages_unshared") || STREQ(field, "pages_volatile") || STREQ(field, "full_scans")) - rc =3D virStrToLong_ull(buf, NULL, 10, (unsigned long long *)value= ); + rc =3D virStrToLong_ull(buf, NULL, 10, (unsigned long long *) valu= e); =20 if (rc < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -635,7 +635,7 @@ virHostMemGetCellsFreeFake(unsigned long long *freeMems, return -1; } =20 - freeMems[0] =3D (unsigned long long)avail; + freeMems[0] =3D (unsigned long long) avail; =20 if (!freeMems[0]) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", diff --git a/src/util/viridentity.c b/src/util/viridentity.c index 2f4307bc8284..6116c205e32f 100644 --- a/src/util/viridentity.c +++ b/src/util/viridentity.c @@ -463,7 +463,7 @@ int virIdentitySetUNIXUserID(virIdentityPtr ident, { char *val; int ret; - if (virAsprintf(&val, "%d", (int)uid) < 0) + if (virAsprintf(&val, "%d", (int) uid) < 0) return -1; ret =3D virIdentitySetAttr(ident, VIR_IDENTITY_ATTR_UNIX_USER_ID, @@ -487,7 +487,7 @@ int virIdentitySetUNIXGroupID(virIdentityPtr ident, { char *val; int ret; - if (virAsprintf(&val, "%d", (int)gid) < 0) + if (virAsprintf(&val, "%d", (int) gid) < 0) return -1; ret =3D virIdentitySetAttr(ident, VIR_IDENTITY_ATTR_UNIX_GROUP_ID, diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c index d4c745a1afac..991a66583608 100644 --- a/src/util/viriscsi.c +++ b/src/util/viriscsi.c @@ -211,7 +211,7 @@ virStorageBackendCreateIfaceIQN(const char *initiatoriq= n, =20 if (virAsprintf(&temp_ifacename, "libvirt-iface-%08llx", - (unsigned long long)virRandomBits(30)) < 0) + (unsigned long long) virRandomBits(30)) < 0) return -1; =20 VIR_DEBUG("Attempting to create interface '%s' with IQN '%s'", diff --git a/src/util/virjson.c b/src/util/virjson.c index dfe00d9280da..2cfcc5ecff6d 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -1644,10 +1644,10 @@ virJSONParserHandleString(void *ctx, yajl_size_t stringLen) { virJSONParserPtr parser =3D ctx; - virJSONValuePtr value =3D virJSONValueNewStringLen((const char *)strin= gVal, + virJSONValuePtr value =3D virJSONValueNewStringLen((const char *) stri= ngVal, stringLen); =20 - VIR_DEBUG("parser=3D%p str=3D%p", parser, (const char *)stringVal); + VIR_DEBUG("parser=3D%p str=3D%p", parser, (const char *) stringVal); =20 if (!value) return 0; @@ -1669,7 +1669,7 @@ virJSONParserHandleMapKey(void *ctx, virJSONParserPtr parser =3D ctx; virJSONParserStatePtr state; =20 - VIR_DEBUG("parser=3D%p key=3D%p", parser, (const char *)stringVal); + VIR_DEBUG("parser=3D%p key=3D%p", parser, (const char *) stringVal); =20 if (!parser->nstate) return 0; @@ -1677,7 +1677,7 @@ virJSONParserHandleMapKey(void *ctx, state =3D &parser->state[parser->nstate-1]; if (state->key) return 0; - if (VIR_STRNDUP(state->key, (const char *)stringVal, stringLen) < 0) + if (VIR_STRNDUP(state->key, (const char *) stringVal, stringLen) < 0) return 0; return 1; } @@ -1835,15 +1835,15 @@ virJSONValueFromString(const char *jsonstring) * with no visibility into how much more input remains. Wrapping * things in an array forces yajl to confess the truth. */ # ifdef WITH_YAJL2 - rc =3D yajl_parse(hand, (const unsigned char *)jsonstring, len); + rc =3D yajl_parse(hand, (const unsigned char *) jsonstring, len); # else - rc =3D yajl_parse(hand, (const unsigned char *)"[", 1); + rc =3D yajl_parse(hand, (const unsigned char *) "[", 1); parser.wrap =3D 1; if (VIR_YAJL_STATUS_OK(rc)) - rc =3D yajl_parse(hand, (const unsigned char *)jsonstring, len); + rc =3D yajl_parse(hand, (const unsigned char *) jsonstring, len); parser.wrap =3D 0; if (VIR_YAJL_STATUS_OK(rc)) - rc =3D yajl_parse(hand, (const unsigned char *)"]", 1); + rc =3D yajl_parse(hand, (const unsigned char *) "]", 1); # endif if (!VIR_YAJL_STATUS_OK(rc) || yajl_complete_parse(hand) !=3D yajl_status_ok) { @@ -1910,7 +1910,7 @@ virJSONValueToStringOne(virJSONValuePtr object, return -1; for (i =3D 0; i < object->data.object.npairs; i++) { if (yajl_gen_string(g, - (unsigned char *)object->data.object.pairs= [i].key, + (unsigned char *) object->data.object.pair= s[i].key, strlen(object->data.object.pairs[i].key)) !=3D yajl_gen_status_ok) return -1; @@ -1932,7 +1932,7 @@ virJSONValueToStringOne(virJSONValuePtr object, break; =20 case VIR_JSON_TYPE_STRING: - if (yajl_gen_string(g, (unsigned char *)object->data.string, + if (yajl_gen_string(g, (unsigned char *) object->data.string, strlen(object->data.string)) !=3D yajl_gen_sta= tus_ok) return -1; break; @@ -2001,7 +2001,7 @@ virJSONValueToString(virJSONValuePtr object, goto cleanup; } =20 - ignore_value(VIR_STRDUP(ret, (const char *)str)); + ignore_value(VIR_STRDUP(ret, (const char *) str)); =20 cleanup: yajl_gen_free(g); diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c index 41af0cdb6d28..b6d2d5b98604 100644 --- a/src/util/virlockspace.c +++ b/src/util/virlockspace.c @@ -618,7 +618,7 @@ int virLockSpaceAcquireResource(virLockSpacePtr lockspa= ce, virLockSpaceResourcePtr res; =20 VIR_DEBUG("lockspace=3D%p resname=3D%s flags=3D0x%x owner=3D%lld", - lockspace, resname, flags, (unsigned long long)owner); + lockspace, resname, flags, (unsigned long long) owner); =20 virCheckFlags(VIR_LOCK_SPACE_ACQUIRE_SHARED | VIR_LOCK_SPACE_ACQUIRE_AUTOCREATE, -1); @@ -667,7 +667,7 @@ int virLockSpaceReleaseResource(virLockSpacePtr lockspa= ce, size_t i; =20 VIR_DEBUG("lockspace=3D%p resname=3D%s owner=3D%lld", - lockspace, resname, (unsigned long long)owner); + lockspace, resname, (unsigned long long) owner); =20 virMutexLock(&lockspace->lock); =20 @@ -686,7 +686,7 @@ int virLockSpaceReleaseResource(virLockSpacePtr lockspa= ce, if (i =3D=3D res->nOwners) { virReportError(VIR_ERR_INTERNAL_ERROR, _("owner %lld does not hold the resource lock"), - (unsigned long long)owner); + (unsigned long long) owner); goto cleanup; } =20 @@ -716,10 +716,10 @@ virLockSpaceRemoveResourcesForOwner(const void *paylo= ad, const void *opaque) { virLockSpaceResourcePtr res =3D (virLockSpaceResourcePtr)payload; - struct virLockSpaceRemoveData *data =3D (struct virLockSpaceRemoveData= *)opaque; + struct virLockSpaceRemoveData *data =3D (struct virLockSpaceRemoveData= *) opaque; size_t i; =20 - VIR_DEBUG("res %s owner %lld", res->name, (unsigned long long)data->ow= ner); + VIR_DEBUG("res %s owner %lld", res->name, (unsigned long long) data->o= wner); =20 for (i =3D 0; i < res->nOwners; i++) { if (res->owners[i] =3D=3D data->owner) @@ -751,7 +751,7 @@ int virLockSpaceReleaseResourcesForOwner(virLockSpacePt= r lockspace, owner, 0 }; =20 - VIR_DEBUG("lockspace=3D%p owner=3D%lld", lockspace, (unsigned long lon= g)owner); + VIR_DEBUG("lockspace=3D%p owner=3D%lld", lockspace, (unsigned long lon= g) owner); =20 virMutexLock(&lockspace->lock); =20 diff --git a/src/util/virlog.c b/src/util/virlog.c index 81a9dc4395c2..3bb542f3936f 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -781,7 +781,7 @@ virLogCloseFd(void *data) static virLogOutputPtr virLogNewOutputToStderr(virLogPriority priority) { - return virLogOutputNew(virLogOutputToFd, NULL, (void *)STDERR_FILENO, + return virLogOutputNew(virLogOutputToFd, NULL, (void *) STDERR_FILENO, priority, VIR_LOG_TO_STDERR, NULL); } =20 @@ -800,7 +800,7 @@ virLogNewOutputToFile(virLogPriority priority, } =20 if (!(ret =3D virLogOutputNew(virLogOutputToFd, virLogCloseFd, - (void *)(intptr_t)fd, + (void *) (intptr_t)fd, priority, VIR_LOG_TO_FILE, file))) { VIR_LOG_CLOSE(fd); return NULL; @@ -965,11 +965,11 @@ journalAddString(struct journalState *state, const ch= ar *field, if (state->iov_end - state->iov < 4) return; /* Silently drop */ IOVEC_SET_STRING(state->iov[0], field); - IOVEC_SET(state->iov[1], (void *)&equals, sizeof(equals)); + IOVEC_SET(state->iov[1], (void *) &equals, sizeof(equals)); state->iov +=3D 2; } IOVEC_SET_STRING(state->iov[0], value); - IOVEC_SET(state->iov[1], (void *)&newline, sizeof(newline)); + IOVEC_SET(state->iov[1], (void *) &newline, sizeof(newline)); state->iov +=3D 2; } =20 @@ -986,9 +986,9 @@ journalAddInt(struct journalState *state, const char *f= ield, int value) num =3D virFormatIntDecimal(state->bufs[0], sizeof(state->bufs[0]), va= lue); =20 IOVEC_SET_STRING(state->iov[0], field); - IOVEC_SET(state->iov[1], (void *)&equals, sizeof(equals)); + IOVEC_SET(state->iov[1], (void *) &equals, sizeof(equals)); IOVEC_SET_STRING(state->iov[2], num); - IOVEC_SET(state->iov[3], (void *)&newline, sizeof(newline)); + IOVEC_SET(state->iov[3], (void *) &newline, sizeof(newline)); state->bufs++; state->iov +=3D 4; } @@ -1129,7 +1129,7 @@ virLogNewOutputToJournald(int priority) } =20 if (!(ret =3D virLogOutputNew(virLogOutputToJournald, virLogCloseFd, - (void *)(intptr_t) journalfd, priority, + (void *) (intptr_t) journalfd, priority, VIR_LOG_TO_JOURNALD, NULL))) { VIR_LOG_CLOSE(journalfd); return NULL; diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index b250af9e2c10..6ee5833d6f3e 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -260,7 +260,7 @@ virNetDevSetMACInternal(const char *ifname, goto cleanup; } =20 - virMacAddrGetRaw(macaddr, (unsigned char *)ifr.ifr_hwaddr.sa_data); + virMacAddrGetRaw(macaddr, (unsigned char *) ifr.ifr_hwaddr.sa_data); =20 if (ioctl(fd, SIOCSIFHWADDR, &ifr) < 0) { =20 @@ -386,7 +386,7 @@ int virNetDevGetMAC(const char *ifname, goto cleanup; } =20 - virMacAddrSetRaw(macaddr, (unsigned char *)ifr.ifr_hwaddr.sa_data); + virMacAddrSetRaw(macaddr, (unsigned char *) ifr.ifr_hwaddr.sa_data); =20 ret =3D 0; =20 @@ -973,7 +973,7 @@ virNetDevGetMaster(const char *ifname, char **master) goto cleanup; =20 if (tb[IFLA_MASTER]) { - if (!(*master =3D virNetDevGetName(*(int *)RTA_DATA(tb[IFLA_MASTER= ])))) + if (!(*master =3D virNetDevGetName(*(int *) RTA_DATA(tb[IFLA_MASTE= R])))) goto cleanup; } =20 @@ -1092,7 +1092,7 @@ int virNetDevValidateConfig(const char *ifname, } =20 if (virMacAddrCmpRaw(macaddr, - (unsigned char *)ifr.ifr_hwaddr.sa_data) !=3D= 0) { + (unsigned char *) ifr.ifr_hwaddr.sa_data) != =3D 0) { ret =3D 0; goto cleanup; } @@ -1720,7 +1720,7 @@ virNetDevSetVfConfig(const char *ifname, int vf, =20 switch (resp->nlmsg_type) { case NLMSG_ERROR: - err =3D (struct nlmsgerr *)NLMSG_DATA(resp); + err =3D (struct nlmsgerr *) NLMSG_DATA(resp); if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err))) goto malformed_resp; =20 @@ -2656,7 +2656,7 @@ int virNetDevAddMulti(const char *ifname, return -1; =20 ifr.ifr_hwaddr.sa_family =3D AF_UNSPEC; - virMacAddrGetRaw(macaddr, (unsigned char *)ifr.ifr_hwaddr.sa_data); + virMacAddrGetRaw(macaddr, (unsigned char *) ifr.ifr_hwaddr.sa_data); =20 if (ioctl(fd, SIOCADDMULTI, &ifr) < 0) { char macstr[VIR_MAC_STRING_BUFLEN]; @@ -2705,7 +2705,7 @@ int virNetDevDelMulti(const char *ifname, return -1; =20 ifr.ifr_hwaddr.sa_family =3D AF_UNSPEC; - virMacAddrGetRaw(macaddr, (unsigned char *)ifr.ifr_hwaddr.sa_data); + virMacAddrGetRaw(macaddr, (unsigned char *) ifr.ifr_hwaddr.sa_data); =20 if (ioctl(fd, SIOCDELMULTI, &ifr) < 0) { char macstr[VIR_MAC_STRING_BUFLEN]; @@ -2751,7 +2751,7 @@ static int virNetDevParseMcast(char *buf, virNetDevMc= astEntryPtr mcast) return -1; } =20 - switch ((virMCastType)ifindex) { + switch ((virMCastType) ifindex) { case VIR_MCAST_TYPE_INDEX_TOKEN: if (virStrToLong_i(token, &endptr, 10, &num) < 0) { virReportSystemError(EINVAL, @@ -3180,7 +3180,7 @@ static void * virNetDevPutExtraHeader(struct nlmsghdr *nlh, size_t size) { - char *ptr =3D (char *)nlh + nlh->nlmsg_len; + char *ptr =3D (char *) nlh + nlh->nlmsg_len; size_t len =3D NLMSG_ALIGN(size); nlh->nlmsg_len +=3D len; return ptr; @@ -3318,7 +3318,7 @@ virNetDevSwitchdevFeature(const char *ifname, } =20 if (tb[DEVLINK_ATTR_ESWITCH_MODE] && - *(int *)RTA_DATA(tb[DEVLINK_ATTR_ESWITCH_MODE]) =3D=3D DEVLINK_ESW= ITCH_MODE_SWITCHDEV) { + *(int *) RTA_DATA(tb[DEVLINK_ATTR_ESWITCH_MODE]) =3D=3D DEVLINK_ES= WITCH_MODE_SWITCHDEV) { ignore_value(virBitmapSetBit(*out, VIR_NET_DEV_FEAT_SWITCHDEV)); } =20 diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c index cfb7ebae99c7..d40f5335bc03 100644 --- a/src/util/virnetdevbridge.c +++ b/src/util/virnetdevbridge.c @@ -195,7 +195,7 @@ static int virNetDevBridgeGet(const char *brname, VIR_FREE(valuestr); } else { struct __bridge_info info; - unsigned long args[] =3D { BRCTL_GET_BRIDGE_INFO, (unsigned long)&= info, 0, 0 }; + unsigned long args[] =3D { BRCTL_GET_BRIDGE_INFO, (unsigned long) = &info, 0, 0 }; =20 if ((fd =3D virNetDevSetupControl(brname, &ifr)) < 0) goto cleanup; @@ -464,7 +464,7 @@ virNetDevBridgeCreate(const char *brname) =20 switch (resp->nlmsg_type) { case NLMSG_ERROR: - err =3D (struct nlmsgerr *)NLMSG_DATA(resp); + err =3D (struct nlmsgerr *) NLMSG_DATA(resp); if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err))) goto malformed_resp; =20 @@ -1123,7 +1123,7 @@ virNetDevBridgeFDBAddDel(const virMacAddr *mac, const= char *ifname, =20 switch (resp->nlmsg_type) { case NLMSG_ERROR: - err =3D (struct nlmsgerr *)NLMSG_DATA(resp); + err =3D (struct nlmsgerr *) NLMSG_DATA(resp); if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err))) goto malformed_resp; if (err->error) { diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index bf98ed8a59e0..b98a582b4ad7 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -415,7 +415,7 @@ virNetDevIPParseDadStatus(struct nlmsghdr *nlh, int len, break; } =20 - ifaddrmsg_ptr =3D (struct ifaddrmsg *)NLMSG_DATA(nlh); + ifaddrmsg_ptr =3D (struct ifaddrmsg *) NLMSG_DATA(nlh); if (!(ifaddrmsg_ptr->ifa_flags & IFA_F_TENTATIVE)) { /* Not tentative: we are not interested in this entry. */ continue; @@ -563,7 +563,7 @@ virNetDevIPCheckIPv6ForwardingCallback(const struct nlm= sghdr *resp, for (rta =3D RTM_RTA(rtmsg); RTA_OK(rta, len); rta =3D RTA_NEXT(rta, l= en)) { VIR_WARNINGS_RESET if (rta->rta_type =3D=3D RTA_OIF) { - oif =3D *(int *)RTA_DATA(rta); + oif =3D *(int *) RTA_DATA(rta); =20 /* Should never happen: netlink message would be broken */ if (ifname) { @@ -856,7 +856,7 @@ virNetDevGetIPv4AddressIoctl(const char *ifname, if ((fd =3D virNetDevSetupControl(ifname, &ifr)) < 0) return -1; =20 - if (ioctl(fd, SIOCGIFADDR, (char *)&ifr) < 0) { + if (ioctl(fd, SIOCGIFADDR, (char *) &ifr) < 0) { virReportSystemError(errno, _("Unable to get IPv4 address for interface %= s via ioctl"), ifname); diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index fb41bf934cf9..0d6c0d0abe12 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -371,7 +371,7 @@ virNetDevMacVLanCreate(const char *ifname, =20 switch (resp->nlmsg_type) { case NLMSG_ERROR: - err =3D (struct nlmsgerr *)NLMSG_DATA(resp); + err =3D (struct nlmsgerr *) NLMSG_DATA(resp); if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err))) goto malformed_resp; =20 @@ -685,15 +685,15 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr = *hdr, case RTM_GETLINK: VIR_DEBUG(" IFINFOMSG"); VIR_DEBUG(" ifi_family =3D 0x%02x", - ((struct ifinfomsg *)data)->ifi_family); + ((struct ifinfomsg *) data)->ifi_family); VIR_DEBUG(" ifi_type =3D 0x%x", - ((struct ifinfomsg *)data)->ifi_type); + ((struct ifinfomsg *) data)->ifi_type); VIR_DEBUG(" ifi_index =3D %i", - ((struct ifinfomsg *)data)->ifi_index); + ((struct ifinfomsg *) data)->ifi_index); VIR_DEBUG(" ifi_flags =3D 0x%04x", - ((struct ifinfomsg *)data)->ifi_flags); + ((struct ifinfomsg *) data)->ifi_flags); VIR_DEBUG(" ifi_change =3D 0x%04x", - ((struct ifinfomsg *)data)->ifi_change); + ((struct ifinfomsg *) data)->ifi_change); } /* DEBUG end */ =20 @@ -703,7 +703,7 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *h= dr, ifinfo.ifi_family, ifinfo.ifi_type, ifinfo.ifi_index, ifinfo.ifi_flags, ifinfo.ifi_change); if (nlmsg_parse(hdr, sizeof(ifinfo), - (struct nlattr **)&tb, IFLA_MAX, NULL)) { + (struct nlattr **) &tb, IFLA_MAX, NULL)) { VIR_DEBUG("error parsing request..."); return; } @@ -753,12 +753,12 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr = *hdr, } =20 if (tb[IFLA_IFNAME]) { - ifname =3D (char *)RTA_DATA(tb[IFLA_IFNAME]); + ifname =3D (char *) RTA_DATA(tb[IFLA_IFNAME]); VIR_DEBUG("IFLA_IFNAME =3D %s", ifname); } =20 if (tb[IFLA_OPERSTATE]) { - rem =3D *(unsigned short *)RTA_DATA(tb[IFLA_OPERSTATE]); + rem =3D *(unsigned short *) RTA_DATA(tb[IFLA_OPERSTATE]); VIR_DEBUG("IFLA_OPERSTATE =3D %d", rem); } =20 diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c index a3ed59da8502..0a1011694773 100644 --- a/src/util/virnetdevtap.c +++ b/src/util/virnetdevtap.c @@ -126,7 +126,7 @@ virNetDevTapGetRealDeviceName(char *ifname ATTRIBUTE_UN= USED) goto cleanup; } =20 - if (ioctl(fd, TAPGIFNAME, (void *)&ifr) < 0) { + if (ioctl(fd, TAPGIFNAME, (void *) &ifr) < 0) { virReportSystemError(errno, "%s", _("Unable to query tap interface name= ")); goto cleanup; @@ -793,7 +793,7 @@ virNetDevTapInterfaceStats(const char *ifname, continue; =20 if (STREQ(ifa->ifa_name, ifname)) { - ifd =3D (struct if_data *)ifa->ifa_data; + ifd =3D (struct if_data *) ifa->ifa_data; if (swapped) { stats->tx_bytes =3D ifd->ifi_ibytes; stats->tx_packets =3D ifd->ifi_ipackets; diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprof= ile.c index 133d962db6b2..491a9cd74526 100644 --- a/src/util/virnetdevvportprofile.c +++ b/src/util/virnetdevvportprofile.c @@ -807,7 +807,7 @@ virNetDevVPortProfileOpSetLink(const char *ifname, int = ifindex, =20 switch (resp->nlmsg_type) { case NLMSG_ERROR: - err =3D (struct nlmsgerr *)NLMSG_DATA(resp); + err =3D (struct nlmsgerr *) NLMSG_DATA(resp); if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err))) goto malformed_resp; =20 @@ -896,7 +896,7 @@ virNetDevVPortProfileGetNthParent(const char *ifname, i= nt ifindex, unsigned int } =20 if (tb[IFLA_LINK]) { - ifindex =3D *(int *)RTA_DATA(tb[IFLA_LINK]); + ifindex =3D *(int *) RTA_DATA(tb[IFLA_LINK]); ifname =3D NULL; } else { end =3D true; diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c index fa1ba3e2a166..f8f520b306cc 100644 --- a/src/util/virnetlink.c +++ b/src/util/virnetlink.c @@ -312,7 +312,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg, protocol, groups))) goto cleanup; =20 - len =3D nl_recv(nlhandle, &nladdr, (unsigned char **)resp, NULL); + len =3D nl_recv(nlhandle, &nladdr, (unsigned char **) resp, NULL); if (len =3D=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nl_recv failed - returned 0 bytes")); @@ -360,7 +360,7 @@ virNetlinkDumpCommand(struct nl_msg *nl_msg, goto cleanup; =20 while (!end) { - len =3D nl_recv(nlhandle, &nladdr, (unsigned char **)&resp, NULL); + len =3D nl_recv(nlhandle, &nladdr, (unsigned char **) &resp, NULL); VIR_WARNINGS_NO_CAST_ALIGN for (msg =3D resp; NLMSG_OK(msg, len); msg =3D NLMSG_NEXT(msg, len= )) { VIR_WARNINGS_RESET @@ -461,7 +461,7 @@ virNetlinkDumpLink(const char *ifname, int ifindex, =20 switch (resp->nlmsg_type) { case NLMSG_ERROR: - err =3D (struct nlmsgerr *)NLMSG_DATA(resp); + err =3D (struct nlmsgerr *) NLMSG_DATA(resp); if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err))) goto malformed_resp; =20 @@ -552,7 +552,7 @@ virNetlinkDelLink(const char *ifname, virNetlinkDelLink= Fallback fallback) =20 switch (resp->nlmsg_type) { case NLMSG_ERROR: - err =3D (struct nlmsgerr *)NLMSG_DATA(resp); + err =3D (struct nlmsgerr *) NLMSG_DATA(resp); if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err))) goto malformed_resp; =20 @@ -638,7 +638,7 @@ virNetlinkGetNeighbor(void **nlData, uint32_t src_pid, = uint32_t dst_pid) =20 switch (resp->nlmsg_type) { case NLMSG_ERROR: - err =3D (struct nlmsgerr *)NLMSG_DATA(resp); + err =3D (struct nlmsgerr *) NLMSG_DATA(resp); if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err))) goto malformed_resp; =20 @@ -686,7 +686,7 @@ virNetlinkGetErrorCode(struct nlmsghdr *resp, unsigned = int recvbuflen) =20 switch (resp->nlmsg_type) { case NLMSG_ERROR: - err =3D (struct nlmsgerr *)NLMSG_DATA(resp); + err =3D (struct nlmsgerr *) NLMSG_DATA(resp); if (resp->nlmsg_len < NLMSG_LENGTH(sizeof(*err))) goto malformed_resp; =20 @@ -775,7 +775,7 @@ virNetlinkEventCallback(int watch, bool handled =3D false; =20 length =3D nl_recv(srv->netlinknh, &peer, - (unsigned char **)&msg, &creds); + (unsigned char **) &msg, &creds); =20 if (length =3D=3D 0) return; @@ -788,7 +788,7 @@ virNetlinkEventCallback(int watch, virNetlinkEventServerLock(srv); =20 VIR_DEBUG("dispatching to max %d clients, called from event watch %d", - (int)srv->handlesCount, watch); + (int) srv->handlesCount, watch); =20 for (i =3D 0; i < srv->handlesCount; i++) { if (srv->handles[i].deleted !=3D VIR_NETLINK_HANDLE_VALID) @@ -910,7 +910,7 @@ int virNetlinkEventServiceLocalPid(unsigned int protoco= l) _("netlink event service not running")); return -1; } - return (int)nl_socket_get_local_port(server[protocol]->netlinknh); + return (int) nl_socket_get_local_port(server[protocol]->netlinknh); } =20 =20 diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c index 0af0908e4ae1..c2340cb9b0f9 100644 --- a/src/util/virnodesuspend.c +++ b/src/util/virnodesuspend.c @@ -109,7 +109,7 @@ static int virNodeSuspendSetNodeWakeup(unsigned long lo= ng alarmTime) */ static void virNodeSuspendHelper(void *cmdString) { - virCommandPtr suspendCmd =3D virCommandNew((const char *)cmdString); + virCommandPtr suspendCmd =3D virCommandNew((const char *) cmdString); =20 /* * Delay for sometime so that the function virNodeSuspend() @@ -221,7 +221,7 @@ int virNodeSuspend(unsigned int target, =20 if (virThreadCreate(&thread, false, virNodeSuspendHelper, - (void *)cmdString) < 0) { + (void *) cmdString) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Failed to create thread to suspend the host")); goto cleanup; diff --git a/src/util/virobject.c b/src/util/virobject.c index 9fb0328d5879..6a2ab967a094 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -630,7 +630,7 @@ virObjectListFreeCount(void *list, return; =20 for (i =3D 0; i < count; i++) - virObjectUnref(((void **)list)[i]); + virObjectUnref(((void **) list)[i]); =20 VIR_FREE(list); } diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index 58ab29f77f2c..9253d2c4ce88 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -252,7 +252,7 @@ int virPidFileReadPathIfAlive(const char *path, goto cleanup; } =20 - if (virAsprintf(&procPath, "/proc/%lld/exe", (long long)retPid) < 0) { + if (virAsprintf(&procPath, "/proc/%lld/exe", (long long) retPid) < 0) { ret =3D -ENOMEM; goto cleanup; } diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c index 198439cea291..d937a1f7faf2 100644 --- a/src/util/virpolkit.c +++ b/src/util/virpolkit.c @@ -87,9 +87,9 @@ int virPolkitCheckAuth(const char *actionid, "(sa{sv})sa&{ss}us", "unix-process", 3, - "pid", "u", (unsigned int)pid, + "pid", "u", (unsigned int) pid, "start-time", "t", startTime, - "uid", "i", (int)uid, + "uid", "i", (int) uid, actionid, virStringListLength(details) / 2, details, diff --git a/src/util/virprobe.h b/src/util/virprobe.h index 88cda2104f08..afc966d06a07 100644 --- a/src/util/virprobe.h +++ b/src/util/virprobe.h @@ -48,7 +48,7 @@ * can safely go to intptr_t and back to void *, which collapses * arrays into pointers; while any integer can be widened to intptr_t * then cast to void *. */ -# define VIR_ADD_CAST(a) ((void *)(intptr_t)(a)) +# define VIR_ADD_CAST(a) ((void *) (intptr_t)(a)) # define VIR_ADD_CAST1(a) \ VIR_ADD_CAST(a) # define VIR_ADD_CAST2(a, b) \ diff --git a/src/util/virprocess.c b/src/util/virprocess.c index 1fbbbb3a279f..43ef0fc16c7d 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -207,7 +207,7 @@ void virProcessAbort(pid_t pid) { /* Not yet ported to mingw. Any volunteers? */ - VIR_DEBUG("failed to reap child %lld, abandoning it", (long long)pid); + VIR_DEBUG("failed to reap child %lld, abandoning it", (long long) pid); } #endif =20 @@ -352,7 +352,7 @@ virProcessKillPainfully(pid_t pid, bool force) int ret =3D -1; const char *signame =3D "TERM"; =20 - VIR_DEBUG("vpid=3D%lld force=3D%d", (long long)pid, force); + VIR_DEBUG("vpid=3D%lld force=3D%d", (long long) pid, force); =20 /* This loop sends SIGTERM, then waits a few iterations (10 seconds) * to see if it dies. If the process still hasn't exited, and @@ -368,7 +368,7 @@ virProcessKillPainfully(pid_t pid, bool force) signum =3D SIGTERM; /* kindly suggest it should exit */ } else if (i =3D=3D 50 && force) { VIR_DEBUG("Timed out waiting after SIGTERM to process %lld, " - "sending SIGKILL", (long long)pid); + "sending SIGKILL", (long long) pid); /* No SIGKILL kill on Win32 ! Use SIGABRT instead which our * virProcessKill proc will handle more or less like SIGKILL */ #ifdef WIN32 @@ -386,7 +386,7 @@ virProcessKillPainfully(pid_t pid, bool force) if (errno !=3D ESRCH) { virReportSystemError(errno, _("Failed to terminate process %lld w= ith SIG%s"), - (long long)pid, signame); + (long long) pid, signame); goto cleanup; } ret =3D signum =3D=3D SIGTERM ? 0 : 1; @@ -398,7 +398,7 @@ virProcessKillPainfully(pid_t pid, bool force) =20 virReportSystemError(EBUSY, _("Failed to terminate process %lld with SIG%s"), - (long long)pid, signame); + (long long) pid, signame); =20 cleanup: return ret; @@ -410,7 +410,7 @@ virProcessKillPainfully(pid_t pid, bool force) int virProcessSetAffinity(pid_t pid, virBitmapPtr map) { size_t i; - VIR_DEBUG("Set process affinity on %lld", (long long)pid); + VIR_DEBUG("Set process affinity on %lld", (long long) pid); # ifdef CPU_ALLOC /* New method dynamically allocates cpu mask, allowing unlimted cpus */ int numcpus =3D 1024; @@ -768,7 +768,7 @@ virProcessSetMaxMemLock(pid_t pid, unsigned long long b= ytes) virReportSystemError(errno, _("cannot limit locked memory " "of process %lld to %llu"), - (long long int)pid, bytes); + (long long int) pid, bytes); return -1; } } @@ -864,7 +864,7 @@ virProcessSetMaxProcesses(pid_t pid, unsigned int procs) virReportSystemError(errno, _("cannot limit number of subprocesses " "of process %lld to %u"), - (long long int)pid, procs); + (long long int) pid, procs); return -1; } } @@ -912,7 +912,7 @@ virProcessSetMaxFiles(pid_t pid, unsigned int files) virReportSystemError(errno, _("cannot limit number of open files " "of process %lld to %u"), - (long long int)pid, files); + (long long int) pid, files); return -1; } } @@ -949,7 +949,7 @@ virProcessSetMaxCoreSize(pid_t pid, unsigned long long = bytes) virReportSystemError(errno, _("cannot limit core file size " "of process %lld to %llu"), - (long long int)pid, bytes); + (long long int) pid, bytes); return -1; } } @@ -1055,7 +1055,7 @@ int virProcessGetStartTime(pid_t pid, return -1; } =20 - *timestamp =3D (unsigned long long)p.ki_start.tv_sec; + *timestamp =3D (unsigned long long) p.ki_start.tv_sec; =20 return 0; =20 diff --git a/src/util/virrandom.c b/src/util/virrandom.c index 41daa404b273..817c8d9968e2 100644 --- a/src/util/virrandom.c +++ b/src/util/virrandom.c @@ -235,7 +235,7 @@ virRandomGenerateWWN(char **wwn, } =20 if (virAsprintf(wwn, "5" "%s%09llx", oui, - (unsigned long long)virRandomBits(36)) < 0) + (unsigned long long) virRandomBits(36)) < 0) return -1; return 0; } diff --git a/src/util/virrotatingfile.c b/src/util/virrotatingfile.c index ca62a8e02641..096c9ef92f36 100644 --- a/src/util/virrotatingfile.c +++ b/src/util/virrotatingfile.c @@ -533,7 +533,7 @@ virRotatingFileReaderSeek(virRotatingFileReaderPtr file, if (ret =3D=3D (off_t)-1) { virReportSystemError(errno, _("Unable to seek to inode %llu offset %l= lu"), - (unsigned long long)inode, (unsigned long= long)offset); + (unsigned long long) inode, (unsigned lon= g long) offset); return -1; } =20 @@ -546,7 +546,7 @@ virRotatingFileReaderSeek(virRotatingFileReaderPtr file, if (ret =3D=3D (off_t)-1) { virReportSystemError(errno, _("Unable to seek to inode %llu offset %llu"), - (unsigned long long)inode, (unsigned long lon= g)offset); + (unsigned long long) inode, (unsigned long lo= ng) offset); return -1; } return 0; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 531540ac9184..bfedaf8fa87b 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -460,7 +460,7 @@ qcow2GetBackingStoreFormat(int *format, if (buf[offset+len] !=3D '\0') break; *format =3D virStorageFileFormatTypeFromString( - ((const char *)buf)+offset); + ((const char *) buf)+offset); if (*format <=3D VIR_STORAGE_FILE_NONE) return -1; } @@ -2475,7 +2475,7 @@ virStorageSourceRBDAddHost(virStorageSourcePtr src, parts =3D virStringSplit(hostport, "\\:", 0); if (!parts) goto error; - src->hosts[src->nhosts-1].name =3D virStringListJoin((const char **)pa= rts, ":"); + src->hosts[src->nhosts-1].name =3D virStringListJoin((const char **) p= arts, ":"); virStringListFree(parts); if (!src->hosts[src->nhosts-1].name) goto error; @@ -3510,8 +3510,8 @@ virStorageSourceUpdateBackingSizes(virStorageSourcePt= r src, /* Get info for normal formats */ if (S_ISREG(sb->st_mode) || fd =3D=3D -1) { #ifndef WIN32 - src->allocation =3D (unsigned long long)sb->st_blocks * - (unsigned long long)DEV_BSIZE; + src->allocation =3D (unsigned long long) sb->st_blocks * + (unsigned long long) DEV_BSIZE; #else src->allocation =3D sb->st_size; #endif @@ -4452,7 +4452,7 @@ virStorageFileChown(const virStorageSource *src, } =20 VIR_DEBUG("chown of storage file %p to %u:%u", - src, (unsigned int)uid, (unsigned int)gid); + src, (unsigned int) uid, (unsigned int) gid); =20 return src->drv->backend->storageFileChown(src, uid, gid); } @@ -4523,7 +4523,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr = src, =20 VIR_DEBUG("path=3D%s format=3D%d uid=3D%u gid=3D%u probe=3D%d", src->path, src->format, - (unsigned int)uid, (unsigned int)gid, allow_probe); + (unsigned int) uid, (unsigned int) gid, allow_probe); =20 /* exit if we can't load information about the current image */ if (!virStorageFileSupportsBackingChainTraversal(src)) @@ -4547,7 +4547,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr = src, goto cleanup; } =20 - if (virHashAddEntry(cycle, uniqueName, (void *)1) < 0) + if (virHashAddEntry(cycle, uniqueName, (void *) 1) < 0) goto cleanup; =20 if ((headerLen =3D virStorageFileRead(src, 0, VIR_STORAGE_MAX_HEADER, @@ -4628,7 +4628,7 @@ virStorageFileGetMetadata(virStorageSourcePtr src, bool report_broken) { VIR_DEBUG("path=3D%s format=3D%d uid=3D%u gid=3D%u probe=3D%d, report_= broken=3D%d", - src->path, src->format, (unsigned int)uid, (unsigned int)gid, + src->path, src->format, (unsigned int) uid, (unsigned int) g= id, allow_probe, report_broken); =20 virHashTablePtr cycle =3D NULL; diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 3be963d704ea..28af95066d1e 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -338,7 +338,7 @@ int virSystemdCreateMachine(const char *name, uuid[12], uuid[13], uuid[14], uuid[15], creatorname, iscontainer ? "container" : "vm", - (unsigned int)pidleader, + (unsigned int) pidleader, rootdir ? rootdir : "", nnicindexes, nicindexes, 3, @@ -380,7 +380,7 @@ int virSystemdCreateMachine(const char *name, uuid[12], uuid[13], uuid[14], uuid[15], creatorname, iscontainer ? "container" : "vm", - (unsigned int)pidleader, + (unsigned int) pidleader, rootdir ? rootdir : "", 3, "Slice", "s", slicename, @@ -464,7 +464,7 @@ virSystemdNotifyStartup(void) .sun_family =3D AF_UNIX, }; struct iovec iov =3D { - .iov_base =3D (char *)msg, + .iov_base =3D (char *) msg, .iov_len =3D strlen(msg), }; struct msghdr mh =3D { diff --git a/src/util/virtime.c b/src/util/virtime.c index 640eb5a1d12c..84879bf19502 100644 --- a/src/util/virtime.c +++ b/src/util/virtime.c @@ -395,7 +395,7 @@ virTimeBackOffStart(virTimeBackOffVar *var, =20 /** * virTimeBackOffWait - * @var: Timeout variable (with type virTimeBackOffVar *). + * @var: Timeout variable (with type virTimeBackOffVar *) . * * You must initialize @var first by calling the following function, * which also starts the timer: diff --git a/src/util/viruri.c b/src/util/viruri.c index b80d9249e638..595a696a78dd 100644 --- a/src/util/viruri.c +++ b/src/util/viruri.c @@ -253,7 +253,7 @@ virURIFormat(virURIPtr uri) if (!xmluri.server && !xmluri.port) xmluri.port =3D -1; =20 - ret =3D (char *)xmlSaveUri(&xmluri); + ret =3D (char *) xmlSaveUri(&xmluri); if (!ret) { virReportOOMError(); goto cleanup; diff --git a/src/util/virutil.c b/src/util/virutil.c index cd6fbf2f306a..2a65b73230bd 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -1904,7 +1904,7 @@ void virUpdateSelfLastChanged(const char *path) =20 if (sb.st_ctime > selfLastChanged) { VIR_DEBUG("Setting self last changed to %lld for '%s'", - (long long)sb.st_ctime, path); + (long long) sb.st_ctime, path); selfLastChanged =3D sb.st_ctime; } } diff --git a/src/util/virutil.h b/src/util/virutil.h index be0f6b0ea855..08d65136b647 100644 --- a/src/util/virutil.h +++ b/src/util/virutil.h @@ -202,9 +202,9 @@ virTristateSwitch virTristateSwitchFromBool(bool val); =20 /* the two enums must be in sync to be able to use helpers interchangeably= in * some special cases */ -verify((int)VIR_TRISTATE_BOOL_YES =3D=3D (int)VIR_TRISTATE_SWITCH_ON); -verify((int)VIR_TRISTATE_BOOL_NO =3D=3D (int)VIR_TRISTATE_SWITCH_OFF); -verify((int)VIR_TRISTATE_BOOL_ABSENT =3D=3D (int)VIR_TRISTATE_SWITCH_ABSEN= T); +verify((int) VIR_TRISTATE_BOOL_YES =3D=3D (int) VIR_TRISTATE_SWITCH_ON); +verify((int) VIR_TRISTATE_BOOL_NO =3D=3D (int) VIR_TRISTATE_SWITCH_OFF); +verify((int) VIR_TRISTATE_BOOL_ABSENT =3D=3D (int) VIR_TRISTATE_SWITCH_ABS= ENT); =20 unsigned int virGetListenFDs(void); char *virGetUNIXSocketPath(int fd); diff --git a/src/util/virxml.c b/src/util/virxml.c index 6e87605ea5e4..9d35e8073228 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -507,7 +507,7 @@ char * virXMLPropString(xmlNodePtr node, const char *name) { - return (char *)xmlGetProp(node, BAD_CAST name); + return (char *) xmlGetProp(node, BAD_CAST name); } =20 =20 @@ -528,7 +528,7 @@ virXMLPropStringLimit(xmlNodePtr node, const char *name, size_t maxlen) { - char *tmp =3D (char *)xmlGetProp(node, BAD_CAST name); + char *tmp =3D (char *) xmlGetProp(node, BAD_CAST name); =20 return virXMLStringLimitInternal(tmp, maxlen, name); } @@ -546,7 +546,7 @@ virXMLPropStringLimit(xmlNodePtr node, char * virXMLNodeContentString(xmlNodePtr node) { - return (char *)xmlNodeGetContent(node); + return (char *) xmlNodeGetContent(node); } =20 =20 @@ -986,7 +986,7 @@ virXMLNodeToString(xmlDocPtr doc, goto cleanup; } =20 - ignore_value(VIR_STRDUP(ret, (const char *)xmlBufferContent(xmlbuf))); + ignore_value(VIR_STRDUP(ret, (const char *) xmlBufferContent(xmlbuf))); =20 cleanup: xmlBufferFree(xmlbuf); @@ -1043,7 +1043,7 @@ virXMLRemoveElementNamespace(xmlNodePtr node, const char *uri =3D opaque; =20 if (node->ns && - STREQ_NULLABLE((const char *)node->ns->href, uri)) + STREQ_NULLABLE((const char *) node->ns->href, uri)) xmlSetNs(node, NULL); return 0; } @@ -1097,12 +1097,12 @@ virXMLExtractNamespaceXML(xmlNodePtr root, } =20 virXMLForeachNode(nodeCopy, virXMLRemoveElementNamespace, - (void *)uri); + (void *) uri); =20 /* remove the namespace declaration * - it's only a single linked list ... doh */ for (actualNs =3D nodeCopy->nsDef; actualNs; actualNs =3D actualNs->ne= xt) { - if (STREQ_NULLABLE((const char *)actualNs->href, uri)) { + if (STREQ_NULLABLE((const char *) actualNs->href, uri)) { =20 /* unlink */ if (prevNs) @@ -1153,13 +1153,13 @@ virXMLInjectNamespace(xmlNodePtr node, { xmlNsPtr ns; =20 - if (xmlValidateNCName((const unsigned char *)key, 1) !=3D 0) { + if (xmlValidateNCName((const unsigned char *) key, 1) !=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to validate prefix for a new XML namespac= e")); return -1; } =20 - if (!(ns =3D xmlNewNs(node, (const unsigned char *)uri, (const unsigne= d char *)key))) { + if (!(ns =3D xmlNewNs(node, (const unsigned char *) uri, (const unsign= ed char *) key))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to create a new XML namespace")); return -1; --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list