From b09e046f4e52825538fb58ee40463b13e8c172d2 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Thu, 27 Aug 2015 11:22:11 -0500 Subject: [PATCH] Fix ambiguous abs(jack_nframes_t) call The expression tries to take the absolute value of an unsigned (jack_nframes_t) which is the difference between two unsigned. Cast the unsigned to signed before taking the difference so a cur_buffer_size larger than delta_time actually produces a meaningful result. --- tests/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test.cpp b/tests/test.cpp index 8a8a8117..f995ea32 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -479,7 +479,7 @@ int process4(jack_nframes_t nframes, void *arg) jack_nframes_t delta_time = cur_time - last_time; Log("calling process4 callback : jack_frame_time = %ld delta_time = %ld\n", cur_time, delta_time); - if (delta_time > 0 && (jack_nframes_t)abs(delta_time - cur_buffer_size) > tolerance) { + if (delta_time > 0 && (jack_nframes_t)abs((long int)delta_time - (long int)cur_buffer_size) > tolerance) { printf("!!! ERROR !!! jack_frame_time seems to return incorrect values cur_buffer_size = %d, delta_time = %d tolerance %d\n", cur_buffer_size, delta_time, tolerance); }