gnumeric r16810 - in trunk: . plugins/excel plugins/mps plugins/openoffice src src/dialogs src/widgets tools



Author: jody
Date: Fri Sep 19 10:23:04 2008
New Revision: 16810
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16810&view=rev

Log:
2008-09-11  Jody Goldberg <jody gnome org>

	* ms-excel-read.c (excel_read_TAB_COLOR) : no sense checking for NULL.
	  [Coverity #197]

2008-09-10  Jody Goldberg <jody gnome org>

	* parser.c (mps_parse_columns) : Clear out unreachable code.
	  [Coverty #245]

2008-09-17  Jody Goldberg <jody gnome org>

	* src/mathfunc.c (random_landau) : Use 'I' not 'i' as per original
	  libgsl code. [Coverity 259].

2008-09-11  Jody Goldberg <jody gnome org>

	* dialog-autoformat.c (cb_category_changed) : handle missing name and
	  selection. [Coverity 70]

Added:
   trunk/tools/run-coverity   (contents, props changed)
Modified:
   trunk/ChangeLog
   trunk/plugins/excel/ChangeLog
   trunk/plugins/excel/ms-excel-read.c
   trunk/plugins/mps/ChangeLog
   trunk/plugins/mps/parser.c
   trunk/plugins/openoffice/ChangeLog
   trunk/plugins/openoffice/openoffice-write.c
   trunk/src/dialogs/ChangeLog
   trunk/src/dialogs/dialog-autoformat.c
   trunk/src/dialogs/dialog-cell-format.c
   trunk/src/gnm-pane.c
   trunk/src/mathfunc.c
   trunk/src/widgets/gnm-cell-combo-foo-view.c
   trunk/src/xml-sax-write.c

Modified: trunk/plugins/excel/ms-excel-read.c
==============================================================================
--- trunk/plugins/excel/ms-excel-read.c	(original)
+++ trunk/plugins/excel/ms-excel-read.c	Fri Sep 19 10:23:04 2008
@@ -3802,11 +3802,10 @@
 		      "tab-foreground", text_color,
 		      "tab-background", color,
 		      NULL);
-	if (color != NULL) {
-		d (1, fprintf (stderr,"%s tab colour = %04hx:%04hx:%04hx\n",
-			      esheet->sheet->name_unquoted,
-			      color->gdk_color.red, color->gdk_color.green, color->gdk_color.blue););
-	}
+	d (1, fprintf (stderr,"%s tab colour = %04hx:%04hx:%04hx\n",
+		      esheet->sheet->name_unquoted,
+		      color->gdk_color.red, color->gdk_color.green, color->gdk_color.blue););
+
 	style_color_unref (text_color);
 	style_color_unref (color);
 }

Modified: trunk/plugins/mps/parser.c
==============================================================================
--- trunk/plugins/mps/parser.c	(original)
+++ trunk/plugins/mps/parser.c	Fri Sep 19 10:23:04 2008
@@ -360,15 +360,8 @@
 {
 	gchar type[3], n1[10], n2[10], n3[10], v1[20], v2[20];
 
-	while (1) {
-	        if (strncmp (ctxt->line, "COLUMNS", 7) == 0)
-		        break;
-		else
-		        return FALSE;
-
-		if (!mps_get_line (ctxt))
-		        return FALSE;
-	}
+	if (strncmp (ctxt->line, "COLUMNS", 7) != 0)
+		return FALSE;
 
 	while (1) {
 	        if (!mps_get_line (ctxt))

Modified: trunk/plugins/openoffice/openoffice-write.c
==============================================================================
--- trunk/plugins/openoffice/openoffice-write.c	(original)
+++ trunk/plugins/openoffice/openoffice-write.c	Fri Sep 19 10:23:04 2008
@@ -360,17 +360,21 @@
 					       (cell->value),
 					       10);
 			break;
+
 		case VALUE_STRING:
-		case VALUE_ARRAY:
 		case VALUE_ERROR:
-		case VALUE_CELLRANGE:
-		default:
-			break;
 			gsf_xml_out_add_cstr_unchecked (state->xml,
 							OFFICE "value-type", "string");
 			gsf_xml_out_add_cstr (state->xml,
 					      OFFICE "value",
 					      value_peek_string (cell->value));
+			break;
+
+		case VALUE_ARRAY:
+		case VALUE_CELLRANGE:
+		default:
+			break;
+
 		}
 		gsf_xml_out_start_element (state->xml, TEXT "p");
 		gsf_xml_out_add_cstr (state->xml, NULL, rendered_string);

Modified: trunk/src/dialogs/dialog-autoformat.c
==============================================================================
--- trunk/src/dialogs/dialog-autoformat.c	(original)
+++ trunk/src/dialogs/dialog-autoformat.c	Fri Sep 19 10:23:04 2008
@@ -464,18 +464,21 @@
 {
 	GList *selection = g_list_nth (state->category_groups,
 		gtk_combo_box_get_active (state->category));
+	char const *tip = NULL;
+
 	state->current_category_group = (selection != NULL) ? selection->data : NULL;
 	previews_free (state);
 	templates_free (state);
 	if (templates_load (state) == FALSE)
 		g_warning ("Error while loading templates!");
 
-	go_widget_set_tooltip_text
-		(GTK_WIDGET (state->category),
-		 _((state->current_category_group->description != NULL)
-		   ? state->current_category_group->description
-		   : state->current_category_group->name));
-
+	if (NULL != state->current_category_group) {
+		tip = state->current_category_group->description;
+		if (NULL == tip)
+			tip = state->current_category_group->name;
+	}
+	go_widget_set_tooltip_text (GTK_WIDGET (state->category),
+		(NULL != tip) ? _(tip) : "");
 	previews_load (state, 0);
 	cb_check_item_toggled (NULL, state);
 	cb_canvas_button_press (state->canvas[0], NULL, state);

Modified: trunk/src/dialogs/dialog-cell-format.c
==============================================================================
--- trunk/src/dialogs/dialog-cell-format.c	(original)
+++ trunk/src/dialogs/dialog-cell-format.c	Fri Sep 19 10:23:04 2008
@@ -352,6 +352,8 @@
 		if (0 == (state->conflicts & (1 << MSTYLE_COLOR_PATTERN)))
 			mcolor = gnm_style_get_pattern_color (state->style);
 
+		/* fallthrough */
+
 	case MSTYLE_BORDER_TOP:	/* MSTYLE_BORDER_TOP is abused as representing all borders. */
 		def_sc = sheet_style_get_auto_pattern_color (state->sheet);
 		break;

Modified: trunk/src/gnm-pane.c
==============================================================================
--- trunk/src/gnm-pane.c	(original)
+++ trunk/src/gnm-pane.c	Fri Sep 19 10:23:04 2008
@@ -2497,20 +2497,24 @@
 
 	switch (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (ctrl_pt), "index"))) {
 	case 1: invert_v = !invert_v;
+		/* fallthrough */
 	case 6: cursor = invert_v ? GDK_TOP_SIDE : GDK_BOTTOM_SIDE;
 		break;
 
 	case 3: invert_h = !invert_h;
+		/* fallthrough */
 	case 4: cursor = invert_h ? GDK_LEFT_SIDE  : GDK_RIGHT_SIDE;
 		break;
 
 	case 2: invert_h = !invert_h;
+		/* fallthrough */
 	case 0: cursor = invert_v
 			? (invert_h ? GDK_BOTTOM_RIGHT_CORNER : GDK_BOTTOM_LEFT_CORNER)
 			: (invert_h ? GDK_TOP_RIGHT_CORNER : GDK_TOP_LEFT_CORNER);
 		break;
 
 	case 7: invert_h = !invert_h;
+		/* fallthrough */
 	case 5: cursor = invert_v
 			? (invert_h ? GDK_TOP_RIGHT_CORNER : GDK_TOP_LEFT_CORNER)
 			: (invert_h ? GDK_BOTTOM_RIGHT_CORNER : GDK_BOTTOM_LEFT_CORNER);

Modified: trunk/src/mathfunc.c
==============================================================================
--- trunk/src/mathfunc.c	(original)
+++ trunk/src/mathfunc.c	Fri Sep 19 10:23:04 2008
@@ -7537,14 +7537,14 @@
 		56.123356, 59.103894
 	};
 	gnm_float X, U, V, RANLAN;
-	int I, i;
+	int I;
 
 	do {
 		X = random_01 ();
 	} while (X == 0.0);
 	U = 1000.0 * X;
-	i = U;
-	U = U - i;
+	I = U;
+	U = U - I;
 
 	if (I >= 70 && I <= 800)
 		RANLAN = F[I] + U * (F[I + 1] - F[I]);

Modified: trunk/src/widgets/gnm-cell-combo-foo-view.c
==============================================================================
--- trunk/src/widgets/gnm-cell-combo-foo-view.c	(original)
+++ trunk/src/widgets/gnm-cell-combo-foo-view.c	Fri Sep 19 10:23:04 2008
@@ -157,6 +157,7 @@
 	case GDK_KP_Down :
 	case GDK_Down :
 	case GDK_KP_Up :
+		/* fallthrough */
 	case GDK_Up :
 		if (!(event->state & GDK_MOD1_MASK))
 			return FALSE;

Modified: trunk/src/xml-sax-write.c
==============================================================================
--- trunk/src/xml-sax-write.c	(original)
+++ trunk/src/xml-sax-write.c	Fri Sep 19 10:23:04 2008
@@ -1350,7 +1350,7 @@
 	GSList       *ptr;
 	GsfOutput    *buf = gsf_output_memory_new ();
 	GnmLocale    *locale;
-	GODoc		 *doc = NULL;
+	GODoc	     *doc = NULL;
 
 	g_return_val_if_fail (cr != NULL, NULL);
 	g_return_val_if_fail (IS_SHEET (cr->origin_sheet), NULL);
@@ -1420,7 +1420,8 @@
 
 	xml_write_objects (&state.state, cr->objects);
 
-	go_doc_write (doc, state.state.output);
+	if (NULL != doc)
+		go_doc_write (doc, state.state.output);
 	gsf_xml_out_end_element (state.state.output); /* </ClipboardRange> */
 
 	gnm_pop_C_locale (locale);

Added: trunk/tools/run-coverity
==============================================================================
--- (empty file)
+++ trunk/tools/run-coverity	Fri Sep 19 10:23:04 2008
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+GNOME_DIR=/gnome/src			# gnumeric/goffice/libgsf sources
+BUILD_DIR=/local/projects/build		# dir into which to store a build
+
+ANALYSIS_DIR=/local/projects/prevent-linux-4.0.1-db	# the global DB of runs
+COV_DIR=/local/projects/prevent-linux-4.0.1		# where we installed coverity
+
+for proj in libgsf goffice gnumeric; do
+    echo '<<<<<<<<<<<<<<<<<<'
+    echo  "$GNOME_DIR/$proj"
+    echo '------------------'
+    cd  "$GNOME_DIR/$proj"
+    make -k clean 
+    "$COV_DIR/bin/cov-build" --dir "$BUILD_DIR" make -k
+    echo '<<<<<<<<<<<<<<<<<<'
+done
+
+"$COV_DIR/bin/cov-analyze"	  --dir "$BUILD_DIR" --trial --enable-constraint-fpp --enable-callgraph-metrics
+"$COV_DIR/bin/cov-commit-defects" --dir "$BUILD_DIR" --datadir "$ANALYSIS_DIR" --product gnumeric



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]