mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Fix unused-but-set warnings in helper functions.
Instead of storing the return value and ignoring it use it directly to check if an error occured. Addresses FS#12542. Change-Id: I447afa006366acfd1851d5b13cae5f1561050283
This commit is contained in:
parent
633749ea61
commit
b18bbabc91
1 changed files with 29 additions and 25 deletions
|
@ -76,34 +76,34 @@
|
||||||
#if defined(Q_OS_WIN32)
|
#if defined(Q_OS_WIN32)
|
||||||
enum System::userlevel System::userPermissions(void)
|
enum System::userlevel System::userPermissions(void)
|
||||||
{
|
{
|
||||||
LPUSER_INFO_1 buf;
|
LPUSER_INFO_1 buf = NULL;
|
||||||
NET_API_STATUS napistatus;
|
|
||||||
wchar_t userbuf[UNLEN];
|
wchar_t userbuf[UNLEN];
|
||||||
DWORD usersize = UNLEN;
|
DWORD usersize = UNLEN;
|
||||||
BOOL status;
|
BOOL status;
|
||||||
enum userlevel result;
|
enum userlevel result = ERR;
|
||||||
|
|
||||||
status = GetUserNameW(userbuf, &usersize);
|
status = GetUserNameW(userbuf, &usersize);
|
||||||
if(!status)
|
if(!status)
|
||||||
return ERR;
|
return ERR;
|
||||||
|
|
||||||
napistatus = NetUserGetInfo(NULL, userbuf, (DWORD)1, (LPBYTE*)&buf);
|
if(NetUserGetInfo(NULL, userbuf, (DWORD)1, (LPBYTE*)&buf) == NERR_Success) {
|
||||||
|
switch(buf->usri1_priv) {
|
||||||
switch(buf->usri1_priv) {
|
case USER_PRIV_GUEST:
|
||||||
case USER_PRIV_GUEST:
|
result = GUEST;
|
||||||
result = GUEST;
|
break;
|
||||||
break;
|
case USER_PRIV_USER:
|
||||||
case USER_PRIV_USER:
|
result = USER;
|
||||||
result = USER;
|
break;
|
||||||
break;
|
case USER_PRIV_ADMIN:
|
||||||
case USER_PRIV_ADMIN:
|
result = ADMIN;
|
||||||
result = ADMIN;
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
result = ERR;
|
||||||
result = ERR;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
NetApiBufferFree(buf);
|
if(buf != NULL)
|
||||||
|
NetApiBufferFree(buf);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -142,9 +142,9 @@ QString System::userName(void)
|
||||||
#if defined(Q_OS_WIN32)
|
#if defined(Q_OS_WIN32)
|
||||||
wchar_t userbuf[UNLEN];
|
wchar_t userbuf[UNLEN];
|
||||||
DWORD usersize = UNLEN;
|
DWORD usersize = UNLEN;
|
||||||
BOOL status;
|
|
||||||
|
|
||||||
status = GetUserNameW(userbuf, &usersize);
|
if(GetUserNameW(userbuf, &usersize) == 0)
|
||||||
|
return QString();
|
||||||
|
|
||||||
return QString::fromWCharArray(userbuf);
|
return QString::fromWCharArray(userbuf);
|
||||||
#endif
|
#endif
|
||||||
|
@ -246,11 +246,15 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
#if defined(LIBUSB1)
|
#if defined(LIBUSB1)
|
||||||
libusb_device **devs;
|
libusb_device **devs;
|
||||||
int res;
|
if(libusb_init(NULL) != 0) {
|
||||||
ssize_t count;
|
qDebug() << "[System] Initializing libusb-1 failed.";
|
||||||
res = libusb_init(NULL);
|
return usbids;
|
||||||
|
}
|
||||||
|
|
||||||
count = libusb_get_device_list(NULL, &devs);
|
if(libusb_get_device_list(NULL, &devs) < 1) {
|
||||||
|
qDebug() << "[System] Error getting device list.";
|
||||||
|
return usbids;
|
||||||
|
}
|
||||||
libusb_device *dev;
|
libusb_device *dev;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while((dev = devs[i++]) != NULL) {
|
while((dev = devs[i++]) != NULL) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue