Fix bug with opening and closing iconv instances
authorali <ali@juiblex.co.uk>
Sat Sep 07 08:38:13 2013 +0100 (2013-09-07)
changeset 86c42c068d2996
parent 85 a76161b5bdc6
child 87 593e4ef5a0f2
Fix bug with opening and closing iconv instances
bookloupe/bookloupe.c
     1.1 --- a/bookloupe/bookloupe.c	Fri Sep 06 22:56:56 2013 +0100
     1.2 +++ b/bookloupe/bookloupe.c	Sat Sep 07 08:38:13 2013 +0100
     1.3 @@ -2659,7 +2659,7 @@
     1.4  {
     1.5      gsize inbytes,outbytes;
     1.6      gchar *buf,*bp;
     1.7 -    GIConv converter=(GIConv)-1;
     1.8 +    static GIConv converter=(GIConv)-1;
     1.9      if (!string)
    1.10      {
    1.11  	if (converter!=(GIConv)-1)
    1.12 @@ -2667,7 +2667,7 @@
    1.13  	converter=(GIConv)-1;
    1.14  	return;
    1.15      }
    1.16 -    if (converter=(GIConv)-1)
    1.17 +    if (converter==(GIConv)-1)
    1.18  	converter=g_iconv_open("WINDOWS-1252","UTF-8");
    1.19      if (converter!=(GIConv)-1)
    1.20      {
    1.21 @@ -3187,16 +3187,16 @@
    1.22      gchar *s,*t;
    1.23      gunichar c;
    1.24      GTree *entities=NULL;
    1.25 -    GIConv translit=(GIConv)-1,to_utf8=(GIConv)-1;
    1.26 +    static GIConv translit=(GIConv)-1,to_utf8=(GIConv)-1;
    1.27      if (!theline)
    1.28      {
    1.29  	if (entities)
    1.30  	    g_tree_destroy(entities);
    1.31  	entities=NULL;
    1.32 -	if (translit==(GIConv)-1)
    1.33 +	if (translit!=(GIConv)-1)
    1.34  	    g_iconv_close(translit);
    1.35  	translit=(GIConv)-1;
    1.36 -	if (to_utf8==(GIConv)-1)
    1.37 +	if (to_utf8!=(GIConv)-1)
    1.38  	    g_iconv_close(to_utf8);
    1.39  	to_utf8=(GIConv)-1;
    1.40  	return;