添加gcc编译器下的代码质量检测

master
a7458969 2020-05-06 18:09:59 +08:00
parent a5c51b5b1a
commit 71eae9a32a
11 changed files with 69 additions and 28 deletions

View File

@ -12,13 +12,19 @@
</component>
<component name="ChangeListManager">
<list default="true" id="0facce0d-c642-4d80-b2fb-daf5f3e68dff" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/general/src/function/btree.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/general/src/function/btree.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/pattern/Observer.h" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/pattern/Observer.hpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/pattern/adapter.h" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/pattern/adapter.hpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/pattern/fsm.h" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/pattern/fsm.hpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/pattern/signleton.h" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/pattern/signleton.hpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/pattern/stratergy.h" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/pattern/stratergy.hpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/general/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/debug.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/debug.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/encrypt/aes.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/encrypt/aes.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/encrypt/rsa.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/encrypt/rsa.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/loger.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/loger.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/net/PackageReceiver.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/net/PackageReceiver.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/net/TcpClient.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/net/TcpClient.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/net/TcpClient.h" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/net/TcpClient.h" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -68,8 +74,20 @@
<recent name="D:\project\c++\generallib\src\encrypt" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="General" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="General" TARGET_NAME="General" CONFIG_NAME="Debug">
<configuration name="General" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="General" TARGET_NAME="General" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
@ -127,23 +145,25 @@
<workItem from="1588607501663" duration="599000" />
<workItem from="1588685364145" duration="2436000" />
<workItem from="1588731711427" duration="7486000" />
<workItem from="1588756178008" duration="3364000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="2" />
<option name="version" value="1" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
<State>
<option name="COLUMN_ORDER" />
</State>
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="WindowStateProjectService">
<state x="651" y="314" width="409" height="388" key="#Notifications" timestamp="1588741195489">

View File

@ -8,6 +8,13 @@ message( "current compiler " ${CMAKE_CXX_COMPILER_ID})
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# using Clang
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-Wall)
add_compile_options(-Wsign-compare)
add_compile_options(-Werror)
add_compile_options(-Wno-unused-function)
add_compile_options(-Wno-misleading-indentation)
add_compile_options(-Wno-format-overflow)
# using GCC
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# using Intel C++
@ -28,7 +35,7 @@ aux_source_directory(src/pattern PaternSrc)
add_library(General OBJECT ${DIRSRCS} ${PaternSrc} src/pattern/signleton.hpp src/pattern/Observer.hpp src/pattern/stratergy.hpp src/pattern/adapter.hpp src/encrypt/base64.cpp src/encrypt/base64.h src/encrypt/aes.cpp src/encrypt/aes.h src/encrypt/rsa.cpp
src/math/BigInt.hpp src/net/TcpClient.cpp src/net/TcpClient.h src/net/PackageReceiver.cpp src/net/PackageReceiver.h)
src/math/BigInt.hpp src/net/TcpClient.cpp src/net/TcpClient.h src/net/PackageReceiver.cpp src/net/PackageReceiver.h src/function/btree.cpp src/function/btree.h)
set(COPYITEM inc)
file(GLOB INCLUDES ${PROJECT_SOURCE_DIR}/inc/*)

View File

@ -5,16 +5,12 @@
int PrintDumpObjvoid (void *dst,int rowNum,int num,bool ifAsii){
char out [2048] = {0};
if (NULL == out) {
return -1;
}
int row = num / rowNum;
int left = num %rowNum;
if (left != 0){
row += 1;
}
char lineStr[5];
sprintf(out,"LN: ",strlen("LN: "));
snprintf(out,strlen("LN: "),"LN: ");
//char out[10240] = "LN: " ;
for (int z = 1;z < rowNum + 1; z++) {
char tmp[4] = {0};
@ -100,9 +96,7 @@ int dumpObj(void *dst,int rowNum,int num,bool ifAsii,char *out) {
if (left != 0){
row += 1;
}
char lineStr[5];
sprintf(out,"LN: ",strlen("LN: "));
//char out[10240] = "LN: " ;
sprintf(out,"LN: ");
for (int z = 1;z < rowNum + 1; z++) {
char tmp[4] = {0};
sprintf(tmp,"%02d ",z);

View File

@ -1054,7 +1054,7 @@ void AES::Encrypt(char const* in, char* result, size_t n, int iMode)
//n should be > 0 and multiple of m_blockSize
if (0 == n || n % m_blockSize != 0)
return;
int i;
size_t i;
char const* pin;
char* presult;
if (CBC == iMode) //CBC mode, using the Chain
@ -1097,7 +1097,7 @@ void AES::Decrypt(char const* in, char* result, size_t n, int iMode)
//n should be > 0 and multiple of m_blockSize
if (0 == n || n % m_blockSize != 0)
return;
int i;
size_t i;
char const* pin;
char* presult;
if (CBC == iMode) //CBC mode, using the Chain

View File

@ -71,7 +71,7 @@ const static int PrimeTable[550]=
// 判断两个数是否为互素
static int Mod(BigInt p1,BigInt p2){
return 0;
}
/*

View File

@ -0,0 +1,5 @@
//
// Created by 29019 on 2020/5/6.
//
#include "btree.h"

View File

@ -0,0 +1,14 @@
//
// Created by 29019 on 2020/5/6.
//
#ifndef GENERAL_BTREE_H
#define GENERAL_BTREE_H
class btree {
};
#endif //GENERAL_BTREE_H

View File

@ -61,7 +61,7 @@ _C_Loger::_C_Loger(string path) {
this->mCurrentPath = path + this->mCurrentDate;
this->mFile = fopen(this->mCurrentPath.c_str(),"a+");
if(! this->mFile){
fprintf(stderr,"error open log files %s code %d,please check file path",this->mCurrentPath.c_str(),this->mFile,errno);
fprintf(stderr,"error open log files %s code %d,please check file path",this->mCurrentPath.c_str(),errno);
exit(0);
}else{

View File

@ -65,8 +65,8 @@ int PackageReceiver::SortPack(uint8_t * inData, uint32_t size)
if ((this->mUnsortData[0] != 0x40 || this->mUnsortData[1] != 0x41)) {
return -1;
}
uint32_t len = mUnsortData[2] << 24 + mUnsortData[3] << 16 + mUnsortData[4]
<< 8 + mUnsortData[0]; // 长度
uint32_t len = mUnsortData[2] << (24 + mUnsortData[3]) << (16 + mUnsortData[4])
<< (8 + mUnsortData[0]); // 长度
if (len > size + mUnsortLen) { //大包还需要重组
memcpy(mUnsortData + mUnsortLen, inData, size);
mUnsortLen += size;

View File

@ -42,6 +42,8 @@ int ThreadRun(TcpClientLibevent *p) {
if (nullptr != p) {
p->mStatus = TcpClientLibevent::UNCONNECTED;
int ret = p->Dispatch();
if (0 > ret){
}
while ((p->mStatus != TcpClientLibevent::UNCONNECTED ))
{
if (p->mStatus == TcpClientLibevent::FAIL) { //连接失败,如果有设置自动重连就一直重连
@ -117,9 +119,8 @@ bool TcpClientLibevent::Connected() {
}
TcpClientLibevent::TcpClientLibevent(std::string addrinfo, int port, TcpClientLibevent::TcpClientObserver *p) :
mObserver(nullptr),
mStatus(UNCONNECTED),
mReConnect(false)
mObserver(nullptr)
{
memset(&mSrv, 0, sizeof(mSrv));
mSrv.sin_addr.S_un.S_addr = inet_addr(addrinfo.c_str());

View File

@ -39,13 +39,13 @@ public:
int Dispatch();
int OnTCPPackage(uint8_t *, uint16_t);
int SetReconnect(bool);
int SetObserver(TcpClientObserver*);
int Close();
Status mStatus;
PackageReceiver mPack;
TcpClientObserver *mObserver;
private:
bool mReConnect;
bool mReConnect = false;
int sendData(void*,size_t);
struct event_base *mBase;
struct bufferevent* bev;