From 35b2270f84a292181bf6004115076640f3c56801 Mon Sep 17 00:00:00 2001 From: Karl Wette Date: Sun, 15 Apr 2012 22:47:38 +0000 Subject: [PATCH] Make octave_dim tests pass for octave version != 3.2.4 - see SourceForge #3516652 git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12995 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/octave_dim.i | 4 ++-- Lib/octave/octrun.swg | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Examples/test-suite/octave_dim.i b/Examples/test-suite/octave_dim.i index c74285808..f0d05852a 100644 --- a/Examples/test-suite/octave_dim.i +++ b/Examples/test-suite/octave_dim.i @@ -127,7 +127,7 @@ public: class Baz5 { public: Array __dims__() const { - Array c(2,1); + Array c(dim_vector(2,1)); c(0) = 3; c(1) = 4; return c; @@ -137,7 +137,7 @@ public: class Baz6 { public: Array __dims__() const { - Array c(1,2); + Array c(dim_vector(1,2)); c(0) = 3; c(1) = 4; return c; diff --git a/Lib/octave/octrun.swg b/Lib/octave/octrun.swg index 5f1c18af4..b006bfabe 100644 --- a/Lib/octave/octrun.swg +++ b/Lib/octave/octrun.swg @@ -424,7 +424,8 @@ namespace Swig { if (ndim==1 && c.columns()!=1) ndim = c.columns(); dim_vector d; - d.resize(ndim); + d.resize(ndim < 2 ? 2 : ndim); + d(0) = d(1) = 1; // Fill in dim_vector for (int k=0;k a = out.int_vector_value(); if (error_state) return dim_vector(1,1); dim_vector d; - d.resize(a.numel()); + d.resize(a.numel() < 2 ? 2 : a.numel()); + d(0) = d(1) = 1; for (int k=0;k