rcanut / nhwcodec

NHW : A Next-Generation Image Compression Codec
Other
68 stars 9 forks source link

compile error due to typo #1

Closed skal65535 closed 6 years ago

skal65535 commented 6 years ago

compiling with gcc on Linux, one get the following error:

nhw_encoder.c: In function ‘write_compressed_file’: nhw_encoder.c:2663:29: warning: passing argument 2 of ‘fwrite’ makes integer from pointer without a cast [-Wint-conversion] fwrite(enc->nhw_char_res1,enc->nhw_char_res1_len,2,compressed); ^~~ In file included from nhw_encoder.c:46:0: /usr/include/stdio.h:717:15: note: expected ‘size_t {aka long unsigned int}’ but argument is of type ‘short unsigned int ’ extern size_t fwrite (const void restrict ptr, size_t __size, ^~ wavelet_filterbank.c: In function ‘wavelet_synthesis_high_quality_settings’: wavelet_filterbank.c:617:24: warning: assignment makes pointer from integer without a cast [-Wint-conversion] enc->nhw_char_res1_len=res;

The fix is easy: nhw_char_res1_len field should be a 'size_t', not 'unsigned short *' at encoder/codec.h:145

Patch attached.

skal/

0001-fix-compilation.txt

rcanut commented 6 years ago

Hi Skal,

Thank you so much for tracking this bug!!!

unsigned short *nhw_char_res1_len; should be replaced by: unsigned short nhw_char_res1_len; as this variable is not a pointer.

Many thanks again! Cheers, Raphael