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
This commit is contained in:
Karl Wette 2012-04-15 22:47:38 +00:00
parent 70e0cf60f7
commit 35b2270f84
2 changed files with 6 additions and 4 deletions

View File

@ -127,7 +127,7 @@ public:
class Baz5 {
public:
Array<octave_idx_type> __dims__() const {
Array<octave_idx_type> c(2,1);
Array<octave_idx_type> c(dim_vector(2,1));
c(0) = 3;
c(1) = 4;
return c;
@ -137,7 +137,7 @@ public:
class Baz6 {
public:
Array<octave_idx_type> __dims__() const {
Array<octave_idx_type> c(1,2);
Array<octave_idx_type> c(dim_vector(1,2));
c(0) = 3;
c(1) = 4;
return c;

View File

@ -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<ndim;k++) {
@ -440,7 +441,8 @@ namespace Swig {
Array<int> 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<a.numel();k++) {
d.elem(k) = a(k);
}