14c15c680d
issue detected by cppcheck [channels/drive/client/drive_main.c:454] -> [channels/drive/client/drive_main.c:443]: (warning) Either the condition '!irp' is redundant or there is possible null pointer dereference: irp. [client/X11/xf_window.c:582] -> [client/X11/xf_window.c:580]: (warning) Either the condition '!xfc' is redundant or there is possible null pointer dereference: xfc. [winpr/libwinpr/path/test/TestPathShell.c:40] -> [winpr/libwinpr/path/test/TestPathShell.c:43]: (warning) Either the condition '!path' is redundant or there is possible null pointer dereference: path. [winpr/libwinpr/path/test/TestPathShell.c:49] -> [winpr/libwinpr/path/test/TestPathShell.c:52]: (warning) Either the condition '!path' is redundant or there is possible null pointer dereference: path.
68 lines
1.1 KiB
C
68 lines
1.1 KiB
C
|
|
#include <stdio.h>
|
|
#include <winpr/crt.h>
|
|
#include <winpr/path.h>
|
|
#include <winpr/tchar.h>
|
|
#include <winpr/winpr.h>
|
|
|
|
int TestPathShell(int argc, char* argv[])
|
|
{
|
|
const int paths[] =
|
|
{
|
|
KNOWN_PATH_HOME,
|
|
KNOWN_PATH_TEMP,
|
|
KNOWN_PATH_XDG_DATA_HOME,
|
|
KNOWN_PATH_XDG_CONFIG_HOME,
|
|
KNOWN_PATH_XDG_CACHE_HOME,
|
|
KNOWN_PATH_XDG_RUNTIME_DIR,
|
|
KNOWN_PATH_XDG_CONFIG_HOME
|
|
};
|
|
const char* names[] =
|
|
{
|
|
"KNOWN_PATH_HOME",
|
|
"KNOWN_PATH_TEMP",
|
|
"KNOWN_PATH_XDG_DATA_HOME",
|
|
"KNOWN_PATH_XDG_CONFIG_HOME",
|
|
"KNOWN_PATH_XDG_CACHE_HOME",
|
|
"KNOWN_PATH_XDG_RUNTIME_DIR",
|
|
"KNOWN_PATH_XDG_CONFIG_HOME"
|
|
};
|
|
int rc = 0;
|
|
size_t x;
|
|
|
|
for (x = 0; x < sizeof(paths) / sizeof(paths[0]); x++)
|
|
{
|
|
const int id = paths[x];
|
|
const char* name = names[x];
|
|
{
|
|
char* path = GetKnownPath(id);
|
|
|
|
if (!path)
|
|
{
|
|
rc = -1;
|
|
}
|
|
else
|
|
{
|
|
printf("%s Path: %s\n", name, path);
|
|
}
|
|
free(path);
|
|
}
|
|
{
|
|
char* path = GetKnownSubPath(id, "freerdp");
|
|
|
|
if (!path)
|
|
{
|
|
rc = -1;
|
|
}
|
|
else
|
|
{
|
|
printf("%s SubPath: %s\n", name, path);
|
|
}
|
|
free(path);
|
|
}
|
|
}
|
|
|
|
return rc;
|
|
}
|
|
|