diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2005-12-31 21:29:15 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2005-12-31 21:29:15 +0100 | 
| commit | a252c1ad43823eb935148a5578ee0d666902b2f1 (patch) | |
| tree | 5d94d74493a550b6709346e212b261206041239c | |
| parent | c88999c6ea83ffbc8a0eb8f1ceb0ee07612dfe29 (diff) | |
Removed useless UTF8-related functions (iconv works a lot better).
| -rw-r--r-- | protocols/jabber/jabber.c | 6 | ||||
| -rw-r--r-- | protocols/nogaim.h | 4 | ||||
| -rw-r--r-- | protocols/yahoo/yahoo_util.c | 50 | ||||
| -rw-r--r-- | util.c | 88 | 
4 files changed, 2 insertions, 146 deletions
| diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index c9fd4e3a..d4b5bde5 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -1855,11 +1855,7 @@ static void jabber_set_away(struct gaim_connection *gc, char *state, char *messa  			y = xmlnode_insert_tag(x, "show");  			xmlnode_insert_cdata(y, "away", -1);  			y = xmlnode_insert_tag(x, "status"); -			{ -				char *utf8 = str_to_utf8(message); -				xmlnode_insert_cdata(y, utf8, -1); -				g_free(utf8); -			} +			xmlnode_insert_cdata(y, message, -1);  			gc->away = "";  		} else {  			/* Gaim wants us to not be away */ diff --git a/protocols/nogaim.h b/protocols/nogaim.h index 607a67de..1c2e3beb 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -290,15 +290,13 @@ G_MODULE_EXPORT void serv_got_chat_left( struct gaim_connection *gc, int id );  /* void serv_finish_login( struct gaim_connection *gc ); */  /* util.c */ -G_MODULE_EXPORT char *utf8_to_str( const char *in ); -G_MODULE_EXPORT char *str_to_utf8( const char *in );  G_MODULE_EXPORT void strip_linefeed( gchar *text );  G_MODULE_EXPORT char *add_cr( char *text );  G_MODULE_EXPORT char *tobase64( const char *text );  G_MODULE_EXPORT char *normalize( const char *s );  G_MODULE_EXPORT time_t get_time( int year, int month, int day, int hour, int min, int sec );  G_MODULE_EXPORT void strip_html( char *msg ); -G_MODULE_EXPORT char * escape_html(const char *html); +G_MODULE_EXPORT char *escape_html( const char *html );  G_MODULE_EXPORT void info_string_append(GString *str, char *newline, char *name, char *value);  /* prefs.c */ diff --git a/protocols/yahoo/yahoo_util.c b/protocols/yahoo/yahoo_util.c index 3c99cf44..7babfa49 100644 --- a/protocols/yahoo/yahoo_util.c +++ b/protocols/yahoo/yahoo_util.c @@ -51,56 +51,6 @@ char * y_string_append(char * string, char * append)  	return new_string;  } -char * y_str_to_utf8(const char *in) -{ -	unsigned int n, i = 0; -	char *result = NULL; - -	if(in == NULL || *in == '\0') -		return ""; -	 -	result = y_new(char, strlen(in) * 2 + 1); - -	/* convert a string to UTF-8 Format */ -	for (n = 0; n < strlen(in); n++) { -		unsigned char c = (unsigned char)in[n]; - -		if (c < 128) { -			result[i++] = (char) c; -		} else { -			result[i++] = (char) ((c >> 6) | 192); -			result[i++] = (char) ((c & 63) | 128); -		} -	} -	result[i] = '\0'; -	return result; -} - -char * y_utf8_to_str(const char *in) -{ -	int i = 0; -	unsigned int n; -	char *result = NULL; - -	if(in == NULL || *in == '\0') -		return ""; -	 -	result = y_new(char, strlen(in) + 1); - -	/* convert a string from UTF-8 Format */ -	for (n = 0; n < strlen(in); n++) { -		unsigned char c = in[n]; - -		if (c < 128) { -			result[i++] = (char) c; -		} else { -			result[i++] = (c << 6) | (in[++n] & 63); -		} -	} -	result[i] = '\0'; -	return result; -} -  #if !HAVE_GLIB  void y_strfreev(char ** vector) @@ -38,94 +38,6 @@  #include <glib.h>  #include <time.h> -char *utf8_to_str(const char *in) -{ -	int n = 0, i = 0; -	int inlen; -	char *result; - -	if (!in) -		return NULL; - -	inlen = strlen(in); - -	result = g_malloc(inlen + 1); - -	while (n <= inlen - 1) { -		long c = (long)in[n]; -		if (c < 0x80) -			result[i++] = (char)c; -		else { -			if ((c & 0xC0) == 0xC0) -				result[i++] = -				    (char)(((c & 0x03) << 6) | (((unsigned char)in[++n]) & 0x3F)); -			else if ((c & 0xE0) == 0xE0) { -				if (n + 2 <= inlen) { -					result[i] = -					    (char)(((c & 0xF) << 4) | (((unsigned char)in[++n]) & 0x3F)); -					result[i] = -					    (char)(((unsigned char)result[i]) | -						   (((unsigned char)in[++n]) & 0x3F)); -					i++; -				} else -					n += 2; -			} else if ((c & 0xF0) == 0xF0) -				n += 3; -			else if ((c & 0xF8) == 0xF8) -				n += 4; -			else if ((c & 0xFC) == 0xFC) -				n += 5; -		} -		n++; -	} -	result[i] = '\0'; - -	return result; -} - -char *str_to_utf8(const char *in) -{ -	int n = 0, i = 0; -	int inlen; -	char *result = NULL; - -	if (!in) -		return NULL; - -	inlen = strlen(in); - -	result = g_malloc(inlen * 2 + 1); - -	while (n < inlen) { -		long c = (long)in[n]; -		if (c == 27) { -			n += 2; -			if (in[n] == 'x') -				n++; -			if (in[n] == '3') -				n++; -			n += 2; -			continue; -		} -		/* why are we removing newlines and carriage returns? -		if ((c == 0x0D) || (c == 0x0A)) { -			n++; -			continue; -		} -		*/ -		if (c < 128) -			result[i++] = (char)c; -		else { -			result[i++] = (char)((c >> 6) | 192); -			result[i++] = (char)((c & 63) | 128); -		} -		n++; -	} -	result[i] = '\0'; - -	return result; -} -  void strip_linefeed(gchar *text)  {  	int i, j; | 
