Using local function prototype redefinition is dangerous, now a single
prototype is seen in all the files that are concerned.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
To be consistent with RCreateXImage and because it should not be up to the
caller to handle this, when XGetImage returns a NULL pointer then the
function RGetXImage will also return NULL instead of an RXImage structure
with a NULL pointer.
This consistent behaviour helps fixing a memory leak in WMaker reported by
Coverity (#50125).
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, this value is never used, the assignation has no
effect, so Coverity reports that it is unnecessary complexity that is not
compatible with code maintainability.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, there's a free on the content of this buffer at
function's end, but if the image's width or height is lower than 1 then we
could reach this free before allocating anything, thus having an
uninitialised pointer.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, environment variables cannot be considered
trustworthy ("tainted"), so we need to make sure the values provided are
within reasonable bounds for safe operations.
Seized the opportunity to try to provide clearer name for the constants
defining the default value.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the behaviour of fopen/fread/fclose in case of
error is not really what the macro RETRY assumes. So the macro is removed
and appropriate action is implemented.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the shift operation performed for color-to-pixel
transform may not behave as well as expected because of the types used
(Coverity pointing suspicious sign extension because of int type being
involved).
The new code tries to leave no open interpretation to the compiler.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As pointed by Coverity, the shift operation performed for color-to-pixel
transform may not behave as well as expected because of the types used
(Coverity pointing suspicious sign extension because of int type being
involved).
The new code tries to leave no open interpretation to the compiler.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
With a set of images i was able to detect that
the flip functions was shifting the image by 1px.
The 90 and 270 degrees rotation were not working as
the functions were also mirroring the img.
The patch is also fixing the C style based on checkpatch.
when the rotation angle value passed to RRotateImage is a modulo of 90,
the function is working well but in other cases the rotateImage()
function is called. That last function is half implemented but
the half already implemented part is also segfaulting (use the testrot.c
to replay the crash).
So the patch is moving the 'not implemented' msg to disable the whole
rotateImage() function and comment it out.
Result of 'malloc' is converted to a pointer of type 'unsigned char',
which is incompatible with sizeof operand type 'char'
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
The library uses internally a cache of tables to convert image to different
depths, there is now an internal function 'r_destroy_conversion_tables' to
free them.
Instead of calling 'MagickWandGenesis' every time an image is loaded, only
call it the first time, and similarly do not call 'MagickWandTerminus' if
the library has not been used before.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
- changed header used for MagickWand to the one specified in the online
documentation
- changed a comparison to 'MagickTrue' because its value does not allow a
compiler optimisation that would be expected in present case
- fixed potential crash, if loading with Magick fails it could return a
pointer to a de-allocated area
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This patch is adding support for google webp image format, if you
don't know it a quick recap is to say that according to their tests
they claim it is better than png and jpeg.
Follow the link below for some more details:
https://developers.google.com/speed/webp/
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
- remove header not needed anymore
- revert change for XPM to stay in line with the standard
- changed PNG to stuck to the standard
- increased GIF to the complete signature
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
load.c is used to identify the file format, I rebased some checks on
what is defined in the spec of the format.
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
- re-add PPM to the list of supported format, because legacy apps may
expect to find it from the list;
- add the copyright notice related to the code that have been borrowed
from Netpbm;
- fixed a small error in PPM format check in the loading procedure;
- and a few minor code improvements
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
This is actually taken from patch:
wrlib: Added support for webp image
in which it is out of place as it is unrelated
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
1) according to that checks i was able to see that some netpbm support
type are missing (exactly: ascii graymap (PGM files) and pixmap (PPM)
and ascii/binary bitmap (PBM))
See the link below for more details.
http://en.wikipedia.org/wiki/Netpbm_format
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
The usual way to define a macro in is to name macro with 'USE_xxx' when
they are used to enable a feature 'xxx'.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This patch makes all files appear together when listing files and
it is more clear about their function.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The two functions require an argument which is used when the libXpm is
used, which means having the same argument list for the builtin code to be
permutable.
This patch adds the appropriate stuff to avoid a false report from the
compiler.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Now that the builtin XPM loading is separated from the saving code, the
use of the conditionals provided by autotools provides a better result
as it avoids unnecessary compilation.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Big files are harder to work with, so split load and save, which
happen to already be independent anyway.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The original check was not compliant with autoconf's syntax, did not
have a very good behaviour for user and was not easy to make evolve.
The new macro:
- uses as much as possible autoconf macros for portability and code
consistency;
- provides a consistent behaviour on yes/no/auto (if user explicitly
enables support, do not silently disable if not found; if library is found
but not the header, complain to let user install it or explicitly disable
support);
- makes uses of shell functions to keep generated configure smaller by
sharing reusable stuff;
- uses an automake conditional to avoid compiling the file is support is
not enabled
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The original check was not compliant with autoconf's syntax, did not
have a very good behaviour for user and was not easy to make evolve.
The new macro:
- uses as much as possible autoconf macros for portability and code
consistency;
- provides a consistent behaviour on yes/no/auto (if user explicitly
enables support, do not silently disable if not found; if library is found
but not the header, complain to let user install it or explicitly disable
support);
- makes uses of shell functions to keep generated configure smaller by
sharing reusable stuff;
- uses an automake conditional to avoid compiling the file is support is
not enabled
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The original check was not compliant with autoconf's syntax, did not
have a very good behaviour for user and was not easy to make evolve.
The new macro:
- uses as much as possible autoconf macros for portability and code
consistency;
- provides a consistent behaviour on yes/no/auto (if user explicitly
enables support, do not silently disable if not found; if library is found
but not the header, complain to let user install it or explicitly disable
support);
- makes uses of shell functions to keep generated configure smaller by
sharing reusable stuff;
- uses an automake conditional to avoid compiling the file is support is
not enabled
It includes a typo fixed by Amadeusz S-B³awiñski.-A
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
The original check was not compliant with autoconf's syntax, did not
have a very good behaviour for user and was not easy to make evolve.
The new macro:
- uses as much as possible autoconf macros for portability and code
consistency;
- provides a consistent behaviour on yes/no/auto (if user explicitly
enables support, do not silently disable if not found; if library is found
but not the header, complain to let user install it or explicitly disable
support);
- makes uses of shell functions to keep generated configure smaller by
sharing reusable stuff;
- uses an automake conditional to avoid compiling the file is support is
not enabled
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
As reported by Nicolas (nhs), compilation of wrlib is broken when
switching to gif_lib v5.
The API of gif_lib has known little change to provide thread-safe usage,
so we now detect this in configure and and use the functions as appropriate
in gif.c
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>