Run cppcheck static analyzer against code base. Fixed a few warnings.
This commit is contained in:
parent
c324a82526
commit
e2ac013cbb
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PROJECT_ROOT=$( cd "$(dirname ${BASH_SOURCE[0]})"/.. && pwd )
|
||||||
|
echo $PROJECT_ROOT;
|
||||||
|
|
||||||
|
SRC_DIR=$PROJECT_ROOT/src
|
||||||
|
|
||||||
|
cd $SRC_DIR;
|
||||||
|
|
||||||
|
cppcheck --version
|
||||||
|
|
||||||
|
IGNORE_DIRS=" -i ./attic "
|
||||||
|
IGNORE_DIRS+="-i ./drivers/sdl "
|
||||||
|
#IGNORE_DIRS+="-i ./drivers/win "
|
||||||
|
|
||||||
|
cppcheck --force $IGNORE_DIRS .
|
|
@ -364,14 +364,6 @@ endif()
|
||||||
include_directories( ${CMAKE_SOURCE_DIR}/src )
|
include_directories( ${CMAKE_SOURCE_DIR}/src )
|
||||||
include_directories( ${CMAKE_SOURCE_DIR}/src/drivers )
|
include_directories( ${CMAKE_SOURCE_DIR}/src/drivers )
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
add_definitions( -DPSS_STYLE=1 )
|
|
||||||
else(APPLE)
|
|
||||||
if(UNIX)
|
|
||||||
add_definitions( -DPSS_STYLE=1 )
|
|
||||||
endif(UNIX)
|
|
||||||
endif(APPLE)
|
|
||||||
|
|
||||||
set(SRC_CORE
|
set(SRC_CORE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/asm.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/asm.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cart.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/cart.cpp
|
||||||
|
|
|
@ -168,12 +168,12 @@ int NetPlayServer::sendRomLoadReq( NetPlayClient *client )
|
||||||
filepath = GameInfo->filename;
|
filepath = GameInfo->filename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("Prep ROM Load Request: %s \n", filepath );
|
|
||||||
|
|
||||||
if (filepath == nullptr)
|
if (filepath == nullptr)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
printf("Prep ROM Load Request: %s \n", filepath );
|
||||||
FILE *fp = ::fopen( filepath, "r");
|
FILE *fp = ::fopen( filepath, "r");
|
||||||
|
|
||||||
if (fp == nullptr)
|
if (fp == nullptr)
|
||||||
|
|
|
@ -167,10 +167,10 @@ int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover)
|
||||||
|
|
||||||
void MakeFilters(int32 rate)
|
void MakeFilters(int32 rate)
|
||||||
{
|
{
|
||||||
const int32 *tabs[6]={C44100NTSC,C44100PAL,C48000NTSC,C48000PAL,C96000NTSC,
|
const int32 *tabs[8]={C44100NTSC,C44100PAL,C48000NTSC,C48000PAL,C96000NTSC,
|
||||||
C96000PAL};
|
C96000PAL, nullptr, nullptr};
|
||||||
const int32 *sq2tabs[6]={SQ2C44100NTSC,SQ2C44100PAL,SQ2C48000NTSC,SQ2C48000PAL,
|
const int32 *sq2tabs[8]={SQ2C44100NTSC,SQ2C44100PAL,SQ2C48000NTSC,SQ2C48000PAL,
|
||||||
SQ2C96000NTSC,SQ2C96000PAL};
|
SQ2C96000NTSC,SQ2C96000PAL, nullptr, nullptr};
|
||||||
|
|
||||||
const int32 *tmp;
|
const int32 *tmp;
|
||||||
int32 x;
|
int32 x;
|
||||||
|
|
|
@ -22,14 +22,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "share.h"
|
#include "share.h"
|
||||||
|
#include "zapper.h"
|
||||||
typedef struct {
|
|
||||||
uint32 mzx,mzy,mzb;
|
|
||||||
int zap_readbit;
|
|
||||||
int bogo;
|
|
||||||
int zappo;
|
|
||||||
uint64 zaphit;
|
|
||||||
} ZAPPER;
|
|
||||||
|
|
||||||
static ZAPPER ZD;
|
static ZAPPER ZD;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ struct ZAPPER
|
||||||
uint8 bogo;
|
uint8 bogo;
|
||||||
int zappo;
|
int zappo;
|
||||||
uint64 zaphit;
|
uint64 zaphit;
|
||||||
uint32 lastInput;
|
uint32 lastInput;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -60,7 +60,7 @@ static uint8 rp2c05004_colortable[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
main()
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
for(x=0;x<64;x++)
|
for(x=0;x<64;x++)
|
||||||
|
@ -71,4 +71,5 @@ main()
|
||||||
palette[rp2c04001_colortable[x]&0x3F].g,
|
palette[rp2c04001_colortable[x]&0x3F].g,
|
||||||
palette[rp2c04001_colortable[x]&0x3F].b);
|
palette[rp2c04001_colortable[x]&0x3F].b);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
14
src/types.h
14
src/types.h
|
@ -96,9 +96,6 @@ typedef uint32_t uint32;
|
||||||
#define GINLINE /* Can't declare a function INLINE
|
#define GINLINE /* Can't declare a function INLINE
|
||||||
and global in MSVC. Bummer.
|
and global in MSVC. Bummer.
|
||||||
*/
|
*/
|
||||||
#define PSS_STYLE 2 /* Does MSVC compile for anything
|
|
||||||
other than Windows/DOS targets?
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if _MSC_VER >= 1300
|
#if _MSC_VER >= 1300
|
||||||
#pragma warning(disable:4244) //warning C4244: '=' : conversion from 'uint32' to 'uint8', possible loss of data
|
#pragma warning(disable:4244) //warning C4244: '=' : conversion from 'uint32' to 'uint8', possible loss of data
|
||||||
|
@ -110,6 +107,17 @@ typedef uint32_t uint32;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
|
||||||
|
|
||||||
|
#define PSS_STYLE 1
|
||||||
|
|
||||||
|
#elif defined(MSVC)
|
||||||
|
|
||||||
|
#define PSS_STYLE 2 /* Does MSVC compile for anything
|
||||||
|
other than Windows/DOS targets?
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
|
||||||
#if PSS_STYLE==2
|
#if PSS_STYLE==2
|
||||||
|
|
||||||
#define PSS "\\"
|
#define PSS "\\"
|
||||||
|
|
Loading…
Reference in New Issue