changeset 5514:e0011660696c

[project @ 2005-10-27 15:43:29 by jwe]
author jwe
date Thu, 27 Oct 2005 15:43:29 +0000
parents 843fa0a80229
children ae35b3381c7a
files src/ChangeLog src/pt-mat.cc
diffstat 2 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Oct 27 02:44:43 2005 +0000
+++ b/src/ChangeLog	Thu Oct 27 15:43:29 2005 +0000
@@ -1,3 +1,11 @@
+2005-10-27  John W. Eaton  <jwe@octave.org>
+
+	* pt-mat.cc (tm_row_const::tm_row_const_rep::tm_row_const_rep):
+	Ensure that we always have at least two dimensions here.
+	(tm_const::tm_const): Likewise.
+	(tm_const::rows, tm_const::columns): Simplify.
+	(tm_row_const::rows, tm_row_const::columns)): Simplify.
+
 2005-10-26  John W. Eaton  <jwe@octave.org>
 
 	* oct-procbuf.cc (octave_procbuf::open): Cast 0 to void * to avoid
--- a/src/pt-mat.cc	Thu Oct 27 02:44:43 2005 +0000
+++ b/src/pt-mat.cc	Thu Oct 27 15:43:29 2005 +0000
@@ -67,13 +67,13 @@
   public:
 
     tm_row_const_rep (void)
-      : count (1), dv (), all_str (false),
+      : count (1), dv (0, 0), all_str (false),
 	all_sq_str (false), all_dq_str (false),
 	some_str (false), all_real (false), all_cmplx (false),
 	all_mt (true), ok (false) { }
 
     tm_row_const_rep (const tree_argument_list& row)
-      : count (1), dv (), all_str (false), all_sq_str (false),
+      : count (1), dv (0, 0), all_str (false), all_sq_str (false),
 	some_str (false), all_real (false), all_cmplx (false),
 	all_mt (true), ok (false)
     { init (row); }
@@ -150,11 +150,8 @@
       delete rep;
   }
 
-  octave_idx_type rows (void)
-  { return (rep->dv.length () > 0 ? rep->dv(0) : 0); }
-
-  octave_idx_type cols (void)
-  { return (rep->dv.length () > 1 ? rep->dv(1) : 0); }
+  octave_idx_type rows (void) { return rep->dv(0); }
+  octave_idx_type cols (void) { return rep->dv(1); }
 
   dim_vector dims (void) { return rep->dv; }
 
@@ -357,15 +354,15 @@
 public:
 
   tm_const (const tree_matrix& tm)
-    : dv (), all_str (false), all_sq_str (false), all_dq_str (false),
+    : dv (0, 0), all_str (false), all_sq_str (false), all_dq_str (false),
       some_str (false), all_real (false), all_cmplx (false),
       all_mt (true), ok (false)
       { init (tm); }
 
   ~tm_const (void) { }
 
-  octave_idx_type rows (void) const { return (dv.length () > 0 ? dv.elem (0) : 0); }
-  octave_idx_type cols (void) const { return (dv.length () > 1 ? dv.elem (1) : 0); }
+  octave_idx_type rows (void) const { return dv.elem (0); }
+  octave_idx_type cols (void) const { return dv.elem (1); }
 
   dim_vector dims (void) const { return dv; }