mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 09:39:46 -06:00
Various changes suggested by cppcheck
- remove unused variables - reduce the scope where it makes sense - correct limits (did you know that strcat()'s last parameter does not include the \0 that is always added?) - set some free()'d pointers to NULL
This commit is contained in:
@ -735,8 +735,8 @@ public:
|
||||
{
|
||||
#ifndef __SYMBIAN32__
|
||||
FreeMemoryPages(region, region_size);
|
||||
#endif
|
||||
region = NULL;
|
||||
#endif
|
||||
region_size = 0;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ std::vector<std::string> cdio_get_devices ()
|
||||
for (unsigned int j = checklist[i].num_min; j <= checklist[i].num_max; ++j)
|
||||
{
|
||||
std::string drive = StringFromFormat(checklist[i].format, j);
|
||||
if ( (is_cdrom(drive, NULL)) > 0 )
|
||||
if (is_cdrom(drive, NULL))
|
||||
{
|
||||
drives.push_back(std::move(drive));
|
||||
}
|
||||
|
@ -25,6 +25,14 @@ extern const char *netplay_dolphin_ver;
|
||||
#define LOGGING 1
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || __clang__
|
||||
// Disable "unused function" warnings for the ones manually marked as such.
|
||||
#define UNUSED __attribute__((unused))
|
||||
#else
|
||||
// Not sure MSVC even checks this...
|
||||
#define UNUSED
|
||||
#endif
|
||||
|
||||
#define STACKALIGN
|
||||
|
||||
#if __cplusplus >= 201103 || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
|
@ -362,8 +362,6 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
|
||||
{
|
||||
STACKFRAME callStack;
|
||||
BOOL bResult;
|
||||
TCHAR symInfo[BUFFERSIZE] = _T("?");
|
||||
TCHAR srcInfo[BUFFERSIZE] = _T("?");
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
|
||||
// If it's not this thread, let's suspend it, and resume it at the end
|
||||
|
@ -20,11 +20,11 @@ namespace FPURoundMode
|
||||
PREC_53 = 1,
|
||||
PREC_64 = 2
|
||||
};
|
||||
void SetRoundMode(enum RoundModes mode);
|
||||
void SetRoundMode(RoundModes mode);
|
||||
|
||||
void SetPrecisionMode(enum PrecisionModes mode);
|
||||
void SetPrecisionMode(PrecisionModes mode);
|
||||
|
||||
void SetSIMDMode(enum RoundModes rounding_mode, bool non_ieee_mode);
|
||||
void SetSIMDMode(RoundModes rounding_mode, bool non_ieee_mode);
|
||||
|
||||
/*
|
||||
* There are two different flavors of float to int conversion:
|
||||
|
@ -21,13 +21,13 @@
|
||||
// Generic, do nothing
|
||||
namespace FPURoundMode
|
||||
{
|
||||
void SetRoundMode(enum RoundModes mode)
|
||||
void SetRoundMode(RoundModes mode)
|
||||
{
|
||||
}
|
||||
void SetPrecisionMode(enum PrecisionModes mode)
|
||||
void SetPrecisionMode(PrecisionModes mode)
|
||||
{
|
||||
}
|
||||
void SetSIMDMode(enum RoundModes rounding_mode, bool non_ieee_mode)
|
||||
void SetSIMDMode(RoundModes rounding_mode, bool non_ieee_mode)
|
||||
{
|
||||
}
|
||||
void SaveSIMDState()
|
||||
|
@ -124,13 +124,12 @@ bool IniFile::Section::Get(const std::string& key, std::vector<std::string>& out
|
||||
}
|
||||
// ignore starting , if any
|
||||
size_t subStart = temp.find_first_not_of(",");
|
||||
size_t subEnd;
|
||||
|
||||
// split by ,
|
||||
while (subStart != std::string::npos)
|
||||
{
|
||||
// Find next ,
|
||||
subEnd = temp.find_first_of(",", subStart);
|
||||
size_t subEnd = temp.find_first_of(",", subStart);
|
||||
if (subStart != subEnd)
|
||||
// take from first char until next ,
|
||||
out.push_back(StripSpaces(temp.substr(subStart, subEnd - subStart)));
|
||||
|
@ -36,7 +36,7 @@ int AshmemCreateFileMapping(const char *name, size_t size)
|
||||
return fd;
|
||||
|
||||
// We don't really care if we can't set the name, it is optional
|
||||
ret = ioctl(fd, ASHMEM_SET_NAME, name);
|
||||
ioctl(fd, ASHMEM_SET_NAME, name);
|
||||
|
||||
ret = ioctl(fd, ASHMEM_SET_SIZE, size);
|
||||
if (ret < 0)
|
||||
|
@ -129,11 +129,10 @@ void FreeMemoryPages(void* ptr, size_t size)
|
||||
if (ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
if (!VirtualFree(ptr, 0, MEM_RELEASE))
|
||||
{
|
||||
PanicAlert("FreeMemoryPages failed!\n%s", GetLastErrorMsg());
|
||||
ptr = NULL; // Is this our responsibility?
|
||||
|
||||
}
|
||||
#else
|
||||
munmap(ptr, size);
|
||||
#endif
|
||||
@ -145,9 +144,9 @@ void FreeAlignedMemory(void* ptr)
|
||||
if (ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_aligned_free(ptr);
|
||||
_aligned_free(ptr);
|
||||
#else
|
||||
free(ptr);
|
||||
free(ptr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace FPURoundMode
|
||||
static u32 saved_sse_state = _mm_getcsr();
|
||||
static const u32 default_sse_state = _mm_getcsr();
|
||||
|
||||
void SetRoundMode(enum RoundModes mode)
|
||||
void SetRoundMode(RoundModes mode)
|
||||
{
|
||||
// Set FPU rounding mode to mimic the PowerPC's
|
||||
#ifdef _M_IX86
|
||||
@ -49,7 +49,7 @@ namespace FPURoundMode
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetPrecisionMode(enum PrecisionModes mode)
|
||||
void SetPrecisionMode(PrecisionModes mode)
|
||||
{
|
||||
#ifdef _M_IX86
|
||||
// sets the floating-point lib to 53-bit
|
||||
@ -75,7 +75,7 @@ namespace FPURoundMode
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetSIMDMode(enum RoundModes rounding_mode, bool non_ieee_mode)
|
||||
void SetSIMDMode(RoundModes rounding_mode, bool non_ieee_mode)
|
||||
{
|
||||
// OR-mask for disabling FPU exceptions (bits 7-12 in the MXCSR register)
|
||||
const u32 EXCEPTION_MASK = 0x1F80;
|
||||
|
Reference in New Issue
Block a user