Commit b102ecce authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Constify. (ms_excel_write_workbook): Constify.

2002-02-21  Morten Welinder  <terra@diku.dk>

	* ms-excel-write.c (init_base_char_width_for_write): Constify.
	(ms_excel_write_workbook): Constify.

	* ms-excel-read.c (get_substitute_font): Constify.
	(ms_excel_get_style_from_xf): Constify.
	(biff_boundsheet_data_new): Constify.

	* ms-summary.c (read_summary_items): Constify.

	* ms-excel-util.c (get_locale_charset_name): Constify.  Remove
	code conditioned on HAVE_ICONV && !HAVE_ICONV.

	* ms-escher.c (ms_escher_read_BSE): Constify.
parent f95d96a7
2002-02-21 Morten Welinder <terra@diku.dk>
* ms-excel-write.c (init_base_char_width_for_write): Constify.
(ms_excel_write_workbook): Constify.
* ms-excel-read.c (get_substitute_font): Constify.
(ms_excel_get_style_from_xf): Constify.
(biff_boundsheet_data_new): Constify.
* ms-summary.c (read_summary_items): Constify.
* ms-excel-util.c (get_locale_charset_name): Constify. Remove
code conditioned on HAVE_ICONV && !HAVE_ICONV.
* ms-escher.c (ms_escher_read_BSE): Constify.
2002-02-20 Morten Welinder <terra@diku.dk>
* ms-excel-write.c (write_value): Fix format.
......
......@@ -333,7 +333,7 @@ ms_escher_read_BSE (MSEscherState * state, MSEscherHeader * h)
guint8 const is_texture = MS_OLE_GET_GUINT8 (data + 32);
guint8 const name_len = MS_OLE_GET_GUINT8 (data + 33);
guint8 checksum[16]; /* RSA Data Security, Inc. MD4 Message-Digest Algorithm */
char *name = "unknown";
const char *name = "unknown";
int i;
for (i = 16; i-- > 0;)
checksum[i] = MS_OLE_GET_GUINT8 (data + 2 + i);
......
......@@ -546,7 +546,7 @@ static void
biff_boundsheet_data_new (BiffQuery *q, ExcelWorkbook *wb, MsBiffVersion ver)
{
BiffBoundsheetData *ans;
char *default_name = "Unknown%d";
const char *default_name = "Unknown%d";
/* Testing seems to indicate that Biff5 is compatibile with Biff7 here. */
if (ver != MS_BIFF_V5 && ver != MS_BIFF_V7 && ver != MS_BIFF_V8) {
......@@ -1093,26 +1093,24 @@ ms_excel_get_xf (ExcelSheet *esheet, int xfidx)
* Returns the name of the substitute font if found. Otherwise returns NULL
*/
/* This is very ad hoc - throw it away when something better comes along */
static gchar *
get_substitute_font (gchar *fontname)
static const gchar *
get_substitute_font (const gchar *fontname)
{
char (*(*p)[2]);
gchar *res = NULL;
int i;
/* Strictly for testing */
static char *temporary[][2] = {
static const char *temporary[][2] = {
{ "Times New Roman", "Times"},
{ "Arial", "Helvetica"},
{ "Courier New", "Courier"},
{ NULL }
};
for (p = temporary; (*p)[0]; p++)
if (g_strcasecmp ((*p)[0], fontname) == 0) {
res = (*p)[1];
break;
for (i = 0; temporary[i][0]; i++)
if (g_strcasecmp (temporary[i][0], fontname) == 0) {
return temporary[i][1];
}
return res;
return NULL;
}
static MStyle *
......@@ -1124,7 +1122,6 @@ ms_excel_get_style_from_xf (ExcelSheet *esheet, guint16 xfidx)
int pattern_index, back_index, font_index;
MStyle *mstyle;
int i;
char *subs_fontname;
d (2, printf ("XF index %d\n", xfidx););
......@@ -1158,7 +1155,7 @@ ms_excel_get_style_from_xf (ExcelSheet *esheet, guint16 xfidx)
fd = ms_excel_get_font (esheet, xf->font_idx);
if (fd != NULL) {
StyleUnderlineType underline = UNDERLINE_NONE;
subs_fontname = get_substitute_font (fd->fontname);
const char *subs_fontname = get_substitute_font (fd->fontname);
if (subs_fontname)
mstyle_set_font_name (mstyle, subs_fontname);
else
......
......@@ -369,34 +369,31 @@ lookup_font_base_char_width_new (char const * const name, double size_pts,
#ifdef HAVE_ICONV
static char*
static char *
get_locale_charset_name (void)
{
#ifndef HAVE_ICONV
return "";
#else
const char *ccharset;
static char* charset = NULL;
if (charset)
return charset;
#ifdef _NL_CTYPE_CODESET_NAME
charset = nl_langinfo (_NL_CTYPE_CODESET_NAME);
ccharset = nl_langinfo (_NL_CTYPE_CODESET_NAME);
#elif defined(CODESET)
charset = nl_langinfo (CODESET);
ccharset = nl_langinfo (CODESET);
#else
{
char* locale = setlocale(LC_CTYPE,NULL);
char* tmp = strchr(locale,'.');
const char *locale = setlocale (LC_CTYPE, NULL);
const char *tmp = strchr (locale, '.');
if (tmp)
charset = tmp+1;
ccharset = tmp + 1;
}
#endif
if (!charset)
charset = "ISO-8859-1";
charset = g_strdup(charset);
if (!ccharset)
ccharset = "ISO-8859-1";
charset = g_strdup (ccharset);
return charset;
#endif
}
#endif
......
......@@ -24,7 +24,7 @@ struct _TwoWayTable {
typedef void (*AfterPutFunc) (gconstpointer key,
gboolean was_added,
gint index,
gpointer closure);
gconstpointer closure);
TwoWayTable *
two_way_table_new (GHashFunc hash_func,
......
......@@ -2927,7 +2927,7 @@ init_base_char_width_for_write (ExcelSheet *esheet)
{
ExcelFont *f = NULL;
/* default to Arial 10 */
char *name = "Arial";
const char *name = "Arial";
double size_pts = 20.* 10.;
if (esheet && esheet->wb
......@@ -3708,7 +3708,7 @@ ms_excel_write_workbook (IOContext *context, MsOle *file, void *state,
MsBiffVersion ver)
{
MsOleErr result;
char *strname;
const char *strname;
MsOleStream *str;
BiffPut *bp;
ExcelWorkbook *wb = state;
......
......@@ -89,7 +89,7 @@ formula_cache_new_std (ExcelSheet *sheet, int i)
fce->u.std.fd = &formula_func_data[i];
fce->u.std.idx = i;
g_hash_table_insert (sheet->formula_cache,
formula_func_data[i].prefix, fce);
(char *)(formula_func_data[i].prefix), fce);
return fce;
}
......
......@@ -142,7 +142,7 @@ read_summary_items (SummaryInfo *sin, MsOleSummary *si, MsOlePropertySetID psid)
for (i = 0 ; i < EXCEL_TO_GNUM_MAPPING_COUNT; i++) {
if (excel_to_gnum_mapping[i].ps_id == psid) {
MsOleSummaryPID p = excel_to_gnum_mapping[i].excel;
gchar *name;
const gchar *name;
sit = NULL;
name = summary_item_name[excel_to_gnum_mapping[i].gnumeric];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment