]> gitweb.michael.orlitzky.com - libsvgtiny.git/blobdiff - src/svgtiny_internal.h
prevent division by zero for gradient with no points and add test
[libsvgtiny.git] / src / svgtiny_internal.h
index 789651ac9c43426c11a4f800d495877e8d7d2177..542a0d0cd565cbdbbb0714d19c278f71d75e4ed7 100644 (file)
@@ -45,27 +45,33 @@ struct svgtiny_parse_state {
 
        /* gradients */
        unsigned int linear_gradient_stop_count;
-       const char *gradient_x1, *gradient_y1, *gradient_x2, *gradient_y2;
+       dom_string *gradient_x1, *gradient_y1, *gradient_x2, *gradient_y2;
        struct svgtiny_gradient_stop gradient_stop[svgtiny_MAX_STOPS];
        bool gradient_user_space_on_use;
        struct {
                float a, b, c, d, e, f;
        } gradient_transform;
+
+       /* Interned strings */
+#define SVGTINY_STRING_ACTION2(n,nn) dom_string *interned_##n;
+#include "svgtiny_strings.h"
+#undef SVGTINY_STRING_ACTION2
+
 };
 
 struct svgtiny_list;
 
 /* svgtiny.c */
-float svgtiny_parse_length(const char *s, int viewport_size,
+float svgtiny_parse_length(dom_string *s, int viewport_size,
                const struct svgtiny_parse_state state);
-void svgtiny_parse_color(const char *s, svgtiny_colour *c,
+void svgtiny_parse_color(dom_string *s, svgtiny_colour *c,
                struct svgtiny_parse_state *state);
 void svgtiny_parse_transform(char *s, float *ma, float *mb,
                float *mc, float *md, float *me, float *mf);
 struct svgtiny_shape *svgtiny_add_shape(struct svgtiny_parse_state *state);
 void svgtiny_transform_path(float *p, unsigned int n,
                struct svgtiny_parse_state *state);
-#if defined(_GNU_SOURCE)
+#if (defined(_GNU_SOURCE) && !defined(__APPLE__) || defined(__amigaos4__) || defined(__HAIKU__) || (defined(_POSIX_C_SOURCE) && ((_POSIX_C_SOURCE - 0) >= 200809L)))
 #define HAVE_STRNDUP
 #else
 #undef HAVE_STRNDUP
@@ -77,7 +83,6 @@ char *svgtiny_strndup(const char *s, size_t n);
 void svgtiny_find_gradient(const char *id, struct svgtiny_parse_state *state);
 svgtiny_code svgtiny_add_path_linear_gradient(float *p, unsigned int n,
                struct svgtiny_parse_state *state);
-dom_node *svgtiny_find_element_by_id(dom_node *node, const char *id);
 
 /* svgtiny_list.c */
 struct svgtiny_list *svgtiny_list_create(size_t item_size);