Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Roland McGrath committed Sep 24, 2002
1 parent d45c148 commit 57b36a0
Show file tree
Hide file tree
Showing 38 changed files with 113 additions and 70 deletions.
57 changes: 51 additions & 6 deletions ChangeLog
@@ -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.
Expand All @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions argp/argp-fmtstream.c
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion catgets/catgetsinfo.h
Expand Up @@ -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. */
Expand Down
3 changes: 1 addition & 2 deletions catgets/open_catalog.c
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion catgets/tst-catgets.c
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions iconvdata/tst-loading.c
@@ -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.
Expand Down Expand Up @@ -118,7 +118,7 @@ static const char inbuf[] =
int
main (void)
{
int count = TEST_ROUNDS;
size_t count = TEST_ROUNDS;
int result = 0;

mtrace ();
Expand Down
4 changes: 2 additions & 2 deletions inet/tst-network.c
@@ -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.
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions io/tst-getcwd.c
@@ -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.
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion libio/oldfileops.c
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions libio/tst-fgetws.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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++)
Expand Down
2 changes: 1 addition & 1 deletion libio/tst-mmap2-eofsync.c
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion libio/tst-widetext.c
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion libio/tst_swprintf.c
Expand Up @@ -21,7 +21,7 @@ static const struct
int
main (int argc, char *argv[])
{
int n;
size_t n;
int result = 0;

puts ("test 1");
Expand Down
6 changes: 3 additions & 3 deletions nscd/nscd_getgr_r.c
@@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions posix/tst-getaddrinfo.c
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions posix/tst-mmap.c
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions resolv/res_hconf.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions resolv/tst-aton.c
Expand Up @@ -39,21 +39,21 @@ static struct tests
{ "1.2.256.4", 0, 0 },
{ "1.2.3.0x100", 0, 0 },
{ "323543357756889", 0, 0 },
{ "10.1.2.3.4", 0, 0},
{ "10.1.2.3.4", 0, 0},
};


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);
Expand Down
4 changes: 2 additions & 2 deletions rt/tst-aio.c
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions rt/tst-aio64.c
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions stdio-common/test-vfprintf.c
@@ -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.
Expand Down Expand Up @@ -41,7 +41,7 @@ int
main (void)
{
char buf[20];
int i;
size_t i;
int res = 0;
int fd;

Expand Down
2 changes: 1 addition & 1 deletion stdio-common/tst-rndseek.c
Expand Up @@ -67,7 +67,7 @@ do_test (void)
{
int fd;
FILE *fp;
int i;
size_t i;
int result;

fd = mkstemp (fname);
Expand Down
2 changes: 1 addition & 1 deletion stdio-common/vfprintf.c
Expand Up @@ -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. */ \
Expand Down
2 changes: 1 addition & 1 deletion stdlib/msort.c
Expand Up @@ -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
{
Expand Down

0 comments on commit 57b36a0

Please sign in to comment.