From 3d70d7c07ad33396f5139244118a7b235107ac00 Mon Sep 17 00:00:00 2001
From: Andrea Censi <andrea@cds.caltech.edu>
Date: Thu, 28 Mar 2013 20:25:56 -0700
Subject: [PATCH] Workaround for compiler not supporting variable-length array

---
 sm/csm/hsm/hsm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sm/csm/hsm/hsm.c b/sm/csm/hsm/hsm.c
index 618b04b..d36881c 100644
--- a/sm/csm/hsm/hsm.c
+++ b/sm/csm/hsm/hsm.c
@@ -200,6 +200,9 @@ void hsm_match(struct hsm_params*p, hsm_buffer b1, hsm_buffer b2) {
 			sm_error("Too few directions.\n");
 		}
 		
+		#define MAX_NPEAKS 1024
+		assert(p->linear_xc_max_npeaks<MAX_NPEAKS);
+
 		struct {
 			/* Direction of cross correlation */
 			double angle;
@@ -207,7 +210,8 @@ void hsm_match(struct hsm_params*p, hsm_buffer b1, hsm_buffer b2) {
 			struct {
 				double delta;
 				double value;
-			} hypotheses[p->linear_xc_max_npeaks];
+			// } hypotheses[p->linear_xc_max_npeaks];
+			} hypotheses[MAX_NPEAKS];
 		} dirs[ndirections];
 
 
-- 
GitLab