[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/src chat_room.c,1.46,1.47 chat_window.c,1.47
From: |
Colin Leroy <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/src chat_room.c,1.46,1.47 chat_window.c,1.47,1.48 smileys.c,1.16,1.17 |
Date: |
Fri, 07 Feb 2003 04:00:22 -0500 |
Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv18294/src
Modified Files:
chat_room.c chat_window.c smileys.c
Log Message:
fix leaks
Index: chat_room.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_room.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- chat_room.c 6 Feb 2003 14:23:32 -0000 1.46
+++ chat_room.c 7 Feb 2003 09:00:16 -0000 1.47
@@ -733,17 +733,20 @@
}
if(RUN_SERVICE(chat_room->local_user)->get_smileys)
- temp_message = eb_smilify(g_strdup(message),
RUN_SERVICE(chat_room->local_user)->get_smileys());
+ temp_message = eb_smilify(message,
RUN_SERVICE(chat_room->local_user)->get_smileys());
else
temp_message = g_strdup(message);
+
link_message = linkify(temp_message);
+
+ g_free(temp_message);
gtk_eb_html_add(EXT_GTK_TEXT(chat_room->chat), buff,0,0,0 );
gtk_eb_html_add(EXT_GTK_TEXT(chat_room->chat), link_message,
iGetLocalPref("do_ignore_back"),
iGetLocalPref("do_ignore_fore"), iGetLocalPref("do_ignore_font"));
gtk_eb_html_add(EXT_GTK_TEXT(chat_room->chat), "\n",0,0,0 );
- g_free(temp_message);
+ g_free(link_message);
if(chat_room->sound_enabled
&& strcmp(chat_room->local_user->handle, user))
Index: chat_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_window.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- chat_window.c 7 Feb 2003 08:25:33 -0000 1.47
+++ chat_window.c 7 Feb 2003 09:00:16 -0000 1.48
@@ -99,12 +99,13 @@
#define RECODE_TO_REMOTE 1
#define RECODE_TO_LOCAL 0
-char * recode_if_needed(char * source_text, char * recoded_text, int direction)
+char * recode_if_needed(char * source_text, int direction)
{
size_t inleft;
size_t outleft;
char * ptr_src_text = source_text;
- char * ptr_recoded_text = recoded_text;
+ char * ptr_recoded_text = g_new0(char, strlen(source_text)*2 + 1);
+ char * recoded_text = ptr_recoded_text;
iconv_t conv_desc;
int tries;
@@ -164,10 +165,10 @@
"Turning recoding off.\n",
cGetLocalPref("local_encoding"),
cGetLocalPref("remote_encoding"));
use_recoding = 0;
- return source_text;
+ return g_strdup(source_text);
}
}
- return source_text;
+ return g_strdup(source_text);
}
#endif /* HAVE_ICONV_H */
@@ -418,11 +419,6 @@
struct tm * cur_time;
time_t t;
LList * filter_walk;
-#ifdef HAVE_ICONV_H
- /* 'BUF_SIZE*2' e.g. for 'Latin-x' to 'UTF-8',
- which is 1-byte to 2-byte recoding */
- char recode_buff[BUF_SIZE*2 + 1];
-#endif
GET_CHAT_WINDOW(data);
@@ -479,12 +475,11 @@
/* TODO make these two filters */
if(RUN_SERVICE(data->local_user)->get_smileys)
- temp_message = eb_smilify(strdup(text),
RUN_SERVICE(data->local_user)->get_smileys());
+ temp_message = eb_smilify(text,
RUN_SERVICE(data->local_user)->get_smileys());
else
temp_message = g_strdup(text);
link_message = linkify(temp_message);
g_free(temp_message);
-
eb_update_window_title(data, FALSE);
eb_debug(DBG_CORE, "Starting to run outgoing filters\n");
@@ -520,10 +515,13 @@
data->preferred,
text);
} else {
+ char *recoded = recode_if_needed(text, RECODE_TO_REMOTE);
RUN_SERVICE(data->local_user)->send_im(
data->local_user,
data->preferred,
- recode_if_needed(text, recode_buff,
RECODE_TO_REMOTE) );
+ recoded);
+ printf("sending %s\n",recoded);
+ g_free(recoded);
}
/* seems like variable 'text' is not used any more down
the function, so we don't have to assign it (BTW it's freed in the
end)*/
@@ -1126,15 +1124,10 @@
struct tm * cur_time;
time_t t;
LList * filter_walk;
- gchar * message, *temp_message;
+ gchar * message, *temp_message, *link_message;
gboolean firstmsg = FALSE; /* init to false so only play if
* first msg is one received rather
* than sent */
-#ifdef HAVE_ICONV_H
- /* 'BUF_SIZE*2' e.g. for 'Latin-x' to 'UTF-8',
- which is 1-byte to 2-byte recoding */
- char recode_buff[BUF_SIZE*2 + 1];
-#endif
if (!o_message || strlen(o_message) == 0)
return;
@@ -1173,8 +1166,10 @@
temp_message = eb_smilify(message,
RUN_SERVICE(account)->get_smileys());
else
temp_message = g_strdup(message);
- message = linkify(temp_message);
+ link_message = linkify(temp_message);
g_free(temp_message);
+ g_free(message);
+ message = link_message;
if(!remote_contact->chatwindow || !remote_contact->chatwindow->window) {
if(remote_contact->chatwindow)
@@ -1249,7 +1244,12 @@
g_snprintf(buff2, BUF_SIZE, "%s", remote_contact->nick);
#ifdef HAVE_ICONV_H
- message = recode_if_needed(message, recode_buff, RECODE_TO_LOCAL);
+ {
+ char *recoded = recode_if_needed(message, RECODE_TO_LOCAL);
+ g_free(message);
+ printf("getting %s\n",recoded);
+ message = recoded;
+ }
#endif
g_snprintf(buff, BUF_SIZE, "<B>%s </B>",buff2);
Index: smileys.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/smileys.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- smileys.c 6 Feb 2003 09:15:37 -0000 1.16
+++ smileys.c 7 Feb 2003 09:00:17 -0000 1.17
@@ -205,7 +205,7 @@
if ( !iGetLocalPref("do_smiley") )
{
- return text;
+ return g_strdup(text);
}
newstr=g_string_sized_new(2048);
@@ -276,8 +276,6 @@
if(!found) { g_string_append_c(newstr, text[ipos++]); }
}
-
- free(text);
result = newstr->str;
g_string_free(newstr, FALSE);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/src chat_room.c,1.46,1.47 chat_window.c,1.47,1.48 smileys.c,1.16,1.17,
Colin Leroy <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.284,1.285 configure.in,1.280,1.281 TODO,1.6,1.7
- Next by Date:
Re: [Ayttm-commits] CVS: ayttm/modules/msn2/libmsn2 msn_core.C,1.22,1.23
- Previous by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.284,1.285 configure.in,1.280,1.281 TODO,1.6,1.7
- Next by thread:
[Ayttm-commits] CVS: ayttm/src tcp_util.c,1.1,1.2 tcp_util.h,1.1,1.2
- Index(es):