cmdmon: avoid unsigned shorts
Change unsigned shorts to uint16_t or longer types to avoid any assumptions about length of the short type.
This commit is contained in:
parent
500c9cbf3b
commit
f9e2a5852d
5 changed files with 7 additions and 7 deletions
2
client.c
2
client.c
|
@ -1120,7 +1120,7 @@ process_cmd_add_source(CMD_Request *msg, char *line)
|
|||
assert(0);
|
||||
strncpy((char *)msg->data.ntp_source.name, data.name,
|
||||
sizeof (msg->data.ntp_source.name));
|
||||
msg->data.ntp_source.port = htonl((unsigned long) data.port);
|
||||
msg->data.ntp_source.port = htonl(data.port);
|
||||
msg->data.ntp_source.minpoll = htonl(data.params.minpoll);
|
||||
msg->data.ntp_source.maxpoll = htonl(data.params.maxpoll);
|
||||
msg->data.ntp_source.presend_minpoll = htonl(data.params.presend_minpoll);
|
||||
|
|
4
cmdmon.c
4
cmdmon.c
|
@ -716,7 +716,7 @@ handle_add_source(CMD_Request *rx_message, CMD_Reply *tx_message)
|
|||
return;
|
||||
}
|
||||
|
||||
port = (unsigned short)(ntohl(rx_message->data.ntp_source.port));
|
||||
port = ntohl(rx_message->data.ntp_source.port);
|
||||
params.minpoll = ntohl(rx_message->data.ntp_source.minpoll);
|
||||
params.maxpoll = ntohl(rx_message->data.ntp_source.maxpoll);
|
||||
params.presend_minpoll = ntohl(rx_message->data.ntp_source.presend_minpoll);
|
||||
|
@ -1341,7 +1341,7 @@ read_from_cmd_socket(int sock_fd, int event, void *anything)
|
|||
IPAddr loopback_addr, remote_ip;
|
||||
int read_length, expected_length;
|
||||
int localhost, allowed, log_index;
|
||||
unsigned short rx_command;
|
||||
uint16_t rx_command;
|
||||
struct timespec now, cooked_now;
|
||||
|
||||
sck_message = SCK_ReceiveMessage(sock_fd, 0);
|
||||
|
|
|
@ -151,7 +151,7 @@ CPS_ParseNTPSourceAdd(char *line, CPS_NTP_Source *src)
|
|||
if (sscanf(line, "%lf%n", &src->params.offset, &n) != 1)
|
||||
return 0;
|
||||
} else if (!strcasecmp(cmd, "port")) {
|
||||
if (sscanf(line, "%hu%n", &src->port, &n) != 1)
|
||||
if (sscanf(line, "%d%n", &src->port, &n) != 1)
|
||||
return 0;
|
||||
} else if (!strcasecmp(cmd, "polltarget")) {
|
||||
if (sscanf(line, "%d%n", &src->params.poll_target, &n) != 1)
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
typedef struct {
|
||||
char *name;
|
||||
unsigned short port;
|
||||
int port;
|
||||
SourceParameters params;
|
||||
} CPS_NTP_Source;
|
||||
|
||||
|
|
|
@ -77,8 +77,8 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
struct timespec ref_time;
|
||||
unsigned short n_samples;
|
||||
unsigned short n_runs;
|
||||
unsigned long n_samples;
|
||||
unsigned long n_runs;
|
||||
unsigned long span_seconds;
|
||||
double rtc_seconds_fast;
|
||||
double rtc_gain_rate_ppm;
|
||||
|
|
Loading…
Reference in a new issue