Re: [Nautilus-list] Compile failure Nautilus 1.0.5



Alfons Hoogervorst <alfons proteus demon nl> writes:

> Lo Paul,
> 
> On 20 Oct 2001 23:34:11 +1000 you wrote:
> 
>   | When I try to configure and compile Nautilus on my
>   | system I get the following error:
>   | ======
>   | nautilus-desktop-file-loader.c: In function `validated_strdup':
>   | nautilus-desktop-file-loader.c:1043: `CODESET' undeclared (first use in
>   | this function)
> 
>   | Any ideas?
> 
> Yeah. A hacker put something distro specific in the file, and even
> mentioned it was *unportable*:
> 
>          if (!initialized) {
>                 /* whee, we are totally unportable (broken too) */
>                 setlocale (LC_CTYPE, "");
>                 locale = nl_langinfo (CODESET);
> 
> If you grep /usr/include for CODESET, you'll probably find something like
> this:
> 
> % grep -C "CODESET" *.h
> langinfo.h-  _NL_CTYPE_WIDTH,
> langinfo.h-  _NL_CTYPE_MB_CUR_MAX,
> langinfo.h:  _NL_CTYPE_CODESET_NAME,
> langinfo.h-#ifdef __USE_XOPEN
> langinfo.h:  CODESET = _NL_CTYPE_CODESET_NAME,
> langinfo.h-#endif
> langinfo.h-  _NL_NUM_LC_CTYPE,
> 
> So define __USE_XOPEN just before the #include <langinfo.h>

You should actually do this as

#define _XOPEN_SOURCE

__USE_XOPEN is a glibc implementation detail.

(Note that nl_langinfo(CODESET) is not distro specific, rather
specific to SUSv2 compliant systems. nl_langinfo(CODESET) was off by
default for older glibc, IIRC, because there were a few issues
in how it worked.

The portable way to charset identification is to use the libcharset
code from libintl. GLib-2.0 uses this code to implement
g_get_charset(); a gnome-1.4 app could use the code directly. Or maybe
we just need to move along on Nautilus on gnome-2.0 and not worry too
much about this.

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]