mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 00:10:10 +00:00
Update.
2000-07-24 Jakub Jelinek <jakub@redhat.com> * libio/wfiledoalloc.c (_IO_wfile_doallocate): Measure size in wide characters, not bytes. * libio/tst_putwc.c (do_test): Add test for writing lots of data into file. 2000-07-22 Bruno Haible <haible@clisp.cons.org> * locale/nl_langinfo.c (nl_langinfo): Accept items belonging to the new categories LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT, LC_IDENTIFICATION. * locale/xlocale.h (struct __locale_struct): Increase size of __locales array. * locale/duplocale.c (__duplocale): Copy newly added categories as well. * locale/freelocale.c (__freelocale): Free newly added categories. * locale/newlocale.c (__newlocale): Fix typo in sanity check. If a base is given, use it, don't simply return it. 2000-07-22 Bruno Haible <haible@clisp.cons.org> * crypt/md5-crypt.c (__md5_crypt_r): Avoid gcc warnings: Use pointer variables, copied_key and copied_salt, instead of boolean variables.
This commit is contained in:
parent
f3d5834e69
commit
5bef282098
26
ChangeLog
26
ChangeLog
@ -1,3 +1,29 @@
|
|||||||
|
2000-07-24 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* libio/wfiledoalloc.c (_IO_wfile_doallocate): Measure size
|
||||||
|
in wide characters, not bytes.
|
||||||
|
* libio/tst_putwc.c (do_test): Add test for writing lots of data
|
||||||
|
into file.
|
||||||
|
|
||||||
|
2000-07-22 Bruno Haible <haible@clisp.cons.org>
|
||||||
|
|
||||||
|
* locale/nl_langinfo.c (nl_langinfo): Accept items belonging to the
|
||||||
|
new categories LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE,
|
||||||
|
LC_MEASUREMENT, LC_IDENTIFICATION.
|
||||||
|
|
||||||
|
* locale/xlocale.h (struct __locale_struct): Increase size of
|
||||||
|
__locales array.
|
||||||
|
* locale/duplocale.c (__duplocale): Copy newly added categories as
|
||||||
|
well.
|
||||||
|
* locale/freelocale.c (__freelocale): Free newly added categories.
|
||||||
|
* locale/newlocale.c (__newlocale): Fix typo in sanity check.
|
||||||
|
If a base is given, use it, don't simply return it.
|
||||||
|
|
||||||
|
2000-07-22 Bruno Haible <haible@clisp.cons.org>
|
||||||
|
|
||||||
|
* crypt/md5-crypt.c (__md5_crypt_r): Avoid gcc warnings: Use pointer
|
||||||
|
variables, copied_key and copied_salt, instead of boolean variables.
|
||||||
|
|
||||||
2000-07-24 Andreas Jaeger <aj@suse.de>
|
2000-07-24 Andreas Jaeger <aj@suse.de>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/powerpc/mmap64.c (__mmap64): Fix offset
|
* sysdeps/unix/sysv/linux/powerpc/mmap64.c (__mmap64): Fix offset
|
||||||
|
@ -60,8 +60,8 @@ __md5_crypt_r (key, salt, buffer, buflen)
|
|||||||
size_t key_len;
|
size_t key_len;
|
||||||
size_t cnt;
|
size_t cnt;
|
||||||
char *cp;
|
char *cp;
|
||||||
int key_copied = 0;
|
char *copied_key = NULL;
|
||||||
int salt_copied = 0;
|
char *copied_salt = NULL;
|
||||||
|
|
||||||
/* Find beginning of salt string. The prefix should normally always
|
/* Find beginning of salt string. The prefix should normally always
|
||||||
be present. Just in case it is not. */
|
be present. Just in case it is not. */
|
||||||
@ -75,21 +75,21 @@ __md5_crypt_r (key, salt, buffer, buflen)
|
|||||||
if ((key - (char *) 0) % __alignof__ (md5_uint32) != 0)
|
if ((key - (char *) 0) % __alignof__ (md5_uint32) != 0)
|
||||||
{
|
{
|
||||||
char *tmp = (char *) alloca (key_len + __alignof__ (md5_uint32));
|
char *tmp = (char *) alloca (key_len + __alignof__ (md5_uint32));
|
||||||
key = memcpy (tmp + __alignof__ (md5_uint32)
|
key = copied_key =
|
||||||
- (tmp - (char *) 0) % __alignof__ (md5_uint32),
|
memcpy (tmp + __alignof__ (md5_uint32)
|
||||||
key, key_len);
|
- (tmp - (char *) 0) % __alignof__ (md5_uint32),
|
||||||
|
key, key_len);
|
||||||
assert ((key - (char *) 0) % __alignof__ (md5_uint32) == 0);
|
assert ((key - (char *) 0) % __alignof__ (md5_uint32) == 0);
|
||||||
key_copied = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((salt - (char *) 0) % __alignof__ (md5_uint32) != 0)
|
if ((salt - (char *) 0) % __alignof__ (md5_uint32) != 0)
|
||||||
{
|
{
|
||||||
char *tmp = (char *) alloca (salt_len + __alignof__ (md5_uint32));
|
char *tmp = (char *) alloca (salt_len + __alignof__ (md5_uint32));
|
||||||
salt = memcpy (tmp + __alignof__ (md5_uint32)
|
salt = copied_salt =
|
||||||
- (tmp - (char *) 0) % __alignof__ (md5_uint32),
|
memcpy (tmp + __alignof__ (md5_uint32)
|
||||||
salt, salt_len);
|
- (tmp - (char *) 0) % __alignof__ (md5_uint32),
|
||||||
|
salt, salt_len);
|
||||||
assert ((salt - (char *) 0) % __alignof__ (md5_uint32) == 0);
|
assert ((salt - (char *) 0) % __alignof__ (md5_uint32) == 0);
|
||||||
salt_copied = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prepare for the real work. */
|
/* Prepare for the real work. */
|
||||||
@ -225,10 +225,10 @@ __md5_crypt_r (key, salt, buffer, buflen)
|
|||||||
__md5_finish_ctx (&ctx, alt_result);
|
__md5_finish_ctx (&ctx, alt_result);
|
||||||
memset (&ctx, '\0', sizeof (ctx));
|
memset (&ctx, '\0', sizeof (ctx));
|
||||||
memset (&alt_ctx, '\0', sizeof (alt_ctx));
|
memset (&alt_ctx, '\0', sizeof (alt_ctx));
|
||||||
if (key_copied)
|
if (copied_key != NULL)
|
||||||
memset ((char *) key, '\0', key_len);
|
memset (copied_key, '\0', key_len);
|
||||||
if (salt_copied)
|
if (copied_salt != NULL)
|
||||||
memset ((char *) salt, '\0', salt_len);
|
memset (copied_salt, '\0', salt_len);
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,16 @@ do_test (void)
|
|||||||
res = 1;
|
res = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Next test: write a bit more than a few bytes. */
|
||||||
|
fp = fopen (outname, "w");
|
||||||
|
if (fp == NULL)
|
||||||
|
error (EXIT_FAILURE, errno, "cannot open temporary file");
|
||||||
|
|
||||||
|
for (n = 0; n < 4098; ++n)
|
||||||
|
putwc (n & 255, fp);
|
||||||
|
|
||||||
|
fclose (fp);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ _IO_wfile_doallocate (fp)
|
|||||||
if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
|
if (fp->_fileno < 0 || _IO_SYSSTAT (fp, &st) < 0)
|
||||||
{
|
{
|
||||||
couldbetty = 0;
|
couldbetty = 0;
|
||||||
size = _IO_BUFSIZ * sizeof (wchar_t);
|
size = _IO_BUFSIZ;
|
||||||
#if 0
|
#if 0
|
||||||
/* do not try to optimise fseek() */
|
/* do not try to optimise fseek() */
|
||||||
fp->_flags |= __SNPT;
|
fp->_flags |= __SNPT;
|
||||||
@ -92,13 +92,12 @@ _IO_wfile_doallocate (fp)
|
|||||||
{
|
{
|
||||||
couldbetty = S_ISCHR (st.st_mode);
|
couldbetty = S_ISCHR (st.st_mode);
|
||||||
#if _IO_HAVE_ST_BLKSIZE
|
#if _IO_HAVE_ST_BLKSIZE
|
||||||
size = ((st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize)
|
size = st.st_blksize <= 0 ? _IO_BUFSIZ : st.st_blksize;
|
||||||
* sizeof (wchar_t));
|
|
||||||
#else
|
#else
|
||||||
size = _IO_BUFSIZ * sizeof (wchar_t);
|
size = _IO_BUFSIZ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ALLOC_WBUF (p, size, EOF);
|
ALLOC_WBUF (p, size * sizeof (wchar_t), EOF);
|
||||||
_IO_wsetb (fp, p, p + size, 1);
|
_IO_wsetb (fp, p, p + size, 1);
|
||||||
if (couldbetty && isatty (fp->_fileno))
|
if (couldbetty && isatty (fp->_fileno))
|
||||||
fp->_flags |= _IO_LINE_BUF;
|
fp->_flags |= _IO_LINE_BUF;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Duplicate handle for selection of locales.
|
/* Duplicate handle for selection of locales.
|
||||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
Copyright (C) 1997, 2000 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||||
|
|
||||||
@ -42,12 +42,13 @@ __duplocale (__locale_t dataset)
|
|||||||
if (result != NULL)
|
if (result != NULL)
|
||||||
{
|
{
|
||||||
int cnt;
|
int cnt;
|
||||||
for (cnt = 0; cnt < LC_ALL; ++cnt)
|
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||||
{
|
if (cnt != LC_ALL)
|
||||||
result->__locales[cnt] = dataset->__locales[cnt];
|
{
|
||||||
if (result->__locales[cnt]->usage_count < MAX_USAGE_COUNT)
|
result->__locales[cnt] = dataset->__locales[cnt];
|
||||||
++result->__locales[cnt]->usage_count;
|
if (result->__locales[cnt]->usage_count < MAX_USAGE_COUNT)
|
||||||
}
|
++result->__locales[cnt]->usage_count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It's done. */
|
/* It's done. */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Free data allocated by a call to setlocale_r
|
/* Free data allocated by a call to setlocale_r
|
||||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
@ -37,8 +37,8 @@ __freelocale (__locale_t dataset)
|
|||||||
/* We modify global data. */
|
/* We modify global data. */
|
||||||
__libc_lock_lock (__libc_setlocale_lock);
|
__libc_lock_lock (__libc_setlocale_lock);
|
||||||
|
|
||||||
for (cnt = 0; cnt < LC_ALL; ++cnt)
|
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||||
if (dataset->__locales[cnt]->usage_count != UNDELETABLE)
|
if (cnt != LC_ALL && dataset->__locales[cnt]->usage_count != UNDELETABLE)
|
||||||
/* We can remove the data. */
|
/* We can remove the data. */
|
||||||
_nl_remove_locale (cnt, dataset->__locales[cnt]);
|
_nl_remove_locale (cnt, dataset->__locales[cnt]);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Return a reference to locale information record.
|
/* Return a reference to locale information record.
|
||||||
Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
|
|||||||
category_mask = (1 << __LC_LAST) - 1 - (1 << LC_ALL);
|
category_mask = (1 << __LC_LAST) - 1 - (1 << LC_ALL);
|
||||||
|
|
||||||
/* Sanity check for CATEGORY argument. */
|
/* Sanity check for CATEGORY argument. */
|
||||||
if ((category_mask & ~((1 << LC_ALL) - 1 - (1 << LC_ALL))) != 0)
|
if ((category_mask & ~((1 << __LC_LAST) - 1 - (1 << LC_ALL))) != 0)
|
||||||
ERROR_RETURN;
|
ERROR_RETURN;
|
||||||
|
|
||||||
/* `newlocale' does not support asking for the locale name. */
|
/* `newlocale' does not support asking for the locale name. */
|
||||||
@ -63,28 +63,25 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
|
|||||||
|
|
||||||
/* Allocate memory for the result. */
|
/* Allocate memory for the result. */
|
||||||
if (base != NULL)
|
if (base != NULL)
|
||||||
{
|
result = *base;
|
||||||
if (base != NULL)
|
|
||||||
return base;
|
|
||||||
|
|
||||||
result = *base;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Fill with pointers to C locale data to . */
|
/* Fill with pointers to C locale data. */
|
||||||
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||||
if (cnt != LC_ALL)
|
if (cnt != LC_ALL)
|
||||||
result.__locales[cnt] = _nl_C[cnt];
|
result.__locales[cnt] = _nl_C[cnt];
|
||||||
|
}
|
||||||
|
|
||||||
/* If no category is to be set we return BASE if available or a
|
/* If no category is to be set we return BASE if available or a
|
||||||
dataset using the C locale data. */
|
dataset using the C locale data. */
|
||||||
if (category_mask == 0)
|
if (category_mask == 0)
|
||||||
{
|
{
|
||||||
result_ptr = (__locale_t) malloc (sizeof (struct __locale_struct));
|
result_ptr = (__locale_t) malloc (sizeof (struct __locale_struct));
|
||||||
*result_ptr = result;
|
if (result_ptr == NULL)
|
||||||
|
return NULL;
|
||||||
|
*result_ptr = result;
|
||||||
|
|
||||||
goto update;
|
goto update;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We perhaps really have to load some data. So we determine the
|
/* We perhaps really have to load some data. So we determine the
|
||||||
@ -175,12 +172,12 @@ __newlocale (int category_mask, const char *locale, __locale_t base)
|
|||||||
update:
|
update:
|
||||||
{
|
{
|
||||||
union locale_data_value *ctypes = result_ptr->__locales[LC_CTYPE]->values;
|
union locale_data_value *ctypes = result_ptr->__locales[LC_CTYPE]->values;
|
||||||
result_ptr->__ctype_b = (const unsigned short int *)
|
result_ptr->__ctype_b = (const unsigned short int *)
|
||||||
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_CLASS)] .string);
|
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_CLASS)].string);
|
||||||
result_ptr->__ctype_tolower = (const int *)
|
result_ptr->__ctype_tolower = (const int *)
|
||||||
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_TOLOWER)].string);
|
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_TOLOWER)].string);
|
||||||
result_ptr->__ctype_toupper = (const int *)
|
result_ptr->__ctype_toupper = (const int *)
|
||||||
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_TOUPPER)].string);
|
(ctypes[_NL_ITEM_INDEX (_NL_CTYPE_TOUPPER)].string);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result_ptr;
|
return result_ptr;
|
||||||
|
@ -33,7 +33,7 @@ nl_langinfo (item)
|
|||||||
unsigned int index = _NL_ITEM_INDEX (item);
|
unsigned int index = _NL_ITEM_INDEX (item);
|
||||||
const struct locale_data *data;
|
const struct locale_data *data;
|
||||||
|
|
||||||
if (category < 0 || category >= LC_ALL)
|
if (category < 0 || category == LC_ALL || category >= __LC_LAST)
|
||||||
/* Bogus category: bogus item. */
|
/* Bogus category: bogus item. */
|
||||||
return (char *) "";
|
return (char *) "";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Definition of locale datatype.
|
/* Definition of locale datatype.
|
||||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
Copyright (C) 1997, 2000 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||||
|
|
||||||
@ -27,7 +27,8 @@
|
|||||||
go away without warning. */
|
go away without warning. */
|
||||||
typedef struct __locale_struct
|
typedef struct __locale_struct
|
||||||
{
|
{
|
||||||
struct locale_data *__locales[6]; /* XXX LC_ALL should be used here */
|
/* Note: LC_ALL is not a valid index into this array. */
|
||||||
|
struct locale_data *__locales[13]; /* 13 = __LC_LAST. */
|
||||||
|
|
||||||
/* To increase the speed of this solution we add some special members. */
|
/* To increase the speed of this solution we add some special members. */
|
||||||
const unsigned short int *__ctype_b;
|
const unsigned short int *__ctype_b;
|
||||||
|
Loading…
Reference in New Issue
Block a user