intl patches (14)

Bruno Haible haible@ilog.fr
Mon Mar 19 13:17:00 GMT 2001


The message catalogs must be opened in binary mode, on those systems where
it makes a difference: DOS, OS/2, Windows (including Cygwin).

This patch has no effect inside glibc.


2001-01-20  Bruno Haible  <haible@clisp.cons.org>

	* intl/loadmsgcat.c (O_BINARY): Define on platforms that don't have it.
	(_nl_load_domain): Open the catalog file in binary mode.

diff -r -c3 intl/loadmsgcat.c intl-98/loadmsgcat.c
*** intl/loadmsgcat.c	Sat Mar 17 19:26:46 2001
--- intl/loadmsgcat.c	Sat Mar 17 14:52:33 2001
***************
*** 117,122 ****
--- 117,139 ----
  # define freea(p) free (p)
  #endif
  
+ /* For systems that distinguish between text and binary I/O.
+    O_BINARY is usually declared in <fcntl.h>. */
+ #if !defined O_BINARY && defined _O_BINARY
+   /* For MSC-compatible compilers.  */
+ # define O_BINARY _O_BINARY
+ # define O_TEXT _O_TEXT
+ #endif
+ #ifdef __BEOS__
+   /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect.  */
+ # undef O_BINARY
+ # undef O_TEXT
+ #endif
+ /* On reasonable systems, binary I/O is the default.  */
+ #ifndef O_BINARY
+ # define O_BINARY 0
+ #endif
+ 
  /* We need a sign, whether a new catalog was loaded, which can be associated
     with all translations.  This is important if the translations are
     cached by one of GCC's features.  */
***************
*** 211,217 ****
      return;
  
    /* Try to open the addressed file.  */
!   fd = open (domain_file->filename, O_RDONLY);
    if (fd == -1)
      return;
  
--- 232,238 ----
      return;
  
    /* Try to open the addressed file.  */
!   fd = open (domain_file->filename, O_RDONLY | O_BINARY);
    if (fd == -1)
      return;
  



More information about the Libc-alpha mailing list