]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Updated to fedora-glibc-20040926T0823
authorJakub Jelinek <jakub@redhat.com>
Sun, 26 Sep 2004 08:39:30 +0000 (08:39 +0000)
committerJakub Jelinek <jakub@redhat.com>
Sun, 26 Sep 2004 08:39:30 +0000 (08:39 +0000)
ChangeLog
fedora/branch.mk
intl/l10nflist.c
intl/loadinfo.h
intl/loadmsgcat.c
libio/vasprintf.c
locale/loadlocale.c

index dcbab5ec5c07c94f9bb899f290dcaeedacf3f4a5..b92394eb40c28b67ebca54cc8c1ab69c9f01d50b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,18 @@
 2004-09-25  Ulrich Drepper  <drepper@redhat.com>
 
+       * locale/loadlocale.c (_nl_intern_locale_data): Recognize LC_CTYPE
+       data where _nl_value_type_LC_CTYPE does not contain the type
+       information.  Add range checks.
+       Reported by John Lumby <johnlumby@hotmail.com> [BZ #356].
+
+       * libio/vasprintf.c (_IO_vasprintf): Fix condition to decide
+       whether to realloc or not.
+       Reported by Pavel Kankovsky <peak@argo.troja.mff.cuni.cz> [BZ #346].
+
        * intl/dcigettext.c (DCIGETTEXT): Protect tfind/tsearch calls.
        * intl/dcigettext.c (_nl_find_msg): Call _nl_load_domain also if
        decided < 0.
        * intl/finddomain.c (_nl_find_domain): Likewise.
-       * intl/l10nflist.c (_nl_make_l10nflist): Initialize lock.
-       * intl/loadinfo.h (struct loaded_l10nfile): Add lock element.
        * intl/loadmsgcat.c (_nl_load_domain): Set decided to 1 only once we
        are done.  First set to -1 to signal initialization is ongoing.
        Protect against concurrent callers with recursive lock.
index e7c3bf9511c036b0fa716a4e26619c734aabb17f..46ec6e506daf4c98c35e81ac8635e5ee24cb9916 100644 (file)
@@ -1,5 +1,5 @@
 # This file is updated automatically by Makefile.
 glibc-branch := fedora
 glibc-base := HEAD
-fedora-sync-date := 2004-09-25 07:38 UTC
-fedora-sync-tag := fedora-glibc-20040925T0738
+fedora-sync-date := 2004-09-26 08:23 UTC
+fedora-sync-tag := fedora-glibc-20040926T0823
index 5a366e59fb1c2a1f66a4fe677f1451dc797a84f7..7ffb4ab590381ab2bc92636d877c638cc66607fc 100644 (file)
@@ -280,7 +280,6 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
                     || ((mask & XPG_CODESET) != 0
                         && (mask & XPG_NORM_CODESET) != 0));
   retval->data = NULL;
-  __libc_lock_init_recursive (retval->lock);
 
   if (last == NULL)
     {
index 913022eb7bc2aac392987a8cb1a398afae62e67a..2c1b44cec49d1a9c748243db19fd1fb3172da701 100644 (file)
@@ -20,8 +20,6 @@
 #ifndef _LOADINFO_H
 #define _LOADINFO_H    1
 
-#include <bits/libc-lock.h>
-
 /* Declarations of locale dependent catalog lookup functions.
    Implemented in
 
@@ -63,7 +61,6 @@ struct loaded_l10nfile
 {
   const char *filename;
   int decided;
-  __libc_lock_define_recursive (, lock);
 
   const void *data;
 
index ec886d9bd7477af56223c26131ba81e5997b96f1..efefc69a435637fc64e32e75cd3d7deabbb99872 100644 (file)
@@ -88,6 +88,7 @@ char *alloca ();
 #ifdef _LIBC
 # include "../locale/localeinfo.h"
 # include <not-cancel.h>
+# include <bits/libc-lock.h>
 #endif
 
 /* Provide fallback values for macros that ought to be defined in <inttypes.h>.
@@ -899,6 +900,7 @@ _nl_load_domain (domain_file, domainbinding)
      struct loaded_l10nfile *domain_file;
      struct binding *domainbinding;
 {
+  __libc_lock_define_initialized_recursive (static, lock);
   int fd = -1;
   size_t size;
 #ifdef _LIBC
@@ -912,7 +914,7 @@ _nl_load_domain (domain_file, domainbinding)
   int revision;
   const char *nullentry;
 
-  __libc_lock_lock_recursive (domain_file->lock);
+  __libc_lock_lock_recursive (lock);
   if (domain_file->decided != 0)
     {
       /* There are two possibilities:
@@ -925,7 +927,7 @@ _nl_load_domain (domain_file, domainbinding)
            Not necessary anymore since if the lock is available this
           is finished.
       */
-      __libc_lock_unlock_recursive (domain_file->lock);
+      __libc_lock_unlock_recursive (lock);
       return;
     }
 
@@ -1400,7 +1402,7 @@ _nl_load_domain (domain_file, domainbinding)
 
   domain_file->decided = 1;
 
-  __libc_lock_unlock_recursive (domain_file->lock);
+  __libc_lock_unlock_recursive (lock);
 }
 
 
index 4e5b7f4cac032c7fe475f7cd7122ea530959f66d..e32a488438929b6c8ee8c560d838ec62b09819ad 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1997,1999,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1999-2002,2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -64,11 +64,11 @@ _IO_vasprintf (result_ptr, format, args)
       free (sf._sbf._f._IO_buf_base);
       return ret;
     }
-  /* Only use realloc if the size we need is of the same order of
-     magnitude then the memory we allocated.  */
+  /* Only use realloc if the size we need is of the same (binary)
+     order of magnitude then the memory we allocated.  */
   needed = sf._sbf._f._IO_write_ptr - sf._sbf._f._IO_write_base + 1;
   allocated = sf._sbf._f._IO_write_end - sf._sbf._f._IO_write_base;
-  if ((allocated << 1) <= needed)
+  if ((allocated >> 1) <= needed)
     *result_ptr = (char *) realloc (sf._sbf._f._IO_buf_base, needed);
   else
     {
index b2d944794f14b145c7b46d291aa7c1844a0a9b6e..11ece50a220400e42c5eaeb90f41eaf8255aa7ca 100644 (file)
@@ -1,5 +1,5 @@
 /* Functions to read locale data files.
-   Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -115,15 +115,45 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize)
          __set_errno (EINVAL);
          return NULL;
        }
-      if (__builtin_expect (_nl_value_types[category][cnt] == word, 0))
+
+      /* Determine the type.  There is one special case: the LC_CTYPE
+        category can have more elements than there are in the
+        _nl_value_type_LC_XYZ array.  There are all pointers.  */
+      switch (category)
+       {
+#define CATTEST(cat) \
+       case LC_##cat:                                                        \
+         assert (cnt < (sizeof (_nl_value_type_LC_##cat)                     \
+                        / sizeof (_nl_value_type_LC_##cat[0])));             \
+         break
+         CATTEST (NUMERIC);
+         CATTEST (TIME);
+         CATTEST (COLLATE);
+         CATTEST (MONETARY);
+         CATTEST (MESSAGES);
+         CATTEST (PAPER);
+         CATTEST (NAME);
+         CATTEST (ADDRESS);
+         CATTEST (TELEPHONE);
+         CATTEST (MEASUREMENT);
+         CATTEST (IDENTIFICATION);
+       default:
+         assert (category == LC_CTYPE);
+         break;
+       }
+
+      if ((category == LC_CTYPE
+          && cnt >= (sizeof (_nl_value_type_LC_CTYPE)
+                     / sizeof (_nl_value_type_LC_CTYPE[0])))
+         || __builtin_expect (_nl_value_types[category][cnt] != word, 1))
+       newdata->values[cnt].string = newdata->filedata + idx;
+      else
        {
          if (idx % __alignof__ (u_int32_t) != 0)
            goto puntdata;
          newdata->values[cnt].word =
            *((const u_int32_t *) (newdata->filedata + idx));
        }
-      else
-       newdata->values[cnt].string = newdata->filedata + idx;
     }
 
   return newdata;