diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-10-17 17:24:23 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-10-17 17:24:23 -0700 |
commit | 8710ed270fbb9ec905b906826cb09095c57003f8 (patch) | |
tree | bf5c24943bd7e3251feb084c519836194e456383 /src/XrrProviderProperty.c | |
parent | 684ed1b997f9e8a2fe2219524c1dea04b20a7e25 (diff) |
Variable scope reductions as recommended by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/XrrProviderProperty.c')
-rw-r--r-- | src/XrrProviderProperty.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/XrrProviderProperty.c b/src/XrrProviderProperty.c index 241e8ee..6d0d186 100644 --- a/src/XrrProviderProperty.c +++ b/src/XrrProviderProperty.c @@ -39,7 +39,6 @@ XRRListProviderProperties (Display *dpy, RRProvider provider, int *nprop) XExtDisplayInfo *info = XRRFindDisplay(dpy); xRRListProviderPropertiesReply rep; xRRListProviderPropertiesReq *req; - int nbytes, rbytes; Atom *props = NULL; RRCheckExtension (dpy, info, NULL); @@ -58,8 +57,8 @@ XRRListProviderProperties (Display *dpy, RRProvider provider, int *nprop) } if (rep.nAtoms) { - rbytes = rep.nAtoms * sizeof (Atom); - nbytes = rep.nAtoms << 2; + size_t rbytes = rep.nAtoms * sizeof (Atom); + size_t nbytes = rep.nAtoms << 2; props = (Atom *) Xmalloc (rbytes); if (props == NULL) { @@ -85,7 +84,7 @@ XRRQueryProviderProperty (Display *dpy, RRProvider provider, Atom property) XExtDisplayInfo *info = XRRFindDisplay(dpy); xRRQueryProviderPropertyReply rep; xRRQueryProviderPropertyReq *req; - unsigned int rbytes, nbytes; + unsigned int nbytes; XRRPropertyInfo *prop_info; RRCheckExtension (dpy, info, NULL); @@ -104,7 +103,7 @@ XRRQueryProviderProperty (Display *dpy, RRProvider provider, Atom property) } if (rep.length < ((INT_MAX / sizeof(long)) - sizeof (XRRPropertyInfo))) { - rbytes = sizeof (XRRPropertyInfo) + (rep.length * sizeof (long)); + size_t rbytes = sizeof (XRRPropertyInfo) + (rep.length * sizeof (long)); nbytes = rep.length << 2; prop_info = Xmalloc (rbytes); @@ -257,7 +256,6 @@ XRRGetProviderProperty (Display *dpy, RRProvider provider, XExtDisplayInfo *info = XRRFindDisplay(dpy); xRRGetProviderPropertyReply rep; xRRGetProviderPropertyReq *req; - unsigned long nbytes, rbytes; /* Always initialize return values, in case callers fail to initialize them and fail to check the return code for an error. */ @@ -289,6 +287,7 @@ XRRGetProviderProperty (Display *dpy, RRProvider provider, if (rep.propertyType != None) { int format = rep.format; + unsigned long nbytes, rbytes; /* * Protect against both integer overflow and just plain oversized |