summaryrefslogtreecommitdiffstats
path: root/libraries/t4k_common/916060_bugfix.patch
diff options
context:
space:
mode:
author Matteo Bernardini2020-01-26 12:12:46 +0100
committer Matteo Bernardini2020-01-26 12:12:46 +0100
commit5c6dca884b084906c44487685b3076b1af9535e5 (patch)
tree539e39579797fc68f887f55276d1d3a18b2e2107 /libraries/t4k_common/916060_bugfix.patch
parent192ba2be163f6c90f8b56e4d4a59c6b7ef3b1b5c (diff)
downloadslackbuilds-5c6dca884b084906c44487685b3076b1af9535e5.tar.gz
20200126.1 global branch merge.current-20200126.1
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
Diffstat (limited to 'libraries/t4k_common/916060_bugfix.patch')
-rw-r--r--libraries/t4k_common/916060_bugfix.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/libraries/t4k_common/916060_bugfix.patch b/libraries/t4k_common/916060_bugfix.patch
new file mode 100644
index 0000000000..e8c8a499f7
--- /dev/null
+++ b/libraries/t4k_common/916060_bugfix.patch
@@ -0,0 +1,32 @@
+Description: fix loading each frame from SVG sprites
+ rsvg_handle_get_desc returns null so next sscanf segfaults. Use instead iterating
+ up from zero for id frame%d
+Author: cdonoghu@gmail.com
+Origin: other
+Forwarded: no
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/src/t4k_loaders.c
++++ b/src/t4k_loaders.c
+@@ -213,14 +213,13 @@
+ new_sprite = malloc(sizeof(sprite));
+ new_sprite->default_img = render_svg_from_handle(file_handle, width, height, "#default");
+
+- /* get number of frames from description */
+- sscanf(rsvg_handle_get_desc(file_handle), "%d", &new_sprite->num_frames);
+- DEBUGMSG(debug_loaders, "load_svg_sprite(): loading %d frames\n", new_sprite->num_frames);
+-
+- for(i = 0; i < new_sprite->num_frames; i++)
+- {
+- sprintf(lay_name, "#frame%d", i);
+- new_sprite->frame[i] = render_svg_from_handle(file_handle, width, height, lay_name);
++ /* get number of frames directly. End when #frame<num> doesn't exist */
++ new_sprite->num_frames = 0;
++ while(1) {
++ sprintf(lay_name, "#frame%d", new_sprite->num_frames);
++ if ( ! (rsvg_handle_has_sub(file_handle, lay_name)) ) break;
++ new_sprite->frame[new_sprite->num_frames] = render_svg_from_handle(file_handle, width, height, lay_name);
++ new_sprite->num_frames++;
+ }
+
+ g_object_unref(file_handle);