Also:
- gif loader: Add error about corrupt frame sequence
- tiff loader: Drop OOM message - Not done elsewhere
- webp loader: Drop messages about quality tag outside [0-100] -
Not done elsewhere
As of libtiff 4.4.0 saving an image with COMPRESSION_DEFLATE will
produce a warning:
TIFFWriteDirectorySec: Warning, Creating TIFF with legacy Deflate codec identifier,
COMPRESSION_ADOBE_DEFLATE is more widely supported.
So let's just use COMPRESSION_ADOBE_DEFLATE.
This should make things slightly more consistent and unambiguous, and
the stdint types are already used here and there (in loaders).
I'm not aware of any systems where this change makes any difference.
If there are targets out there with 64 bit ints imlib2 might now work
there and on targets with 16 bit ints it most likely still doesn't.
Patch from Daniel Friesel <derf@finalrewind.org>:
---
Fix .gif loader if filename does not end in .gif
Imlib2 is currently unable to load gif images if the filename does not end in
.gif. This appears to be caused by imlib2 not resetting the file descriptor
back to 0 after trying to open the image with its different loaders.
While imlib2 does call rewind(FILE* im->fp) before invoking each loader, this
does not guarantee that the underlying FD is seeked as well. However, the GIF
loader uses the FD directly, and therefore tries to read from the middle of the
file (unless it is the first loader). This patch adds an explicit seek in the
same fashion as implemented in the TIFF loader.
Patch and debugging credits go to Lars Stoltenow.
---
Also fix same issue in TIFF and WEBP loaders.
im->w and im->h must always be set before __imlib_AllocateData() is
called due to non-immediate loading (__imlib_AllocateData() only
comes in play when the pixel data must be loaded).
Summary:
... and add imlib_create_image_using_data_and_memory_function().
For example, it allows to load an image in one process and then
pass it through shared memory to another process without extra
memory copy.
Reviewers: kwo
Differential Revision: https://phab.enlightenment.org/D10222
Instead of assigning it (in different ways) in each loader, do it
centrally in __imlib_LoadImageWrapper().
And a couple of cleanups in code related to im->format.
The code did not properly release resources in some error paths,
leading to memory leaks or possible double free issues.
If an image could not be loaded, some code paths check if width is 0
to determine if an error occurred. Therefore, always set width to 0
in such cases.
This fixes warnings with newer compilers/distros that enable warning
flags by default:
loader_zlib.c: In function 'uncompress_file':
loader_zlib.c:33:17: warning: ignoring return value of 'write',
declared with attribute warn_unused_result [-Wunused-result]
write(dest, outbuf, bytes);
^
Apply badzero.cocci, badnull.coci and badnull2.cocci
This should convert all cases where there's a comparison to NULL to simpler
forms. This patch applies the following transformations:
code before patch ||code after patch
===============================================================
return a == NULL; return !a;
return a != NULL; return !!a;
func(a == NULL); func(!a);
func(a != NULL); func(!!a);
b = a == NULL; b = !a;
b = a != NULL; b = !!a;
b = a == NULL ? c : d; b = !a ? c : d;
b = a != NULL ? c : d; b = a ? c : d;
other cases:
a == NULL !a
a != NULL a
SVN revision: 51487