X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=perl-module%2FPSPP.xs;h=0f0d16b34321cc8d05165725a75be1455f1c31ae;hb=d7a8159acf53f6bf70940d711b32348b6ae75f16;hp=0895f641a8577570fe5aff2a011d356fc1cf72f8;hpb=ac3210e657919902ce3f71f6538a03fbfc0baa89;p=pspp diff --git a/perl-module/PSPP.xs b/perl-module/PSPP.xs index 0895f641a8..0f0d16b343 100644 --- a/perl-module/PSPP.xs +++ b/perl-module/PSPP.xs @@ -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 @@ -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: