Convert text to utf8 more then 2-4 times freezes the application
- From: Magnus-swe <magnus-swe telia com>
- To: GTK Devel List <gtk-app-devel-list gnome org>
- Subject: Convert text to utf8 more then 2-4 times freezes the application
- Date: 29 Jul 2002 19:31:51 +0200
Hi.
Im having problems with the g_locale_to_utf8 conversion.
It works ok if i just update the textview 1-2 times but anything more
then that and the whole application freezes.
It seems to be the utf8 conversion and ive run out of ideeas so i cant
continue development, please help.
void
on_files_textview_map (GtkWidget *widget,
gpointer user_data)
{
FILE *fp;
long fp_size;
char *file_buffer;
char *get_file_buffer;
gchar *utf8;
GtkTextBuffer *file_text_buffer;
files_textview = lookup_widget (GTK_WIDGET (widget),
"files_textview");
if( (fp = fopen("/var/log/xferlog", "r")) == NULL)
{
error_window = create_error_window ();
gtk_widget_show (error_window);
return;
}
fseek(fp, 0, SEEK_END);
fp_size = ftell(fp);
rewind(fp);
file_buffer=(char *)malloc(fp_size);
get_file_buffer=(char *)malloc(fp_size);
while (fgets(file_buffer, fp_size, fp)!=NULL)
{
strcat(get_file_buffer, file_buffer);
}
// convert the text to utf8 more then 2-4 times freezes the
application
printf("\nConversion begun...\n");
utf8 = g_locale_to_utf8(get_file_buffer, strlen(get_file_buffer),
NULL, NULL, NULL);
printf("\nConversion ended.\n");
file_text_buffer=
gtk_text_view_get_buffer(GTK_TEXT_VIEW(files_textview));
// Set the text
gtk_text_buffer_set_text(file_text_buffer, utf8, strlen(utf8));
fclose(fp);
free(file_buffer);
free(get_file_buffer);
g_free(utf8);
}
Sincerely: Magnus-swe
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]