Since d8114e8 the file name is used for caching as-is without adding
.jpg at the end, but sxiv -c still expected old format causing it to
remove all fresh thumbnails.
Fixes issue #295
The imlib2 TGA loader returns an imlib image handle without any actual data
when given a text file like this:
T
Content-Type: application/javascript
Content-Length: 3836
Last-Modified: Wed, 23 Sep 2015 12:25:47 GMT
Etag: "56029a4b-efc"
Expires: Sat, 20 Aug 2016 15:14:33 GMT
Cache-Control: max-age=604800, public
Accept-Ranges: bytes
Fortunately, `imlib_image_get_data()` returns NULL in this case, so that we can
use it as an additional check when opening files.
- Functions warn() and die() replaced by GNU-like error(3) function
- Register cleanup() with atexit(3)
- Functions called by cleanup() are marked with CLEANUP and are not allowed to
call exit(3)
- Only load the thumbnails that are currently visible in the window
- Unload thumbnails that are leaving the visible area
- Much less memory needed, but scrolling is now slower
- This also unintentionally fixes issue #86
The function "free" performs input parameter validation.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html
It is therefore not needed to check a passed pointer before this function call.
A corresponding update suggestion was generated by the software "Coccinelle"
from the following semantic patch approach.
http://coccinelle.lip6.fr/
@Remove_unnecessary_pointer_checks1@
expression x;
@@
-if (x != \(0 \| NULL\))
free(x);
@Remove_unnecessary_pointer_checks2@
expression x;
@@
-if (x != \(0 \| NULL\)) {
free(x);
x = \(0 \| NULL\);
-}
@Remove_unnecessary_pointer_checks3@
expression a, b;
@@
-if (a != \(0 \| NULL\) && b != \(0 \| NULL\))
+if (a)
free(b);
@Remove_unnecessary_pointer_checks4@
expression a, b;
@@
-if (a != \(0 \| NULL\) && b != \(0 \| NULL\)) {
+if (a) {
free(b);
b = \(0 \| NULL\);
}
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
- Buffer for window content is bigger than the window, minimizes artifacts
when window is resized
- Back to using XSetWindowBackgroundPixmap() instead of XCopyArea(),
no need to handle exposure events; X server can show gray background directly
after resize event before sxiv redraws the window contents