changeset 8168:dadf478ddc42

fix empty string assignment
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 30 Sep 2008 09:19:43 +0200
parents 17352ccd860e
children 66bc6f9b4f72
files scripts/ChangeLog scripts/strings/split.m src/ChangeLog src/ov-str-mat.cc src/ov-str-mat.h
diffstat 5 files changed, 14 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Sat Sep 27 16:53:40 2008 +0200
+++ b/scripts/ChangeLog	Tue Sep 30 09:19:43 2008 +0200
@@ -1,3 +1,7 @@
+2008-09-30  Jaroslav Hajek  <highegg@gmail.com>
+
+	* string/split.m: New tests.
+
 2008-09-30  Ben Abbott <bpabbott@mac.com>
 
 	* plot/__go_draw_axes__.m: Fix interpolation of facecolors.
--- a/scripts/strings/split.m	Sat Sep 27 16:53:40 2008 +0200
+++ b/scripts/strings/split.m	Tue Sep 30 09:19:43 2008 +0200
@@ -107,3 +107,8 @@
 
 %!error split ("foo", "bar", 3, 4);
 
+%!assert (all (strcmp (split("road//to/hell","/"), ["road"; "    "; "to  "; "hell"])))
+
+%!assert (all (strcmp (split("/road/to/hell/","/"), ["    "; "road"; "to  "; "hell"; "    "])))
+
+
--- a/src/ChangeLog	Sat Sep 27 16:53:40 2008 +0200
+++ b/src/ChangeLog	Tue Sep 30 09:19:43 2008 +0200
@@ -1,3 +1,8 @@
+2008-09-30  Jaroslav Hajek  <highegg@gmail.com>
+
+	* ov-str-mat.h (octave-char-matrix-str::assign): Remove declaration.
+	* ov-str-mat.cc (octave-char-matrix-str::assign): Remove definition.
+
 2008-09-30  John W. Eaton  <jwe@octave.org>
 
 	* DLD-FUNCTIONS/__magick_read__.cc: Only define
--- a/src/ov-str-mat.cc	Sat Sep 27 16:53:40 2008 +0200
+++ b/src/ov-str-mat.cc	Tue Sep 30 09:19:43 2008 +0200
@@ -135,23 +135,6 @@
   return retval;
 }
 
-void
-octave_char_matrix_str::assign (const octave_value_list& idx,
-				const charMatrix& rhs)
-{
-  octave_idx_type len = idx.length ();
-
-  // FIXME
-  charMatrix tmp = rhs;
-  if (tmp.rows () == 1 && tmp.columns () == 0)
-    tmp.resize (0, 0);    
-
-  for (octave_idx_type i = 0; i < len; i++)
-    matrix.set_index (idx(i).index_vector ());
-
-  ::assign (matrix, tmp, Vstring_fill_char);
-}
-
 octave_value 
 octave_char_matrix_str::resize (const dim_vector& dv, bool fill) const
 {
--- a/src/ov-str-mat.h	Sat Sep 27 16:53:40 2008 +0200
+++ b/src/ov-str-mat.h	Tue Sep 30 09:19:43 2008 +0200
@@ -91,8 +91,6 @@
 			    bool resize_ok = false)
     { return do_index_op_internal (idx, resize_ok); }
 
-  void assign (const octave_value_list& idx, const charMatrix& rhs);
-
   octave_value reshape (const dim_vector& new_dims) const
     { return octave_value (charNDArray (matrix.reshape (new_dims)), true); }