mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 05:20:06 +00:00
[BZ #3902]
2007-01-22 Ulrich Drepper <drepper@redhat.com> [BZ #3902] * stdio-common/_itoa.c (_itoa): Make sure at least a zero is emitted. * stdio-common/Makefile (tests): Add bug17. * stdio-common/bug17.c: New file.
This commit is contained in:
parent
439201dea2
commit
6cae39579b
@ -1,3 +1,10 @@
|
|||||||
|
2007-01-22 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
[BZ #3902]
|
||||||
|
* stdio-common/_itoa.c (_itoa): Make sure at least a zero is emitted.
|
||||||
|
* stdio-common/Makefile (tests): Add bug17.
|
||||||
|
* stdio-common/bug17.c: New file.
|
||||||
|
|
||||||
2007-01-19 Ulrich Drepper <drepper@redhat.com>
|
2007-01-19 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* iconvdata/brf.c: New file.
|
* iconvdata/brf.c: New file.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 1991-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
|
# Copyright (C) 1991-2006, 2007 Free Software Foundation, Inc.
|
||||||
# This file is part of the GNU C Library.
|
# This file is part of the GNU C Library.
|
||||||
|
|
||||||
# The GNU C Library is free software; you can redistribute it and/or
|
# The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -54,7 +54,7 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
|
|||||||
tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
|
tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
|
||||||
tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 bug15 \
|
tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 bug15 \
|
||||||
tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
|
tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
|
||||||
tst-fwrite bug16
|
tst-fwrite bug16 bug17
|
||||||
|
|
||||||
test-srcs = tst-unbputc tst-printf
|
test-srcs = tst-unbputc tst-printf
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Internal function for converting integers to ASCII.
|
/* Internal function for converting integers to ASCII.
|
||||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2002, 2003, 2004
|
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2002, 2003, 2004, 2007
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Torbjorn Granlund <tege@matematik.su.se>
|
Contributed by Torbjorn Granlund <tege@matematik.su.se>
|
||||||
@ -269,6 +269,7 @@ _itoa (value, buflim, base, upper_case)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
char *bufend = buflim;
|
||||||
#if BITS_PER_MP_LIMB == 64
|
#if BITS_PER_MP_LIMB == 64
|
||||||
mp_limb_t base_multiplier = brec->base_multiplier;
|
mp_limb_t base_multiplier = brec->base_multiplier;
|
||||||
if (brec->flag)
|
if (brec->flag)
|
||||||
@ -454,6 +455,8 @@ _itoa (value, buflim, base, upper_case)
|
|||||||
}
|
}
|
||||||
while (n != 0);
|
while (n != 0);
|
||||||
#endif
|
#endif
|
||||||
|
if (buflim == bufend)
|
||||||
|
*--buflim = '0';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
31
stdio-common/bug17.c
Normal file
31
stdio-common/bug17.c
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
static int
|
||||||
|
do_test (void)
|
||||||
|
{
|
||||||
|
static const char expect[] = "0, 0, 0";
|
||||||
|
char buf[100];
|
||||||
|
int status = 0;
|
||||||
|
|
||||||
|
static const char fmt1[] = "%0d, %0ld, %0lld";
|
||||||
|
snprintf (buf, sizeof (buf), fmt1, 0, 0L, 0LL);
|
||||||
|
if (strcmp (buf, expect) != 0)
|
||||||
|
{
|
||||||
|
printf ("\"%s\": got \"%s\", expected \"%s\"\n", fmt1, buf, expect);
|
||||||
|
status = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char fmt2[] = "%0u, %0lu, %0llu";
|
||||||
|
snprintf (buf, sizeof (buf), fmt2, 0u, 0uL, 0uLL);
|
||||||
|
if (strcmp (buf, expect) != 0)
|
||||||
|
{
|
||||||
|
printf ("\"%s\": got \"%s\", expected \"%s\"\n", fmt2, buf, expect);
|
||||||
|
status = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TEST_FUNCTION do_test ()
|
||||||
|
#include "../test-skeleton.c"
|
Loading…
Reference in New Issue
Block a user