projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added naive callbacks for the "value-changed" signal
[pspp]
/
src
/
data
/
ods-reader.c
diff --git
a/src/data/ods-reader.c
b/src/data/ods-reader.c
index 8504c14cca545033de0d074a29f45659c47258c0..2f058b044d8ac8892115ff53b498a96e7f8c78bf 100644
(file)
--- a/
src/data/ods-reader.c
+++ b/
src/data/ods-reader.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc.
+ Copyright (C) 2011, 2012, 2013
, 2016
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 published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-127,7
+127,7
@@
struct ods_reader
{
struct spreadsheet spreadsheet;
struct zip_reader *zreader;
{
struct spreadsheet spreadsheet;
struct zip_reader *zreader;
- int ref_cnt;
+
int target_sheet_index;
xmlChar *target_sheet_name;
int target_sheet_index;
xmlChar *target_sheet_name;
@@
-157,11
+157,11
@@
struct ods_reader
};
void
};
void
-ods_
destroy
(struct spreadsheet *s)
+ods_
unref
(struct spreadsheet *s)
{
struct ods_reader *r = (struct ods_reader *) s;
{
struct ods_reader *r = (struct ods_reader *) s;
- if (--
r
->ref_cnt == 0)
+ if (--
s
->ref_cnt == 0)
{
int i;
{
int i;
@@
-170,10
+170,12
@@
ods_destroy (struct spreadsheet *s)
{
xmlFree (r->sheets[i].name);
}
{
xmlFree (r->sheets[i].name);
}
-
+
+ dict_destroy (r->dict);
+
zip_reader_destroy (r->zreader);
free (r->sheets);
zip_reader_destroy (r->zreader);
free (r->sheets);
-
+ free (s->file_name);
free (r);
}
}
free (r);
}
}
@@
-276,7
+278,7
@@
ods_file_casereader_destroy (struct casereader *reader UNUSED, void *r_)
r->target_sheet_name = NULL;
r->target_sheet_name = NULL;
- ods_
destroy
(&r->spreadsheet);
+ ods_
unref
(&r->spreadsheet);
}
}
@@
-632,7
+634,7
@@
ods_probe (const char *filename, bool report_errors)
sheet_count = get_sheet_count (zr);
r->zreader = zr;
sheet_count = get_sheet_count (zr);
r->zreader = zr;
- r->ref_cnt = 1;
+ r->
spreadsheet.
ref_cnt = 1;
xtr = init_reader (r, report_errors);
if (xtr == NULL)
xtr = init_reader (r, report_errors);
if (xtr == NULL)
@@
-650,7
+652,7
@@
ods_probe (const char *filename, bool report_errors)
r->n_allocated_sheets = 0;
r->sheets = NULL;
r->n_allocated_sheets = 0;
r->sheets = NULL;
- r->spreadsheet.file_name =
filename
;
+ r->spreadsheet.file_name =
strdup (filename)
;
return &r->spreadsheet;
error:
return &r->spreadsheet;
error:
@@
-679,7
+681,7
@@
ods_make_reader (struct spreadsheet *spreadsheet,
assert (r);
r->read_names = opts->read_names;
ds_init_empty (&r->ods_errs);
assert (r);
r->read_names = opts->read_names;
ds_init_empty (&r->ods_errs);
- ++r->ref_cnt;
+ ++r->
spreadsheet.
ref_cnt;
xtr = init_reader (r, true);
if ( xtr == NULL)
xtr = init_reader (r, true);
if ( xtr == NULL)
@@
-919,8
+921,6
@@
ods_make_reader (struct spreadsheet *spreadsheet,
free (var_spec);
free (var_spec);
- dict_destroy (r->spreadsheet.dict);
- r->spreadsheet.dict = NULL;
ods_file_casereader_destroy (NULL, r);
return NULL;
ods_file_casereader_destroy (NULL, r);
return NULL;
@@
-986,8
+986,9
@@
ods_file_casereader_read (struct casereader *reader UNUSED, void *r_)
struct xml_value *xmv = xzalloc (sizeof *xmv);
xmv->text = xmlTextReaderValue (r->rsd.xtr);
xmv->value = val_string;
struct xml_value *xmv = xzalloc (sizeof *xmv);
xmv->text = xmlTextReaderValue (r->rsd.xtr);
xmv->value = val_string;
- xmv->type = type;
val_string = NULL;
val_string = NULL;
+ xmv->type = type;
+ type = NULL;
for (col = 0; col < r->rsd.col_span; ++col)
{
for (col = 0; col < r->rsd.col_span; ++col)
{
@@
-1013,6
+1014,9
@@
ods_file_casereader_read (struct casereader *reader UNUSED, void *r_)
break;
}
break;
}
+ xmlFree (type);
+ xmlFree (val_string);
+
return c;
}
#endif
return c;
}
#endif