From 484e380536c5ecce3313dd240bd7abb4929518f7 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 18 Nov 2014 04:46:37 +0100 Subject: [PATCH] silence clang "dead assignment" warnings --- gtk2_ardour/midi_tracer.cc | 2 ++ libs/evoral/src/libsmf/smf_decode.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/gtk2_ardour/midi_tracer.cc b/gtk2_ardour/midi_tracer.cc index a92c5a57e3..a6cbdd6e01 100644 --- a/gtk2_ardour/midi_tracer.cc +++ b/gtk2_ardour/midi_tracer.cc @@ -405,6 +405,8 @@ MidiTracer::tracer (Parser&, byte* msg, size_t len) // If you want to append more to the line, uncomment this first // bufsize -= s; + assert(s <= buffer_size); // clang dead-assignment + fifo.write (&buf, 1); if (g_atomic_int_get (const_cast (&_update_queued)) == 0) { diff --git a/libs/evoral/src/libsmf/smf_decode.c b/libs/evoral/src/libsmf/smf_decode.c index 8037fd80d2..b227797b1c 100644 --- a/libs/evoral/src/libsmf/smf_decode.c +++ b/libs/evoral/src/libsmf/smf_decode.c @@ -285,6 +285,7 @@ smf_event_decode_metadata(const smf_event_t *event) goto error; } + assert (off < BUFFER_SIZE); return (buf); error: @@ -342,6 +343,7 @@ smf_event_decode_system_realtime(const smf_event_t *event) return (NULL); } + assert (off < BUFFER_SIZE); return (buf); } @@ -373,6 +375,7 @@ smf_event_decode_sysex(const smf_event_t *event) } else { off += snprintf(buf + off, BUFFER_SIZE - off, "SysEx, manufacturer 0x%x", manufacturer); + assert (off < BUFFER_SIZE); return (buf); } @@ -445,6 +448,7 @@ smf_event_decode_sysex(const smf_event_t *event) else off += snprintf(buf + off, BUFFER_SIZE - off, ", Unknown"); + assert (off <= BUFFER_SIZE); return (buf); } @@ -487,6 +491,7 @@ smf_event_decode_system_common(const smf_event_t *event) return (NULL); } + assert (off < BUFFER_SIZE); return (buf); } @@ -583,6 +588,8 @@ smf_event_decode(const smf_event_t *event) return (NULL); } + assert(off <= BUFFER_SIZE); + return (buf); } @@ -633,6 +640,7 @@ smf_decode(const smf_t *smf) else off += snprintf(buf + off, BUFFER_SIZE - off, "; division: %d FPS, %d resolution", smf->frames_per_second, smf->resolution); + assert (off < BUFFER_SIZE); return (buf); }