summaryrefslogtreecommitdiff
path: root/test/pdf-tagged-text.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2016-10-07 07:38:37 +1030
committerAdrian Johnson <ajohnson@redneon.com>2016-10-07 07:38:37 +1030
commit4790a3663d12cfbbe643023713477204d61b1c4a (patch)
tree64e3fba94ca3ababb5d3998159926c23f71a1df9 /test/pdf-tagged-text.c
parent55f8c6d9f4161f5ee2a11fd068f0ccb25a5b3aed (diff)
downloadcairo-4790a3663d12cfbbe643023713477204d61b1c4a.tar.gz
strndup is not avuilable with MSVC
Diffstat (limited to 'test/pdf-tagged-text.c')
-rw-r--r--test/pdf-tagged-text.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/pdf-tagged-text.c b/test/pdf-tagged-text.c
index e8484f071..14dbad187 100644
--- a/test/pdf-tagged-text.c
+++ b/test/pdf-tagged-text.c
@@ -134,7 +134,11 @@ layout_paragraph (cairo_t *cr)
cairo_text_extents (cr, begin, &text_extents);
*end = ' ';
if (text_extents.width + 2*MARGIN > PAGE_WIDTH) {
- paragraph_text[paragraph_num_lines++] = strndup (begin, prev_end - begin);
+ int len = prev_end - begin;
+ char *s = malloc (len);
+ memcpy (s, begin, len);
+ s[0] = 0;
+ paragraph_text[paragraph_num_lines++] = s;
begin = prev_end + 1;
}
prev_end = end;