On Fri, 24 Nov 2023 11:46:53 +0800
Gao Xiang <[email protected]> wrote:

> Hi Yue,
> 
> On 2023/11/24 11:36, Yue Hu wrote:
> > From: Yue Hu <[email protected]>
> > 
> > badlz4.c:72:58: warning: format ??%d?? expects argument of type ??int??, 
> > but argument 4 has type ??long unsigned int?? [-Wformat=]
> >     printf("test LZ4_compress_HC_destSize(%d) error (%d < %d)\n",
> >                                                           ~^
> >                                                           %ld
> > 
> > Signed-off-by: Yue Hu <[email protected]>
> > ---
> >   tests/src/badlz4.c | 7 ++++---
> >   1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tests/src/badlz4.c b/tests/src/badlz4.c
> > index f2f1f05..2a4a908 100644
> > --- a/tests/src/badlz4.c
> > +++ b/tests/src/badlz4.c
> > @@ -60,17 +60,18 @@ int test_LZ4_compress_HC_destSize(int inlen)
> >     char buf[1642496];
> >     int SrcSize = inlen;
> >     char dst[4116];
> > +   int DstSize = sizeof(dst);
> >     int compressed;
> >   
> >     void *ctx = LZ4_createStreamHC();
> >   
> >     memset(buf, 0, inlen);
> >     compressed = LZ4_compress_HC_destSize(ctx, buf, dst, &SrcSize,
> > -                                         sizeof(dst), 1);
> > +                                         DstSize, 1);
> >     LZ4_freeStreamHC(ctx);
> > -   if (SrcSize <= sizeof(dst)) {
> > +   if (SrcSize <= DstSize) {
> >             printf("test LZ4_compress_HC_destSize(%d) error (%d < %d)\n",
> > -                  inlen, SrcSize, sizeof(dst));  
> 
> Could we just use printf(...., (int)sizeof(dst)); instead?

Then it should be `if (SrcSize <= (int)sizeof(dst))` as well? 

> 
> Thanks,
> Gao Xiang
> 
> > +                  inlen, SrcSize, DstSize);
> >             return 1;
> >     }
> >     printf("test LZ4_compress_HC_destSize(%d) OK\n", inlen);  

Reply via email to