gnumeric r17083 - in trunk: . plugins/xbase
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r17083 - in trunk: . plugins/xbase
- Date: Fri, 23 Jan 2009 16:19:49 +0000 (UTC)
Author: mortenw
Date: Fri Jan 23 16:19:48 2009
New Revision: 17083
URL: http://svn.gnome.org/viewvc/gnumeric?rev=17083&view=rev
Log:
2009-01-23 Morten Welinder <terra gnome org>
* boot.c (xbase_file_open): Handle NULL value.
(xbase_field_as_value): Handle bogus dates, including 00000000.
* xbase.c (xbase_field_new): Fix ref-counting.
Modified:
trunk/NEWS
trunk/plugins/xbase/ChangeLog
trunk/plugins/xbase/boot.c
trunk/plugins/xbase/xbase.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Fri Jan 23 16:19:48 2009
@@ -74,6 +74,7 @@
* Fix XLS import criticals. [#567823]
* Don't evaluate both branches of IF. [#326595]
* Fix undo crash for inter-workbook operations. [#568634]
+ * Fix crash and criticals in dbf import. [#568454]
--------------------------------------------------------------------------
Gnumeric 1.9.3
Modified: trunk/plugins/xbase/boot.c
==============================================================================
--- trunk/plugins/xbase/boot.c (original)
+++ trunk/plugins/xbase/boot.c Fri Jan 23 16:19:48 2009
@@ -24,6 +24,7 @@
#include <goffice/utils/datetime.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
+#include <string.h>
GNM_PLUGIN_MODULE_HEADER;
@@ -124,7 +125,10 @@
case 'D': {
/* double check that the date is stored according to spec */
int year, month, day;
- if (sscanf (s, "%4d%2d%2d", &year, &month, &day) == 3) {
+ if (strcmp (s, "00000000") == 0)
+ return NULL;
+ if (sscanf (s, "%4d%2d%2d", &year, &month, &day) == 3 &&
+ g_date_valid_dmy (day, month, year)) {
GDate *date = g_date_new_dmy (day, month, year);
/* Use default date convention */
val = value_new_int (datetime_g_to_serial (date, NULL));
@@ -210,9 +214,11 @@
break;
}
for (i = 0; i < file->fields ; i++) {
- field = record->file->format [i];
+ field = record->file->format[i];
val = xbase_field_as_value (
record_get_field (record, i), field, file);
+ if (!val)
+ continue;
cell = sheet_cell_fetch (sheet, i, row);
value_set_fmt (val, field->fmt);
gnm_cell_set_value (cell, val);
Modified: trunk/plugins/xbase/xbase.c
==============================================================================
--- trunk/plugins/xbase/xbase.c (original)
+++ trunk/plugins/xbase/xbase.c Fri Jan 23 16:19:48 2009
@@ -242,7 +242,9 @@
} else
field->pos = 0;
- field->fmt = (field->type == 'D') ? go_format_default_date () : NULL;
+ field->fmt = (field->type == 'D')
+ ? go_format_ref (go_format_default_date ())
+ : NULL;
return field; /* FIXME: use more of buf if needed ? */
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]