OCT 修正代码检查规范警告

This commit is contained in:
huangxin 2022-10-17 15:45:08 +08:00
parent da68990550
commit 2e2ff5a6fc
1 changed files with 15 additions and 27 deletions

View File

@ -20,14 +20,6 @@ using namespace std;
#include "s2j/cJSON.h"
#include <net/if_arp.h>
#pragma clang diagnostic pop
#pragma clang diagnostic push
#pragma ide diagnostic ignored "cert-err34-c"
typedef struct {
} USER_INFO, *PUSER_INFO;
const char *getRequestMethod(const char *buffer) {
int i = 0;
char httpMethod[64] = {0};
@ -47,10 +39,8 @@ const char *getRequestMethod(const char *buffer) {
return strdup(httpMethod);
}
void sendUserList(data19 *req, const char *pRequest,
dhcpMap dhcpCache, data2 cfig, time_t t) {
void sendUserList(data19 *req, const char *pRequest, dhcpMap dhcpCache, data2 cfig, time_t t) {
char logBuff[512];
char rspBuf[2048] = {0};
dhcpMap::iterator p;
printf("Input: %s\n", pRequest);
@ -141,7 +131,7 @@ void sendUserList(data19 *req, const char *pRequest,
cJSON_AddItemToObject(pRspRoot, "msgContent", pRspMsg);
char *fp = req->dp;
char *maxData = req->dp + (req->memSize - 512);
//char *maxData = req->dp + (req->memSize - 512);
//fp += sprintf(fp, send200, strlen(rspBuf));
fp += sprintf(fp, "%s", cJSON_Print(pRspRoot));
@ -154,14 +144,13 @@ void sendUserList(data19 *req, const char *pRequest,
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
int errcode = pthread_create(&threadId, &attr, sendHTTP, (void *)req);
pthread_create(&threadId, &attr, sendHTTP, (void *)req);
pthread_attr_destroy(&attr);
}
void sendAllLists(data19 *req, bool kRunning,
dhcpMap dhcpCache, data2 cfig) {
void sendAllLists(data19 *req, bool kRunning, dhcpMap dhcpCache, data2 cfig) {
char logBuff[512];
data7 *dhcpEntry = nullptr;
data7 *dhcpEntry;
dhcpMap::iterator p;
req->memSize = (int)(2048 + (135 * dhcpCache.size()) + (cfig.dhcpSize * 26));
@ -208,12 +197,11 @@ void sendAllLists(data19 *req, bool kRunning,
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
int errcode = pthread_create(&threadId, &attr, sendHTTP, (void *)req);
pthread_create(&threadId, &attr, sendHTTP, (void *)req);
pthread_attr_destroy(&attr);
}
int method_Judge(data19 *req, char *buffer, char *fp, bool kRunning,
dhcpMap dhcpCache, data2 cfig, time_t t){
int method_Judge(data19 *req, char *buffer, char *fp, bool kRunning, dhcpMap dhcpCache, data2 cfig, time_t t) {
const char *pMethod = getRequestMethod(buffer);
const char *pBody = strstr(buffer, "\r\n\r\n");
@ -264,7 +252,7 @@ int getHwAddr(char *buff, char *mac) {
return -1;
}
int i = 0;
int i;
unsigned int p[6];
if (sscanf(mac, "%x:%x:%x:%x:%x:%x", &p[0], &p[1], &p[2], &p[3], &p[4], &p[5]) < 6) {
@ -286,8 +274,8 @@ int arpSet(const char *ifname, char *ipStr, char *mac) {
struct arpreq req {};
struct sockaddr_in *sin;
int ret = 0;
int sock_fd = 0;
int ret;
int sock_fd;
memset(&req, 0, sizeof(struct arpreq));
sin = (struct sockaddr_in *)&req.arp_pa;