render: Fix typo in comment.
[pspp] / perl-module / PSPP.xs
index 0895f641a8577570fe5aff2a011d356fc1cf72f8..e600f7b45d4e271d1d381e087349ec017a5f7831 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - computes sample statistics.
-   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -424,7 +424,7 @@ set_label (var, label)
  struct variable *var;
  char *label
 CODE:
-  var_set_label (var, label, false);
+  var_set_label (var, label);
 
 
 void
@@ -632,7 +632,9 @@ INIT:
     SV** version = hv_fetch(opt_h, "version", 7, 0);
 
     opts.create_writeable = readonly ? ! SvIV (*readonly) : true;
-    opts.compress = compress ? SvIV (*compress) : false;
+    opts.compression = (compress && SvIV (*compress)
+                        ? SFM_COMP_SIMPLE
+                       : SFM_COMP_NONE);
     opts.version = version ? SvIV (*version) : 3 ;
   }
 CODE:
@@ -753,17 +755,26 @@ CODE:
  struct file_handle *fh =
         fh_create_file (NULL, name, fh_default_properties () );
  struct dictionary *dict;
+ struct sfm_reader *r;
 
  sri = xmalloc (sizeof (*sri));
- sri->reader = sfm_open_reader (fh, NULL, &dict, &sri->opts);
-
- if ( sri->reader != NULL)
-   sri->dict = create_pspp_dict (dict);
+ r = sfm_open (fh);
+ if (r)
+   {
+     sri->reader = sfm_decode (r, NULL, &dict, &sri->opts);
+     if (sri->reader)
+       sri->dict = create_pspp_dict (dict);
+     else
+       {
+        free (sri);
+        sri = NULL;
+       }
+   }
  else
    {
      free (sri);
      sri = NULL;
-   }
+   } 
 
  RETVAL = sri;
  OUTPUT: