summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile2
-rw-r--r--src/svgtiny.c5
-rw-r--r--src/svgtiny_gradient.c9
-rwxr-xr-xtest/runtest.sh5
5 files changed, 16 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index 015f2f7..a7aa1c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
build-*
*~
+src/autogenerated_colors.c
diff --git a/Makefile b/Makefile
index fa01e2e..6511191 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@
# Component settings
COMPONENT := svgtiny
-COMPONENT_VERSION := 0.1.5
+COMPONENT_VERSION := 0.1.7
# Default to a static library
COMPONENT_TYPE ?= lib-static
diff --git a/src/svgtiny.c b/src/svgtiny.c
index bbefb88..8831b92 100644
--- a/src/svgtiny.c
+++ b/src/svgtiny.c
@@ -457,6 +457,7 @@ svgtiny_code svgtiny_parse_path(dom_element *path,
/* empty path is permitted it just disables the path */
palloc = dom_string_byte_length(path_d_str);
if (palloc == 0) {
+ dom_string_unref(path_d_str);
svgtiny_cleanup_state_local(&state);
return svgtiny_OK;
}
@@ -577,7 +578,7 @@ svgtiny_code svgtiny_parse_path(dom_element *path,
p[i++] = last_cubic_y = last_quad_y = last_y
= y;
s += n;
- } while (sscanf(s, "%f %n", &x, &n) == 1);
+ } while (sscanf(s, "%f %n", &y, &n) == 1);
/* curveto (C, c) (6 arguments) */
} else if (sscanf(s, " %1[Cc] %f %f %f %f %f %f %n", command,
@@ -708,7 +709,7 @@ svgtiny_code svgtiny_parse_path(dom_element *path,
&x, &y, &n) == 7);
} else {
- fprintf(stderr, "parse failed at \"%s\"\n", s);
+ /* fprintf(stderr, "parse failed at \"%s\"\n", s); */
break;
}
}
diff --git a/src/svgtiny_gradient.c b/src/svgtiny_gradient.c
index b282f45..4b327dd 100644
--- a/src/svgtiny_gradient.c
+++ b/src/svgtiny_gradient.c
@@ -237,7 +237,7 @@ svgtiny_code svgtiny_parse_linear_gradient(dom_element *linear,
(const uint8_t *) s,
strcspn(s, "; "),
&value);
- if (exc != DOM_NO_ERR &&
+ if (exc == DOM_NO_ERR &&
value != NULL) {
svgtiny_parse_color(value,
&color,
@@ -420,8 +420,10 @@ svgtiny_code svgtiny_add_path_linear_gradient(float *p, unsigned int n,
gradient_norm_squared = gradient_dx * gradient_dx +
gradient_dy * gradient_dy;
pts = svgtiny_list_create(sizeof (struct grad_point));
- if (!pts)
+ if (!pts) {
+ free(p);
return svgtiny_OUT_OF_MEMORY;
+ }
for (j = 0; j != n; ) {
int segment_type = (int) p[j];
struct grad_point *point;
@@ -446,6 +448,7 @@ svgtiny_code svgtiny_add_path_linear_gradient(float *p, unsigned int n,
gradient_norm_squared;
point = svgtiny_list_push(pts);
if (!point) {
+ free(p);
svgtiny_list_free(pts);
return svgtiny_OUT_OF_MEMORY;
}
@@ -524,6 +527,7 @@ svgtiny_code svgtiny_add_path_linear_gradient(float *p, unsigned int n,
#endif
point = svgtiny_list_push(pts);
if (!point) {
+ free(p);
svgtiny_list_free(pts);
return svgtiny_OUT_OF_MEMORY;
}
@@ -551,6 +555,7 @@ svgtiny_code svgtiny_add_path_linear_gradient(float *p, unsigned int n,
/* There must be at least a single point for the gradient */
if (svgtiny_list_size(pts) == 0) {
svgtiny_list_free(pts);
+ free(p);
return svgtiny_OK;
}
diff --git a/test/runtest.sh b/test/runtest.sh
index 243729d..708f84a 100755
--- a/test/runtest.sh
+++ b/test/runtest.sh
@@ -73,8 +73,11 @@ done
echo "Tests:${SVGTESTTOTC} Pass:${SVGTESTPASSC} Fail:${SVGTESTFAILC} Error:${SVGTESTERRC}"
# exit code
-if [ "${SVGTESTERRC}" -gt 0 ]; then
+if [ "${SVGTESTFAILC}" -gt 0 ]; then
exit 1
fi
+if [ "${SVGTESTERRC}" -gt 0 ]; then
+ exit 2
+fi
exit 0