buffered_audio->buffer_max_size = conn->ap2_audio_buffer_size;
buffered_audio->buffer = malloc(conn->ap2_audio_buffer_size);
if (buffered_audio->buffer == NULL)
- debug(1, "cannot allocate an audio buffer of %lu bytes!", buffered_audio->buffer_max_size);
+ debug(1, "cannot allocate an audio buffer of %zu bytes!", buffered_audio->buffer_max_size);
pthread_cleanup_push(malloc_cleanup, &buffered_audio->buffer);
// pthread_mutex_lock(&conn->buffered_audio_mutex);
nonce,
conn->session_key); // *k
if (response != 0)
- debug(1, "Error decrypting audio packet %u -- packet length %ld.", seq_no,
+ debug(1, "Error decrypting audio packet %u -- packet length %zd.", seq_no,
nread);
} else {
debug(2, "No session key, so the audio packet can not be deciphered -- skipped.");
skip_this_block = 1;
debug(2,
"skipping block %u because it is too old. Timestamp "
- "difference: %d, length of block: %lu.",
+ "difference: %d, length of block: %zu.",
seq_no, timestamp_difference, get_ssrc_block_length(payload_ssrc));
}
}
dither_random_number_store, current_encoded_output_format);
ret = do_play(silence, frames_of_silence);
- debug(3, "Played %u frames of silence on %u channels, equal to %lu bytes.",
+ debug(3, "Played %u frames of silence on %u channels, equal to %zu bytes.",
frames_of_silence, CHANNELS_FROM_ENCODED_FORMAT(current_encoded_output_format),
size_of_silence_buffer);
frame_count++;
CHANNELS_FROM_ENCODED_FORMAT(current_encoded_output_format) * 1; // one seconds
audio_lmb = malloc(audio_size);
if (audio_lmb == NULL)
- die("Can't allocate %ld bytes for pulseaudio buffer.", audio_size);
+ die("Can't allocate %zd bytes for pulseaudio buffer.", audio_size);
audio_toq = audio_eoq = audio_lmb;
audio_umb = audio_lmb + audio_size;
audio_occupancy = 0;
// allocate space for the audio buffer
audio_lmb = malloc(audio_size);
if (audio_lmb == NULL)
- die("Can't allocate %ld bytes for PipeWire buffer.", audio_size);
+ die("Can't allocate %zd bytes for PipeWire buffer.", audio_size);
audio_toq = audio_eoq = audio_lmb;
audio_umb = audio_lmb + audio_size;
audio_occupancy = 0;
if ((config.channel_set & (1 << c)) != 0) {
unsigned int s = 0;
- int f = 0;
- while ((s < SIO_NCHAN) && (f == 0)) {
+ int fo = 0;
+ while ((s < SIO_NCHAN) && (fo == 0)) {
if (cap.pchan[s] == c)
- f = 1;
+ fo = 1;
else
s++;
}
- if (f == 0) {
+ if (fo == 0) {
debug(3, "sndio: output device can't deal with %u channels.", c);
config.channel_set &= ~(1 << c); // remove this channel count
} else {
// default, check it...
if ((config.rate_set & (1 << r)) != 0) {
unsigned int s = 0;
- int f = 0;
- while ((s < SIO_NRATE) && (f == 0)) {
+ int fo = 0;
+ while ((s < SIO_NRATE) && (fo == 0)) {
if (cap.rate[s] == sps_rate_actual_rate(r))
- f = 1;
+ fo = 1;
else
s++;
}
- if (f == 0) {
+ if (fo == 0) {
debug(3, "sndio: output device can't be set to %u fps.", sps_rate_actual_rate(r));
config.rate_set &= ~(1 << r); // remove this rate
} else {
if (EVP_PKEY_sign(ctx, NULL, &ol, (const unsigned char *)input, inlen) > 0) { // 1.0.2
out = (unsigned char *)malloc(ol);
if (EVP_PKEY_sign(ctx, out, &ol, (const unsigned char *)input, inlen) > 0) { // 1.0.2
- debug(3, "success with output length of %lu.", ol);
+ debug(3, "success with output length of %zu.", ol);
} else {
debug(1, "error 2 \"%s\" with EVP_PKEY_sign:",
ERR_error_string(ERR_get_error(), NULL));
rem = req;
} while ((result == -1) && (errno == EINTR));
if (result == -1)
- debug(1, "Error in sps_nanosleep of %ld sec and %ld nanoseconds: %d.", sec, nanosec, errno);
+ debug(1, "Error in sps_nanosleep of %" PRIdMAX " sec and %ld nanoseconds: %d.", (intmax_t)sec, nanosec, errno);
}
// Mac OS X doesn't have pthread_mutex_timedlock
snprintf(dstring, sizeof(dstring), "%s:%d", filename, line);
debug(debuglevel, "mutex_unlock \"%s\" at \"%s\".", mutexname, dstring);
int r = pthread_mutex_unlock(mutex);
- if ((debuglevel != 0) && (r != 0))
- debug(1, "error %d: \"%s\" unlocking mutex \"%s\" at \"%s\".", r,
- strerror_r(r, errstr, sizeof(errstr)), mutexname, dstring);
+ if ((debuglevel != 0) && (r != 0)) {
+ if (strerror_r(r, errstr, sizeof(errstr)) == 0) {
+ debug(1, "error %d: \"%s\" unlocking mutex \"%s\" at \"%s\".", r, errstr, mutexname, dstring);
+ } else {
+ debug(1, "error %d: unlocking mutex \"%s\" at \"%s\".", r, mutexname, dstring);
+ }
+ }
pthread_setcancelstate(oldState, NULL);
return r;
}
int32_t active_speakers = 0;
for (i = 0; i < speaker_count; i++) {
if (speaker_info[i].speaker_number == machine_number) {
- debug(2, "Our speaker number found: %ld with relative volume %" PRId32 ".", machine_number,
+ debug(2, "Our speaker number found: %" PRId64 " with relative volume %" PRId32 ".", machine_number,
speaker_info[i].volume);
}
if (speaker_info[i].active == 1) {
int level, const char *str) {
switch (level) {
case MOSQ_LOG_DEBUG:
- debug(3, str);
+ debug(3, "%s", str);
break;
case MOSQ_LOG_INFO:
- debug(3, str);
+ debug(3, "%s", str);
break;
case MOSQ_LOG_NOTICE:
- debug(3, str);
+ debug(3, "%s", str);
break;
case MOSQ_LOG_WARNING:
- inform(str);
+ inform("%s", str);
break;
case MOSQ_LOG_ERR: {
die("MQTT: Error: %s\n", str);
int keepalive = 60;
mosquitto_lib_init();
if (!(global_mosq = mosquitto_new(config.service_name, true, NULL))) {
- die("[MQTT]: FATAL: Could not create mosquitto object! %d\n", global_mosq);
+ die("[MQTT]: FATAL: Could not create mosquitto object!");
}
if (config.mqtt_cafile != NULL || config.mqtt_capath != NULL || config.mqtt_certfile != NULL ||
if (ret < 0) {
av_frame_free(&decoded_frame);
decoded_frame = NULL;
- debug(1, "error %d during decoding. Data size: %ld", ret, incoming_data_length);
+ debug(1, "error %d during decoding. Data size: %zd", ret, incoming_data_length);
/*
char *obf = malloc(incoming_data_length * 3);
char *obfp = obf;
}
}
} else {
- debug(1, "error %d during decoding. Gross data size: %ld", ret, incoming_data_length);
+ debug(1, "error %d during decoding. Gross data size: %zd", ret, incoming_data_length);
/*
char obf[128];
char *obfp = obf;
// } else {
if (len <= 8) {
debug(1,
- "Using the FFMPEG ALAC_44100_S16_2 decoder, a short audio packet %u, rtptime %u, of length %lu has been decoded but not discarded. Contents follow:", seqno,
+ "Using the FFMPEG ALAC_44100_S16_2 decoder, a short audio packet %u, rtptime %u, of length %zu has been decoded but not discarded. Contents follow:", seqno,
actual_timestamp, len);
debug_print_buffer(1, data, len);
// abuf->length = conn->frames_per_packet;
//} else {
if (len <= 8) {
debug(1,
- "Using an FFMPEG decoder, a short audio packet %u, rtptime %u, of length %lu has been decoded but not discarded. Contents follow:", seqno,
+ "Using an FFMPEG decoder, a short audio packet %u, rtptime %u, of length %zu has been decoded but not discarded. Contents follow:", seqno,
actual_timestamp, len);
debug_print_buffer(1, data, len);
// abuf->length = 0;
if (offset_to_flush_frame > 0) {
debug(2,
"flush to %u request: flush buffer %u, from "
- "%u to %lu. ab_write is: %u.",
+ "%u to %zu. ab_write is: %u.",
conn->flush_rtp_timestamp, conn->ab_read, current_packet->timestamp,
current_packet->timestamp + current_packet->length - 1,
conn->ab_write);
insertions_plus_deletions_ppm =
(1000000.0 * tsum_of_insertions_and_deletions) / tsum_of_frames;
} else {
- debug(3, "tsum_of_frames: %lu.", tsum_of_frames);
+ debug(3, "tsum_of_frames: %zu.", tsum_of_frames);
}
}
if (config.statistics_requested) {
debug(2, "resend-related request packet received, ignoring.");
continue;
}
- debug(1, "Audio receiver -- Unknown RTP packet of type 0x%02X length %ld seqno %d", type,
+ debug(1, "Audio receiver -- Unknown RTP packet of type 0x%02X length %zd seqno %d", type,
nread, seqno);
}
- warn("Audio receiver -- Unknown RTP packet of type 0x%02X length %ld.", type, nread);
+ warn("Audio receiver -- Unknown RTP packet of type 0x%02X length %zd.", type, nread);
} else {
char em[1024];
strerror_r(errno, em, sizeof(em));
debug(3, "Too-short retransmitted audio packet received in control port, ignored.");
}
} else
- debug(1, "Control Receiver -- Unknown RTP packet of type 0x%02X length %ld, ignored.",
+ debug(1, "Control Receiver -- Unknown RTP packet of type 0x%02X length %zd, ignored.",
packet[1], nread);
} else {
debug(3, "Control Receiver -- dropping a packet to simulate a bad network.");
return_time);
}
} else {
- debug(1, "Timing port -- Unknown RTP packet of type 0x%02X length %ld.", packet[1], nread);
+ debug(1, "Timing port -- Unknown RTP packet of type 0x%02X length %zd.", packet[1], nread);
}
} else {
debug(3, "Timing Receiver Thread -- dropping incoming packet to simulate a bad network.");
char *packet_in_hex_cstring =
debug_malloc_hex_cstring(packet, nread); // remember to free this afterwards
debug(1,
- "AP2 Control Receiver Packet of first byte 0x%02X, type 0x%02X length %ld "
+ "AP2 Control Receiver Packet of first byte 0x%02X, type 0x%02X length %zd "
"received: "
"\"%s\".",
packet[0], packet[1], nread, packet_in_hex_cstring);
conn->connection_number, errno);
}
} else {
- debug(2, "Connection %d: AP2 Control Receiver -- malformed packet, %ld bytes long.",
+ debug(2, "Connection %d: AP2 Control Receiver -- malformed packet, %zd bytes long.",
conn->connection_number, nread);
}
}
ssize_t consumed = pair_decrypt(&plain, &plain_len, ctx->encrypted_read_buffer.data,
ctx->encrypted_read_buffer.length, ctx->cipher_ctx);
if (consumed < 0) {
- debug(1, "read_encrypted: abnormal exit from pair_decrypt: %ld.", consumed);
+ debug(1, "read_encrypted: abnormal exit from pair_decrypt: %zd.", consumed);
response = -1;
} else {
buf_drain(&ctx->encrypted_read_buffer, consumed);
if ((result <= 0) && (errno != 0)) {
char errorstring[1024];
strerror_r(errno, (char *)errorstring, sizeof(errorstring));
- debug(3, "read_from_rtsp_connection error %d \"%s\" attempting to read up to %lu bytes.",
+ debug(3, "read_from_rtsp_connection error %d \"%s\" attempting to read up to %zu bytes.",
errno, errorstring, count);
}
} else {
return -4;
}
if (reply != p - pkt) {
- debug(1, "msg_write_response error -- requested bytes: %ld not fully written: %ld.", p - pkt,
+ debug(1, "msg_write_response error -- requested bytes: %zd not fully written: %zd.", p - pkt,
reply);
return -5;
}
debug(1, "rtsp_read_request_response_bad_packet write response error %d: \"%s\".", errno,
(char *)errorstring);
} else if (lreply != (ssize_t)strlen(response_text)) {
- debug(1, "rtsp_read_request_response_bad_packet write %ld bytes requested but %d written.",
+ debug(1, "rtsp_read_request_response_bad_packet write %zd bytes requested but %d written.",
strlen(response_text), reply);
}
}
config.mqtt_port = 1883;
if (config_lookup_int(config.cfg, "mqtt.port", &value)) {
if ((value < 0) || (value > 65535))
- die("Invalid mqtt port number \"%sd\". It should be between 0 and 65535, default is 1883",
+ die("Invalid mqtt port number \"%d\". It should be between 0 and 65535, default is 1883",
value);
else
config.mqtt_port = value;
// Produces a UUID string at uuid consisting of lower-case letters
uuid_unparse_lower(result, psi_uuid);
config.airplay_psi = psi_uuid;
- debug(3, "size of pk is %lu.", sizeof(config.airplay_pk));
+ debug(3, "size of pk is %zu.", sizeof(config.airplay_pk));
pair_public_key_get(PAIR_SERVER_HOMEKIT, config.airplay_pk, config.airplay_device_id);
char buf[128];
debug(option_print_level, "metadata pipename is \"%s\".", config.metadata_pipename);
debug(option_print_level, "metadata socket address is \"%s\" port %d.", config.metadata_sockaddr,
config.metadata_sockport);
- debug(option_print_level, "metadata socket packet size is \"%ld\".",
+ debug(option_print_level, "metadata socket packet size is \"%zd\".",
config.metadata_sockmsglength);
debug(option_print_level, "get-coverart is %d.", config.get_coverart);
#endif
descriptor->closed = 0;
if (descriptor->buffer_occupancy == 0) {
- debug(2, "buffered_read: buffer empty -- waiting for %lu bytes.", count);
+ debug(2, "buffered_read: buffer empty -- waiting for %zu bytes.", count);
}
while ((descriptor->buffer_occupancy == 0) && (descriptor->error_code == 0) &&
if (pthread_cond_wait(&descriptor->not_empty_cv, &descriptor->mutex))
debug(1, "Error waiting for buffered read");
else
- debug(2, "buffered_read: signalled with %lu bytes after waiting.",
+ debug(2, "buffered_read: signalled with %zu bytes after waiting.",
descriptor->buffer_occupancy);
}
// do the read
if (descriptor->buffer_occupancy == 0)
- debug(2, "recv of up to %ld bytes with an buffer empty.", bytes_to_request);
+ debug(2, "recv of up to %zd bytes with an buffer empty.", bytes_to_request);
nread = recv(fd, descriptor->eoq, bytes_to_request, 0);
// debug(1, "Received %d bytes for a buffer size of %d bytes.",nread,
// descriptor->buffer_occupancy + nread);