mirror of
https://github.com/reactos/sysreg2.git
synced 2024-11-26 21:00:27 +00:00
[SYSREG2]
Make sysreg2 pass cppcheck analysis svn path=/trunk/sysreg2/; revision=2076
This commit is contained in:
parent
cca2c688ef
commit
9c57ebcb1f
@ -25,7 +25,6 @@ bool LibVirt::IsMachineRunning(const char* name, bool destroy)
|
||||
int* ids = NULL;
|
||||
int numids;
|
||||
int maxids = 0;
|
||||
const char* domname;
|
||||
virDomainPtr vDomPtr = NULL;
|
||||
|
||||
maxids = virConnectNumOfDomains(vConn);
|
||||
@ -43,7 +42,7 @@ bool LibVirt::IsMachineRunning(const char* name, bool destroy)
|
||||
for(i=0; i<numids; i++)
|
||||
{
|
||||
vDomPtr = virDomainLookupByID(vConn, ids[i]);
|
||||
domname = virDomainGetName(vDomPtr);
|
||||
const char *domname = virDomainGetName(vDomPtr);
|
||||
if (strcasecmp(name, domname) == 0)
|
||||
{
|
||||
bool Ret = true;
|
||||
@ -104,8 +103,6 @@ bool LibVirt::LaunchMachine(const char* XmlFileName, const char* BootDevice)
|
||||
xmlXPathObjectPtr obj = NULL;
|
||||
xmlXPathContextPtr ctxt = NULL;
|
||||
char* buffer;
|
||||
const char* name;
|
||||
char* domname;
|
||||
int len = 0;
|
||||
|
||||
buffer = ReadFile(XmlFileName);
|
||||
@ -155,8 +152,8 @@ bool LibVirt::LaunchMachine(const char* XmlFileName, const char* BootDevice)
|
||||
else
|
||||
{
|
||||
/* workaround a bug in libvirt */
|
||||
name = virDomainGetName(vDom);
|
||||
domname = strdup(name);
|
||||
const char *name = virDomainGetName(vDom);
|
||||
char *domname = strdup(name);
|
||||
virDomainFree(vDom);
|
||||
vDom = virDomainLookupByName(vConn, domname);
|
||||
free(domname);
|
||||
|
@ -82,7 +82,6 @@ void InitializeModuleList()
|
||||
void CleanModuleList()
|
||||
{
|
||||
ModuleListEntry* CurrentElement;
|
||||
ModuleListEntry* PreviousElement;
|
||||
|
||||
CurrentElement = ModuleList->Next;
|
||||
|
||||
@ -91,7 +90,7 @@ void CleanModuleList()
|
||||
free(CurrentElement->Module);
|
||||
free(CurrentElement->Path);
|
||||
|
||||
PreviousElement = CurrentElement;
|
||||
ModuleListEntry* PreviousElement = CurrentElement;
|
||||
CurrentElement = CurrentElement->Next;
|
||||
free(PreviousElement);
|
||||
}
|
||||
@ -121,10 +120,8 @@ bool ResolveAddressFromFile(char* Buffer, size_t BufferSize, const char* Data)
|
||||
bool ReturnValue = false;
|
||||
char* Address = NULL;
|
||||
char* AddressStart;
|
||||
char Command[256];
|
||||
char* Module = NULL;
|
||||
char* pBuffer;
|
||||
FILE* Process;
|
||||
ModuleListEntry* ModuleEntry;
|
||||
size_t AddressLength;
|
||||
|
||||
@ -157,9 +154,11 @@ bool ResolveAddressFromFile(char* Buffer, size_t BufferSize, const char* Data)
|
||||
/* Try to find the path to this module */
|
||||
if ((ModuleEntry = FindModule(Module)))
|
||||
{
|
||||
char Command[256];
|
||||
|
||||
/* Run raddr2line */
|
||||
sprintf(Command, "%s/host-tools/tools/rsym/raddr2line %s %s 2>/dev/null", OutputPath, ModuleEntry->Path, Address);
|
||||
Process = popen(Command, "r");
|
||||
FILE* Process = popen(Command, "r");
|
||||
|
||||
if(!feof(Process))
|
||||
{
|
||||
|
8
utils.c
8
utils.c
@ -14,11 +14,11 @@ ssize_t safewrite(int fd, const void *buf, size_t count, int timeout)
|
||||
struct pollfd fds[] = {
|
||||
{ fd, POLLOUT, 0 },
|
||||
};
|
||||
int got;
|
||||
size_t nwritten = 0;
|
||||
|
||||
while (count > 0) {
|
||||
/* Ensure we can write to the fd */
|
||||
got = poll(fds, (sizeof(fds) / sizeof(struct pollfd)), timeout);
|
||||
int got = poll(fds, (sizeof(fds) / sizeof(struct pollfd)), timeout);
|
||||
/* Timeout, signal it to caller */
|
||||
if (got == 0) {
|
||||
errno = EWOULDBLOCK;
|
||||
@ -47,7 +47,7 @@ ssize_t safewrite(int fd, const void *buf, size_t count, int timeout)
|
||||
char * ReadFile (const char *filename)
|
||||
{
|
||||
char *buffer = NULL, *oldbuffer;
|
||||
int len = 0, fd, r;
|
||||
int len = 0, fd;
|
||||
char b[1024];
|
||||
|
||||
fd = open (filename, O_RDONLY);
|
||||
@ -55,7 +55,7 @@ char * ReadFile (const char *filename)
|
||||
return NULL;
|
||||
|
||||
for (;;) {
|
||||
r = read (fd, b, sizeof b);
|
||||
int r = read (fd, b, sizeof b);
|
||||
if (r == -1)
|
||||
{
|
||||
if (buffer) free (buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user