John Darrington [Sat, 17 Oct 2015 15:29:31 +0000 (17:29 +0200)]
make-file.c: Behave better under windows operating systems
Under w32 it is necessary to convert all file names to UTF-16 and prefix all
the file related system calls with "_w". Otherwise, calls involving filenames
which contain non-ascii characters will not work properly.
John Darrington [Tue, 20 Oct 2015 10:08:46 +0000 (12:08 +0200)]
Append the correct number of null bytes to the end of recoded strings
Previously the recode_string et al functions assumed that the correct way to
terminate a string was to append a single \0. With encodings such as UTF-16
however, two \0 bytes are necessary and four with UTF-32. This change fixes
the problem.
John Darrington [Sat, 17 Oct 2015 16:04:10 +0000 (18:04 +0200)]
Add tests for cases exercising the atomic replacement mechanism
Add a test case when writing to a fifo.
Add some test cases for situations where file creation fails. Failure
to create a file should be reported gracefully.
John Darrington [Sun, 4 Oct 2015 20:54:48 +0000 (22:54 +0200)]
Zip Reader: Avoid undefined behaviour when reading short files
The zip reader makes many calls to fread. However the return value was not checked. This could
have had undefined consequences when reading short files. This change checks all calls to fread.
John Darrington [Wed, 16 Sep 2015 05:30:57 +0000 (07:30 +0200)]
Text file importer: Initialise the total_is_exact variable.
The text file importer was supposed to have a feature where the total number of lines
in the file was measured if the file was short, or estimated if it was long. However
the variable which was supposed to hold this information was never initialised. This
change fixes that.
John Darrington [Tue, 15 Sep 2015 16:17:19 +0000 (18:17 +0200)]
Ref count struct spreadsheet
struct spreadsheet is a base class for which all current derivations
are ref counted. It makes sense then to have the base class refcounted
instead of the more derived ones
John Darrington [Sat, 12 Sep 2015 10:38:50 +0000 (12:38 +0200)]
Fix dereference to reallocated pointer in data-parser.c (parse_delimited_no_span, parse_delimited_span)
The parse_delimited_span and parse_delimited_no_span functions were
accessing a pointer from within a loop, but the pointer had been
initialised outside the loop. However the loop itself was deallocating
the memory referenced by that pointer.
This change initialises the pointer within the loop so as to avoid
a potential crash here.
A number of users have complained that the import dialog assistant
crashes on exit. This seems to be because some callback is accessing
the data after it has been freed.
This change "fixes" that by simply not ever freeing the data. This
will cause a memory leak. However during my investigations, I have
found that this dialog leaks so much anyway that these few bytes are
hardly significant.
John Darrington [Mon, 17 Aug 2015 17:00:53 +0000 (19:00 +0200)]
Restore the splash screen.
Re-implementat the splash screen, using functinos which are not
deprecated under Gtk3. Note: This implementation does not
use the gtk functions which the Gtk devs recommend for splash screens.
What they forget, is that a primary purpose of a splash screen is
that it should appear with the minimum of delay. gtk_init can
have significant delay - hence the recommended way of doing splash
screens in Gtk is self defeating.
John Darrington [Sun, 26 Jul 2015 08:22:32 +0000 (10:22 +0200)]
PsppireDialogAction and subclasses - use function to set class activate and thus minimise deprecation warnings
All subclasses of PsppireDialogAction needed to use GtkActionClass. This widget however
is deprecated in recent Gtk versions. Meaning that all instances of PsppireDialogAction
implementations would provoke a deprecation warning at compile time.
This change avoids that by providing a common function to set GtkActionClass->activate.
Thus, there is now only a single warning instead of many.
Ben Pfaff [Sat, 25 Jul 2015 20:44:07 +0000 (13:44 -0700)]
sys-file-reader: Change some errors to warnings.
I encountered some system files with corrupt data in the long string
missing value record. Until now, this entirely prevented the file from
being read. This commit changes that to just a warning, enabling the file
to be read.
Also revises system file format documentation to better explain that
unknown or corrupted extension records should be ignored.
Ben Pfaff [Sat, 25 Jul 2015 15:58:06 +0000 (08:58 -0700)]
dictionary: Make dict_delete_var() much faster in common case.
When a system file is opened, dict_delete_consecutive_vars() deletes lots
of variables if the system file has long string variables. This was very
slow because of the O(n**2) behavior in dict_delete_var(). The biggest
cost of that O(n**2) behavior was in calling var_clone() on every variable
several times. Fortunately, the var_clone() call is not necessary in this
case, because the cloned variable is only needed for callbacks, which
aren't set when a dictionary is being read.
This reduced the time to read the dictionary in a particular sample system
file from seconds to milliseconds.
Ben Pfaff [Tue, 21 Jul 2015 03:43:00 +0000 (20:43 -0700)]
GET DATA/TYPE=TXT: Remove ESCAPE subcommand and make its behavior default.
Frans Houweling reported that this is the default and only behavior for
GET DATA/TYPE=TXT in SPSS 14, at:
http://lists.gnu.org/archive/html/pspp-users/2015-07/msg00027.html
Therefore, this commit makes this behavior the default and only behavior
in PSPP as well. (In my opinion it's the only sensible behavior, but SPSS
didn't document it so I assumed that it didn't do it that way.)
missing-val-dialog.c: fixed bug #45419 - added value type checks
This patch fixes bug #45419:
psppire crashes when entering missing data in new string variable.
The missing value width is now derived from the variable type. I noticed that
there are currently no type checks and no detailed warnings. I added the type
checks which were already provided by data_in and forward them to the existing
error dialog box. If an error is detected, the focus of the dialog box is
set to the field which produces the error.
psppire-output-view.c: added check for view->xr - fixes bug #45421
The output windows crashed when an empty syntax window is executed. The
rerender function got called without a valid view->xr (=NULL). I added a
check for this condition and create a new view->xr as it is done in the
psppire_output_view_put function.
This fixes bug #45421: Crash when trying to run empty syntax
fix s390x build failure on debian due to wrong type casting
The problem showed up on s390x for the 0.8.5 debian version
where four graph tests using pdf export failed with the same assertion. The
problem is due to wrong casting. intptr_t is long int (64 Bit) on s390x
but nl_langinfo returns 0xd200000000 on s390x where 0 is the integer result.
This results in wrong but positive height and width values for the paper size.
fix crash when exporting pdf via gui - fixes bug #45272
The problem https://savannah.gnu.org/bugs/?45272 occurs when the pdf
export is done via the gui. The problem is that tables containing only
carriage returns are considered to have no vertical space consumption.