Commit c8014400 authored by Nalin Dahyabhai's avatar Nalin Dahyabhai

remove the unused DEFAULT_ISO_8859_1 case. don't call

* src/vte.c(vte_sequence_handler_local_charset): remove the unused
	DEFAULT_ISO_8859_1 case.
* src/vte.c(vte_terminal_class_init): don't call _vte_matcher_narrow_encoding(),
	because we don't need it any more.  Change the error message emitted
	when _vte_matcher_wide_encoding() fails (#111925), and mark it for
	translation.
* src/trie.c(main): don't call _vte_matcher_narrow_encoding() just to print
	its result.
* src/vte.c(vte_terminal_set_encoding): include the right codeset name in the
	error message.
* src/vteglyph.c(_vte_glyph_get): mark error message for translation.
* src/matcher.c, src/matcher.h: remove _vte_matcher_narrow_encoding().  Make
	tables of strings "const".
parent 154b6ffd
2003-04-29 nalin
* src/vte.c(vte_sequence_handler_local_charset): remove the unused
DEFAULT_ISO_8859_1 case.
* src/vte.c(vte_terminal_class_init): don't call
_vte_matcher_narrow_encoding(), because we don't need it any more.
Change the error message emitted when _vte_matcher_wide_encoding()
fails (#111925), and mark it for translation.
* src/trie.c(main): don't call _vte_matcher_narrow_encoding() just
to print its result.
* src/vte.c(vte_terminal_set_encoding): include the right codeset name
in the error message.
* src/vteglyph.c(_vte_glyph_get): mark error message for translation.
* src/matcher.c, src/matcher.h: remove _vte_matcher_narrow_encoding().
Make tables of strings "const".
2003-04-29 nalin
* src/vte.c(vte_terminal_unrealize): set the IM context's client window
to NULL before unreferencing it to avoid crashes when preedit is active.
......
......@@ -126,13 +126,15 @@ _vte_matcher_print(struct _vte_matcher *matcher)
}
}
/* Determine sensible iconv target names for gunichar and iso-8859-1. */
#define SAMPLE "ABCDEF"
/* Determine a giconv target name which produces output which is bit-for-bit
* identical to either ASCII (wide==FALSE) or gunichar (wide==TRUE). */
static char *
_vte_matcher_find_valid_encoding(char **list, gssize length, gboolean wide)
_vte_matcher_find_valid_encoding(const char **list, gssize length,
gboolean wide)
{
gunichar wbuffer[8];
unsigned char nbuffer[8];
const char SAMPLE[] = "ABCDEF #@{|}[\\]~";
gunichar wbuffer[sizeof(SAMPLE)];
unsigned char nbuffer[sizeof(SAMPLE)];
void *buffer;
char inbuf[BUFSIZ];
char outbuf[BUFSIZ];
......@@ -142,17 +144,21 @@ _vte_matcher_find_valid_encoding(char **list, gssize length, gboolean wide)
gsize outbytes;
GIConv conv;
/* Decide what the iconv output buffer must resemble. */
if (wide) {
buffer = wbuffer;
} else {
buffer = nbuffer;
}
/* Initialize both the narrow and wide output buffers. */
for (i = 0; SAMPLE[i] != '\0'; i++) {
wbuffer[i] = nbuffer[i] = SAMPLE[i];
}
wbuffer[i] = nbuffer[i] = SAMPLE[i];
/* Iterate over the list, attempting to convert from UTF-8 to the
* named encoding, and then comparing it to the desired buffer. */
for (i = 0; i < length; i++) {
conv = g_iconv_open(list[i], "UTF-8");
if (conv == ((GIConv) -1)) {
......@@ -194,7 +200,7 @@ _vte_matcher_find_valid_encoding(char **list, gssize length, gboolean wide)
const char *
_vte_matcher_wide_encoding()
{
char *wide[] = {
const char *wide[] = {
"10646",
"ISO_10646",
"ISO-10646",
......@@ -226,21 +232,3 @@ _vte_matcher_wide_encoding()
}
return ret;
}
const char *
_vte_matcher_narrow_encoding()
{
char *narrow[] = {
"8859-1",
"ISO-8859-1",
"ISO8859-1",
};
static char *ret = NULL;
if (ret == NULL) {
ret = _vte_matcher_find_valid_encoding(narrow,
G_N_ELEMENTS(narrow),
FALSE);
}
return ret;
}
......@@ -50,7 +50,4 @@ void _vte_matcher_print(struct _vte_matcher *matcher);
/* A gunichar-compatible giconv target, if one can be found. */
const char *_vte_matcher_wide_encoding(void);
/* A single-byte iso-8859-1 giconv target, if one can be found. */
const char *_vte_matcher_narrow_encoding(void);
#endif
......@@ -891,7 +891,6 @@ main(int argc, char **argv)
g_quark_from_string("decset-title"));
printf("Wide encoding is `%s'.\n", _vte_matcher_wide_encoding());
printf("Narrow encoding is `%s'.\n", _vte_matcher_narrow_encoding());
_vte_trie_print(trie);
printf("\n");
......
......@@ -1991,7 +1991,7 @@ vte_terminal_set_encoding(VteTerminal *terminal, const char *codeset)
conv = g_iconv_open(codeset, "UTF-8");
if (conv == ((GIConv) -1)) {
g_warning(_("Unable to convert characters from %s to %s."),
"UTF-8", _vte_matcher_wide_encoding());
"UTF-8", codeset);
return;
}
if (terminal->pvt->outgoing_conv != (GIConv) -1) {
......@@ -5009,12 +5009,8 @@ vte_sequence_handler_local_charset(VteTerminal *terminal,
GValueArray *params)
{
G_CONST_RETURN char *locale_encoding;
#ifdef VTE_DEFAULT_ISO_8859_1
vte_terminal_set_encoding(terminal, _vte_matcher_narrow_encoding());
#else
g_get_charset(&locale_encoding);
vte_terminal_set_encoding(terminal, locale_encoding);
#endif
}
static void
......@@ -13162,11 +13158,8 @@ vte_terminal_class_init(VteTerminalClass *klass, gconstpointer data)
G_TYPE_NONE, 1);
/* Try to determine some acceptable encoding names. */
if (_vte_matcher_narrow_encoding() == NULL) {
g_error("Don't know how to read ISO-8859-1 data!");
}
if (_vte_matcher_wide_encoding() == NULL) {
g_error("Don't know how to read native-endian unicode data!");
g_error(_("Don't know how to convert to/from gunichar data!"));
}
#ifdef VTE_DEBUG
......
......@@ -29,6 +29,14 @@
#include "vtefc.h"
#include "vteglyph.h"
#ifdef ENABLE_NLS
#include <libintl.h>
#define _(String) dgettext(PACKAGE, String)
#else
#define _(String) String
#define bindtextdomain(package,dir)
#endif
#define FONT_INDEX_FUDGE 10
#define CHAR_WIDTH_FUDGE 10
#define INVALID_GLYPH -1
......@@ -562,7 +570,7 @@ _vte_glyph_get(struct _vte_glyph_cache *cache, gunichar c)
r = g = b = face->glyph->bitmap.buffer[ioffset];
break;
default:
g_error("Unknown pixel mode %d.\n",
g_error(_("Unknown pixel mode %d.\n"),
face->glyph->bitmap.pixel_mode);
r = g = b = 0;
g_assert_not_reached();
......
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