Double // in codepages list error

Walery Studennikov despair at sama.ru
Sun Aug 12 14:10:12 UTC 2001


On Sat, Aug 11, 2001 at 11:12:19PM -0400, Pavel Roskin wrote:
> 
> I understand that my criticism really should be directed at Walery, but
> I'm asking everybody to clean up the code being modified instead of piling
> one "quick fix" onto another.

The patch is attached.
Now we use concat_dir_and_file in charsets.c and on error we
return filename that we failed to open.

Regards, Walery
-------------- next part --------------
582c582
<     char *profile;
---
>     char *profile, *cpindex_filename;
653,654c653,655
<     if ( load_codepages_list() <= 0 ) {
< 	message( 1, MSG_ERROR, _("Can't load %s/%s"), mc_home, CHARSETS_INDEX );
---
>     if ( (cpindex_filename = load_codepages_list()) ) {
> 	message( 1, MSG_ERROR, _("Cannot load %s"), cpindex_filename );
> 	g_free( cpindex_filename );
-------------- next part --------------
7a8
> #include <glib.h>
9a11
> #include "util.h"
20c22,23
< int load_codepages_list(void)
---
> /* When it fails it returns the filename  */
> char* load_codepages_list(void)
22d24
<     int result = -1;
27c29,31
<     char * default_codepage = NULL;
---
>     char* default_codepage = NULL;
>     char* cpindex_filename =
> 	concat_dir_and_file( mc_home, CHARSETS_INDEX );
29,32c33,34
<     strcpy ( buf, mc_home );
<     strcat ( buf, "/" CHARSETS_INDEX );
<     if ( !( f = fopen( buf, "r" ) ) )
< 	return -1;
---
>     if ( !( f = fopen( cpindex_filename, "r" ) ) )
> 	return cpindex_filename;
78c80,81
<     result = n_codepages;
---
>     g_free( cpindex_filename );
>     cpindex_filename = NULL;
81c84
<     return result;
---
>     return cpindex_filename;
-------------- next part --------------
26c26
< int load_codepages_list(void);
---
> char* load_codepages_list(void);


More information about the mc-devel mailing list