OCT 修正代码检查规范警告
This commit is contained in:
parent
da68990550
commit
2e2ff5a6fc
|
@ -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");
|
||||
|
||||
|
@ -251,7 +239,7 @@ int method_Judge(data19 *req, char *buffer, char *fp, bool kRunning,
|
|||
free((void *)pBody);
|
||||
}
|
||||
|
||||
if (fp && !strcasecmp(fp, "/allusers")){
|
||||
if (fp && !strcasecmp(fp, "/allusers")) {
|
||||
sendAllLists(req, kRunning, dhcpCache, cfig);
|
||||
res = 2;
|
||||
return res;
|
||||
|
@ -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;
|
||||
|
@ -319,7 +307,7 @@ int arpSet(const char *ifname, char *ipStr, char *mac) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
sockaddr_in get_cliAddr(char *nicif, char *tempbuff, data9 *req){
|
||||
sockaddr_in get_cliAddr(char *nicif, char *tempbuff, data9 *req) {
|
||||
arpSet(nicif, IP2String(tempbuff, req->dhcpp.header.bp_yiaddr), req->chaddr);
|
||||
|
||||
sockaddr_in cliAddr {};
|
||||
|
|
Loading…
Reference in New Issue