summaryrefslogtreecommitdiff
path: root/wrapper/XvMCWrapper.c
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 /wrapper/XvMCWrapper.c
parent0f537ab4913a8d2b3e58a40385a7745c4974bd76 (diff)
Variable scope reductions as recommended by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'wrapper/XvMCWrapper.c')
-rw-r--r--wrapper/XvMCWrapper.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/wrapper/XvMCWrapper.c b/wrapper/XvMCWrapper.c
index 7a07634..35c74ee 100644
--- a/wrapper/XvMCWrapper.c
+++ b/wrapper/XvMCWrapper.c
@@ -222,13 +222,14 @@ dlopenversion(const char *lib, const char *version, int flag)
void *ret;
int curLen, verLen;
char *curName;
- const char *tail;
curLen = strlen(lib) + (verLen = strlen(version)) + 1;
curName = (char *) malloc(curLen * sizeof(char));
strncpy(curName, lib, curLen);
if (verLen > 1) {
- if (NULL != (tail = strstr(version + 1, "."))) {
+ const char *tail = strstr(version + 1, ".");
+
+ if (NULL != tail) {
strncat(curName, version, tail - version);
}
else {
@@ -279,13 +280,9 @@ initW(Display *dpy, XvPortID port)
{
char nameBuffer[BUFLEN];
void *handle;
- int tmp;
char *clientName = NULL;
char *err;
- FILE *configFile;
int nameLen = 0;
- int major, minor, patchLevel, isLocal;
- char *busID = NULL;
wrapperInit = 1;
xW.initialised = 0;
@@ -302,6 +299,9 @@ initW(Display *dpy, XvPortID port)
dlsym(handle2, "XvMCGetDRInfo");
if ((err = dlerror()) == NULL) {
+ int major, minor, patchLevel, isLocal;
+ char *busID = NULL;
+
if (0 == xW.XvMCGetDRInfo(dpy, port, &clientName, &busID, &major,
&minor, &patchLevel, &isLocal)) {
nameLen = strlen(clientName);
@@ -332,6 +332,9 @@ initW(Display *dpy, XvPortID port)
* No. Try to obtain it from the config file.
*/
+ int tmp;
+ FILE *configFile;
+
if (clientName)
XFree(clientName);