potracer 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/potracer/potracer.c +5 -1
- metadata +1 -1
data/ext/potracer/potracer.c
CHANGED
@@ -169,6 +169,7 @@ trace_as_svg (VALUE klass)
|
|
169
169
|
FILE *out = tmpfile();
|
170
170
|
char *out_buffer;
|
171
171
|
long size;
|
172
|
+
VALUE svg;
|
172
173
|
potrace_path_t *path;
|
173
174
|
int i, num_segments, *tag;
|
174
175
|
potrace_dpoint_t (*c)[3];
|
@@ -205,7 +206,9 @@ trace_as_svg (VALUE klass)
|
|
205
206
|
rewind(out);
|
206
207
|
fread(out_buffer, 1, size, out);
|
207
208
|
fclose(out);
|
208
|
-
|
209
|
+
svg = rb_str_new(out_buffer, size);
|
210
|
+
xfree(out_buffer);
|
211
|
+
return svg;
|
209
212
|
}
|
210
213
|
|
211
214
|
static VALUE
|
@@ -283,6 +286,7 @@ bitmap_new (int argc, VALUE *argv, VALUE klass)
|
|
283
286
|
bm->h = (argc > 1) ? NUM2INT(argv[1]) : BM_HEIGHT;
|
284
287
|
bm->dy = (bm->w + BM_WORDBITS - 1) / BM_WORDBITS;
|
285
288
|
bm->map = ALLOC_N(potrace_word, bm->dy * bm->h * BM_WORDSIZE);
|
289
|
+
memset(bm->map, 0, bm->dy * bm->h * BM_WORDSIZE);
|
286
290
|
|
287
291
|
if (argc > 2) {
|
288
292
|
if (T_STRING == TYPE(argv[2])) {
|