OCT 1. 修正代码检查警告

This commit is contained in:
huangxin 2023-01-28 16:09:12 +08:00
parent 3cbbb839a6
commit a62f7436a8
2 changed files with 78 additions and 87 deletions

View File

@ -298,7 +298,7 @@ int dhcpd_main(int daemon, const char *pInifile, const char *pStatusFile, const
} }
#endif #endif
verbatim = (daemon > 0) ? true : false; verbatim = (daemon > 0);
if (pInifile && strlen(pInifile) > 0) { if (pInifile && strlen(pInifile) > 0) {
strcpy(iniFile, pInifile); strcpy(iniFile, pInifile);

View File

@ -1,5 +1,7 @@
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma ide diagnostic ignored "cppcoreguidelines-pro-type-member-init" #pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
#pragma ide diagnostic ignored "cppcoreguidelines-pro-type-member-init"
/************************************************************************** /**************************************************************************
* Copyright (C) 2005 by Achal Dhir * * Copyright (C) 2005 by Achal Dhir *
* achaldhir@gmail.com * * achaldhir@gmail.com *
@ -132,6 +134,7 @@ enum {
QTYPE_CHILDZONE QTYPE_CHILDZONE
}; };
#if 0
struct data10 { struct data10 {
char zone[256]; char zone[256];
MYWORD zLen; MYWORD zLen;
@ -149,6 +152,7 @@ struct data16 {
char wildcard[256]; char wildcard[256];
MYDWORD ip; MYDWORD ip;
}; };
#endif
struct data7 //cache struct data7 //cache
{ {
@ -209,10 +213,12 @@ struct data71 //Lump
typedef std::map<string, data7 *> dhcpMap; typedef std::map<string, data7 *> dhcpMap;
#if 0
struct data11 { struct data11 {
char hostname[256]; char hostname[256];
MYWORD pref; MYWORD pref;
}; };
#endif
struct ConnType { struct ConnType {
SOCKET sock; SOCKET sock;
@ -695,89 +701,74 @@ struct data15 {
}; };
//Function Prototypes //Function Prototypes
bool checkIP(data9 *req, data17 *rangeData, MYDWORD ip); bool checkIP(data9 *req, data17 *rangeData, MYDWORD ip);
bool checkMask(MYDWORD); bool checkMask(MYDWORD);
bool checkRange(data17 *, char); bool checkRange(data17 *, char);
bool detectChange(); bool detectChange();
bool getSection(const char *, char *, MYBYTE, char *); bool getSection(const char *, char *, MYBYTE, char *);
bool isInt(char *); bool isInt(char *);
bool isIP(char *); bool isIP(char *);
FILE *openSection(const char *, MYBYTE); FILE *openSection(const char *, MYBYTE);
MYBYTE pIP(void *, MYDWORD); MYBYTE pIP(void *, MYDWORD);
MYBYTE pInt(void *, MYDWORD); MYBYTE pUInt(void *raw, MYDWORD data);
MYBYTE pUInt(void *raw, MYDWORD data); MYBYTE pUShort(void *, MYWORD);
MYBYTE pUShort(void *, MYWORD); MYBYTE addServer(MYDWORD *, MYBYTE, MYDWORD);
MYBYTE addServer(MYDWORD *, MYBYTE, MYDWORD); int getRangeInd(MYDWORD);
int getRangeInd(MYDWORD); char *myTrim(char *, char *);
char *myTrim(char *, char *); char *myGetToken(char *, MYBYTE);
char *myGetToken(char *, MYBYTE); char *cloneString(char *);
char *cloneString(char *); char *getHexValue(MYBYTE *, char *, MYBYTE *);
char *getHexValue(MYBYTE *, char *, MYBYTE *); char *genHostName(char *, const MYBYTE *, MYBYTE);
char *genHostName(char *, const MYBYTE *, MYBYTE); char *hex2String(char *, const MYBYTE *, MYBYTE);
char *hex2String(char *, const MYBYTE *, MYBYTE); char *IP2String(char *, MYDWORD);
char *IP2String(char *, MYDWORD); char *myUpper(char *string);
char *IP2arpa(char *, MYDWORD); char *myLower(char *string);
char *IP62String(char *, MYBYTE *); char *readSection(char *, FILE *);
char *myUpper(char *string); data7 *findDHCPEntry(char *);
char *myLower(char *string); data7 *createCache(data71 *pLump);
char *readSection(char *, FILE *); MYDWORD alad(data9 *);
data7 *findDHCPEntry(char *); MYDWORD resad(data9 *);
data7 *createCache(data71 *pLump); MYDWORD sdmess(data9 *);
MYDWORD alad(data9 *); MYDWORD sendRepl(data9 *req);
MYDWORD calcMask(MYDWORD, MYDWORD); MYDWORD *findServer(MYDWORD *, MYBYTE, MYDWORD);
MYDWORD chaddr(data9 *); int getIndex(char, MYDWORD);
MYDWORD resad(data9 *); int addDHCPRange(char *dp);
MYDWORD sdmess(data9 *); void addVendClass(MYBYTE rangeSetInd, char *vendClass, MYBYTE vendClassSize);
MYDWORD sendRepl(data9 *req); void addUserClass(MYBYTE rangeSetInd, char *userClass, MYBYTE userClassSize);
MYDWORD *findServer(MYDWORD *, MYBYTE, MYDWORD); void addMacRange(MYBYTE rangeSetInd, char *macRange);
int getIndex(char, MYDWORD); void addOptions(data9 *req);
int addDHCPRange(char *dp); void calcRangeLimits(MYDWORD, MYDWORD, MYDWORD *, MYDWORD *);
void addVendClass(MYBYTE rangeSetInd, char *vendClass, MYBYTE vendClassSize); void closeConn();
void addUserClass(MYBYTE rangeSetInd, char *userClass, MYBYTE userClassSize); void debug(const char *mess, int i);
void addMacRange(MYBYTE rangeSetInd, char *macRange); bool getInterfaces(data1 *pNetwork);
void addOptions(data9 *req); void *init(void *);
void calcRangeLimits(MYDWORD, MYDWORD, MYDWORD *, MYDWORD *); void lockOptions(FILE *);
void catch_int(int sig_num); void loadOptions(FILE *, const char *, data20 *);
void checkSize(MYBYTE); void mySplit(char *, char *, const char *, char);
void closeConn(); void *sendHTTP(void *);
void debug(const char *mess, int i); void procHTTP(data19 *);
bool getInterfaces(data1 *pNetwork); void pvdata(data9 *, data3 *);
void getSecondary(); void recvRepl(data9 *);
void *init(void *); void lockIP(MYDWORD);
void lockOptions(FILE *); void sendStatus(data19 *req);
void loadOptions(FILE *, const char *, data20 *); void setTempLease(data7 *);
void mySplit(char *, char *, const char *, char); void setLeaseExpiry(data7 *);
void *sendHTTP(void *); void setLeaseExpiry(data7 *, MYDWORD);
void procHTTP(data19 *); void *updateStateFile(void *);
void pvdata(data9 *, data3 *); MYWORD fUShort(void *);
void recvRepl(data9 *); MYWORD gdmess(data9 *, MYBYTE);
void runProg(); MYWORD myTokenize(char *, char *, const char *, bool);
void lockIP(MYDWORD); MYDWORD fIP(void *raw);
void sendScopeStatus(data19 *req); MYDWORD fUInt(void *raw);
void sendStatus(data19 *req); void prepareUserHtmlRespStatus(data19 *req);
void setTempLease(data7 *); void opendhcp_init_http_server();
void setLeaseExpiry(data7 *); void opendhcp_set_replication_svr();
void setLeaseExpiry(data7 *, MYDWORD); void opendhcp_add_ip_pool_set();
void *updateStateFile(void *); void opendhcp_add_mac_filter();
MYWORD fUShort(void *); int process_iptv_multicast(const unsigned char *p, int size, const char *mac);
MYWORD gdmess(data9 *, MYBYTE); int opendhcp_add_listener();
MYWORD myTokenize(char *, char *, const char *, bool); unsigned int opendhcp_set_lease_time();
MYWORD pQu(char *, char *); int getHwAddr(char *buff, char *mac);
MYWORD qLen(char *); int arpSet(const char *ifname, char *ipStr, char *mac);
MYDWORD fIP(void *raw); sockaddr_in get_cliAddr(char *nicif, char *tempbuff, data9 *req);
MYDWORD fUInt(void *raw);
const char *getRequestMethod(const char *buffer);
void prepareUserHtmlRespStatus(data19 *req);
void opendhcp_init_http_server();
void opendhcp_set_replication_svr();
void opendhcp_add_ip_pool_set();
void opendhcp_add_mac_filter();
int process_iptv_multicast(const unsigned char *p, int size, const char *mac);
int opendhcp_add_listener();
unsigned int opendhcp_set_lease_time();
void sendUserList(data19 *req, const char *pRequest, dhcpMap *dhcpCache, data2 *cfig, time_t t);
void sendAllLists(data19 *req, bool kRunning, dhcpMap *dhcpCache, data2 *cfig);
int getHwAddr(char *buff, char *mac);
int arpSet(const char *ifname, char *ipStr, char *mac);
sockaddr_in get_cliAddr(char *nicif, char *tempbuff, data9 *req);
#pragma clang diagnostic pop #pragma clang diagnostic pop