* catgets/open_catalog.c (__open_catalog): Don't use a value type

as the __builtin_expect expression, just the Boolean value.

	* sysdeps/generic/wordexp.c (parse_glob): int -> size_t for counter.
	* sysdeps/unix/sysv/linux/opensock.c (__opensock): Likewise.
	* resolv/res_hconf.c (arg_service_list, parse_line): Likewise.
	* iconvdata/tst-loading.c (main): Likewise.
	* catgets/tst-catgets.c (main): Likewise.
	* stdlib/tst-xpg-basename.c (main): Likewise.
	* stdlib/tst-bsearch.c (main): Likewise.
	* stdio-common/test-vfprintf.c (main): Likewise.
	* stdio-common/tst-rndseek.c (do_test): Likewise.
	* libio/tst_swprintf.c (main): Likewise.
	* libio/tst-fgetws.c (main): Likewise.
	* wcsmbs/tst-mbrtowc.c (check_ascii): Likewise.
	* time/tst-posixtz.c (main): Likewise.
	* time/tst-strptime.c (test_tm): Likewise.
	* time/tst-strptime.c (main): Likewise.
	* time/tst-getdate.c (main): Likewise.
	* posix/tst-mmap.c (main): Likewise.
	* posix/tst-getaddrinfo.c (do_test): Likewise.
	* io/tst-getcwd.c (do_test): Likewise.
	* resolv/tst-aton.c (main): Likewise.
	* inet/tst-network.c (main): Likewise.
	* libio/tst-fgetws.c (main): Likewise.
	* sysdeps/posix/sprofil.c (add_region): int -> unsigned int for I.
	* sysdeps/unix/sysv/linux/ptsname.c (__ptsname_r): int -> unsigned int
	for PTYNO.

	* stdlib/msort.c (qsort): Add a cast to silence warning.
	* stdio-common/vfprintf.c (process_string_arg): Likewise.
	* libio/oldfileops.c (_IO_old_do_write): Likewise.
	* sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Likewise.
	* sysdeps/unix/sysv/linux/ttyname.c (ttyname): Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c (gethostid): Likewise.
	* argp/argp-fmtstream.c (__argp_fmtstream_printf): Likewise.
	* nscd/nscd_getgr_r.c (nscd_getgr_r): Likewise.
	* sysdeps/unix/grantpt.c (grantpt): Likewise.
	* libio/tst-widetext.c (main): Likewise.
	* libio/tst-mmap2-eofsync.c (do_test): Likewise.
	* rt/tst-aio.c (test_file): Likewise.
	* rt/tst-aio64.c (test_file): Likewise.
	* resolv/tst-aton.c (main): Likewise.

	* catgets/catgetsinfo.h (CATGETS_MAGIC): Use U suffix on the constant.

	* ctype/ctype.c (__ctype_tolower, __ctype_toupper): Cast to int32_t
	instead of uint32_t in these macros.
This commit is contained in:
Roland McGrath 2002-09-24 04:24:25 +00:00
parent d45c148997
commit 57b36a0a75
38 changed files with 113 additions and 70 deletions

View File

@ -1,10 +1,59 @@
2002-09-23 Roland McGrath <roland@redhat.com>
* catgets/open_catalog.c (__open_catalog): Don't use a value type
as the __builtin_expect expression, just the Boolean value.
* sysdeps/generic/wordexp.c (parse_glob): int -> size_t for counter.
* sysdeps/unix/sysv/linux/opensock.c (__opensock): Likewise.
* resolv/res_hconf.c (arg_service_list, parse_line): Likewise.
* iconvdata/tst-loading.c (main): Likewise.
* catgets/tst-catgets.c (main): Likewise.
* stdlib/tst-xpg-basename.c (main): Likewise.
* stdlib/tst-bsearch.c (main): Likewise.
* stdio-common/test-vfprintf.c (main): Likewise.
* stdio-common/tst-rndseek.c (do_test): Likewise.
* libio/tst_swprintf.c (main): Likewise.
* libio/tst-fgetws.c (main): Likewise.
* wcsmbs/tst-mbrtowc.c (check_ascii): Likewise.
* time/tst-posixtz.c (main): Likewise.
* time/tst-strptime.c (test_tm): Likewise.
* time/tst-strptime.c (main): Likewise.
* time/tst-getdate.c (main): Likewise.
* posix/tst-mmap.c (main): Likewise.
* posix/tst-getaddrinfo.c (do_test): Likewise.
* io/tst-getcwd.c (do_test): Likewise.
* resolv/tst-aton.c (main): Likewise.
* inet/tst-network.c (main): Likewise.
* libio/tst-fgetws.c (main): Likewise.
* sysdeps/posix/sprofil.c (add_region): int -> unsigned int for I.
* sysdeps/unix/sysv/linux/ptsname.c (__ptsname_r): int -> unsigned int
for PTYNO.
* stdlib/msort.c (qsort): Add a cast to silence warning.
* stdio-common/vfprintf.c (process_string_arg): Likewise.
* libio/oldfileops.c (_IO_old_do_write): Likewise.
* sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Likewise.
* sysdeps/unix/sysv/linux/ttyname.c (ttyname): Likewise.
* sysdeps/unix/sysv/linux/gethostid.c (gethostid): Likewise.
* argp/argp-fmtstream.c (__argp_fmtstream_printf): Likewise.
* nscd/nscd_getgr_r.c (nscd_getgr_r): Likewise.
* sysdeps/unix/grantpt.c (grantpt): Likewise.
* libio/tst-widetext.c (main): Likewise.
* libio/tst-mmap2-eofsync.c (do_test): Likewise.
* rt/tst-aio.c (test_file): Likewise.
* rt/tst-aio64.c (test_file): Likewise.
* resolv/tst-aton.c (main): Likewise.
* catgets/catgetsinfo.h (CATGETS_MAGIC): Use U suffix on the constant.
* ctype/ctype.c (__ctype_tolower, __ctype_toupper): Cast to int32_t
instead of uint32_t in these macros.
2002-09-22 Bruno Haible <bruno@clisp.org>
* iconv/iconv_prog.c (main): Provide an error message that identifies
the wrong encoding.
2002-09-22 Bruno Haible <bruno@clisp.org>
* iconvdata/tscii.c: New file.
* iconvdata/testdata/TSCII: New file.
* iconvdata/testdata/TSCII..UTF8: New file.
@ -18,16 +67,12 @@
* iconvdata/tst-tables.sh: Add TSCII.
* iconvdata/TESTS: Add TSCII.
2002-09-22 Bruno Haible <bruno@clisp.org>
Revert 2002-04-18 patch.
* iconvdata/euc-jisx0213.c (EMIT_SHIFT_TO_INIT, BODY for
FROM_DIRECTION): Make the FROM direction stateful again.
* iconvdata/shift_jisx0213.c (EMIT_SHIFT_TO_INIT, BODY for
FROM_DIRECTION): Likewise.
2002-09-22 Bruno Haible <bruno@clisp.org>
* iconvdata/tst-e2big.c: New file.
* iconvdata/Makefile (tests): Add tst-e2big.

View File

@ -415,10 +415,10 @@ __argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...)
avail = fs->end - fs->p;
out = __vsnprintf (fs->p, avail, fmt, args);
va_end (args);
if (out >= avail)
if ((size_t) out >= avail)
size_guess = out + 1;
}
while (out >= avail);
while ((size_t) out >= avail);
fs->p += out;

View File

@ -48,7 +48,7 @@ typedef struct catalog_info
/* The magic number to signal we really have a catalog file. */
#define CATGETS_MAGIC 0x960408de
#define CATGETS_MAGIC 0x960408deU
/* Prototypes for helper functions. */

View File

@ -253,8 +253,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
/* Determine whether the file is a catalog file and if yes whether
it is written using the correct byte order. Else we have to swap
the values. */
if (__builtin_expect (catalog->file_ptr->magic, CATGETS_MAGIC)
== CATGETS_MAGIC)
if (__builtin_expect (catalog->file_ptr->magic == CATGETS_MAGIC, 1))
swapping = 0;
else if (catalog->file_ptr->magic == SWAPU32 (CATGETS_MAGIC))
swapping = 1;

View File

@ -26,7 +26,7 @@ main (void)
for (rnd = 0; rnd < ROUNDS; ++rnd)
{
nl_catd cd = catopen ("libc", 0);
int cnt;
size_t cnt;
if (cd == (nl_catd) -1)
{

View File

@ -1,5 +1,5 @@
/* Tests for loading and unloading of iconv modules.
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
@ -118,7 +118,7 @@ static const char inbuf[] =
int
main (void)
{
int count = TEST_ROUNDS;
size_t count = TEST_ROUNDS;
int result = 0;
mtrace ();

View File

@ -1,5 +1,5 @@
/* Test for inet_network.
Copyright (C) 2000 Free Software Foundation, Inc.
Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 2000.
@ -51,7 +51,7 @@ int
main (void)
{
int errors = 0;
int i;
size_t i;
uint32_t res;
for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)

View File

@ -1,5 +1,5 @@
/* Test of getcwd function.
Copyright (C) 2000 Free Software Foundation, Inc.
Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000.
@ -36,8 +36,7 @@ do_test (void)
char *bufs[10];
size_t lens[10];
size_t sbs;
size_t len;
int i;
size_t len, i;
if (getcwd (thepath, sizeof thepath) == NULL)
{

View File

@ -266,7 +266,7 @@ _IO_old_do_write (fp, data, to_do)
const char *data;
_IO_size_t to_do;
{
return (to_do == 0 || old_do_write (fp, data, to_do) == to_do)
return (to_do == 0 || (_IO_size_t) old_do_write (fp, data, to_do) == to_do)
? 0 : EOF;
}

View File

@ -13,7 +13,7 @@
int
main (int argc, char *argv[])
{
int i;
size_t i;
FILE *fp;
wchar_t *ret, wcs[WIDE_STR_LEN];
int result = 0;
@ -123,7 +123,7 @@ main (int argc, char *argv[])
}
else
{
int i;
size_t i;
printf ("Return Value: %p\n", ret);
for (i = 0; i < wcslen (wcs) + 1; i++)

View File

@ -78,7 +78,7 @@ do_test (void)
}
c = write (temp_fd, pages + pagesize, pagesize);
if (c == pagesize)
if (c == (ssize_t) pagesize)
printf ("wrote more to file\n");
else
{

View File

@ -89,7 +89,7 @@ main (void)
exit (1);
}
if ((size_t) nonr == -1 )
if (nonr == (size_t) -1)
{
printf ("\
%u: iconv returned with %Zd and errno = %m (inleft: %Zd, outleft: %Zd)\n",

View File

@ -21,7 +21,7 @@ static const struct
int
main (int argc, char *argv[])
{
int n;
size_t n;
int result = 0;
puts ("test 1");

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1998.
@ -114,7 +114,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
vec[1].iov_base = (void *) key;
vec[1].iov_len = keylen;
if (__writev (sock, vec, 2) != sizeof (request_header) + keylen)
if ((size_t) __writev (sock, vec, 2) != sizeof (request_header) + keylen)
{
__close (sock);
return -1;
@ -182,7 +182,7 @@ nscd_getgr_r (const char *key, size_t keylen, request_type type,
total_len += gr_resp.gr_name_len + gr_resp.gr_passwd_len;
/* Get this data. */
if (__readv (sock, vec, 2) != total_len)
if ((size_t) __readv (sock, vec, 2) != total_len)
{
__close (sock);
return -1;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
/* Copyright (C) 1999, 2000, 2001, 2002 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
@ -28,7 +28,8 @@ do_test (void)
{
const int family[2] = { AF_INET, AF_INET6 };
int result = 0;
int gaierr, index;
int gaierr;
size_t index;
struct addrinfo hints, *ai, *aitop;
for (index = 0; index < sizeof (family) / sizeof (family[0]); ++index)

View File

@ -11,10 +11,10 @@ main (void)
{
int result = 0;
FILE *fp;
int c;
size_t c;
char buf[1000];
int fd;
char *ptr;
unsigned char *ptr;
size_t ps = sysconf (_SC_PAGESIZE);
void *mem;

View File

@ -112,7 +112,7 @@ arg_service_list (const char *fname, int line_num, const char *args,
enum Name_Service service;
const char *start;
size_t len;
int i;
size_t i;
static struct
{
const char * name;
@ -339,7 +339,7 @@ parse_line (const char *fname, int line_num, const char *str)
const char *start;
struct cmd *c = 0;
size_t len;
int i;
size_t i;
str = skip_ws (str);

View File

@ -47,13 +47,13 @@ int
main (int argc, char *argv[])
{
int result = 0;
int cnt;
size_t cnt;
for (cnt = 0; cnt < sizeof (tests) / sizeof (tests[0]); ++cnt)
{
struct in_addr addr;
if (inet_aton (tests[cnt].input, &addr) != tests[cnt].valid)
if ((int) inet_aton (tests[cnt].input, &addr) != tests[cnt].valid)
{
if (tests[cnt].valid)
printf ("\"%s\" not seen as valid IP address\n", tests[cnt].input);

View File

@ -76,14 +76,14 @@ test_file (const void *buf, size_t size, int fd, const char *msg)
return 1;
}
if (st.st_size != size)
if (st.st_size != (off_t) size)
{
error (0, errno, "%s: wrong size: %lu, should be %lu",
msg, (unsigned long int) st.st_size, (unsigned long int) size);
return 1;
}
if (pread (fd, tmp, size, 0) != size)
if (pread (fd, tmp, size, 0) != (ssize_t) size)
{
error (0, errno, "%s: failed pread", msg);
return 1;

View File

@ -77,14 +77,14 @@ test_file (const void *buf, size_t size, int fd, const char *msg)
return 1;
}
if (st.st_size != size)
if (st.st_size != (off_t) size)
{
error (0, errno, "%s: wrong size: %lu, should be %lu",
msg, (unsigned long int) st.st_size, (unsigned long int) size);
return 1;
}
if (pread (fd, tmp, size, 0) != size)
if (pread (fd, tmp, size, 0) != (ssize_t) size)
{
error (0, errno, "%s: failed pread", msg);
return 1;

View File

@ -1,5 +1,5 @@
/* Tests of *printf for very large strings.
Copyright (C) 2000 Free Software Foundation, Inc.
Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
@ -41,7 +41,7 @@ int
main (void)
{
char buf[20];
int i;
size_t i;
int res = 0;
int fd;

View File

@ -67,7 +67,7 @@ do_test (void)
{
int fd;
FILE *fp;
int i;
size_t i;
int result;
fd = mkstemp (fname);

View File

@ -1035,7 +1035,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
const char *mbs = (const char *) string; \
mbstate_t mbstate; \
\
len = prec != -1 ? prec : strlen (mbs); \
len = prec != -1 ? (size_t) prec : strlen (mbs); \
\
/* Allocate dynamically an array which definitely is long \
enough for the wide character version. */ \

View File

@ -130,7 +130,7 @@ qsort (void *b, size_t n, size_t s, __compar_fn_t cmp)
measured in bytes. */
/* If the memory requirements are too high don't allocate memory. */
if (size / pagesize > phys_pages)
if (size / pagesize > (size_t) phys_pages)
_quicksort (b, n, s, cmp);
else
{

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 Free Software Foundation, Inc.
/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
@ -54,7 +54,7 @@ comp (const void *p1, const void *p2)
int
main (void)
{
int cnt;
size_t cnt;
int result = 0;
struct entry key;
struct entry *res;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1999.
@ -41,7 +41,7 @@ static struct
int
main (void)
{
int i = 0;
size_t i = 0;
int errors = 0;
char path[1024];
char *file;

View File

@ -445,7 +445,7 @@ parse_glob (char **word, size_t *word_length, size_t *max_length,
/* We are poised just after a '*', a '[' or a '?'. */
int error = WRDE_NOSPACE;
int quoted = 0; /* 1 if singly-quoted, 2 if doubly */
int i;
size_t i;
wordexp_t glob_list; /* List of words to glob */
glob_list.we_wordc = 0;

View File

@ -239,7 +239,7 @@ add_region (struct prof *p, int prof_uint)
{
unsigned long int nsamples;
size_t start, end;
int i;
unsigned int i;
if (p->pr_scale < 2)
return 0;

View File

@ -130,7 +130,7 @@ grantpt (int fd)
}
/* Get the group ID of the special `tty' group. */
if (grbuflen == -1)
if (grbuflen == (size_t) -1L)
/* `sysconf' does not support _SC_GETGR_R_SIZE_MAX.
Try a moderate value. */
grbuflen = 1024;

View File

@ -143,7 +143,7 @@ __getcwd (char *buf, size_t size)
{
if (path[0] == '/')
{
if (n >= alloc_size - 1)
if ((size_t) n >= alloc_size - 1)
{
if (buf == NULL)
free (path);

View File

@ -108,7 +108,7 @@ gethostid ()
in.s_addr = 0;
memcpy (&in, hp->h_addr,
(int) sizeof (in) < hp->h_length ? sizeof (in) : hp->h_length);
(int) sizeof (in) < hp->h_length ? (int) sizeof (in) : hp->h_length);
/* For the return value to be not exactly the IP address we do some
bit fiddling. */

View File

@ -59,7 +59,7 @@ __opensock (void)
char fname[sizeof "/proc/" + 14];
int result;
int has_proc;
int cnt;
size_t cnt;
/* We already know which family to use from the last call. Use it
again. */

View File

@ -75,7 +75,7 @@ __ptsname_r (int fd, char *buf, size_t buflen)
{
int save_errno = errno;
struct stat64 st;
int ptyno;
unsigned int ptyno;
if (buf == NULL)
{
@ -102,7 +102,7 @@ __ptsname_r (int fd, char *buf, size_t buflen)
numbuf[sizeof (numbuf) - 1] = '\0';
p = _itoa_word (ptyno, &numbuf[sizeof (numbuf) - 1], 10, 0);
if (buflen < devptslen + &numbuf[sizeof (numbuf)] - p)
if (buflen < devptslen + (&numbuf[sizeof (numbuf)] - p))
{
__set_errno (ERANGE);
return ERANGE;

View File

@ -141,7 +141,7 @@ ttyname (int fd)
/* This is for Linux 2.0. */
&& ttyname_buf[0] != '[')
{
if (len >= buflen)
if ((size_t) len >= buflen)
return NULL;
/* readlink need not terminate the string. */
ttyname_buf[len] = '\0';

View File

@ -1,5 +1,5 @@
/* Test for getdate.
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 2000.
@ -77,7 +77,7 @@ int
main (void)
{
int errors = 0;
int i;
size_t i;
struct tm *tm;

View File

@ -28,7 +28,7 @@ int
main (void)
{
int result = 0;
int cnt;
size_t cnt;
for (cnt = 0; cnt < sizeof (tests) / sizeof (tests[0]); ++cnt)
{

View File

@ -1,5 +1,5 @@
/* Test for strptime.
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@ -65,7 +65,7 @@ static int
test_tm (void)
{
struct tm tm;
int i;
size_t i;
int result = 0;
char buf[100];
@ -114,7 +114,7 @@ int
main (int argc, char *argv[])
{
struct tm tm;
int i;
size_t i;
int result = 0;
for (i = 0; i < sizeof (day_tests) / sizeof (day_tests[0]); ++i)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
@ -171,8 +171,7 @@ check_ascii (const char *locname)
char buf[MB_CUR_MAX];
wchar_t wc = 0xffffffff;
mbstate_t s;
size_t n;
int i;
size_t n, i;
for (i = 0; i < MB_CUR_MAX; ++i)
buf[i] = c + i;