Fixed some errors reported by colobot-lint

dev-time-step
krzys-h 2016-01-23 20:58:03 +01:00
parent 344cda4ae6
commit 048534e89d
10 changed files with 21 additions and 13 deletions

View File

@ -55,7 +55,8 @@ void CBotDebug::DumpCompiledProgram(CBotProgram* program)
}
std::set<CBotInstr*> finished;
std::function<void(CBotInstr*)> DumpInstr = [&](CBotInstr* instr) {
std::function<void(CBotInstr*)> DumpInstr = [&](CBotInstr* instr)
{
if (finished.find(instr) != finished.end()) return;
finished.insert(instr);

View File

@ -170,7 +170,8 @@ enum TokenId
/**
* \brief Types of tokens
*/
enum TokenType {
enum TokenType
{
TokenTypNone = 0,
TokenTypKeyWord = 1, //!< keyword of the language (see TokenKeyWord)
TokenTypNum = 2, //!< number

View File

@ -168,4 +168,4 @@ bool CBotExternalCallDefault::Run(CBotVar* thisVar, CBotStack* pStack)
return true;
}
}
}

View File

@ -117,7 +117,8 @@ static const std::map<TokenId, const std::string> KEYWORDS = {
{TX_NAN, "not a number"}
};
namespace {
namespace
{
static const std::string emptyString = "";
}
const std::string& LoadString(TokenId id)

View File

@ -96,7 +96,8 @@ long GetNumInt(const std::string& str);
*/
float GetNumFloat(const std::string& str);
template<typename T> class CBotLinkedList {
template<typename T> class CBotLinkedList
{
public:
/**
* \brief Destructor. Be careful, destroys the whole linked list!
@ -134,7 +135,8 @@ protected:
T* m_next = nullptr;
};
template<typename T> class CBotDoublyLinkedList {
template<typename T> class CBotDoublyLinkedList
{
public:
/**
* \brief Destructor. Be careful, destroys the whole linked list!

View File

@ -28,7 +28,8 @@
namespace CBot
{
namespace {
namespace
{
std::unique_ptr<CBotFileAccessHandler> g_fileHandler;
std::unordered_map<int, std::unique_ptr<CBotFile>> g_files;
int g_nextFileId = 1;

View File

@ -3448,4 +3448,4 @@ void CScriptFunctions::DestroyObjectVar(CBotVar* botVar, bool permanent)
bool CScriptFunctions::CheckOpenFiles()
{
return CBotFileColobot::m_numFilesOpen > 0;
}
}

View File

@ -51,7 +51,8 @@ protected:
CBotToken* token = tokens.get()->GetNext(); // TODO: why do we always have to skip the first one :/
ASSERT_TRUE(token != nullptr);
unsigned int i = 0;
do {
do
{
ASSERT_LT(i, data.size()) << "too many tokens processed";
TokenTest correct = data[i];
@ -120,4 +121,4 @@ TEST_F(CBotTokenUT, BasicProgram)
{";", ID_SEP},
{"}", ID_CLBLK},
});
}
}

View File

@ -39,7 +39,8 @@ public:
}
private:
class CBotTestFail : public std::runtime_error {
class CBotTestFail : public std::runtime_error
{
public:
CBotTestFail(const std::string& message) : runtime_error(message)
{
@ -982,4 +983,4 @@ TEST_F(CBotUT, DISABLED_TestNANParam_Issue642)
" ASSERT(test(nan) == nan);\n"
"}\n"
);
}
}

View File

@ -10,7 +10,7 @@ set(UT_SOURCES
main.cpp
app/app_test.cpp
CBot/CBotToken_test.cpp
CBot/CBot.cpp
CBot/CBot_test.cpp
common/config_file_test.cpp
graphics/engine/lightman_test.cpp
math/func_test.cpp