From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Wed, 31 Dec 2025 19:02:16 +0000 (+0000) Subject: further changes to remove compilation warnings on 32-bit builds X-Git-Tag: 5.0-post-dev~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16b6534ad37404d0df862c2fc4c9d50192df3238;p=thirdparty%2Fshairport-sync.git further changes to remove compilation warnings on 32-bit builds --- diff --git a/ap2_buffered_audio_processor.c b/ap2_buffered_audio_processor.c index 2e577331..38ddfd5d 100644 --- a/ap2_buffered_audio_processor.c +++ b/ap2_buffered_audio_processor.c @@ -148,7 +148,7 @@ void *rtp_buffered_audio_processor(void *arg) { 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); @@ -488,7 +488,7 @@ void *rtp_buffered_audio_processor(void *arg) { 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."); @@ -581,7 +581,7 @@ void *rtp_buffered_audio_processor(void *arg) { 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)); } } diff --git a/audio_alsa.c b/audio_alsa.c index 516e3a2c..2fed54f0 100644 --- a/audio_alsa.c +++ b/audio_alsa.c @@ -2380,7 +2380,7 @@ static void *alsa_buffer_monitor_thread_code(__attribute__((unused)) void *arg) 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++; diff --git a/audio_pa.c b/audio_pa.c index 8ea1d273..998dbc27 100644 --- a/audio_pa.c +++ b/audio_pa.c @@ -209,7 +209,7 @@ static int configure(int32_t requested_encoded_format, char **resulting_channel_ 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; diff --git a/audio_pw.c b/audio_pw.c index 74f3cb64..e227bba9 100644 --- a/audio_pw.c +++ b/audio_pw.c @@ -335,7 +335,7 @@ static int configure(int32_t requested_encoded_format, char **resulting_channel_ // 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; diff --git a/audio_sndio.c b/audio_sndio.c index e83f3cb8..dd1d3bac 100644 --- a/audio_sndio.c +++ b/audio_sndio.c @@ -101,14 +101,14 @@ static int get_permissible_configuration_settings() { 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 { @@ -123,14 +123,14 @@ static int get_permissible_configuration_settings() { // 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 { diff --git a/common.c b/common.c index fde58abb..84de277a 100644 --- a/common.c +++ b/common.c @@ -846,7 +846,7 @@ uint8_t *rsa_apply(uint8_t *input, int inlen, int *outlen, int mode) { 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)); @@ -1808,7 +1808,7 @@ void sps_nanosleep(const time_t sec, const long nanosec) { 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 @@ -1892,9 +1892,13 @@ int _debug_mutex_unlock(pthread_mutex_t *mutex, const char *mutexname, const cha 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; } diff --git a/dacp.c b/dacp.c index 09de5fc4..a849c8a6 100644 --- a/dacp.c +++ b/dacp.c @@ -1302,7 +1302,7 @@ int dacp_set_volume(int32_t vo) { 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) { diff --git a/mqtt.c b/mqtt.c index 3e284288..bcabccce 100644 --- a/mqtt.c +++ b/mqtt.c @@ -25,16 +25,16 @@ void _cb_log(__attribute__((unused)) struct mosquitto *mosq, __attribute__((unus 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); @@ -397,7 +397,7 @@ int initialise_mqtt() { 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 || diff --git a/player.c b/player.c index 5fe3533e..5cdb162c 100644 --- a/player.c +++ b/player.c @@ -1273,7 +1273,7 @@ AVFrame *block_to_avframe(rtsp_conn_info *conn, uint8_t *incoming_data, 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; @@ -1293,7 +1293,7 @@ AVFrame *block_to_avframe(rtsp_conn_info *conn, uint8_t *incoming_data, } } } 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; @@ -1584,7 +1584,7 @@ uint32_t player_put_packet(uint32_t ssrc, seq_t seqno, uint32_t actual_timestamp // } 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; @@ -1636,7 +1636,7 @@ uint32_t player_put_packet(uint32_t ssrc, seq_t seqno, uint32_t actual_timestamp //} 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; @@ -2126,7 +2126,7 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn, int resync_requested) { 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); @@ -4037,7 +4037,7 @@ void *player_thread_func(void *arg) { 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) { diff --git a/rtp.c b/rtp.c index 335079ed..d72568c2 100644 --- a/rtp.c +++ b/rtp.c @@ -300,10 +300,10 @@ void *rtp_audio_receiver(void *arg) { 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)); @@ -573,7 +573,7 @@ void *rtp_control_receiver(void *arg) { 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."); @@ -981,7 +981,7 @@ void *rtp_timing_receiver(void *arg) { 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."); @@ -1761,7 +1761,7 @@ void *rtp_ap2_control_receiver(void *arg) { 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); @@ -1789,7 +1789,7 @@ void *rtp_ap2_control_receiver(void *arg) { 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); } } diff --git a/rtsp.c b/rtsp.c index d11f4ba8..52bda460 100644 --- a/rtsp.c +++ b/rtsp.c @@ -939,7 +939,7 @@ ssize_t read_encrypted(int fd, pair_cipher_bundle *ctx, void *buf, size_t count) 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); @@ -1008,7 +1008,7 @@ ssize_t read_from_rtsp_connection(rtsp_conn_info *conn, void *buf, size_t count) 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 { @@ -1333,7 +1333,7 @@ int msg_write_response(rtsp_conn_info *conn, rtsp_message *resp) { 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; } @@ -5194,7 +5194,7 @@ static void *rtsp_conversation_thread_func(void *pconn) { 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); } } diff --git a/shairport.c b/shairport.c index 5779d65f..ed2bf07a 100644 --- a/shairport.c +++ b/shairport.c @@ -1397,7 +1397,7 @@ int parse_options(int argc, char **argv) { 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; @@ -1626,7 +1626,7 @@ int parse_options(int argc, char **argv) { // 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]; @@ -3116,7 +3116,7 @@ int main(int argc, char **argv) { 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 diff --git a/utilities/buffered_read.c b/utilities/buffered_read.c index 82baa2d3..24f93cf7 100644 --- a/utilities/buffered_read.c +++ b/utilities/buffered_read.c @@ -42,7 +42,7 @@ ssize_t buffered_read(buffered_tcp_desc *descriptor, void *buf, size_t count, 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) && @@ -50,7 +50,7 @@ ssize_t buffered_read(buffered_tcp_desc *descriptor, void *buf, size_t count, 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); } @@ -144,7 +144,7 @@ void *buffered_tcp_reader(void *arg) { // 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);