From 0a29ffb9650075946e30615a2e1cdcfa2a988015 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 26 Jan 2005 06:14:42 +0000 Subject: added constant C_INTERNAL and CS_INTERNAL. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@41 ee746299-78ed-0310-b773-934348b2243d --- src/addrbook.c | 3 +-- src/addrindex.c | 3 +-- src/codeconv.c | 12 ++++++------ src/codeconv.h | 3 +++ src/compose.c | 14 +++++--------- src/folder.c | 2 +- src/imap.c | 10 +++++----- src/prefs.c | 6 ++---- src/xml.c | 21 +++++++-------------- 9 files changed, 31 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/addrbook.c b/src/addrbook.c index 32c0e777..b11a6504 100644 --- a/src/addrbook.c +++ b/src/addrbook.c @@ -1080,8 +1080,7 @@ gint addrbook_write_to( AddressBookFile *book, gchar *newFile ) { g_free( fileSpec ); if( pfile ) { fp = pfile->fp; - fprintf( fp, "\n", - conv_get_internal_charset_str() ); + fprintf( fp, "\n", CS_INTERNAL ); #endif addrbook_write_elem_s( fp, 0, AB_ELTAG_ADDRESS_BOOK ); addrbook_write_attr( fp, AB_ATTAG_NAME, book->name ); diff --git a/src/addrindex.c b/src/addrindex.c index 07d57711..23956b2b 100644 --- a/src/addrindex.c +++ b/src/addrindex.c @@ -1114,8 +1114,7 @@ gint addrindex_write_to( AddressIndex *addrIndex, const gchar *newFile ) { g_free( fileSpec ); if( pfile ) { fp = pfile->fp; - fprintf( fp, "\n", - conv_get_internal_charset_str() ); + fprintf( fp, "\n", CS_INTERNAL ); #endif addrindex_write_elem_s( fp, 0, TAG_ADDRESS_INDEX ); fputs( ">\n", fp ); diff --git a/src/codeconv.c b/src/codeconv.c index 0623421c..3063b4f0 100644 --- a/src/codeconv.c +++ b/src/codeconv.c @@ -809,7 +809,7 @@ void conv_localetodisp(gchar *outbuf, gint outlen, const gchar *inbuf) gchar *tmpstr; tmpstr = conv_iconv_strdup(inbuf, conv_get_locale_charset_str(), - conv_get_internal_charset_str()); + CS_INTERNAL); if (tmpstr) { strncpy2(outbuf, tmpstr, outlen); g_free(tmpstr); @@ -969,7 +969,7 @@ gchar *conv_iconv_strdup(const gchar *inbuf, if (!src_code) src_code = conv_get_outgoing_charset_str(); if (!dest_code) - dest_code = conv_get_internal_charset_str(); + dest_code = CS_INTERNAL; /* don't convert if src and dest codeset are identical */ if (!strcasecmp(src_code, dest_code)) @@ -1423,17 +1423,17 @@ const gchar *conv_get_locale_charset_str(void) if (!codeset) codeset = conv_get_charset_str(conv_get_locale_charset()); - return codeset ? codeset : CS_UTF_8; + return codeset ? codeset : CS_INTERNAL; } CharSet conv_get_internal_charset(void) { - return C_UTF_8; + return C_INTERNAL; } const gchar *conv_get_internal_charset_str(void) { - return CS_UTF_8; + return CS_INTERNAL; } CharSet conv_get_outgoing_charset(void) @@ -1626,7 +1626,7 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src, mimesep_enc = "?Q?"; } - cur_encoding = conv_get_internal_charset_str(); + cur_encoding = CS_INTERNAL; out_encoding = conv_get_outgoing_charset_str(); if (!strcmp(out_encoding, CS_US_ASCII)) out_encoding = CS_ISO_8859_1; diff --git a/src/codeconv.h b/src/codeconv.h index 2d1bf46d..11252aa1 100644 --- a/src/codeconv.h +++ b/src/codeconv.h @@ -166,6 +166,9 @@ struct _CodeConverter #define CS_GEORGIAN_PS "GEORGIAN-PS" #define CS_TCVN5712_1 "TCVN5712-1" +#define C_INTERNAL C_UTF_8 +#define CS_INTERNAL CS_UTF_8 + void conv_jistoeuc (gchar *outbuf, gint outlen, const gchar *inbuf); void conv_euctojis (gchar *outbuf, gint outlen, const gchar *inbuf); void conv_sjistoeuc (gchar *outbuf, gint outlen, const gchar *inbuf); diff --git a/src/compose.c b/src/compose.c index 495f10c6..370ccf47 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1561,9 +1561,7 @@ static gchar *compose_get_signature_str(Compose *compose) if (sig_str) { utf8_sig_str = conv_codeset_strdup - (sig_str, - conv_get_locale_charset_str(), - conv_get_internal_charset_str()); + (sig_str, conv_get_locale_charset_str(), CS_INTERNAL); g_free(sig_str); } @@ -1597,8 +1595,7 @@ static void compose_insert_file(Compose *compose, const gchar *file) while (fgets(buf, sizeof(buf), fp) != NULL) { gchar *str; - str = conv_codeset_strdup - (buf, cur_encoding, conv_get_internal_charset_str()); + str = conv_codeset_strdup(buf, cur_encoding, CS_INTERNAL); if (!str) continue; /* strip if DOS/Windows file, @@ -2760,7 +2757,7 @@ static gint compose_write_to_file(Compose *compose, const gchar *file, encoding = ENC_BASE64; #endif - src_codeset = conv_get_internal_charset_str(); + src_codeset = CS_INTERNAL; debug_print("src encoding = %s, out encoding = %s, transfer encoding = %s\n", src_codeset, out_codeset, procmime_get_encoding_str(encoding)); @@ -2947,9 +2944,8 @@ static gint compose_write_body_to_file(Compose *compose, const gchar *file) gtk_text_buffer_get_end_iter(buffer, &end); tmp = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); - chars = conv_codeset_strdup(tmp, - conv_get_internal_charset_str(), - conv_get_locale_charset_str()); + chars = conv_codeset_strdup + (tmp, CS_INTERNAL, conv_get_locale_charset_str()); g_free(tmp); diff --git a/src/folder.c b/src/folder.c index 7e96c294..9780f1d4 100644 --- a/src/folder.c +++ b/src/folder.c @@ -371,7 +371,7 @@ void folder_write_list(void) if ((pfile = prefs_file_open(path)) == NULL) return; fprintf(pfile->fp, "\n", - conv_get_internal_charset_str()); + CS_INTERNAL); fputs("\n\n", pfile->fp); for (list = folder_list; list != NULL; list = list->next) { diff --git a/src/imap.c b/src/imap.c index cbd430ad..5953bf2a 100644 --- a/src/imap.c +++ b/src/imap.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2004 Hiroyuki Yamamoto + * Copyright (C) 1999-2005 Hiroyuki Yamamoto * * 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 @@ -3660,10 +3660,10 @@ static gchar *imap_modified_utf7_to_utf8(const gchar *mutf7_str) if (!iconv_ok) return g_strdup(mutf7_str); if (cd == (iconv_t)-1) { - cd = iconv_open(conv_get_internal_charset_str(), CS_UTF_7); + cd = iconv_open(CS_INTERNAL, CS_UTF_7); if (cd == (iconv_t)-1) { g_warning("iconv cannot convert UTF-7 to %s\n", - conv_get_internal_charset_str()); + CS_INTERNAL); iconv_ok = FALSE; return g_strdup(mutf7_str); } @@ -3729,10 +3729,10 @@ static gchar *imap_utf8_to_modified_utf7(const gchar *from) if (!iconv_ok) return g_strdup(from); if (cd == (iconv_t)-1) { - cd = iconv_open(CS_UTF_7, conv_get_internal_charset_str()); + cd = iconv_open(CS_UTF_7, CS_INTERNAL); if (cd == (iconv_t)-1) { g_warning(_("iconv cannot convert %s to UTF-7\n"), - conv_get_internal_charset_str()); + CS_INTERNAL); iconv_ok = FALSE; return g_strdup(from); } diff --git a/src/prefs.c b/src/prefs.c index 230bf2a0..7223b5ed 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -70,8 +70,7 @@ void prefs_read_config(PrefParam *param, const gchar *label, gchar *conv_str; conv_str = conv_codeset_strdup - (buf, encoding, - conv_get_internal_charset_str()); + (buf, encoding, CS_INTERNAL); if (!conv_str) conv_str = g_strdup(buf); val = strncmp @@ -95,8 +94,7 @@ void prefs_read_config(PrefParam *param, const gchar *label, gchar *conv_str; conv_str = conv_codeset_strdup - (buf, encoding, - conv_get_internal_charset_str()); + (buf, encoding, CS_INTERNAL); if (!conv_str) conv_str = g_strdup(buf); prefs_config_parse_one_line(param, conv_str); diff --git a/src/xml.c b/src/xml.c index fac7b8fb..c804d443 100644 --- a/src/xml.c +++ b/src/xml.c @@ -177,8 +177,7 @@ gint xml_get_dtd(XMLFile *file) extract_quote(bufp, '"'); file->encoding = g_strdup(bufp); } else - file->encoding = - g_strdup(conv_get_internal_charset_str()); + file->encoding = g_strdup(CS_INTERNAL); } else { g_warning("Can't get xml dtd\n"); return -1; @@ -232,8 +231,7 @@ gint xml_parse_next_tag(XMLFile *file) while (*bufp != '\0' && !isspace(*bufp)) bufp++; if (*bufp == '\0') { - tag_str = conv_codeset_strdup(buf, file->encoding, - conv_get_internal_charset_str()); + tag_str = conv_codeset_strdup(buf, file->encoding, CS_INTERNAL); if (tag_str) { tag->tag = XML_STRING_ADD(tag_str); g_free(tag_str); @@ -242,8 +240,7 @@ gint xml_parse_next_tag(XMLFile *file) return 0; } else { *bufp++ = '\0'; - tag_str = conv_codeset_strdup(buf, file->encoding, - conv_get_internal_charset_str()); + tag_str = conv_codeset_strdup(buf, file->encoding, CS_INTERNAL); if (tag_str) { tag->tag = XML_STRING_ADD(tag_str); g_free(tag_str); @@ -288,11 +285,9 @@ gint xml_parse_next_tag(XMLFile *file) g_strchomp(attr_name); xml_unescape_str(attr_value); utf8_attr_name = conv_codeset_strdup - (attr_name, file->encoding, - conv_get_internal_charset_str()); + (attr_name, file->encoding, CS_INTERNAL); utf8_attr_value = conv_codeset_strdup - (attr_value, file->encoding, - conv_get_internal_charset_str()); + (attr_value, file->encoding, CS_INTERNAL); if (!utf8_attr_name) utf8_attr_name = g_strdup(attr_name); if (!utf8_attr_value) @@ -372,8 +367,7 @@ gchar *xml_get_element(XMLFile *file) return NULL; } - new_str = conv_codeset_strdup(str, file->encoding, - conv_get_internal_charset_str()); + new_str = conv_codeset_strdup(str, file->encoding, CS_INTERNAL); if (!new_str) new_str = g_strdup(str); g_free(str); @@ -564,8 +558,7 @@ gint xml_file_put_xml_decl(FILE *fp) { g_return_val_if_fail(fp != NULL, -1); - fprintf(fp, "\n", - conv_get_internal_charset_str()); + fprintf(fp, "\n", CS_INTERNAL); return 0; } -- cgit v1.2.3