diff src/dmtimeline.c @ 958:985225a93aeb

Add error code parameter to dmError() and dmErrorVA().
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 27 Feb 2015 03:58:25 +0200
parents 18cd96a27dee
children e06abfde6c39
line wrap: on
line diff
--- a/src/dmtimeline.c	Fri Feb 27 02:21:57 2015 +0200
+++ b/src/dmtimeline.c	Fri Feb 27 03:58:25 2015 +0200
@@ -149,9 +149,9 @@
     
     if (hdr.nparams > DT_MAX_EFFECT_PARAMS)
     {
-        dmError("Invalid number of parameters, %d > %d ('%s' @ %d:%d)\n",
+        return dmError(DMERR_INVALID_DATA,
+            "Invalid number of parameters, %d > %d ('%s' @ %d:%d)\n",
             hdr.nparams, DT_MAX_EFFECT_PARAMS, hdr.effectName, hdr.start, hdr.duration);
-        return DMERR_INVALID_DATA;
     }
 
     event->start     = hdr.start;
@@ -160,15 +160,16 @@
     event->effect    = engineFindEffect(hdr.effectName, hdr.nparams);
     if (event->effect == NULL)
     {
-        dmError("No matching registered effect found for '%s'.\n", hdr.effectName);
-        return DMERR_INVALID_DATA;
+        return dmError(DMERR_INVALID_DATA,
+            "No matching registered effect found for '%s'.\n",
+            hdr.effectName);
     }
 
     event->params    = dmCalloc(event->nparams, sizeof(DMTimelineEventParam));
     if (event->params == NULL)
     {
-        dmError("Could not allocate memory for timeline event parameters.\n");
-        return DMERR_MALLOC;
+        return dmError(DMERR_MALLOC,
+            "Could not allocate memory for timeline event parameters.\n");
     }
 
     for (param = 0; param < event->nparams; param++)