changeset 33182:a959fc381fee

maint: Merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 09 Mar 2024 16:57:33 +0100
parents 4ec97d8770ff (current diff) 2bee38885727 (diff)
children f5487b66e56e
files libinterp/corefcn/graphics.cc libinterp/corefcn/regexp.cc
diffstat 2 files changed, 20 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Thu Mar 07 16:12:15 2024 -0500
+++ b/libinterp/corefcn/graphics.cc	Sat Mar 09 16:57:33 2024 +0100
@@ -9835,6 +9835,15 @@
       return;
     }
 
+  // Check if number of color values matches number of faces or vertices
+  octave_idx_type nfvc = fvc.rows ();
+  if (nfvc > 1 && nfvc != nfaces && nfvc != nvert)
+    {
+      m_bad_data_msg = "number of facevertexcdata values matches "
+                       "neither number of faces nor number of vertices";
+      return;
+    }
+
   // Replace NaNs
   if (idx.any_element_is_inf_or_nan ())
     {
@@ -9901,21 +9910,20 @@
 
   if (fvc.rows () == nfaces || fvc.rows () == 1)
     {
+      // "facevertexcdata" holds color data per face or same color for all
       dv(0) = 1;
       dv(1) = fvc.rows ();
       dv(2) = fvc.columns ();
       cd = fvc.reshape (dv);
     }
-  else
-    {
-      if (! fvc.isempty ())
-        {
-          dv(0) = idx.rows ();
-          dv(1) = nfaces;
-          dv(2) = fvc.columns ();
-          cd.resize (dv);
-          pervertex = true;
-        }
+  else if (! fvc.isempty ())
+    {
+      // "facevertexcdata" holds color data per vertex
+      dv(0) = idx.rows ();
+      dv(1) = nfaces;
+      dv(2) = fvc.columns ();
+      cd.resize (dv);
+      pervertex = true;
     }
 
   // Build x,y,zdata and eventually per vertex cdata
--- a/libinterp/corefcn/regexp.cc	Thu Mar 07 16:12:15 2024 -0500
+++ b/libinterp/corefcn/regexp.cc	Sat Mar 09 16:57:33 2024 +0100
@@ -880,9 +880,9 @@
 complement), and then further processing the return variables (now reduced in
 size) with successive @code{regexp} searches.
 
-Octave's @code{regexp} implementaion is based on the Perl Compatible
+Octave's @code{regexp} implementation is based on the Perl Compatible
 Regular Expressions library (@url{https://www.pcre.org/}).  For a more
-comprehensive list of rexexp operator syntax see the
+comprehensive list of @code{regexp} operator syntax see the
 @url{https://www.pcre.org/current/doc/html/pcre2syntax.html,,
 "PCRE Syntax quick-reference summary"}.