From dc46ceaa88fda4093e97dd8796062528f55c47fd Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Fri, 29 Sep 2017 11:15:24 -0400
Subject: [PATCH] a few more workarounds for an unknown instruction in valgrind

---
 externals/pdogg/oggamp~.c  | 2 +-
 externals/pdogg/oggcast~.c | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/externals/pdogg/oggamp~.c b/externals/pdogg/oggamp~.c
index 9ee27b8f3..2dfe189cb 100644
--- a/externals/pdogg/oggamp~.c
+++ b/externals/pdogg/oggamp~.c
@@ -1004,7 +1004,7 @@ static void oggamp_tick(t_oggamp *x)
 static void *oggamp_new(t_floatarg fdographics, t_floatarg fnchannels, t_floatarg fbufsize)
 {
     t_oggamp *x;
-    int nchannels = fnchannels, bufsize = fbufsize * 1024, i;
+    int nchannels = fnchannels, bufsize = ((double)fbufsize) * 1024, i;
     float *buf;
     
     if (nchannels < 1)
diff --git a/externals/pdogg/oggcast~.c b/externals/pdogg/oggcast~.c
index e4b5a2eb0..b80fa0267 100644
--- a/externals/pdogg/oggcast~.c
+++ b/externals/pdogg/oggcast~.c
@@ -998,7 +998,11 @@ static void oggcast_tick_pages(t_oggcast *x)
 static void *oggcast_new(t_floatarg fnchannels, t_floatarg fbufsize)
 {
     t_oggcast *x;
-    int nchannels = fnchannels, bufsize = fbufsize * 1024, i;
+    /* The cast to double below is a workaround for an unrecognized instruction
+       when running the arm CI runner under valgrind. Fortunately there are
+       only a handful of these in the entire codebase. Once this gets fixed
+       upstream in Valgrind these casts can be removed. */
+    int nchannels = fnchannels, bufsize = ((double)fbufsize) * 1024, i;
     float *buf;
     
     if (nchannels < 1)
-- 
GitLab