JosePineiro / WebP-wrapper

Wrapper for libwebp in C#. The most complete wapper in pure managed C#. Exposes Simple Decoding API, Simple Encoding API, Advanced Encoding API (with stadistis of compresion), Get version library and WebPGetFeatures (info of any WebP file). In the future I´ll update for expose Advanced Decoding API. The wapper are in safe managed code in one class. No need external dll except libwebp.dll (included). The wapper work in 32 and 64 bit system.
MIT License
213 stars 48 forks source link

type_mismatch of return_value from DLL #28

Closed okrt-p07 closed 3 years ago

okrt-p07 commented 3 years ago

https://github.com/JosePineiro/WebP-wrapper/blob/bc6f3a9133fae827ceea204fb97437b85b563fa4/WebPTest/WebPWrapper.cs#L1160 https://github.com/JosePineiro/WebP-wrapper/blob/bc6f3a9133fae827ceea204fb97437b85b563fa4/WebPTest/WebPWrapper.cs#L1184

I think the following: https://github.com/JosePineiro/WebP-wrapper/blob/bc6f3a9133fae827ceea204fb97437b85b563fa4/WebPTest/WebPWrapper.cs#L1161 must be public static IntPtr WebPDecodeBGRInto(IntPtr data, int data_size, IntPtr output_buffer, int output_buffer_size, int output_stride) and https://github.com/JosePineiro/WebP-wrapper/blob/bc6f3a9133fae827ceea204fb97437b85b563fa4/WebPTest/WebPWrapper.cs#L1185 must be public static IntPtr WebPDecodeBGRAInto(IntPtr data, int data_size, IntPtr output_buffer, int output_buffer_size, int output_stride)

Some other lines related to this also need to be changed.

On Windows x86, int and IntPtr are same size. But on Windows x64, they are different size.

okrt-p07 commented 3 years ago

Ah, the parameters of https://github.com/JosePineiro/WebP-wrapper/blob/bc6f3a9133fae827ceea204fb97437b85b563fa4/WebPTest/WebPWrapper.cs#L1161 https://github.com/JosePineiro/WebP-wrapper/blob/bc6f3a9133fae827ceea204fb97437b85b563fa4/WebPTest/WebPWrapper.cs#L1185 must be (IntPtr data, UIntPtr data_size, IntPtr output_buffer, UIntPtr output_buffer_size, int output_stride) for Windows x64, isn't it?

On Windows x64, int and size_t are different size.

JosePineiro commented 3 years ago

What you say is correct. I have corrected the bug