Add test for bug fixed recently in recode
[pspp] / src / recode.c
index e2df650f26ecc25fd59312970f4aa0a03ef7a337..90a405c868431b91f5a10c8e5dee2b464bbfc34f 100644 (file)
@@ -18,7 +18,7 @@
    02111-1307, USA. */
 
 #include <config.h>
-#include <assert.h>
+#include "error.h"
 #include <ctype.h>
 #include <math.h>
 #include <stdlib.h>
@@ -232,7 +232,7 @@ cmd_recode (void)
              else
                {
                  for (i = mark; i < rcd->nmap; i++)
-                   rcd->map[i].t.c = xstrdup (output.c);
+                   rcd->map[i].t.c = (output.c?xstrdup (output.c):NULL);
                  free (output.c);
                }
            }
@@ -788,6 +788,7 @@ recode_trns_proc (struct trns_header * t, struct ccase * c,
          break;
         default:
           assert (0);
+          abort ();
        }
       if (!cp)
        continue;
@@ -804,9 +805,9 @@ recode_trns_proc (struct trns_header * t, struct ccase * c,
       else
        {
          char *val = cp->t.c;
-         if (val == NULL)
+         if (val == NULL) 
            st_bare_pad_len_copy (c->data[v->dest->fv].s,
-                                 c->data[v->src->fv].c,
+                                 c->data[v->src->fv].s,
                                  v->dest->width, v->src->width);
          else
            memcpy (c->data[v->dest->fv].s, cp->t.c, v->dest->width);