Description: Use pd_error() instead of the deprecated error()
Author: IOhannes m zmölnig
Origin: Debian
Forwarded: not-needed
Last-Update: 2022-09-28
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- pd-iemmatrix.orig/src/mtx_concat.c
+++ pd-iemmatrix/src/mtx_concat.c
@@ -49,7 +49,7 @@
     mtx_concat_obj->concat_mode = 0;
     break;
   default:
-    error("mtx_concat: invalid mode '%s'", c_mode->s_name);
+    pd_error(mtx_concat_obj, "mtx_concat: invalid mode '%s'", c_mode->s_name);
     break;
   }
 }
--- pd-iemmatrix.orig/src/mtx_fill.c
+++ pd-iemmatrix/src/mtx_fill.c
@@ -152,13 +152,16 @@
 
 static void *newMTXFill (t_symbol *s, int argc, t_atom *argv)
 {
+  static int first_time = 1;
   MTXfill *mtx_fill_obj = (MTXfill *) pd_new (mtx_fill_class);
 
   mtx_fill_obj->size = 0;
   mtx_fill_obj->fill_startrow = 1;
   mtx_fill_obj->fill_startcol = 1;
   mtx_fill_obj->fill_type = DONT_FILL_JUST_PASS;
-  error("[mtx_fill]: this object _might_ change in the future!");
+  if(first_time)
+      pd_error(mtx_fill_obj, "[mtx_fill]: this object _might_ change in the future!");
+  first_time = 0;
   if (argc) {
     if (atom_getsymbol(argv)==gensym("matrix")) {
       mTXFillIndexMatrix (mtx_fill_obj, s, argc-1, argv+1);
--- pd-iemmatrix.orig/src/mtx_find.c
+++ pd-iemmatrix/src/mtx_find.c
@@ -67,6 +67,7 @@
 
 static void *newMTXFind (t_symbol *s, int argc, t_atom *argv)
 {
+  static int first_time = 1;
   MTXfind *mtx_find_obj = (MTXfind *) pd_new (mtx_find_class);
 
   mTXSetFindMode (mtx_find_obj, gensym(":"));
@@ -106,7 +107,9 @@
   mtx_find_obj->list_outlet = outlet_new (&mtx_find_obj->x_obj,
                                           gensym("matrix"));
 
-  error("[mtx_find]: this object is likely to change! not really for use yet");
+  if (first_time)
+      pd_error(mtx_find_obj, "[mtx_find]: this object is likely to change! not really for use yet");
+  first_time = 0;
   return ((void *) mtx_find_obj);
 }
 
--- pd-iemmatrix.orig/src/mtx_index.c
+++ pd-iemmatrix/src/mtx_index.c
@@ -47,6 +47,7 @@
 
 static void *newMTXIndex (t_symbol *s, int argc, t_atom *argv)
 {
+  static int first_time = 1;
   MTXindex *mtx_index_obj = (MTXindex *) pd_new (mtx_index_class);
   t_atom fill_atom;
 
@@ -70,7 +71,9 @@
   inlet_new(&mtx_index_obj->x_obj, &mtx_index_obj->x_obj.ob_pd,
             gensym("matrix"),gensym(""));
 
-  error("[mtx_index]: this object is likely to change! not really for use yet");
+  if (first_time)
+      pd_error(mtx_index_obj, "[mtx_index]: this object is likely to change! not really for use yet");
+  first_time = 0;
 
   return ((void *) mtx_index_obj);
 }
--- pd-iemmatrix.orig/src/mtx_mul.c
+++ pd-iemmatrix/src/mtx_mul.c
@@ -29,7 +29,7 @@
 
 static int matchingdimension(void*x, int col, int row, t_matrix*m) {
   if ((col!=m->col)||(row!=m->row)) {
-    pd_error(x, "%smatrix dimension do not match (%dx%d != %dx%d)",
+    pd_error(x, "%s: matrix dimension do not match (%dx%d != %dx%d)",
         iemmatrix_objname(x),
         col, row, m->col, m->row);
     return 0;
@@ -179,11 +179,11 @@
 
 static void *mtx_mul_new(t_symbol *s, int argc, t_atom *argv)
 {
-  if (argc>1) {
-    error("[%s]: extra arguments ignored", s->s_name);
-  }
   if (argc) {
     t_mtx_binscalar *x = (t_mtx_binscalar *)pd_new(mtx_mulscalar_class);
+    if (argc>1) {
+      pd_error(x, "[%s]: extra arguments ignored", s->s_name);
+    }
     floatinlet_new(&x->x_obj, &x->f);
     x->f = atom_getfloatarg(0, argc, argv);
     outlet_new(&x->x_obj, 0);
@@ -347,12 +347,12 @@
 
 static void *mtx_div_new(t_symbol *s, int argc, t_atom *argv)
 {
-  if (argc>1) {
-    error("[%s] extra arguments ignored", s->s_name);
-  }
   if (argc) {
     /* scalar division */
     t_mtx_binscalar *x = (t_mtx_binscalar *)pd_new(mtx_divscalar_class);
+    if (argc>1) {
+      pd_error(x, "[%s] extra arguments ignored", s->s_name);
+    }
     floatinlet_new(&x->x_obj, &x->f);
     x->f = atom_getfloatarg(0, argc, argv);
     outlet_new(&x->x_obj, 0);
--- pd-iemmatrix.orig/src/mtx_reverse.c
+++ pd-iemmatrix/src/mtx_reverse.c
@@ -56,7 +56,7 @@
     mtx_reverse_obj->reverse_mode = -1;
     break;
   default:
-    error("mtx_reverse: invalid mode '%s'", c_mode->s_name);
+    pd_error(mtx_reverse_obj, "mtx_reverse: invalid mode '%s'", c_mode->s_name);
     break;
   }
 }
@@ -125,10 +125,10 @@
 
   /* size check */
   if (!size) {
-    error("mtx_reverse: invalid dimensions");
+    pd_error(mtx_reverse_obj, "mtx_reverse: invalid dimensions");
     return;
   } else if (list_size<size) {
-    error("mtx_reverse: sparse matrix not yet supported: use \"mtx_check\"");
+    pd_error(mtx_reverse_obj, "mtx_reverse: sparse matrix not yet supported: use \"mtx_check\"");
     return;
   }
 
