gcc6.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From ff1ed2c4524095055140370c1008a2d9cccc5645 Mon Sep 17 00:00:00 2001
  2. From: Adrian Knoth <adi@drcomp.erfurt.thur.de>
  3. Date: Sat, 11 Jun 2016 05:35:07 +0200
  4. Subject: [PATCH] Fix initialization in test/iodelay.cpp
  5. jack_latency_range_t is
  6. struct _jack_latency_range {
  7. jack_nframes_t min;
  8. jack_nframes_t max;
  9. };
  10. and jack_nframes_t is
  11. typedef uint32_t jack_nframes_t;
  12. so it's unsigned. Initialising it with -1 is invalid (at least in C++14). We cannot use {0, 0}, because latency_cb has
  13. jack_latency_range_t range;
  14. range.min = range.max = 0;
  15. if ((range.min != capture_latency.min) || (range.max !=
  16. capture_latency.max)) {
  17. capture_latency = range;
  18. }
  19. so we must not have {0, 0}, otherwise the condition would never be true.
  20. Using UINT32_MAX should be equivalent to the previous -1.
  21. ---
  22. tests/iodelay.cpp | 7 ++++---
  23. 1 file changed, 4 insertions(+), 3 deletions(-)
  24. diff --git a/tests/iodelay.cpp b/tests/iodelay.cpp
  25. index e1ba63f..1ef470f 100644
  26. --- a/tests/iodelay.cpp
  27. +++ b/tests/iodelay.cpp
  28. @@ -20,6 +20,7 @@
  29. #include <stdlib.h>
  30. #include <stdio.h>
  31. +#include <stdint.h>
  32. #include <math.h>
  33. #include <unistd.h>
  34. #include <jack/jack.h>
  35. @@ -167,8 +168,8 @@ static jack_client_t *jack_handle;
  36. static jack_port_t *jack_capt;
  37. static jack_port_t *jack_play;
  38. -jack_latency_range_t capture_latency = {-1, -1};
  39. -jack_latency_range_t playback_latency = {-1, -1};
  40. +jack_latency_range_t capture_latency = {UINT32_MAX, UINT32_MAX};
  41. +jack_latency_range_t playback_latency = {UINT32_MAX, UINT32_MAX};
  42. void
  43. latency_cb (jack_latency_callback_mode_t mode, void *arg)
  44. @@ -266,4 +267,4 @@ int main (int ac, char *av [])
  45. return 0;
  46. }
  47. -// --------------------------------------------------------------------------------
  48. \ No newline at end of file
  49. +// --------------------------------------------------------------------------------