[gnumeric] Compilation: eliminate more printf calls.



commit 2d908b504bd01253b8da89c539e11da3d837b5a4
Author: Morten Welinder <terra gnome org>
Date:   Fri Dec 28 16:37:49 2012 -0500

    Compilation: eliminate more printf calls.

 plugins/applix/applix-read.c      |   14 +++++-----
 plugins/excel/ms-excel-write.c    |    2 +-
 plugins/lotus-123/lotus-formula.c |   28 +++++++++---------
 plugins/lotus-123/lotus.c         |   55 ++++++++++++++++++-------------------
 4 files changed, 49 insertions(+), 50 deletions(-)
---
diff --git a/plugins/applix/applix-read.c b/plugins/applix/applix-read.c
index 1d5d76a..4a6efaf 100644
--- a/plugins/applix/applix-read.c
+++ b/plugins/applix/applix-read.c
@@ -399,8 +399,8 @@ applix_read_colormap (ApplixReadState *state)
 			g_ptr_array_add	(state->colors,
 					 gnm_color_new_rgb8 (r, g, b));
 #if 0
-			printf ("'%s' %ld %ld %ld %ld\n", buffer, numbers[1],
-				numbers[2], numbers[3], numbers[4]);
+			g_printerr ("'%s' %ld %ld %ld %ld\n", buffer, numbers[1],
+				    numbers[2], numbers[3], numbers[4]);
 #endif
 		}
 	}
@@ -1155,7 +1155,7 @@ applix_read_cells (ApplixReadState *state)
 				val = value_new_string (ptr);
 
 #if 0
-			printf ("\'%s\'\n\'%s\'\n", ptr, expr_string);
+			g_printerr ("\'%s\'\n\'%s\'\n", ptr, expr_string);
 #endif
 
 			if (content_type == ';') {
@@ -1245,7 +1245,7 @@ applix_read_cells (ApplixReadState *state)
 				while (key > expr_string && !g_ascii_isspace (key[-1]))
 					key--;
 #if 0
-				printf ("Shared '%s'\n", expr_string);
+				g_printerr ("Shared '%s'\n", expr_string);
 #endif
 				texpr = g_hash_table_lookup (state->exprs, key);
 				gnm_cell_set_expr_and_value (cell, texpr, val, TRUE);
@@ -1258,7 +1258,7 @@ applix_read_cells (ApplixReadState *state)
 
 			ptr += 2;
 #if 0
-			printf ("\"%s\" %d\n", ptr, val_is_string);
+			g_printerr ("\"%s\" %d\n", ptr, val_is_string);
 #endif
 			/* Does it match any formats (use default date convention) */
 			if (!val_is_string)
@@ -1481,8 +1481,8 @@ applix_read_impl (ApplixReadState *state)
 				return applix_parse_error (state, "Invalid line length");
 			state->line_len = len;
 
-			d (0, printf ("Applix load : Saved with revision %d.%d",
-				      major_rev, minor_rev););
+			d (0, g_printerr ("Applix load : Saved with revision %d.%d",
+					  major_rev, minor_rev););
 		} else if (!a_strncmp (buffer, "Current Doc Real Name:")) {
 			g_free (real_name);
 			real_name = NULL;  /* FIXME? g_strdup (buffer + 22); */
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 6f10608..9df6968 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -2260,7 +2260,7 @@ excel_write_FONTs (BiffPut *bp, ExcelWriteState *ewb)
  * @format     format
  * @was_added  true if format was added
  * @index      index of format
- * @tmpl       printf template
+ * @tmpl       g_printerr template
  *
  * Callback called when putting format to table. Print to debug log when
  * format is added. Free resources when it was already there.
diff --git a/plugins/lotus-123/lotus-formula.c b/plugins/lotus-123/lotus-formula.c
index 0bd464a..e28e11a 100644
--- a/plugins/lotus-123/lotus-formula.c
+++ b/plugins/lotus-123/lotus-formula.c
@@ -556,10 +556,10 @@ get_cellref (GnmCellRef *ref, guint8 const *dataa, guint8 const *datab,
 	}
 
 #if FORMULA_DEBUG > 0
-	printf ("0x%x 0x%x -> (%d, %d)\n",
-		GSF_LE_GET_GUINT16 (dataa),
-		GSF_LE_GET_GUINT16 (datab),
-		ref->col, ref->row);
+	g_printerr ("0x%x 0x%x -> (%d, %d)\n",
+		    GSF_LE_GET_GUINT16 (dataa),
+		    GSF_LE_GET_GUINT16 (datab),
+		    ref->col, ref->row);
 #endif
 }
 
@@ -905,10 +905,10 @@ lotus_parse_formula (LotusState *state, GnmParsePos *pos,
 #if FORMULA_DEBUG > 0
 	{
 		char *txt = gnm_expr_top_as_string (result, pos, gnm_conventions_default);
-		g_print ("Lotus: %s!%s: %s\n",
-			 pos->sheet->name_unquoted,
-			 cell_coord_name (pos->eval.col, pos->eval.row),
-			 txt);
+		g_printerr ("Lotus: %s!%s: %s\n",
+			    pos->sheet->name_unquoted,
+			    cell_coord_name (pos->eval.col, pos->eval.row),
+			    txt);
 		g_free (txt);
 	}
 #endif
@@ -930,9 +930,9 @@ lotus_formula_init (void)
 		g_assert (f->ordinal < G_N_ELEMENTS (lotus_ordinal_to_info));
 		if (f->gnumeric_name &&
 		    !gnm_func_lookup (f->gnumeric_name, NULL)) {
-			g_print ("Lotus function @%s maps to unknown function %s.\n",
-				 f->lotus_name,
-				 f->gnumeric_name);
+			g_printerr ("Lotus function @%s maps to unknown function %s.\n",
+				    f->lotus_name,
+				    f->gnumeric_name);
 		}
 #endif
 		if (f->ordinal <= LOTUS_MAX_ORDINAL)
@@ -950,9 +950,9 @@ lotus_formula_init (void)
 		g_assert (f->ordinal < G_N_ELEMENTS (lotus_ordinal_to_info));
 		if (f->gnumeric_name &&
 		    !gnm_func_lookup (f->gnumeric_name, NULL)) {
-			g_print ("Works function @%s maps to unknown function %s.\n",
-				 f->lotus_name,
-				 f->gnumeric_name);
+			g_printerr ("Works function @%s maps to unknown function %s.\n",
+				    f->lotus_name,
+				    f->gnumeric_name);
 		}
 #endif
 
diff --git a/plugins/lotus-123/lotus.c b/plugins/lotus-123/lotus.c
index 15b8d95..5c457dd 100644
--- a/plugins/lotus-123/lotus.c
+++ b/plugins/lotus-123/lotus.c
@@ -746,7 +746,7 @@ cell_set_format_from_lotus_format (GnmCell *cell, guint fmt)
 	if (fmt_string[0])
 		gnm_cell_set_format (cell, fmt_string);
 #ifdef DEBUG_FORMAT
-	g_print ("Format: %s\n", fmt_string);
+	g_printerr ("Format: %s\n", fmt_string);
 #endif
 	g_free (fmt_string);
 }
@@ -843,7 +843,7 @@ record_next (record_t *r)
 		r->data = NULL;
 
 #if LOTUS_DEBUG > 0
-	g_print ("Record 0x%x length 0x%x\n", r->type, r->len);
+	g_printerr ("Record 0x%x length 0x%x\n", r->type, r->len);
 	if (r->data)
 		gsf_mem_dump (r->data, r->len);
 #endif
@@ -984,10 +984,10 @@ lotus_rldb_new (int ndims, const int *dims, LotusRLDB *top)
 	if (!top) {
 #ifdef DEBUG_RLDB
 		int i;
-		g_print ("New %dd (", ndims);
+		g_printerr ("New %dd (", ndims);
 		for (i = 0; i < ndims; i++)
-			g_print ("%s%d", (i ? " x " : ""), dims[i]);
-		g_print (") rldb.\n");
+			g_printerr ("%s%d", (i ? " x " : ""), dims[i]);
+		g_printerr (") rldb.\n");
 #endif
 		top = res;
 		res->dims = g_memdup (dims, ndims * sizeof (*dims));
@@ -1040,7 +1040,7 @@ lotus_rldb_repeat (LotusRLDB *rldb, int rll)
 		lotus_rldb_repeat (child, rll);
 	} else {
 #ifdef DEBUG_RLDB
-		g_print ("%*sRepeat %d.\n", rldb->top->ndims - rldb->ndims, "", rll);
+		g_printerr ("%*sRepeat %d.\n", rldb->top->ndims - rldb->ndims, "", rll);
 #endif
 		if (rll > rldb->rest) {
 			g_warning ("Got rll of %d when only %d left.",
@@ -1054,7 +1054,7 @@ lotus_rldb_repeat (LotusRLDB *rldb, int rll)
 		g_ptr_array_add (rldb->lower, child);
 		if (rldb->top->pending_id) {
 #ifdef DEBUG_RLDB
-			g_print ("%*sMapped id %d to child with rll %d.\n",
+			g_printerr ("%*sMapped id %d to child with rll %d.\n",
 				 rldb->top->ndims - rldb->ndims, "",
 				 rldb->top->pending_id, rll);
 #endif
@@ -1069,7 +1069,7 @@ lotus_rldb_repeat (LotusRLDB *rldb, int rll)
 	if (lotus_rldb_full (child)) {
 		rldb->rest -= child->rll;
 #ifdef DEBUG_RLDB
-		g_print ("%*sNow %d left.\n", 3 - rldb->ndims, "",
+		g_printerr ("%*sNow %d left.\n", 3 - rldb->ndims, "",
 			 rldb->rest);
 #endif
 	}
@@ -1097,7 +1097,7 @@ lotus_rldb_register_id (LotusRLDB *rldb, guint16 id)
 	g_return_if_fail (rldb->pending_id == 0);
 
 #ifdef DEBUG_RLDB
-	g_print ("Defining id %d.\n", id);
+	g_printerr ("Defining id %d.\n", id);
 #endif
 	rldb->pending_id = id;
 }
@@ -1116,7 +1116,7 @@ lotus_rldb_use_id (LotusRLDB *rldb, guint16 id)
 		g_return_if_fail (child != NULL);
 		g_return_if_fail (lotus_rldb_full (child));
 #ifdef DEBUG_RLDB
-		g_print ("%*sUsing id %d.\n", rldb->top->ndims - rldb->ndims, "",
+		g_printerr ("%*sUsing id %d.\n", rldb->top->ndims - rldb->ndims, "",
 			 id);
 #endif
 		lotus_rldb_ref (child);
@@ -1126,7 +1126,7 @@ lotus_rldb_use_id (LotusRLDB *rldb, guint16 id)
 	if (lotus_rldb_full (child)) {
 		rldb->rest -= child->rll;
 #ifdef DEBUG_RLDB
-		g_print ("%*sNow %d left.\n", rldb->top->ndims - rldb->ndims, "",
+		g_printerr ("%*sNow %d left.\n", rldb->top->ndims - rldb->ndims, "",
 			 rldb->rest);
 #endif
 	}
@@ -1265,11 +1265,11 @@ lotus_set_style_cb (LotusState *state, const GnmSheetRange *r,
 
 	sid = GSF_LE_GET_GUINT16 (data);
 #ifdef DEBUG_STYLE
-	g_print ("Got style %d for %s!%s",
+	g_printerr ("Got style %d for %s!%s",
 		 sid,
 		 r->sheet->name_unquoted,
 		 cellpos_as_string (&r->range.start));
-	g_print (":%s\n",
+	g_printerr (":%s\n",
 		 cellpos_as_string (&r->range.end));
 #endif
 
@@ -1298,10 +1298,10 @@ lotus_set_formats_cb (LotusState *state, const GnmSheetRange *r,
 		return;
 
 #ifdef DEBUG_FORMAT
-	g_print ("Got format for %s!%s",
+	g_printerr ("Got format for %s!%s",
 		 r->sheet->name_unquoted,
 		 cellpos_as_string (&r->range.start));
-	g_print (":%s\n",
+	g_printerr (":%s\n",
 		 cellpos_as_string (&r->range.end));
 #endif
 
@@ -1326,7 +1326,7 @@ lotus_set_formats_cb (LotusState *state, const GnmSheetRange *r,
 
 	fmt_string = lotus_format_string (fmt);
 #ifdef DEBUG_FORMAT
-	g_print ("Format 0x%x: %s\n", fmt, fmt_string);
+	g_printerr ("Format 0x%x: %s\n", fmt, fmt_string);
 #endif
 	gnm_style_set_format_text (style, fmt_string);
 	g_free (fmt_string);
@@ -1354,10 +1354,10 @@ lotus_set_colwidth_cb (LotusState *state,
 		return;
 
 #ifdef DEBUG_COLROW
-	g_print ("Got width for %s!%s",
+	g_printerr ("Got width for %s!%s",
 		 sheet->name_unquoted,
 		 col_name (start));
-	g_print ("-%s\n", col_name (end));
+	g_printerr ("-%s\n", col_name (end));
 #endif
 
 	outlinelevel = GSF_LE_GET_GUINT16 (data);
@@ -1400,7 +1400,7 @@ lotus_set_rowheight_cb (LotusState *state,
 		return;
 
 #ifdef DEBUG_COLROW
-	g_print ("Got height for %s!%d-%d\n",
+	g_printerr ("Got height for %s!%d-%d\n",
 		 sheet->name_unquoted,
 		 start, end);
 #endif
@@ -1496,8 +1496,7 @@ insert_value (LotusState *state, Sheet *sheet, guint32 col, guint32 row, GnmValu
 	if (cell) {
 		gnm_cell_set_value (cell, val);
 #if LOTUS_DEBUG > 0
-		printf ("Inserting value at %s:\n",
-			cell_name (cell));
+		g_printerr ("Inserting value at %s:\n", cell_name (cell));
 		value_dump (val);
 #endif
 	} else
@@ -1981,7 +1980,7 @@ lotus_read_new (LotusState *state, record_t *r)
 #endif
 
 #if 0
-				g_print ("Saw text style %d with fontid %d.\n", styleid, fontid);
+				g_printerr ("Saw text style %d with fontid %d.\n", styleid, fontid);
 #endif
 				break;
 			}
@@ -2048,7 +2047,7 @@ lotus_read_new (LotusState *state, record_t *r)
 #undef FACEBIT
 
 #ifdef DEBUG_STYLE
-				g_print ("Defining style 0x%04x:\n", styleid);
+				g_printerr ("Defining style 0x%04x:\n", styleid);
 				gnm_style_dump (style);
 #endif
 				g_hash_table_insert (state->style_pool,
@@ -2075,7 +2074,7 @@ lotus_read_new (LotusState *state, record_t *r)
 				gnm_style_set_font_name (style, fontname);
 
 #ifdef DEBUG_STYLE
-				g_print ("Defining style 0x%04x:\n", styleid);
+				g_printerr ("Defining style 0x%04x:\n", styleid);
 				gnm_style_dump (style);
 #endif
 				g_hash_table_insert (state->style_pool,
@@ -2087,7 +2086,7 @@ lotus_read_new (LotusState *state, record_t *r)
 			}
 
 			default:
-				g_print ("Unknown style record 0x%x/%04x of length %d.\n",
+				g_printerr ("Unknown style record 0x%x/%04x of length %d.\n",
 					 r->type, subtype,
 					 r->len);
 
@@ -2390,7 +2389,7 @@ lotus_read (LotusState *state)
 	if (r.type == LOTUS_BOF) {
 		state->is_works = FALSE;
 #if LOTUS_DEBUG > 0
-		g_print ("Version=%x, Lotus\n", state->version);
+		g_printerr ("Version=%x, Lotus\n", state->version);
 #endif
 		switch (state->version) {
 		case LOTUS_VERSION_ORIG_123:
@@ -2410,7 +2409,7 @@ lotus_read (LotusState *state)
 	} else if (r.type == WORKS_BOF) {
 		state->is_works = TRUE;
 #if LOTUS_DEBUG > 0
-		g_print ("Version=%x, MS Works\n", state->version);
+		g_printerr ("Version=%x, MS Works\n", state->version);
 #endif
 		if (state->version == WORKS_VERSION_3)
 			return lotus_read_works (state, &r);
@@ -2899,7 +2898,7 @@ lotus_read_works (LotusState *state, record_t *r)
 			}
 
 #ifdef DEBUG_STYLE
-			g_print ("Defining style 0x%04x:\n", styleid);
+			g_printerr ("Defining style 0x%04x:\n", styleid);
 			gnm_style_dump (style);
 #endif
 			g_hash_table_insert (state->style_pool,



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