Replaced deprecated BSD against ANSI functions (bzero -> memset, bcopy
-> memcopy)
This commit is contained in:
@ -57,7 +57,7 @@ mbus_serial_connect(char *device)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bzero(&(handle->t), sizeof(handle->t));
|
memset(&(handle->t), 0, sizeof(handle->t));
|
||||||
handle->t.c_cflag |= (CS8|CREAD|CLOCAL);
|
handle->t.c_cflag |= (CS8|CREAD|CLOCAL);
|
||||||
handle->t.c_cflag |= PARENB;
|
handle->t.c_cflag |= PARENB;
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ mbus_serial_recv_frame(mbus_serial_handle *handle, mbus_frame *frame)
|
|||||||
if (handle == NULL || frame == NULL)
|
if (handle == NULL || frame == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
bzero((void *)buff, sizeof(buff));
|
memset((void *)buff, 0, sizeof(buff));
|
||||||
|
|
||||||
//
|
//
|
||||||
// read data until a packet is received
|
// read data until a packet is received
|
||||||
|
@ -78,7 +78,7 @@ mbus_tcp_connect(char *host, int port)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bcopy((void *)(host_addr->h_addr), (void *)(&s.sin_addr), host_addr->h_length);
|
memcpy((void *)(&s.sin_addr), (void *)(host_addr->h_addr), host_addr->h_length);
|
||||||
|
|
||||||
if (connect(handle->sock, (struct sockaddr *)&s, sizeof(s)) < 0)
|
if (connect(handle->sock, (struct sockaddr *)&s, sizeof(s)) < 0)
|
||||||
{
|
{
|
||||||
@ -169,7 +169,7 @@ mbus_tcp_recv_frame(mbus_tcp_handle *handle, mbus_frame *frame)
|
|||||||
if (handle == NULL || frame == NULL)
|
if (handle == NULL || frame == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
bzero((void *)buff, sizeof(buff));
|
memset((void *)buff, 0, sizeof(buff));
|
||||||
|
|
||||||
//
|
//
|
||||||
// read data until a packet is received
|
// read data until a packet is received
|
||||||
|
@ -41,13 +41,13 @@ main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bzero(buf, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
len = read(fd, buf, sizeof(buf));
|
len = read(fd, buf, sizeof(buf));
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
bzero(&reply, sizeof(reply));
|
memset(&reply, 0, sizeof(reply));
|
||||||
bzero(&frame_data, sizeof(frame_data));
|
memset(&frame_data, 0, sizeof(frame_data));
|
||||||
mbus_parse(&reply, buf, len);
|
mbus_parse(&reply, buf, len);
|
||||||
mbus_frame_data_parse(&reply, &frame_data);
|
mbus_frame_data_parse(&reply, &frame_data);
|
||||||
mbus_frame_print(&reply);
|
mbus_frame_print(&reply);
|
||||||
|
@ -41,7 +41,7 @@ main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bzero(raw_buff, sizeof(raw_buff));
|
memset(raw_buff, 0, sizeof(raw_buff));
|
||||||
len = read(fd, raw_buff, sizeof(raw_buff));
|
len = read(fd, raw_buff, sizeof(raw_buff));
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
@ -60,8 +60,8 @@ main(int argc, char *argv[])
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bzero(&reply, sizeof(reply));
|
memset(&reply, 0, sizeof(reply));
|
||||||
bzero(&frame_data, sizeof(frame_data));
|
memset(&frame_data, 0, sizeof(frame_data));
|
||||||
|
|
||||||
//mbus_parse_set_debug(1);
|
//mbus_parse_set_debug(1);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user