]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
further changes to remove compilation warnings on 32-bit builds
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Wed, 31 Dec 2025 19:02:16 +0000 (19:02 +0000)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Wed, 31 Dec 2025 19:02:16 +0000 (19:02 +0000)
13 files changed:
ap2_buffered_audio_processor.c
audio_alsa.c
audio_pa.c
audio_pw.c
audio_sndio.c
common.c
dacp.c
mqtt.c
player.c
rtp.c
rtsp.c
shairport.c
utilities/buffered_read.c

index 2e577331a1c030bcf52be2734d7fc8cdc733bfb7..38ddfd5d2f79217631c73cf0aecd0c7a2c251dc6 100644 (file)
@@ -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));
                     }
                   }
index 516e3a2c2811e5a906b0423f1344b0e72d0a0ff9..2fed54f0984427a267c8c42ba8c51c61c2aed452 100644 (file)
@@ -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++;
index 8ea1d273df33b032747e2560d3c7bd675c9ec455..998dbc271aea5c34aca405de73841a5073942a4e 100644 (file)
@@ -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;
index 74f3cb642ad48f6a71b6613d524c21eb1ed8a3ca..e227bba9a2e06a19a7023e6f7aa208e2304f6c71 100644 (file)
@@ -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;
index e83f3cb81fee0694d9bd135d7180fb12a43b04e5..dd1d3bac2204e6cc1cbdce2094a82dc063788c35 100644 (file)
@@ -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 {
index fde58abb9a37ef57e1f2daecdd1e7949dc75cad5..84de277a3744a14bc4d5380ade19925dd086eb56 100644 (file)
--- 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 09de5fc4a09fb52a357145c86720bf058aa68ed3..a849c8a691968c4816d20a2037f39e2f1a42b8de 100644 (file)
--- 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 3e284288ef236611d6a9618f1352c2332c7e16c2..bcabcccebe02c37417d5fd1af5a6f7c76c4f0461 100644 (file)
--- 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 ||
index 5fe3533e75b98d0ef493df9b3e5d2f6856fcb093..5cdb162c42578af263ce893fa9786fc4e8522afa 100644 (file)
--- 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 335079edc0a25cfb237ee81f29483bc4d131443d..d72568c2909f1f36a48bce368a8cf55f648c3926 100644 (file)
--- 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 d11f4ba81587d9b1f4482e35fcc408453a4b1f3c..52bda460cbd97d9aa86695ac0a2001930c619a3f 100644 (file)
--- 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);
         }
       }
index 5779d65f3339d473d016fbede227637a1d0096af..ed2bf07a2292252bddd22e82d3d783ab7e7afaac 100644 (file)
@@ -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
index 82baa2d39b014bc47bee6e450b7ecac231d1d0f0..24f93cf7147e5a8b39c97dbae34d09c5f9427f0c 100644 (file)
@@ -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);