Fixed many warnings
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 15 Feb 2013 11:08:21 +0000 (12:08 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 16 Feb 2013 14:04:21 +0000 (15:04 +0100)
19 files changed:
src/data/gnumeric-reader.c
src/data/spreadsheet-reader.c
src/data/spreadsheet-reader.h
src/language/data-io/get-data.c
src/ui/gui/automake.mk
src/ui/gui/page-assistant.c
src/ui/gui/page-file.c
src/ui/gui/page-first-line.c
src/ui/gui/page-first-line.h [new file with mode: 0644]
src/ui/gui/page-formats.c
src/ui/gui/page-formats.h [new file with mode: 0644]
src/ui/gui/page-intro.c
src/ui/gui/page-intro.h [new file with mode: 0644]
src/ui/gui/page-separators.c
src/ui/gui/page-separators.h [new file with mode: 0644]
src/ui/gui/page-sheet-spec.c
src/ui/gui/page-sheet-spec.h [new file with mode: 0644]
src/ui/gui/sheet-test.c
src/ui/gui/text-data-import-dialog.c

index edb4b4291d3b67e39800510003376f3ddca4fd97..7bec97a9e0c6af974b250e78e42d19483894aa5c 100644 (file)
@@ -140,7 +140,7 @@ gnumeric_get_sheet_name (struct spreadsheet *s, int n)
   struct gnumeric_reader *gr = (struct gnumeric_reader *) s;
   assert (n < s->n_sheets);
 
-  return gr->sheets[n].name;
+  return gr->sheets[n].name; // Kludge: Assumes the encoding is utf8
 }
 
 
@@ -175,7 +175,6 @@ gnumeric_get_sheet_range (struct spreadsheet *s, int n)
 static void
 gnm_file_casereader_destroy (struct casereader *reader UNUSED, void *r_)
 {
-  int i;
   struct gnumeric_reader *r = r_;
   if ( r == NULL)
        return ;
@@ -430,7 +429,6 @@ struct var_spec
 void 
 gnumeric_destroy (struct spreadsheet *s)
 {
-  struct gnumeric_reader *r = (struct gnumeric *) s;
   gnm_file_casereader_destroy (NULL, s);
 }
 
index 2b4178835a2dae2af78e1c9d4deb34bfeb42bd01..b010999c1f55701a2036a8d52632fd3da08a9a9f 100644 (file)
 
 #include "spreadsheet-reader.h"
 
+#include "gnumeric-reader.h"
+
 #include <libpspp/str.h>
 #include <stdio.h>
 #include <string.h>
-
+#include <gl/xalloc.h>
+#include <gl/c-xvasprintf.h>
+#include <stdlib.h>
 
 struct spreadsheet * 
 spreadsheet_open (const char *filename)
@@ -34,7 +38,7 @@ spreadsheet_open (const char *filename)
 }
 
 void 
-spreadsheet_close (struct spreadsheet *spreadsheet)
+spreadsheet_close (UNUSED struct spreadsheet *spreadsheet)
 {
 }
 
@@ -107,7 +111,7 @@ int_to_ps26 (int i)
   i -= lower;
   i += base;
 
-  ret = malloc (exp);
+  ret = xmalloc (exp);
 
   exp = 0;
   do
@@ -137,7 +141,7 @@ create_cell_ref (int col0, int row0, int coli, int rowi)
 
   cs0 =  int_to_ps26 (col0);
   csi =  int_to_ps26 (coli);
-  s =  c_xasprintf ("%s%d:%s%ld",
+  s =  c_xasprintf ("%s%d:%s%d",
                         cs0, row0 + 1,
                         csi, rowi + 1);
   free (cs0);
index 765f3ca953705af2cfe849f5a445cad1b6d41790..f6380e31c1af537e9273f21b5f590e056eecf5ec 100644 (file)
@@ -61,7 +61,7 @@ enum spreadsheet_type
 
 struct spreadsheet
 {
-  char *file_name;
+  const char *file_name;
 
   enum spreadsheet_type type;
 
index 26de74546450e85d1639b876e5c2716b30e9fd0f..7b1d2882a2c9a26646783f67464f1a5bfba5620b 100644 (file)
@@ -671,7 +671,7 @@ parse_get_txt (struct lexer *lexer, struct dataset *ds)
 
 
 static void 
-destroy_spreadsheet_read_info (struct spreadsheet_read_info *sri,
+destroy_spreadsheet_read_info (UNUSED struct spreadsheet_read_info *sri,
                               struct spreadsheet_read_options *opts)
 {
   free (opts->sheet_name);
index 38a22b6e69f71252d409b7b5edb6dca2ee800024..e47996ea62076618538dd0e9bcbfb6f467e6dcdf 100644 (file)
@@ -320,11 +320,16 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/split-file-dialog.h \
        src/ui/gui/page-assistant.c \
        src/ui/gui/page-intro.c \
+       src/ui/gui/page-intro.h \
        src/ui/gui/page-file.c \
        src/ui/gui/page-first-line.c \
+       src/ui/gui/page-first-line.h \
        src/ui/gui/page-formats.c \
+       src/ui/gui/page-formats.h \
        src/ui/gui/page-separators.c \
+       src/ui/gui/page-separators.h \
        src/ui/gui/page-sheet-spec.c \
+       src/ui/gui/page-sheet-spec.h \
        src/ui/gui/text-data-import-dialog.c \
        src/ui/gui/text-data-import-dialog.h \
        src/ui/gui/transpose-dialog.c \
index 7c54f40f803e0a43ccc211de2b802f093636a179..43f6a362872b478d8b69478a4b3de277e791332f 100644 (file)
@@ -153,10 +153,7 @@ static void
 on_prepare (GtkAssistant *assistant, GtkWidget *page,
             struct import_assistant *ia)
 {
-  struct sheet_spec_page *ssp = ia->sheet_spec;
-
   int pn = gtk_assistant_get_current_page (assistant);
-  g_print ("%s:%d Page %d %p\n", __FILE__, __LINE__, pn, page);
 
   if ( ia->spreadsheet) 
     {
index fdf6d6c912b61def31369cfe6f87b849ef4eb194..48db5a2a16de868890b18792c3c705e4ffe3c400 100644 (file)
@@ -81,7 +81,6 @@ init_file (struct import_assistant *ia, GtkWindow *parent_window)
 {
   enum { MAX_LINE_LEN = 16384 }; /* Max length of an acceptable line. */
   struct file *file = &ia->file;
-  struct sheet_spec_page *ssp = ia->sheet_spec;
   struct spreadsheet_read_info sri;
   struct spreadsheet_read_options opts;
 
index 8a0e103227db7b2e07014892f8b3d2b606eb81e9..d1cec2cb4ee83d77eb009890cfe7e4cf40fcf381 100644 (file)
@@ -16,6 +16,8 @@
 
 #include <config.h>
 
+#include "page-first-line.h"
+
 #include "ui/gui/text-data-import-dialog.h"
 
 #include <errno.h>
diff --git a/src/ui/gui/page-first-line.h b/src/ui/gui/page-first-line.h
new file mode 100644 (file)
index 0000000..291ffd2
--- /dev/null
@@ -0,0 +1,26 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2013  Free Software Foundation
+
+   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
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+
+#ifndef PAGE_FIRST_LINE_H
+#define PAGE_FIRST_LINE_H
+
+struct first_line_page ;
+struct import_assistant;
+
+struct first_line_page *first_line_page_create (struct import_assistant *ia);
+
+#endif
index b80699887f573c361e79518ec5cfa5e29f4f3e3f..16438eeaee9d52542ac914fd75e351e952f37e98 100644 (file)
@@ -117,7 +117,6 @@ prepare_formats_page (struct import_assistant *ia)
   GtkBin *vars_scroller;
   GtkWidget *old_var_sheet;
   PsppireVarSheet *var_sheet;
-  struct separators_page *seps = ia->separators;
   struct formats_page *p = ia->formats;
   struct fmt_guesser *fg;
   unsigned long int number = 0;
diff --git a/src/ui/gui/page-formats.h b/src/ui/gui/page-formats.h
new file mode 100644 (file)
index 0000000..2e53206
--- /dev/null
@@ -0,0 +1,26 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2013  Free Software Foundation
+
+   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
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef PAGE_FORMATS_H
+#define PAGE_FORMATS_H
+
+struct formats_page;
+struct import_assistant;
+
+struct formats_page *formats_page_create (struct import_assistant *ia);
+
+
+#endif
index f580310c1fe99b78485195c2096bbefa0310453c..6ef991c314d5bede4eddf3f5e1b8bb72f9de1f5f 100644 (file)
@@ -16,6 +16,8 @@
 
 #include <config.h>
 
+#include "page-intro.h"
+
 #include "ui/gui/text-data-import-dialog.h"
 
 #include <errno.h>
diff --git a/src/ui/gui/page-intro.h b/src/ui/gui/page-intro.h
new file mode 100644 (file)
index 0000000..d0de8bf
--- /dev/null
@@ -0,0 +1,26 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2013  Free Software Foundation
+
+   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
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef PAGE_INTRO_H
+#define PAGE_INTRO_H
+
+struct intro_page;
+struct import_assistant;
+
+struct intro_page *intro_page_create (struct import_assistant *ia);
+
+
+#endif
index e153a231f53a296698ccbddd08e2a1f2198abecf..780742bf5ba216cdb71969bf01f73e6637c11c80 100644 (file)
@@ -16,6 +16,8 @@
 
 #include <config.h>
 
+#include "page-separators.h"
+
 #include "ui/gui/text-data-import-dialog.h"
 
 #include <errno.h>
diff --git a/src/ui/gui/page-separators.h b/src/ui/gui/page-separators.h
new file mode 100644 (file)
index 0000000..273bcaa
--- /dev/null
@@ -0,0 +1,26 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2013  Free Software Foundation
+
+   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
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. 
+*/
+
+#ifndef PAGE_SEPARATORS
+#define PAGE_SEPARATORS
+
+struct separators_page;
+struct import_assistant;
+
+struct separators_page *separators_page_create (struct import_assistant *ia);
+
+#endif
index b68180bf04cef7c4cdd7ec43e7d867d066c436b8..59c9c76636644eb99eae08ed70ab2b0fb0f85a01 100644 (file)
@@ -16,6 +16,8 @@
 
 #include <config.h>
 
+#include "page-sheet-spec.h"
+
 #include "ui/gui/text-data-import-dialog.h"
 
 #include <errno.h>
@@ -163,11 +165,11 @@ prepare_sheet_spec_page (struct import_assistant *ia)
 {
   GtkBuilder *builder = ia->asst.builder;
   GtkWidget *sheet_entry = get_widget_assert (builder, "sheet-entry");
-  printf ("%s:%d %p\n", __FILE__, __LINE__, ia->spreadsheet);
+
   gtk_combo_box_set_model (GTK_COMBO_BOX (sheet_entry), 
                           psppire_spreadsheet_model_new (ia->spreadsheet));
 
-  gtk_combo_box_set_active (sheet_entry, 0);
+  gtk_combo_box_set_active (GTK_COMBO_BOX (sheet_entry), 0);
 }
 
 
@@ -195,7 +197,6 @@ post_sheet_spec_page (struct import_assistant *ia)
   struct casereader *creader = NULL;
   struct dictionary *dict = NULL;
 
-  GtkWidget *sheet_entry = get_widget_assert (builder, "sheet-entry");
   GtkWidget *range_entry = get_widget_assert (builder, "cell-range-entry");
   GtkWidget *readnames_checkbox = get_widget_assert (builder, "readnames-checkbox");
 
diff --git a/src/ui/gui/page-sheet-spec.h b/src/ui/gui/page-sheet-spec.h
new file mode 100644 (file)
index 0000000..7a4e801
--- /dev/null
@@ -0,0 +1,30 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2013  Free Software Foundation
+
+   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
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef PAGE_SHEET_SPEC
+#define PAGE_SHEET_SPEC 1
+
+
+struct sheet_spec_page ;
+struct import_assistant;
+
+/* Initializes IA's sheet_spec substructure. */
+struct sheet_spec_page *sheet_spec_page_create (struct import_assistant *ia);
+
+char *sheet_spec_gen_syntax (const struct import_assistant *ia);
+
+
+#endif
index bc7fd04e51bcba1bc5e005ca46233f66a950bafd..8f38e90f061a89e08a3bfde3bbaab649727c5407 100644 (file)
@@ -13,6 +13,7 @@
 
 #define N 10
 
+#if 0
 static GtkListStore *
 make_store ()
   {
@@ -31,7 +32,7 @@ make_store ()
       }
     return list_store;
   }
-
+#endif
 
 struct spreadsheet *sp = NULL;
 GtkWidget *combo_box;
index 94fc9300d76b9fc27dfdd1cd691affcc7eb8652f..412af5b8f4a1c0e1ac12f5de8c2ff2d55e90e1d8 100644 (file)
 
 #include "ui/gui/text-data-import-dialog.h"
 
+#include "page-intro.h"
+#include "page-sheet-spec.h"
+#include "page-first-line.h"
+#include "page-separators.h"
+#include "page-formats.h"
+
 #include <errno.h>
 #include <fcntl.h>
 #include <gtk-contrib/psppire-sheet.h>
@@ -72,7 +78,6 @@ text_data_import_assistant (PsppireDataWindow *dw)
 {
   GtkWindow *parent_window = GTK_WINDOW (dw);
   struct import_assistant *ia = init_assistant (parent_window);
-  GtkBuilder *builder = ia->asst.builder;
   struct sheet_spec_page *ssp ;
 
   if (!init_file (ia, parent_window))
@@ -216,8 +221,6 @@ generate_syntax (const struct import_assistant *ia)
 
   if (ia->spreadsheet == NULL)
     {
-      size_t var_cnt;
-      size_t i;
       syntax_gen_pspp (&s,
                       "GET DATA"
                       "\n  /TYPE=TXT"
@@ -226,13 +229,14 @@ generate_syntax (const struct import_assistant *ia)
       if (ia->file.encoding && strcmp (ia->file.encoding, "Auto"))
        syntax_gen_pspp (&s, "  /ENCODING=%sq\n", ia->file.encoding);
 
+#if 0
       intro_append_syntax (ia->intro, &s);
 
       ds_put_cstr (&s,
                   "  /ARRANGEMENT=DELIMITED\n"
                   "  /DELCASE=LINE\n");
 
-#if 0
+
       if (ia->first_line->skip_lines > 0)
        ds_put_format (&s, "  /FIRSTCASE=%d\n", ia->first_line->skip_lines + 1);
       ds_put_cstr (&s, "  /DELIMITERS=\"");