Commit Graph

1466 Commits

Author SHA1 Message Date
Kim Woelders c608354760 Revert "JPG, PNG loaders: Avoid clobber warnings"
This caused a segv in the jpg loader if trying to load a non-jpg image
(gcc 9.2.1 with -O2, not with -O).

This reverts commit f588650bb6.
2020-02-29 06:55:15 +01:00
Kim Woelders c913f97285 __imlib_FileExtension: Use basename if there are no dots 2020-02-27 21:20:36 +01:00
Kim Woelders ac41eae7fa GZ, BZ2 loaders: Accept more file names
E.g. ".png.gz", "png.gz", ".../png.gz".
2020-02-27 21:20:36 +01:00
Alexander Volkov 97865ad8ef GIF loader: Don't close file descriptor twice
Summary:
DGifOpenFileHandle() closes it on failure and DGifCloseFile()
closes it when working normally.

Reviewers: kwo

Differential Revision: https://phab.enlightenment.org/D11425
2020-02-26 19:06:34 +01:00
Kim Woelders 4d191f6492 ID3 loader: Some mostly cosmetic rearrangements 2020-02-23 13:26:00 +01:00
Kim Woelders 4ec88a0dda TIFF loader: Minor speedup 2020-02-23 13:26:00 +01:00
Kim Woelders b059049034 Add a couple of consts 2020-02-23 13:26:00 +01:00
Kim Woelders f588650bb6 JPG, PNG loaders: Avoid clobber warnings 2020-02-17 18:18:13 +01:00
Kim Woelders 8d9f33d365 Fix enum conversion warnings (gcc10) 2020-02-01 19:30:03 +01:00
Tobias Stoeckmann d5400cc047 ICO loader: Handle malloc failures
If not enough memory is available and a program is run on a system
which returns NULL in such cases, then treat this error gracefully.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2020-01-20 21:49:57 +01:00
Tobias Stoeckmann c95f938ff1 ICO loader: Do not crash on invalid files
If an ICO file contains icons with an excessively large amount of colors
in its color map, an integer overflow can lead to 0 byte allocations of
the color map.

If such an icon is displayed later on, the color map access leads to
out of boundary reads.

Also verify that excessively large icons are not parsed at all to prevent
out of boundary reads of raw pixel data during display.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2020-01-20 06:21:15 +01:00
Kim Woelders 106e2188ee autogen.sh: Add -n as alternative to NOCONFIGURE 2020-01-11 12:56:43 +01:00
Kim Woelders 9eaed188d2 Make ImlibLoader struct opaque
Loaders should no longer directly access it.
2020-01-11 12:56:08 +01:00
Kim Woelders 875bc82b49 Introduce __imlib_LoaderSetFormats() 2020-01-11 12:55:08 +01:00
Kim Woelders c02dc3c975 Introduce __imlib_LoadEmbedded() 2020-01-11 12:55:08 +01:00
Kim Woelders 10e21579fa Savers: Simplify progress handling 2020-01-04 15:30:20 +01:00
Kim Woelders 0f5b4fb10a Loaders: Simplify/fix progress handling
Progress handling was broken in at least bmp, gif, lbm, and png loaders.
2020-01-04 15:30:20 +01:00
Kim Woelders 87c84278ec image.c: Add infrastructure to simplify progress handling 2020-01-04 15:30:20 +01:00
Kim Woelders 9f479126f9 image.c: Remove redundant pixmap unref
Already done in __imlib_ConsumeImage().
2020-01-04 15:30:20 +01:00
Kim Woelders 495527a74e Fix loader cleanup breakage (gif) 2019-12-29 16:54:26 +01:00
Kim Woelders f4ab8e10b1 imlib2_view: Various tweaks
- Only process latest key press
- Clear to background before drawing new image
- Skip redraw of current image
2019-12-29 16:54:26 +01:00
Kim Woelders 83e7e89348 image.c: Move data_memory_func assignment to better place 2019-12-28 12:06:22 +01:00
Kim Woelders 002df3c1fa image.c: Minor refactoring of pixmap cache cleaners 2019-12-28 12:06:22 +01:00
Kim Woelders a7be91805f image.c: Enable non-dirty pixmap cache cleaning
For whatever reason this does not seem to have ever been active.
Let's activate it now.
2019-12-28 12:06:22 +01:00
Kim Woelders 6acfd27058 image.c: Move loader functions to separate file 2019-12-28 12:06:22 +01:00
Kim Woelders 02e85ee069 image.c: Move image tag functions to separate file 2019-12-28 12:06:22 +01:00
Kim Woelders 0c7464f0db image.c/h: Cleanups
- Make a number of functions static
- Shuffle prototypes around for nicer grouping
- Remove unused __imlib_SetImageAlphaFlag()
- Remove __imlib_FlushCache() prototype (not implemented)
2019-12-28 12:06:22 +01:00
Kim Woelders 6a7eb67f46 Saver cleanups
- Do exit cleanups at exit.
- Use LOAD_FAIL/SUCCESS/BREAK for save() exit code.
- Cosmetics.
2019-12-23 12:55:46 +01:00
Kim Woelders bd3aa88242 Loader cleanups
- Do exit cleanups at exit.
- Merge data load conditions.
- Use LOAD_FAIL/SUCCESS/BREAK for load() exit code.
- Cosmetics.
2019-12-23 12:07:48 +01:00
Kim Woelders 540a98870b image.c: Use loader return value, not im->w to determine load success 2019-12-23 10:53:26 +01:00
Kim Woelders 670c8428a4 image.c: Introduce __imlib_ErrorFromErrno() 2019-12-23 10:53:26 +01:00
Kim Woelders c60ad00b1e image.c: Use real_file to get file time 2019-12-23 10:53:26 +01:00
Kim Woelders 0f4c0d9453 image.c: Don't strdup() real_name when not necessary in __imlib_LoadImage() 2019-12-23 10:53:26 +01:00
Kim Woelders 2c35a349ea image.c: Rework some obscure file name stuff in __imlib_SaveImage() 2019-12-23 10:53:26 +01:00
Kim Woelders c1b2686441 image.c: Remove some unnecessary clearing of calloc'ed structs 2019-12-23 10:53:26 +01:00
Kim Woelders 0c69bb64cc image.c: Add some space for readability 2019-12-23 10:53:26 +01:00
Kim Woelders cdf64148b0 Drop the __imlib_IsRealFile() file check in __imlib_File...() functions
There should be no reason to do this everywhere.
Only keep the one used when doing an image load.
2019-12-23 06:37:00 +01:00
Kim Woelders fa670dcbd7 Refactor many __imlib_File...() functions to use common __imlib_FileStat()
And drop unused __imlib_FilePermissions()
2019-12-23 06:37:00 +01:00
Kim Woelders 57b4b12c7e Simplify __imlib_FileExtension()
__imlib_FileExtension() has (presumably by mistake) never used the
"real" file name to determine the extension so let's just drop all the
strdup'ing and return a pointer into the file string.
2019-12-23 06:37:00 +01:00
Kim Woelders 7b3b5f7f0c imlib2_load: Add repeated load option 2019-12-23 06:37:00 +01:00
Kim Woelders 55da63d700 imlib2_load: Use getopt() 2019-12-23 06:37:00 +01:00
Kim Woelders c396b32739 imlib2_load: Properly check non-full loads (load data too) 2019-12-23 06:37:00 +01:00
Kim Woelders 8e376b549f XPM loader: Major speedup for cpp > 2 2019-12-23 06:37:00 +01:00
Kim Woelders 59027165b2 1.6.1 2019-12-13 19:08:18 +01:00
Luiz Carlos Ramos 641dd66349 BMP loader: Fix size calculation when saving files
The sizes stored both in BMP file and bitmap headers were not considering the
padding of each row, leading to smaller values when the width was not multiple
of 4.

Fixed by including the padding in the formula.
2019-12-08 14:39:09 +01:00
Kim Woelders 48ff9e10c1 LBM loader: Fix header-only loading 2019-12-03 20:03:21 +01:00
Kim Woelders 503bce9c64 XPM loader: Minor optimization for cpp > 2 2019-12-03 17:26:24 +01:00
Kim Woelders 269e0b8572 BMP loader: Remove some bogus conditions
And tweak (disabled) debug stuff.
2019-12-03 17:26:24 +01:00
Kim Woelders 3bd4e8032c Enable specifying loader/filter paths with environment variables
Useful for testing.
2019-12-03 17:26:24 +01:00
Kim Woelders fdbf1c49e3 imlib2_view: Add progress debug options 2019-12-03 17:26:24 +01:00