mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-14 00:04:13 +09:00
raop_ntp.c, utils.c : fixes #192
This commit is contained in:
@@ -290,10 +290,10 @@ raop_ntp_thread(void *arg)
|
||||
byteutils_put_ntp_timestamp(request, 24, send_time);
|
||||
int send_len = sendto(raop_ntp->tsock, (char *)request, sizeof(request), 0,
|
||||
(struct sockaddr *) &raop_ntp->remote_saddr, raop_ntp->remote_saddr_len);
|
||||
if (logger_debug) {
|
||||
char *str = utils_data_to_string(request, send_len, 16);
|
||||
logger_log(raop_ntp->logger, LOGGER_DEBUG, "\nraop_ntp send time type_t=%d send_len = %d, now = %8.6f\n%s",
|
||||
request[1] &~0x80, send_len, (double) send_time / SECOND_IN_NSECS, str);
|
||||
if (logger_debug) {
|
||||
char *str = utils_data_to_string(request, sizeof(request), 16);
|
||||
logger_log(raop_ntp->logger, LOGGER_DEBUG, "\nraop_ntp send time type_t=%d packetlen = %d, now = %8.6f\n%s",
|
||||
request[1] &~0x80, sizeof(request), (double) send_time / SECOND_IN_NSECS, str);
|
||||
free(str);
|
||||
}
|
||||
if (send_len < 0) {
|
||||
|
||||
@@ -187,7 +187,12 @@ char *utils_parse_hex(const char *str, int str_len, int *data_len) {
|
||||
}
|
||||
|
||||
char *utils_data_to_string(const unsigned char *data, int datalen, int chars_per_line) {
|
||||
int len = 3*datalen + ((datalen-1)/chars_per_line ) + 1;
|
||||
assert(datalen >= 0);
|
||||
assert(chars_per_line > 0);
|
||||
int len = 3*datalen + 1;
|
||||
if (datalen > chars_per_line) {
|
||||
len += (datalen-1)/chars_per_line;
|
||||
}
|
||||
char *str = (char *) calloc(len + 1, sizeof(char));
|
||||
assert(str);
|
||||
char *p = str;
|
||||
|
||||
Reference in New Issue
Block a user