[PATCH] stdio: fix nano-vfprintf pointer formating with long pointers

Bin.Cheng amker.cheng@gmail.com
Thu Nov 20 07:21:00 GMT 2014


On Thu, Nov 20, 2014 at 1:01 AM, Peter A. Bigot <pab@pabigot.com> wrote:
> On the MSP430 when building with -mlarge sizeof(void*) is larger than
> sizeof(int), resulting in an offset error extracting arguments to format
> strings that include %p.
>
> stdio/ChangeLog:
> 2014-11-19  Peter A. Bigot  <pab@pabigot.com>
>
>         * libc/stdio/nano-vfprintf_i.c (_printf_i): Use LONGINT when void* is
>         larger than an int.
>
> Cc: nickc@redhat.com
> Signed-off-by: Peter A. Bigot <pab@pabigot.com>
> ---
>  newlib/libc/stdio/nano-vfprintf_i.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/newlib/libc/stdio/nano-vfprintf_i.c b/newlib/libc/stdio/nano-vfprintf_i.c
> index b75a142..992173b 100644
> --- a/newlib/libc/stdio/nano-vfprintf_i.c
> +++ b/newlib/libc/stdio/nano-vfprintf_i.c
> @@ -150,8 +150,10 @@ _printf_i (struct _reent *data, struct _prt_data_t *pdata, FILE *fp,
>         * defined manner.''
>         *       -- ANSI X3J11
>         */
> -      /* NOSTRICT.  */
>        pdata->flags |= HEXPREFIX;
> +      if (sizeof(void*) > sizeof(int))
Space before '('.

> +        pdata->flags |= LONGINT;
Spaces -> Tab.

> +      /* NOSTRICT.  */
>      case 'x':
>        pdata->l_buf[2] = 'x';
>        xdigs = "0123456789abcdef";
> --
> 1.8.5.5
>

Otherwise good for me, Thanks for fixing the problem.

Thanks,
bin



More information about the Newlib mailing list