This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem in swscanf


Hi,

On Aug  3 10:11, Shoichi Sakon wrote:
> Hi,
> 
> It seems there is a problem in swscanf.
> 
> Here is a test program.
> ----------------------------------------------------------
> #include <stdio.h>
> #include <wchar.h>
> #define SIZE 100
> 
> main() {
>         const wchar_t *ws = L"ab cd ef";
>         wchar_t x[SIZE],y[SIZE],z[SIZE];
>         int ret;
> 
>         ret = swscanf(ws, L"%3$l[ab] %2$ls %1$lc",x,y,z);
>         wprintf(L"ret=%d x=%lc y=%ls z=%ls\n",ret,*x,y,z);
> }
> -----------------------------------------------------------
> 
> In case of l[], ls or lc format, it does not handle %n$ properly,
> null character is not add, and/or return value is not correct.
> 
> I made an experimental patch to try to correct them.
> Please take a look.

the patch looks good.  It was malformed (somehow all TABs got replaced
with spaces in your patch) but contentwise it's fine.  I applied the
patch with fixed formatting.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: pgpSBAbC2KLnB.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]