Skip to content

Commit

Permalink
Updated to AStyle 2.03, require this version
Browse files Browse the repository at this point in the history
  • Loading branch information
PKEuS committed Aug 7, 2013
1 parent dd82817 commit a9a5dc0
Show file tree
Hide file tree
Showing 76 changed files with 3,743 additions and 3,743 deletions.
7,020 changes: 3,510 additions & 3,510 deletions htdocs/archive/miniz.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions htdocs/archive/webarchive.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static void unencode(const char *src, char *dest)
*dest = '\0';
}

int readdata(char * * const data, int sz)
int readdata(char ** const data, int sz)
{
FILE *f = fopen("data.txt", "rt");
if (!f)
Expand Down Expand Up @@ -88,7 +88,7 @@ int getversion(const char *data)
return ret;
}

void sortdata(char * * const data, int sz)
void sortdata(char ** const data, int sz)
{
for (int i = 1; i < sz && data[i]; i++) {
if (strcmp(data[i-1], data[i]) > 0) {
Expand Down
8 changes: 4 additions & 4 deletions lib/check.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class CPPCHECKLIB Check {

/** This constructor is used when running checks. */
Check(const std::string &aname, const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: _tokenizer(tokenizer), _settings(settings), _errorLogger(errorLogger), _name(aname)
{ }
: _tokenizer(tokenizer), _settings(settings), _errorLogger(errorLogger), _name(aname) {
}

virtual ~Check() {
#if !defined(DJGPP) && !defined(__sun)
Expand Down Expand Up @@ -79,8 +79,8 @@ class CPPCHECKLIB Check {
}

/** run checks, the token list is not simplified */
virtual void runChecks(const Tokenizer *, const Settings *, ErrorLogger *)
{ }
virtual void runChecks(const Tokenizer *, const Settings *, ErrorLogger *) {
}

/** run checks, the token list is simplified */
virtual void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) = 0;
Expand Down
8 changes: 4 additions & 4 deletions lib/checkassert.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@

class CPPCHECKLIB CheckAssert : public Check {
public:
CheckAssert() : Check(myName())
{}
CheckAssert() : Check(myName()) {
}

CheckAssert(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{}
: Check(myName(), tokenizer, settings, errorLogger) {
}

virtual void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
CheckAssert check(tokenizer, settings, errorLogger);
Expand Down
8 changes: 4 additions & 4 deletions lib/checkautovariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ bool CheckAutoVariables::isPtrArg(const Token *tok)
{
const Variable *var = tok->variable();

return(var && var->isArgument() && var->isPointer());
return (var && var->isArgument() && var->isPointer());
}

bool CheckAutoVariables::isRefPtrArg(const Token *tok)
{
const Variable *var = tok->variable();

return(var && var->isArgument() && var->isReference() && var->isPointer());
return (var && var->isArgument() && var->isReference() && var->isPointer());
}

bool CheckAutoVariables::isNonReferenceArg(const Token *tok)
{
const Variable *var = tok->variable();

return(var && var->isArgument() && !var->isReference() && (var->isPointer() || var->typeStartToken()->isStandardType() || var->type()));
return (var && var->isArgument() && !var->isReference() && (var->isPointer() || var->typeStartToken()->isStandardType() || var->type()));
}

bool CheckAutoVariables::isAutoVar(const Token *tok)
Expand Down Expand Up @@ -96,7 +96,7 @@ static bool checkRvalueExpression(const Token * const vartok)
return var2 && !var2->isPointer();
}

return((next->str() != "." || (!var->isPointer() && (!var->isClass() || var->type()))) && next->strAt(2) != ".");
return ((next->str() != "." || (!var->isPointer() && (!var->isClass() || var->type()))) && next->strAt(2) != ".");
}

static bool variableIsUsedInScope(const Token* start, unsigned int varId, const Scope *scope)
Expand Down
8 changes: 4 additions & 4 deletions lib/checkautovariables.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
class CPPCHECKLIB CheckAutoVariables : public Check {
public:
/** This constructor is used when registering the CheckClass */
CheckAutoVariables() : Check(myName())
{ }
CheckAutoVariables() : Check(myName()) {
}

/** This constructor is used when running checks. */
CheckAutoVariables(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}

/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
Expand Down
4 changes: 2 additions & 2 deletions lib/checkbool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ void CheckBool::bitwiseOnBooleanError(const Token *tok, const std::string &varna

static bool isBool(const Variable* var)
{
return(var && var->typeEndToken()->str() == "bool");
return (var && var->typeEndToken()->str() == "bool");
}
static bool isNonBoolStdType(const Variable* var)
{
return(var && var->typeEndToken()->isStandardType() && var->typeEndToken()->str() != "bool");
return (var && var->typeEndToken()->isStandardType() && var->typeEndToken()->str() != "bool");
}
void CheckBool::checkComparisonOfBoolWithInt()
{
Expand Down
8 changes: 4 additions & 4 deletions lib/checkbool.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ class Variable;
class CPPCHECKLIB CheckBool : public Check {
public:
/** @brief This constructor is used when registering the CheckClass */
CheckBool() : Check(myName())
{ }
CheckBool() : Check(myName()) {
}

/** @brief This constructor is used when running checks. */
CheckBool(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}

/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
Expand Down
8 changes: 4 additions & 4 deletions lib/checkboost.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class Token;
class CPPCHECKLIB CheckBoost : public Check {
public:
/** This constructor is used when registering the CheckClass */
CheckBoost() : Check(myName())
{ }
CheckBoost() : Check(myName()) {
}

/** This constructor is used when running checks. */
CheckBoost(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}

/** Simplified checks. The token list is simplified. */
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
Expand Down
8 changes: 4 additions & 4 deletions lib/checkbufferoverrun.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ class CPPCHECKLIB CheckBufferOverrun : public Check {
public:

/** This constructor is used when registering the CheckClass */
CheckBufferOverrun() : Check(myName())
{ }
CheckBufferOverrun() : Check(myName()) {
}

/** This constructor is used when running checks. */
CheckBufferOverrun(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}

void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
CheckBufferOverrun checkBufferOverrun(tokenizer, settings, errorLogger);
Expand Down
28 changes: 14 additions & 14 deletions lib/checkclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1694,7 +1694,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
continue;

if (tok1->str() == "this" && tok1->previous()->isAssignmentOp())
return(false);
return (false);

const Token* jumpBackToken = 0;
const Token *lastVarTok = tok1;
Expand All @@ -1709,7 +1709,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
const Variable *var = end->variable();

if (var && Token::simpleMatch(var->typeStartToken(), "std :: map")) // operator[] changes a map
return(false);
return (false);
}
if (!jumpBackToken)
jumpBackToken = end->next(); // Check inside the [] brackets
Expand All @@ -1723,35 +1723,35 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
if (end->strAt(1) == "(") {
const Variable *var = lastVarTok->variable();
if (!var)
return(false);
return (false);
if (Token::simpleMatch(var->typeStartToken(), "std ::") // assume all std::*::size() and std::*::empty() are const
&& (Token::Match(end, "size|empty|cend|crend|cbegin|crbegin|max_size|length|count|capacity|get_allocator|c_str|str ( )") || Token::Match(end, "rfind|copy")))
;
else if (!var->typeScope() || !isConstMemberFunc(var->typeScope(), end))
return(false);
return (false);
}

// Assignment
else if (end->next()->type() == Token::eAssignmentOp)
return(false);
return (false);

// Streaming
else if (end->strAt(1) == "<<" && tok1->strAt(-1) != "<<")
return(false);
return (false);
else if (tok1->strAt(-1) == ">>")
return(false);
return (false);

// ++/--
else if (end->next()->type() == Token::eIncDecOp || tok1->previous()->type() == Token::eIncDecOp)
return(false);
return (false);


const Token* start = tok1;
while (tok1->strAt(-1) == ")")
tok1 = tok1->linkAt(-1);

if (start->strAt(-1) == "delete")
return(false);
return (false);

tok1 = jumpBackToken?jumpBackToken:end; // Jump back to first [ to check inside, or jump to end of expression
}
Expand All @@ -1761,7 +1761,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
isMemberVar(scope, tok1->tokAt(-2))) {
const Variable* var = tok1->tokAt(-2)->variable();
if (!var || !var->isMutable())
return(false);
return (false);
}


Expand All @@ -1770,7 +1770,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
!Token::Match(tok1, "return|if|string|switch|while|catch|for")) {
if (isMemberFunc(scope, tok1) && tok1->strAt(-1) != ".") {
if (!isConstMemberFunc(scope, tok1))
return(false);
return (false);
memberAccessed = true;
}
// Member variable given as parameter
Expand All @@ -1780,15 +1780,15 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
else if (tok2->isName() && isMemberVar(scope, tok2)) {
const Variable* var = tok2->variable();
if (!var || !var->isMutable())
return(false); // TODO: Only bailout if function takes argument as non-const reference
return (false); // TODO: Only bailout if function takes argument as non-const reference
}
}
} else if (Token::simpleMatch(tok1, "> (") && (!tok1->link() || !Token::Match(tok1->link()->previous(), "static_cast|const_cast|dynamic_cast|reinterpret_cast"))) {
return(false);
return (false);
}
}

return(true);
return (true);
}

void CheckClass::checkConstError(const Token *tok, const std::string &classname, const std::string &funcname, bool suggestStatic)
Expand Down
4 changes: 2 additions & 2 deletions lib/checkclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class Function;
class CPPCHECKLIB CheckClass : public Check {
public:
/** @brief This constructor is used when registering the CheckClass */
CheckClass() : Check(myName()), symbolDatabase(NULL)
{ }
CheckClass() : Check(myName()), symbolDatabase(NULL) {
}

/** @brief This constructor is used when running checks. */
CheckClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger);
Expand Down
8 changes: 4 additions & 4 deletions lib/checkexceptionsafety.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ class Token;
class CPPCHECKLIB CheckExceptionSafety : public Check {
public:
/** This constructor is used when registering the CheckClass */
CheckExceptionSafety() : Check(myName())
{ }
CheckExceptionSafety() : Check(myName()) {
}

/** This constructor is used when running checks. */
CheckExceptionSafety(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}

/** Checks that uses the simplified token list */
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
Expand Down
8 changes: 4 additions & 4 deletions lib/checkinternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class Token;
class CPPCHECKLIB CheckInternal : public Check {
public:
/** This constructor is used when registering the CheckClass */
CheckInternal() : Check(myName())
{ }
CheckInternal() : Check(myName()) {
}

/** This constructor is used when running checks. */
CheckInternal(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}

/** Simplified checks. The token list is simplified. */
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
Expand Down
6 changes: 3 additions & 3 deletions lib/checkio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ void CheckIO::invalidScanfError(const Token *tok, bool portability)
static bool isComplexType(const Variable* var, const Token* varTypeTok)
{
if (var->type())
return(true);
return (true);

static std::set<std::string> knownTypes;
if (knownTypes.empty()) {
Expand All @@ -417,12 +417,12 @@ static bool isComplexType(const Variable* var, const Token* varTypeTok)

if (varTypeTok->str() == "std")
varTypeTok = varTypeTok->tokAt(2);
return((knownTypes.find(varTypeTok->str()) != knownTypes.end() || (varTypeTok->strAt(1) == "<" && varTypeTok->linkAt(1) && varTypeTok->linkAt(1)->strAt(1) != "::")) && !var->isPointer() && !var->isArray());
return ((knownTypes.find(varTypeTok->str()) != knownTypes.end() || (varTypeTok->strAt(1) == "<" && varTypeTok->linkAt(1) && varTypeTok->linkAt(1)->strAt(1) != "::")) && !var->isPointer() && !var->isArray());
}

static bool isKnownType(const Variable* var, const Token* varTypeTok)
{
return(varTypeTok->isStandardType() || varTypeTok->next()->isStandardType() || isComplexType(var, varTypeTok));
return (varTypeTok->isStandardType() || varTypeTok->next()->isStandardType() || isComplexType(var, varTypeTok));
}

void CheckIO::checkWrongPrintfScanfArguments()
Expand Down
8 changes: 4 additions & 4 deletions lib/checkio.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ class Variable;
class CPPCHECKLIB CheckIO : public Check {
public:
/** @brief This constructor is used when registering CheckIO */
CheckIO() : Check(myName())
{ }
CheckIO() : Check(myName()) {
}

/** @brief This constructor is used when running checks. */
CheckIO(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}

/** @brief Run checks on the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
Expand Down
Loading

0 comments on commit a9a5dc0

Please sign in to comment.