Matthew 7 months ago
parent a7e4fabe13
commit 2653290682

@ -706,10 +706,7 @@ char Gm_GetSensorsPowerState(int port)
void BytestreamLOG(int commid, char* describe, u_char* buf, int len, char flag)
{
int i;
// char szbuf[4096];
char* szbuf = new char[4096];
std::unique_ptr<char[]> bufptr(szbuf);
char szbuf[4096];
memset(szbuf, 0, sizeof(szbuf));
if (NULL != describe)
@ -746,8 +743,7 @@ void BytestreamLOG(int commid, char* describe, u_char* buf, int len, char flag)
void Gm_OpenSerialPort(int devidx)
{
int fd = -1;
char* szbuf = new char[512];
std::unique_ptr<char[]> bufptr(szbuf);
char szbuf[512];
if ((devidx < 0) || (devidx >= MAX_SERIAL_DEV_NUM))
return;
@ -796,8 +792,7 @@ void Gm_CloseSerialPort()
int GM_SerialComSend(unsigned char * cSendBuf, size_t nSendLen, int commid)
{
int i, len;
char* szbuf = new char[512];
std::unique_ptr<char[]> bufptr(szbuf);
char szbuf[512];
memset(szbuf, 0, sizeof(szbuf));
len = write(serialport[commid].fd, cSendBuf, (size_t)nSendLen);/* 向串囗发送字符串 */
@ -1705,9 +1700,7 @@ void GM_IsCloseSensors()
void GM_AllSerialComRecv()
{
int i, j, recvlen;
u_char* recvbuf = new u_char[RECVDATA_MAXLENTH];
std::unique_ptr<u_char[]> recvbufptr(recvbuf);
u_char recvbuf[RECVDATA_MAXLENTH];
char buf[256];
for (j = 0; j < MAX_SERIAL_PORT_NUM; j++)
@ -1739,7 +1732,7 @@ void GM_AllSerialComRecv()
int GM_CloseTimer()
{
int i, j, iretime;
char buf[32];
char buf[256];
for (i = 0; i < MAX_SERIAL_DEV_NUM; i++)
{
@ -1817,17 +1810,7 @@ int SaveLogTofile(int commid, char *szbuf)
{
int status;
time_t now;
// char filename[512], filedir[512], buf[128];
char* filename = new char[512];
char* filedir = new char[512];
char* buf = new char[128];
std::unique_ptr<char[]> fnptr(filename);
std::unique_ptr<char[]> fdptr(filedir);
std::unique_ptr<char[]> bufptr(buf);
char filename[512], filedir[512], buf[128];
FILE *fp = NULL;
struct tm t0;
struct timeval tv;
@ -1873,7 +1856,7 @@ int SaveImageDataTofile(int devno)
u_char *image = NULL, *tempphoto = NULL;
int i, status;
size_t len;
char szbuf[32];
char filename[512]/*, filedir[512]*/, szbuf[128];
FILE *fp = NULL;
SERIAL_DEV_DEF *pPortParam;
@ -3411,8 +3394,7 @@ int Gm_CtrlPtzCmd(u_char channel, uint32_t ptzcmd)
time_t now = time(NULL);
DIR *dir = opendir(path);
struct dirent *entry;
char* szbuf = new char[1024];
std::unique_ptr<char[]> szbufptr(szbuf);
char szbuf[1024];
char fullpath[256];
memset(szbuf, 0, sizeof(szbuf));

Loading…
Cancel
Save