Ben Pfaff [Sun, 30 Sep 2012 18:25:23 +0000 (11:25 -0700)]
Merge 'master' into 'psppsheet'.
Ben Pfaff [Wed, 26 Sep 2012 04:18:32 +0000 (21:18 -0700)]
Suppress GCC 4.7 warnings by changes to code that make it less clear.
I'm not entirely happy with these changes, because they make the code
slightly less obvious. However, it's still not really bad code, and
it's convenient to have a warning-free build.
Ben Pfaff [Wed, 26 Sep 2012 04:20:09 +0000 (21:20 -0700)]
Suppress GCC 4.7 warnings due to unimplemented features.
GCC 4.7 complains that the variables removed by this commit are
assigned values that are not used. Fair enough, so this commit
removes them.
Ben Pfaff [Wed, 26 Sep 2012 00:09:47 +0000 (17:09 -0700)]
gnumeric-reader: Add cast to suppress warning.
This suppresses a GCC warning for a mismatch between
xmlInputCloseCallback, which takes a "void *" parameter, and
gzclose(), which takes a "gzFile" (which is "struct gzFile_s *").
This came up with an upgrade from "squeeze" to "wheezy". I assume
that a gzclose prototype became visible or that gzFile changed away
from "void *".
An alternative would be to write a trampoline to just transform one
pointer type to the other, but the xmlReaderForIO() invocation
already has one function cast so a second cast doesn't make it much
worse.
Ben Pfaff [Wed, 26 Sep 2012 00:03:10 +0000 (17:03 -0700)]
split-file-dialog: Add use of unused variable in split_file_dialog().
'selector' was assigned but never used, but here's a use.
Reported by GCC 4.7.
Ben Pfaff [Wed, 26 Sep 2012 00:02:21 +0000 (17:02 -0700)]
Suppress warnings for suspicious use of "enum" constants.
In each case, the code is using values of enums in valid ways that
GCC 4.7 does not expect, so use a cast to suppress the warnings.
Ben Pfaff [Wed, 26 Sep 2012 00:00:34 +0000 (17:00 -0700)]
gui: Check return value of gtk_tree_model_get_iter().
In these two cases the return value was assigned to a variable but
never used. This commit adds a check for the return value.
Ben Pfaff [Tue, 25 Sep 2012 22:54:43 +0000 (15:54 -0700)]
cairo: Avoid deprecated pango_cairo_font_map_create_context().
Pango 1.30 that is in Debian "wheezy" has marked this function as
deprecated. The replacement pango_font_map_create_context() was
introduced in Pango 1.22, which was also in Debian "squeeze" (which
had Pango 1.28), so it seems safe to switch without worrying about
a Pango version check.
Ben Pfaff [Tue, 25 Sep 2012 22:47:04 +0000 (15:47 -0700)]
Remove unused "finalize" functions.
A finalize function that just calls into the parent class finalize
function is a no-op that need not exist.
Ben Pfaff [Tue, 25 Sep 2012 22:36:50 +0000 (15:36 -0700)]
Remove variables assigned to but never used.
Each of the variables removed here was assigned a value that was
never used, the assignment didn't have any useful side effects, and
I don't see anything that the variable should have been used for.
Found by GCC 4.7.
Ben Pfaff [Tue, 25 Sep 2012 22:51:07 +0000 (15:51 -0700)]
EXAMINE: Avoid useless call to casereader_count_cases().
The return value is never used, and this call could have significant
expense (it could cause the data to be read an extra time), so do not
do it.
Reported by GCC 4.7.
Ben Pfaff [Tue, 25 Sep 2012 23:59:04 +0000 (16:59 -0700)]
CROSSTABS: Fix bug in check for REPORT in general mode.
Found by GCC 4.7.
Ben Pfaff [Tue, 25 Sep 2012 22:14:50 +0000 (15:14 -0700)]
expressions: Fix coercion of numbers to booleans at top level.
The check for the expected type in type_check() used the wrong
constant (a node type instead of an expression type) and so the
"if" test was never true. Also, OP_NUM_TO_BOOLEAN is binary, not
unary, so fixing just the test caused an assertion failure.
This commit fixes both problems and adds a test.
Found by GCC 4.7 report of a type mismatch.
John Darrington [Thu, 20 Sep 2012 11:14:55 +0000 (13:14 +0200)]
gtk.h wrapper: Added *_set_realized and set_mapped
We are using these functions, but they are not defined for older gtk versions.
John Darrington [Thu, 20 Sep 2012 09:22:12 +0000 (11:22 +0200)]
src/data/data-out.c: Added assertion to catch negative values
If the contents of string does not contain a '.', then integer_digits
will end up negative, thus causing a crash later. This change adds
an assertion to catch this condition and thus make the diagnosis easier
should it ever occur.
John Darrington [Wed, 12 Sep 2012 18:38:23 +0000 (20:38 +0200)]
Added keybindings to move to the extremities of the sheet.
Altered the Home key to move far left instead of up.
Added Ctrl Left/Right/Up/Down to move to the far edges of the
sheet.
This behaviour is consistent with other software.
John Darrington [Wed, 12 Sep 2012 07:26:21 +0000 (09:26 +0200)]
Perl Module: Avoid forcing scalar value into a pointer.
The code fragment: struct dictionary *dict = (void *) SvIV (dict_sv);
is dangerous. This fix uses the properl Perl XS mechanism to get
the pointer and the scalar associated with the dictionary.
Reviewed-By: Ben Pfaff
Ben Pfaff [Mon, 3 Sep 2012 05:21:09 +0000 (22:21 -0700)]
psppire-cell-renderer: Fix behavior of repeated clicks on a button.
I'm not sure why I thought this code was necessary. Removing it
fixes the problem, which John Darrington reported as:
1. Create or load a dataset with one or more variables.
2. Switch to the variable sheet.
3. Click on one of the in-cell buttons (for example) Value Labels.
4. After the dialog box appears, cancel it with the cancel button.
5. The dialog closes, and the button which invoked it, now has the
focus. However clicking on that button again refuses to bring the
dialog back. One has to move off the button and onto the cell
background.
Ben Pfaff [Sun, 2 Sep 2012 18:07:59 +0000 (11:07 -0700)]
psppire-var-sheet: Allow adjusting width of string variables.
John Darrington pointed out that the "width" column in the variable
sheet didn't allow the width to be modified with a spin button for
string variables, as it did for numeric variables. This commit
fixes the problem.
The reordering in on_var_column_edited() is necessary because the
print format of a string variable can't be changed to a different
width before changing the variable's width. (The change from
var_set_print_format() to var_set_both_formats() is not
necessary. It is for consistency with changing variable type and
format via the var-type-dialog.)
John Darrington [Sat, 25 Aug 2012 17:12:43 +0000 (19:12 +0200)]
var-type-dialog: Adjust packing parameters
John Darrington [Sat, 25 Aug 2012 17:01:45 +0000 (19:01 +0200)]
Merge branch 'master' into psppsheet
John Darrington [Sat, 25 Aug 2012 16:58:31 +0000 (18:58 +0200)]
Update widgets.c from psppsheet branch
John Darrington [Wed, 22 Aug 2012 04:46:18 +0000 (06:46 +0200)]
Fix memory leak in sys-file-reader.c
John Darrington [Mon, 20 Aug 2012 19:32:11 +0000 (21:32 +0200)]
ref count the linreg structure so as to avoid double free problems
Ben Pfaff [Mon, 20 Aug 2012 07:00:33 +0000 (00:00 -0700)]
sys-file-reader: Fix setjmp() technicality.
The C standards say that the compiler is allowed to optimize away
changes to local variables within a function between a call to
setjmp() and a later call to longjmp(), unless the local variables
are volatile-qualified.
The 'info' local variable in sfm_open_reader() fits this
description but wasn't volatile-qualified. This commit fixes that,
even though my compiler didn't in fact seem to have a problem with
the previous version.
Ben Pfaff [Mon, 20 Aug 2012 06:59:47 +0000 (23:59 -0700)]
sys-file-reader: Fix memory leak.
The C standards say that the compiler is allowed to optimize away
changes to local variables within a function between a call to
setjmp() and a later call to longjmp(), unless the local variables
are volatile-qualified.
The 'dict' local variable in sfm_open_reader() fits this
description but wasn't volatile-qualified. GCC in fact optimized
out the changes on my system, and this commit fixes that.
Ben Pfaff [Sun, 19 Aug 2012 20:19:39 +0000 (13:19 -0700)]
widgets: Insert (void) cast in call, to suppress GCC warning.
Otherwise GCC tells me that the call has no effect.
Ben Pfaff [Sun, 19 Aug 2012 20:19:17 +0000 (13:19 -0700)]
widgets: #include missing header file.
It didn't build for me otherwise.
Ben Pfaff [Sun, 19 Aug 2012 20:18:56 +0000 (13:18 -0700)]
psppire-cell-renderer-button: Avoid use-after-free with popup dialog.
When gtk_button_clicked() on a PsppireCellRendererButton causes a
modal dialog to pop up, psppire_cell_renderer_button_initial_click()
only returns from gtk_button_clicked() after the button has already
been destroyed, which causes the g_object_steal_data() call to
remove the IDLE_ID_STRING to access freed memory. This commit fixes
the problem by calling g_object_steal_data() before
gtk_button_clicked().
Ben Pfaff [Sun, 19 Aug 2012 20:16:05 +0000 (13:16 -0700)]
Merge 'master' into 'psppsheet'.
Ben Pfaff [Sun, 19 Aug 2012 18:36:16 +0000 (11:36 -0700)]
missing-val-dialog: Convert to a GObject.
Ben Pfaff [Sun, 19 Aug 2012 18:41:25 +0000 (11:41 -0700)]
missing-val-dialog: Avoid destroying uninitialized data.
If text_to_value() fails for low_val, then this code would still
destroy high_val, even though high_val hadn't been initialized,
thus accessing indeterminate data.
This also eliminates some redundancy in the code.
Ben Pfaff [Sat, 18 Aug 2012 22:31:09 +0000 (15:31 -0700)]
gui: Rename var-sheet-dialogs.ui to missing-val-dialog.ui.
The msising value dialog is the only dialog left in this UI file.
Ben Pfaff [Sun, 19 Aug 2012 17:30:36 +0000 (10:30 -0700)]
psppire-dialog: Add "acceptable" predicate.
PsppireDialog already has a validity predicate that allows a dialog
to easily disable "OK" and other buttons when the dialog has not
yet been completely filled. It should usually be obvious to the
user why this is the case.
The upcoming GObjectification of the missing value dialog calls for
a different kind of predicate, one where the reason is not obvious
to the user (typically because he has just made a typo or does not
understand a variable's format). In this case, the user needs more
feedback, such as a message explaining the problem.
This commit therefore introduces a second kind of predicate, the
"accept" predicate. This predicate is only checked when the user
clicks on the "OK" button.
Ben Pfaff [Sun, 19 Aug 2012 18:36:42 +0000 (11:36 -0700)]
val-labs-dialog, var-type-dialog: Make these dialogs modal.
I missed this in the initial conversion.
Ben Pfaff [Sun, 19 Aug 2012 17:30:53 +0000 (10:30 -0700)]
val-labs-dialog: Remove unused 'window' member.
Ben Pfaff [Sat, 18 Aug 2012 19:28:37 +0000 (12:28 -0700)]
psppire-var-sheet: Remove unneeded #include from header.
Ben Pfaff [Sat, 18 Aug 2012 19:26:03 +0000 (12:26 -0700)]
val-labs-dialog: Convert to a GObject.
Ben Pfaff [Sat, 18 Aug 2012 19:17:01 +0000 (12:17 -0700)]
gui: Factor new text_to_value__() function out of text_to_value().
I intend to use this in an upcoming commit.
Ben Pfaff [Sat, 18 Aug 2012 19:24:21 +0000 (12:24 -0700)]
var-type-dialog: Fix memory leak.
John Darrington [Wed, 15 Aug 2012 05:03:56 +0000 (07:03 +0200)]
Fixed memory leak in FACTOR
John Darrington [Tue, 14 Aug 2012 19:49:26 +0000 (21:49 +0200)]
Fix leaks in REGRESSION
John Darrington [Tue, 14 Aug 2012 18:11:09 +0000 (20:11 +0200)]
Fixed the remaining leaks in AUTORECODE
John Darrington [Mon, 13 Aug 2012 19:13:56 +0000 (21:13 +0200)]
Fix leaks in MEANS command
John Darrington [Sun, 12 Aug 2012 17:51:19 +0000 (19:51 +0200)]
fix some of the leaks in the AUTORECODE command
John Darrington [Sun, 12 Aug 2012 14:29:38 +0000 (16:29 +0200)]
Fixed remaining leaks in ONEWAY
John Darrington [Sun, 12 Aug 2012 11:33:09 +0000 (13:33 +0200)]
Fix memory leaks in ONEWAY command
Ben Pfaff [Thu, 9 Aug 2012 06:27:32 +0000 (23:27 -0700)]
var-type-dialog: Convert to a GObject.
The one issue I can't figure out is why this changes the look of
the dialog box so that its height is the total height of all of
the widgets in the "middlebox", rather than the maximum height
actually needed.
John Darrington [Sat, 11 Aug 2012 06:15:59 +0000 (08:15 +0200)]
src/math/categoricals.c: Remove inappropriate const qualifier
Ben Pfaff [Thu, 9 Aug 2012 06:17:36 +0000 (23:17 -0700)]
variable: Skip callback if new format is same as old format.
Seems fairly worthwhile.
John Darrington [Sun, 5 Aug 2012 16:00:36 +0000 (18:00 +0200)]
Fixed one of the leaks in MEANS
John Darrington [Sun, 5 Aug 2012 14:57:04 +0000 (16:57 +0200)]
Fix leaks in RELIABILITY command
John Darrington [Sat, 4 Aug 2012 05:26:07 +0000 (07:26 +0200)]
Fixed leak in Chi-Squared test
John Darrington [Sat, 4 Aug 2012 05:04:47 +0000 (07:04 +0200)]
categoricals.c (struct payload): Rename destroy to calculate
John Darrington [Sat, 4 Aug 2012 04:48:30 +0000 (06:48 +0200)]
ONEWAY: call categoricals_done only once
John Darrington [Fri, 3 Aug 2012 19:35:11 +0000 (21:35 +0200)]
Make categoricals own its interactions
John Darrington [Thu, 2 Aug 2012 18:54:18 +0000 (20:54 +0200)]
Fix leak in render-test
John Darrington [Wed, 1 Aug 2012 19:22:11 +0000 (21:22 +0200)]
sys-file-reader.c: Fix leak in parse_mrsets
Ben Pfaff [Wed, 1 Aug 2012 05:55:30 +0000 (22:55 -0700)]
ods-reader: Fix ods_file_casereader_destroy() call in open function.
zreader is a "struct zip_reader *" but ods_file_casereader_destroy()
takes a "struct casereader *". However ods_file_casereader_destroy()
doesn't actually use that argument so we might as well pass NULL.
John Darrington [Tue, 31 Jul 2012 17:38:51 +0000 (19:38 +0200)]
Fix leak in psppire-lex-reader.c
Ben Pfaff [Tue, 31 Jul 2012 06:16:39 +0000 (23:16 -0700)]
FACTOR: Fix warning about discarding const qualifier.
Ben Pfaff [Mon, 30 Jul 2012 06:56:09 +0000 (23:56 -0700)]
var-type-dialog: Change entries to spin buttons, add validation.
The GtkEntry boxes used for entering and displaying width and
decimal places didn't do any validation that the width and decimal
places were valid for the selected format type, so it was possible
to enter values that couldn't actually be used. This commit changes
the GtkEntry boxes into GtkSpinButton widgets that, as a side
effect, validate correct values through their attached
GtkAdjustments. This is not just safer but easier to use.
Ben Pfaff [Mon, 30 Jul 2012 06:09:09 +0000 (23:09 -0700)]
var-type-dialog: Reduce redundancy further.
set_format_from_treeview() and set_format_type_from_treeview() were
mostly common code.
Ben Pfaff [Sat, 28 Jul 2012 21:18:40 +0000 (14:18 -0700)]
var-type-dialog: Reduce redundancy.
var_type_dialog_set_state() and on_toggle_2() had considerable
redundant code. This reduces it by adding a new function
on_active_button_change() that generalizes the two functions. I
also personally found the previous way of showing and hiding widgets
to be hard to follow; I think that the bitmap approach used here
is more straightforward.
This also consolidates the two separate signal handlers for each
button into one, and replaces the similar functions
select_treeview_from_format() and select_treeview_from_format_type()
by three functions find_format(), find_format_type(), and
select_treeview_at_index() that total less code.
Ben Pfaff [Fri, 27 Jul 2012 06:21:54 +0000 (23:21 -0700)]
var-type-dialog: Properly adjust formats when switching buttons.
The var-type-dialog based the default new format on the variable's
existing format when a button was clicked, and attempted to adjust
the width and decimals into valid range, but the adjustment wasn't
always correct, so in some cases it could pick an invalid format.
This commit uses fmt_fix_output() instead, which will always choose
a valid output format.
John Darrington [Sun, 29 Jul 2012 18:59:12 +0000 (20:59 +0200)]
Fixed a second ONEWAY leak
John Darrington [Sun, 29 Jul 2012 18:54:16 +0000 (20:54 +0200)]
Fix one of the leaks in ONEWAY
John Darrington [Sun, 29 Jul 2012 13:12:26 +0000 (15:12 +0200)]
Fix memory leak in Chisquare
John Darrington [Sun, 29 Jul 2012 12:49:32 +0000 (14:49 +0200)]
Fix memory leak in AGGREGATE command
John Darrington [Sun, 29 Jul 2012 11:37:41 +0000 (13:37 +0200)]
Fix memory leak in dictionary.c
John Darrington [Sun, 29 Jul 2012 09:22:13 +0000 (11:22 +0200)]
Fix leaks in ODS reader
John Darrington [Sun, 29 Jul 2012 06:05:00 +0000 (08:05 +0200)]
Fixed a memory leak in sparse-xarray-test.c
John Darrington [Sun, 29 Jul 2012 04:55:14 +0000 (06:55 +0200)]
README.Git - Update the gnulib commit number to include memory leak fix
John Darrington [Sat, 28 Jul 2012 16:27:22 +0000 (18:27 +0200)]
Fixed some of the leaks in REGRESSION
John Darrington [Sat, 28 Jul 2012 15:00:32 +0000 (17:00 +0200)]
Fixed memory leaks in FACTOR
John Darrington [Sat, 28 Jul 2012 11:13:08 +0000 (13:13 +0200)]
Fix leak in u8-istream-test.c
John Darrington [Sat, 28 Jul 2012 10:44:26 +0000 (12:44 +0200)]
Fix typo in include-path.c which was causing memory leaks.
John Darrington [Sat, 28 Jul 2012 08:33:44 +0000 (10:33 +0200)]
Fix memory leak in encoding-guesser-test
John Darrington [Sat, 28 Jul 2012 07:52:46 +0000 (09:52 +0200)]
Fix memory leak in format-guesser-test.c
John Darrington [Sat, 28 Jul 2012 07:52:09 +0000 (09:52 +0200)]
Fix memory leak in datasheet-test.c
John Darrington [Fri, 27 Jul 2012 19:59:54 +0000 (21:59 +0200)]
dict_clone: Fix memory leak.
The encoding is already set in dict_create, so this assignment is
redunant and leaks memory.
Reviewed-by: Ben Pfaff.
John Darrington [Mon, 23 Jul 2012 20:45:57 +0000 (22:45 +0200)]
datasehhet.c: Fix memory leak
John Darrington [Sun, 22 Jul 2012 16:26:06 +0000 (18:26 +0200)]
scan-test.c: Fix memory leak
John Darrington [Sun, 22 Jul 2012 16:20:36 +0000 (18:20 +0200)]
Fixed memory leaks coming from file-handle-def.c
Ben Pfaff [Tue, 17 Jul 2012 06:44:52 +0000 (23:44 -0700)]
var-type-dialog: Use fmt_date_template() to reduce duplication.
I believe that it should be possible to merge more code together
later.
Ben Pfaff [Tue, 17 Jul 2012 06:36:30 +0000 (23:36 -0700)]
format: Make fmt_date_template() human-friendly, respect field width.
The strings that fmt_date_template() returned were almost but not
quite the kind of strings that humans expect to see. For one, they
always used "yy", even though the code uses 4-digit years ("yyyy")
when the field width is sufficient. Similarly, they never included
seconds (i.e. omitted ":SS"). Finally, FMT_MOYR had an "X" where
one would expect a space.
This commit corrects all of the above issues. Future commits will
make more use of fmt_date_template().
Ben Pfaff [Tue, 17 Jul 2012 05:28:44 +0000 (22:28 -0700)]
var-type-dialog: Use G_TYPE_INT to store an int.
It seems more straightforward to store an int by value than by
pointer.
Ben Pfaff [Tue, 17 Jul 2012 05:28:14 +0000 (22:28 -0700)]
var-type-dialog: Fix possible memory leaks.
gtk_tree_model_get_value() documentation says:
When done with value, g_value_unset() needs to be called to free
any allocated memory.
but none of the users in this file did that.
Ben Pfaff [Tue, 17 Jul 2012 05:20:42 +0000 (22:20 -0700)]
var-type-dialog: Avoid string copy setting up currency treeview.
The return value of fmt_name() is perfectly suitable here.
John Darrington [Mon, 16 Jul 2012 20:02:45 +0000 (22:02 +0200)]
Fixed leak in aggregate dialog
John Darrington [Mon, 16 Jul 2012 19:10:40 +0000 (21:10 +0200)]
PsppireWindow and PsppireDialog: Use correct the parent structures.
This change makes the structure declarations agree with the class definition.
John Darrington [Mon, 16 Jul 2012 11:17:48 +0000 (13:17 +0200)]
Workaround runtime problem in cygwin
John Darrington [Sun, 15 Jul 2012 12:59:30 +0000 (14:59 +0200)]
GET DATA: Fix memory leak
John Darrington [Sun, 15 Jul 2012 12:59:11 +0000 (14:59 +0200)]
Fix memory leak in odt driver
John Darrington [Sun, 15 Jul 2012 09:19:44 +0000 (11:19 +0200)]
Fix some of the memory leaks in MEANS
John Darrington [Sun, 15 Jul 2012 09:09:06 +0000 (11:09 +0200)]
DO REPEAT: Fix memory leak
Ben Pfaff [Sat, 14 Jul 2012 18:17:59 +0000 (11:17 -0700)]
text-data-import-dialog: Convert input lines to UTF-8 upon read.
Otherwise we can try to display, e.g., ISO 8859-1 with Pango, which
only supports UTF-8, and we get a Gtk-CRITICAL as a result.
Reported by "Alain-F. Nizard" <Alain.Nizard@ac-creteil.fr>
via Jeremy Lavergne <jeremy@lavergne.gotdns.org>.
Ben Pfaff [Sat, 14 Jul 2012 18:17:07 +0000 (11:17 -0700)]
u8-istream: Retry read upon EINTR.
This seems unlikely to be a problem, since we're normally dealing
with regular files, for which reads are uninterruptible, but it
can't hurt.
John Darrington [Sat, 14 Jul 2012 17:38:46 +0000 (19:38 +0200)]
Fixed bug where psppire crashed after selecting custom currency type.
Reviewed-by: Ben Pfaff
John Darrington [Sat, 14 Jul 2012 12:18:08 +0000 (14:18 +0200)]
Data file reader: Avoid crash after failing to open file