Commit Graph

1558 Commits

Author SHA1 Message Date
Kim Woelders ea19ed87c8 XPM loader: Reduce signature window size some more
Now back (approximately) to the size before the mmap refactoring in
88231b52, included in release 1.7.5.
2022-02-24 19:37:51 +01:00
NRK ac59f89870 XPM Loader: limit signature check to first 4KiB
this prevents the loader from spending unreasonable amount of time going
through the entire file in case someone opens a directory which might
contain large videos or files.
2022-02-24 19:37:51 +01:00
Matthias Grosser 37e8c95788 imlib2: saving progressive JPEG 2022-02-18 13:25:48 +01:00
Kim Woelders 346449a6b2 PNM, XPM loaders: Fix trouble with non-ascii characters
The loaders would quit if e.g. a comment contains a non-ascii character
(byte with MSB set).
2022-02-12 17:25:23 +01:00
Kim Woelders b8213bfd2a v1.8.0 2022-02-06 14:27:39 +01:00
Kim Woelders 79a5086b58 test: Merge common stuff 2022-02-06 13:07:47 +01:00
Kim Woelders abc16b8c2c Add imlib_version() 2022-02-06 13:07:47 +01:00
Kim Woelders b27b625f25 HEIF loader: Header cleanups
sys/stat.h is unused.
stdio.h is more or less per convention included via loader_common.h ->
common.h.
2022-02-04 14:08:11 +01:00
Kim Woelders 2b6a2d7640 TGA loader: Make function order same as in other loaders 2022-02-04 14:02:47 +01:00
Kim Woelders 6d4c4de75a Fix gcc12 warning in __imlib_stripwhitespace()
Warning seems to be incorrect though..

In function ‘__imlib_stripwhitespace’,
    inlined from ‘__imlib_script_parse’ at ../../../../src/lib/script.c:256:21:
../../../../src/lib/script.c:53:4: error: pointer may be used after ‘free’ [-Werror=use-after-free]
   53 |    strcpy(str, tmpstr);
      |    ^~~~~~~~~~~~~~~~~~~
../../../../src/lib/script.c:54:4: note: call to ‘free’ here
   54 |    free(tmpstr);
      |    ^~~~~~~~~~~~
2022-01-29 19:59:47 +01:00
Kim Woelders 749c6ab254 Fix gcc12 warning in __imlib_ConsumeImage()
Although the warning is technically correct it is not a problem as the
address is just used to match if an ImlibImagePixmap references it.

../../../../src/lib/image.c: In function ‘__imlib_ConsumeImage’:
../../../../src/lib/image.c:111:4: error: pointer ‘im’ used after ‘free’ [-Werror=use-after-free]
  111 |    __imlib_PixmapUnrefImage(im);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../src/lib/image.c:108:4: note: call to ‘free’ here
  108 |    free(im);
      |    ^~~~~~~~
2022-01-29 19:59:47 +01:00
Kim Woelders 4384b8ee43 Add some missing const qualifiers 2022-01-29 19:59:47 +01:00
Kim Woelders ea7e1feb7e imlib2.spec.in: Introduce acflags for configuration of rpmbuilds 2022-01-29 19:59:47 +01:00
Kim Woelders 9f58303ac4 Refactoring around font glyph lookup
Avoiding some code duplication.
2022-01-29 19:59:47 +01:00
Kim Woelders 68171bdf7c test: Add basic heif loader check 2022-01-29 19:59:47 +01:00
Kim Woelders c74cb9f1a9 Mark obsolete TTF encoding functions as deprecated
and move them to separate file.

Haven't done anything useful for ~20 years.
2022-01-28 08:29:55 +01:00
Kim Woelders 3157181bc3 HEIF loader: Avoid memory leak when module is loaded more than once
Memory leak can be reproduced by running valgrind on test_load (which
calls imlib_flush_loaders()).
2022-01-28 08:29:55 +01:00
Kim Woelders 91a2ab9b14 SVG loader: Fix memory leak on error 2022-01-28 08:29:55 +01:00
Kim Woelders f9aca8ff43 autofoo: Sort loaders 2022-01-26 22:54:04 +01:00
Kim Woelders 5d6ed3db15 loaders.c: Add heif to known loaders 2022-01-26 20:28:06 +01:00
Kim Woelders 1c7446ee9d HEIF loader: A couple of cleanups and fixes
- No need to check fileno
  Should be valid on entry
- No need for stat()
  File size is passed via im
- Call __imlib_FreeData() on error like the other loaders do
2022-01-26 20:27:18 +01:00
Rishvic Pushpakaran b9668a0851 imlib2: added loader for HEIF files (uses libheif), implemented just `load2` for now
Summary: Implemented a loader for HEIF images. Uses libheif, and implemented the `load2` function as of now

Reviewers: raster

Subscribers: Colocasian, eworm, kwo

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12267
2022-01-26 20:26:06 +01:00
Kim Woelders 5261da4a6e Move some code as suggested in source 2022-01-26 20:23:46 +01:00
Kim Woelders 60fb882dad Drop/adjust a few comments 2022-01-26 20:23:36 +01:00
Kim Woelders 31982cbe63 imlib2_view: Avoid clang error
imlib2_view.c:206:33: error: initializer element is not a compile-time constant
   static rect_t       r_prev = r_zero;
                                ^~~~~~
2022-01-21 16:32:27 +01:00
Kim Woelders 838c391093 image.c: Avoid potential compile error
gcc 11.2.1 with -pedantic:
image.c: In function ‘__imlib_LoadImage’:
image.c:567:9: error: a label can only be part of a statement and a declaration is not a statement [-Werror=pedantic]
  567 |         ImlibLoader ** loaders = __imlib_GetLoaderList();

clang 13.0.0:
image.c:567:9: error: expected expression
        ImlibLoader ** loaders = __imlib_GetLoaderList();
        ^

Also remove pointless self-assignment.
2022-01-21 16:32:19 +01:00
Kim Woelders dde8b3fcd1 test: Add some more PNM type loading tests
Also avoid that .gz file contents depend on contained file's time stamp.
2022-01-19 19:38:32 +01:00
Kim Woelders 510938f097 PNM loader: Fix "XV thumbnail" (P7 332) loading
Not sure this has ever worked.
2022-01-19 19:10:23 +01:00
Kim Woelders f4e8e1414b PNM loader: Fix P1 when spaces are omitted 2022-01-18 20:44:26 +01:00
Kim Woelders 10f692c946 test: Add makefile to generate test images 2022-01-18 20:42:13 +01:00
Kim Woelders da2ce0d94b test: Move generated image files out of source dir
Simplifies cleaning up.
2022-01-18 20:40:59 +01:00
Kim Woelders 0d6211c501 Drop change log from before first version tag 2022-01-18 20:31:27 +01:00
Kim Woelders cd6c00b1ce Avoid redundant operations when non-existing file has no "key" 2022-01-17 13:08:58 +01:00
Kim Woelders 9afad50f97 Simplify __imlib_FileKey()
And avoid malloc when not needed.
2022-01-17 13:06:22 +01:00
Kim Woelders 64c031acab test: Check __imlib_FileKey() 2022-01-17 13:06:16 +01:00
Kim Woelders 8891246610 PNG loader: Add multiframe support 2022-01-16 20:53:58 +01:00
Kim Woelders 5dfccd5713 PNG loader: Rewrite to use callback API
Preparing for multiframe support.
2022-01-16 20:53:58 +01:00
Kim Woelders 83f55515fb PNG loader: Disable Imlib2-Comment stuff
Not useful, AFAICT.
2022-01-16 20:53:58 +01:00
Kim Woelders 1f883a721a Add dispose-to-previous frame handling
Dispose to previous appears to be used often by apng's.
2022-01-16 20:53:58 +01:00
Kim Woelders b26150d9f4 imlib2_load: Add no-data option
Also start using stdbool for boolean stuff.
2022-01-16 20:53:31 +01:00
Kim Woelders ffbd8bbca0 SVG loader: Avoid problems when loading the module more than once
It appears that the svg loader fails when dlopen'ed a second time,
presumably due to some issue in librsvg2:

thread '<unnamed>' panicked at 'Type RsvgHandle has already been registered', /builddir/build/BUILD/librsvg-2.52.4/vendor/glib/src/subclass/types.rs:751:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5

A second load of a loader will only happen if an application calls
imlib_flush_loaders(), which I don't see why regular applications would
need to do.
However, calling imlib_flush_loaders() shouldn't cause applications to
potentially fail (abort) anyway.

The failure can be avoided by dlopen'ing with RTLD_NODELETE, but that
would apply to all loaders, which doesn't seem right.
With the solution here the svg.so module is marked to be un-unloadable
which seems to solve the problem and doesn't affect other modules.
2022-01-08 16:08:38 +01:00
Kim Woelders a542fb6724 Add svg loader 2022-01-08 16:08:37 +01:00
Kim Woelders 04b8c35e17 XBM loader: Correct load2() result when no header is found
Also require that the header is found within the first 30 lines in the
file.
Otherwise we may waste some time parsing large C files.
2022-01-07 21:17:50 +01:00
Kim Woelders b123cb7674 configure.ac: Correct simplification changes some more 2022-01-07 21:11:26 +01:00
Kim Woelders c109324bbf configure.ac: Correct simplification changes 2022-01-04 09:36:03 +01:00
Kim Woelders 564334d708 LZMA loader: Fix potential warning 2022-01-04 09:36:03 +01:00
Sören Tempel 7d60151ba9 ICO loader: Fix compilation on big endian architectures
Commit ff79901a07 refactors the
ico_read_idir function and removed the local nr variable. Unfortunately,
this variable is still used within an `#ifdef WORDS_BIGENDIAN` block on
big endian architectures as a for loop index variable. As such, the code
does presently not compile since the aforementioned commit. This patch
fixes this issue by re-introducing the variable conditionally on big
endian architectures.

Note: It would likely be cleaner to declare the nr variable as part of
the loop declaration, however, this C99 feature does not seem to be used
anywhere in the code base, hence I refrained from using it here.
2022-01-03 17:29:06 +01:00
Kim Woelders 31d6d8532c imlib2_load: Verbosity twaeks 2022-01-02 12:59:24 +01:00
Kim Woelders 8f65acf7c2 imlib2_view: Verbosity twaeks 2022-01-02 12:51:24 +01:00
Kim Woelders 86e3b4fada imlib2_grab: Print error message if saving fails 2021-12-30 06:56:35 +01:00