if (view_box) {
char *s = strndup(dom_string_data(view_box),
- dom_string_length(view_box));
+ dom_string_byte_length(view_box));
float min_x, min_y, vwidth, vheight;
if (sscanf(s, "%f,%f,%f,%f",
&min_x, &min_y, &vwidth, &vheight) == 4 ||
}
s = path_d = strndup(dom_string_data(path_d_str),
- dom_string_length(path_d_str));
+ dom_string_byte_length(path_d_str));
dom_string_unref(path_d_str);
if (s == NULL) {
return svgtiny_OUT_OF_MEMORY;
}
s = points = strndup(dom_string_data(points_str),
- dom_string_length(points_str));
+ dom_string_byte_length(points_str));
dom_string_unref(points_str);
/* read points attribute */
if (s == NULL)
return svgtiny_LIBDOM_ERROR;
}
shape->text = strndup(dom_string_data(content),
- dom_string_length(content));
+ dom_string_byte_length(content));
dom_string_unref(content);
shape->text_x = px;
shape->text_y = py;
float svgtiny_parse_length(dom_string *s, int viewport_size,
const struct svgtiny_parse_state state)
{
- char *ss = strndup(dom_string_data(s), dom_string_length(s));
+ char *ss = strndup(dom_string_data(s), dom_string_byte_length(s));
float ret = _svgtiny_parse_length(ss, viewport_size, state);
free(ss);
return ret;
exc = dom_element_get_attribute(node, state->interned_style, &attr);
if (exc == DOM_NO_ERR && attr != NULL) {
char *style = strndup(dom_string_data(attr),
- dom_string_length(attr));
+ dom_string_byte_length(attr));
const char *s;
char *value;
if ((s = strstr(style, "fill:"))) {
void svgtiny_parse_color(dom_string *s, svgtiny_colour *c,
struct svgtiny_parse_state *state)
{
- char *ss = strndup(dom_string_data(s), dom_string_length(s));
+ char *ss = strndup(dom_string_data(s), dom_string_byte_length(s));
_svgtiny_parse_color(ss, c, state);
free(ss);
}
&attr);
if (exc == DOM_NO_ERR && attr != NULL) {
transform = strndup(dom_string_data(attr),
- dom_string_length(attr));
+ dom_string_byte_length(attr));
svgtiny_parse_transform(transform, &state->ctm.a, &state->ctm.b,
&state->ctm.c, &state->ctm.d,
&state->ctm.e, &state->ctm.f);
if (exc == DOM_NO_ERR && attr != NULL) {
if (dom_string_data(attr)[0] == (uint8_t) '#') {
char *s = strndup(dom_string_data(attr) + 1,
- dom_string_length(attr) - 1);
+ dom_string_byte_length(attr) - 1);
svgtiny_find_gradient(s, state);
free(s);
}
if (exc == DOM_NO_ERR && attr != NULL) {
float a = 1, b = 0, c = 0, d = 1, e = 0, f = 0;
char *s = strndup(dom_string_data(attr),
- dom_string_length(attr));
+ dom_string_byte_length(attr));
if (s == NULL) {
dom_string_unref(attr);
return svgtiny_OUT_OF_MEMORY;
&attr);
if (exc == DOM_NO_ERR && attr != NULL) {
char *s = strndup(dom_string_data(attr),
- dom_string_length(attr));
+ dom_string_byte_length(attr));
offset = svgtiny_parse_gradient_offset(s);
free(s);
dom_string_unref(attr);
&attr);
if (exc == DOM_NO_ERR && attr != NULL) {
char *content = strndup(dom_string_data(attr),
- dom_string_length(attr));
+ dom_string_byte_length(attr));
const char *s;
dom_string *value;
if ((s = strstr(content, "stop-color:"))) {
object_x0, object_y0, object_x1, object_y1);
#endif
- /* compute gradient vector */
- fprintf(stderr, "x1 %*s, y1 %*s, x2 %*s, y2 %*s\n",
- dom_string_length(state->gradient_x1),
- dom_string_data(state->gradient_x1),
- dom_string_length(state->gradient_y1),
- dom_string_data(state->gradient_y1),
- dom_string_length(state->gradient_x2),
- dom_string_data(state->gradient_x2),
- dom_string_length(state->gradient_y2),
- dom_string_data(state->gradient_y2));
-
if (!state->gradient_user_space_on_use) {
gradient_x0 = object_x0 +
svgtiny_parse_length(state->gradient_x1,