summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-03-19 12:49:56 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-03-19 14:30:52 -0700
commit58073bc12d17341cb9459f36caf161256fc8be19 (patch)
tree946118c7e622deca3e584c0115cb81d97f75c03e /src
parent0f537ab4913a8d2b3e58a40385a7745c4974bd76 (diff)
Variable scope reductions as recommended by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src')
-rw-r--r--src/XvMC.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/XvMC.c b/src/XvMC.c
index 262469a..cf92662 100644
--- a/src/XvMC.c
+++ b/src/XvMC.c
@@ -115,12 +115,11 @@ XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num)
surface_info = Xmalloc(rep.num * sizeof(XvMCSurfaceInfo));
if (surface_info) {
- xvmcSurfaceInfo sinfo;
- CARD32 i;
-
*num = rep.num;
- for (i = 0; i < rep.num; i++) {
+ for (CARD32 i = 0; i < rep.num; i++) {
+ xvmcSurfaceInfo sinfo;
+
_XRead(dpy, (char *) &sinfo, sizeof(xvmcSurfaceInfo));
surface_info[i].surface_type_id = sinfo.surface_type_id;
surface_info[i].chroma_format = sinfo.chroma_format;
@@ -173,12 +172,11 @@ XvMCListSubpictureTypes(Display *dpy,
ret = Xmalloc(rep.num * sizeof(XvImageFormatValues));
if (ret) {
- xvImageFormatInfo Info;
- CARD32 i;
-
*count_return = rep.num;
- for (i = 0; i < rep.num; i++) {
+ for (CARD32 i = 0; i < rep.num; i++) {
+ xvImageFormatInfo Info;
+
_XRead(dpy, (char *) (&Info), sz_xvImageFormatInfo);
ret[i].id = Info.id;
ret[i].type = Info.type;
@@ -477,16 +475,10 @@ XvMCGetDRInfo(Display *dpy, XvPortID port,
XExtDisplayInfo *info = xvmc_find_display(dpy);
xvmcGetDRInfoReply rep;
xvmcGetDRInfoReq *req;
- CARD32 magic;
#ifdef HAVE_SHMAT
int shmKey;
volatile CARD32 *shMem;
- struct timezone here;
- struct timeval now;
-
- here.tz_minuteswest = 0;
- here.tz_dsttime = 0;
#endif
*name = NULL;
@@ -498,7 +490,6 @@ XvMCGetDRInfo(Display *dpy, XvPortID port,
XvMCGetReq(GetDRInfo, req);
req->port = port;
- magic = 0;
req->magic = 0;
#ifdef HAVE_SHMAT
shmKey = shmget(IPC_PRIVATE, 1024, IPC_CREAT | 0600);
@@ -520,6 +511,9 @@ XvMCGetDRInfo(Display *dpy, XvPortID port,
register volatile CARD32 *shMemC = shMem;
register int i;
+ CARD32 magic;
+ struct timezone here = {0, 0};
+ struct timeval now;
gettimeofday(&now, &here);
magic = now.tv_usec & 0x000FFFFF;