democlient.cpp: apply astyle
This commit is contained in:
parent
2794d3dfd2
commit
2acda0854b
|
@ -7,41 +7,37 @@
|
||||||
|
|
||||||
static void unencode(const char *src, char *dest)
|
static void unencode(const char *src, char *dest)
|
||||||
{
|
{
|
||||||
for(; *src; src++, dest++) {
|
for (; *src; src++, dest++) {
|
||||||
if(*src == '+')
|
if (*src == '+')
|
||||||
*dest = ' ';
|
*dest = ' ';
|
||||||
else if(*src == '%') {
|
else if (*src == '%') {
|
||||||
int code;
|
int code;
|
||||||
if (sscanf(src+1, "%2x", &code) != 1)
|
if (sscanf(src+1, "%2x", &code) != 1)
|
||||||
code = '?';
|
code = '?';
|
||||||
*dest = code;
|
*dest = code;
|
||||||
src += 2;
|
src += 2;
|
||||||
}
|
} else
|
||||||
else
|
*dest = *src;
|
||||||
*dest = *src;
|
|
||||||
}
|
}
|
||||||
*dest = '\0';
|
*dest = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CppcheckExecutor : public ErrorLogger
|
class CppcheckExecutor : public ErrorLogger {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
const std::time_t stoptime;
|
const std::time_t stoptime;
|
||||||
CppCheck cppcheck;
|
CppCheck cppcheck;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CppcheckExecutor()
|
CppcheckExecutor()
|
||||||
: ErrorLogger()
|
: ErrorLogger()
|
||||||
, stoptime(std::time(NULL)+2U)
|
, stoptime(std::time(NULL)+2U)
|
||||||
, cppcheck(*this,false)
|
, cppcheck(*this,false) {
|
||||||
{
|
|
||||||
cppcheck.settings().addEnabled("all");
|
cppcheck.settings().addEnabled("all");
|
||||||
cppcheck.settings().inconclusive = true;
|
cppcheck.settings().inconclusive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(const char code[])
|
void run(const char code[]) {
|
||||||
{
|
|
||||||
printf("%s\n", ErrorLogger::ErrorMessage::getXMLHeader(2).c_str());
|
printf("%s\n", ErrorLogger::ErrorMessage::getXMLHeader(2).c_str());
|
||||||
cppcheck.check("test.c", code);
|
cppcheck.check("test.c", code);
|
||||||
printf("%s\n", ErrorLogger::ErrorMessage::getXMLFooter(2).c_str());
|
printf("%s\n", ErrorLogger::ErrorMessage::getXMLFooter(2).c_str());
|
||||||
|
@ -49,19 +45,16 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void reportOut(const std::string &outmsg) { }
|
void reportOut(const std::string &outmsg) { }
|
||||||
void reportErr(const ErrorLogger::ErrorMessage &msg)
|
void reportErr(const ErrorLogger::ErrorMessage &msg) {
|
||||||
{
|
|
||||||
const std::string str(msg.toXML(true,2U));
|
const std::string str(msg.toXML(true,2U));
|
||||||
printf("%s\n", str.c_str());
|
printf("%s\n", str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void reportProgress(const
|
void reportProgress(const
|
||||||
std::string &filename,
|
std::string &filename,
|
||||||
const char stage[],
|
const char stage[],
|
||||||
const unsigned int value)
|
const unsigned int value) {
|
||||||
{
|
if (std::time(NULL) >= stoptime) {
|
||||||
if (std::time(NULL) >= stoptime)
|
|
||||||
{
|
|
||||||
printf("time to analyse the "
|
printf("time to analyse the "
|
||||||
"code is more than 1 "
|
"code is more than 1 "
|
||||||
"second. terminating."
|
"second. terminating."
|
||||||
|
@ -89,4 +82,3 @@ int main()
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue