diff options
Diffstat (limited to 'pdf')
-rw-r--r-- | pdf/pdf_annot.c | 14 | ||||
-rw-r--r-- | pdf/pdf_colorspace.c | 12 | ||||
-rw-r--r-- | pdf/pdf_font.c | 24 | ||||
-rw-r--r-- | pdf/pdf_form.c | 4 | ||||
-rw-r--r-- | pdf/pdf_function.c | 22 | ||||
-rw-r--r-- | pdf/pdf_interpret.c | 28 | ||||
-rw-r--r-- | pdf/pdf_nametree.c | 6 | ||||
-rw-r--r-- | pdf/pdf_object.c | 5 | ||||
-rw-r--r-- | pdf/pdf_page.c | 19 | ||||
-rw-r--r-- | pdf/pdf_parse.c | 8 | ||||
-rw-r--r-- | pdf/pdf_repair.c | 2 | ||||
-rw-r--r-- | pdf/pdf_shade.c | 4 | ||||
-rw-r--r-- | pdf/pdf_write.c | 38 | ||||
-rw-r--r-- | pdf/pdf_xref.c | 2 | ||||
-rw-r--r-- | pdf/pdf_xref_aux.c | 2 |
15 files changed, 123 insertions, 67 deletions
diff --git a/pdf/pdf_annot.c b/pdf/pdf_annot.c index 5109ae45..02f91e33 100644 --- a/pdf/pdf_annot.c +++ b/pdf/pdf_annot.c @@ -415,16 +415,12 @@ pdf_load_annots(pdf_document *xref, pdf_obj *annots, fz_matrix page_ctm) annot->next = NULL; - - if (annot) + if (!head) + head = tail = annot; + else { - if (!head) - head = tail = annot; - else - { - tail->next = annot; - tail = annot; - } + tail->next = annot; + tail = annot; } } } diff --git a/pdf/pdf_colorspace.c b/pdf/pdf_colorspace.c index ee5bc5fc..13323ce3 100644 --- a/pdf/pdf_colorspace.c +++ b/pdf/pdf_colorspace.c @@ -47,9 +47,9 @@ lab_to_rgb(fz_context *ctx, fz_colorspace *cs, float *lab, float *rgb) r = (3.240449f * x + -1.537136f * y + -0.498531f * z) * 0.830026f; g = (-0.969265f * x + 1.876011f * y + 0.041556f * z) * 1.05452f; b = (0.055643f * x + -0.204026f * y + 1.057229f * z) * 1.1003f; - rgb[0] = sqrtf(CLAMP(r, 0, 1)); - rgb[1] = sqrtf(CLAMP(g, 0, 1)); - rgb[2] = sqrtf(CLAMP(b, 0, 1)); + rgb[0] = sqrtf(fz_clamp(r, 0, 1)); + rgb[1] = sqrtf(fz_clamp(g, 0, 1)); + rgb[2] = sqrtf(fz_clamp(b, 0, 1)); } static void @@ -160,7 +160,7 @@ indexed_to_rgb(fz_context *ctx, fz_colorspace *cs, float *color, float *rgb) float alt[FZ_MAX_COLORS]; int i, k; i = color[0] * 255; - i = CLAMP(i, 0, idx->high); + i = fz_clampi(i, 0, idx->high); for (k = 0; k < idx->base->n; k++) alt[k] = idx->lookup[i * idx->base->n + k] / 255.0f; idx->base->to_rgb(ctx, idx->base, alt, rgb); @@ -203,7 +203,7 @@ pdf_expand_indexed_pixmap(fz_context *ctx, fz_pixmap *src) { int v = *s++; int a = *s++; - v = MIN(v, high); + v = fz_mini(v, high); for (k = 0; k < n; k++) *d++ = fz_mul255(lookup[v * n + k], a); *d++ = a; @@ -240,7 +240,7 @@ load_indexed(pdf_document *xref, pdf_obj *array) idx->lookup = NULL; idx->base = base; idx->high = pdf_to_int(highobj); - idx->high = CLAMP(idx->high, 0, 255); + idx->high = fz_clampi(idx->high, 0, 255); n = base->n * (idx->high + 1); idx->lookup = fz_malloc_array(ctx, 1, n); diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c index 3c1a3205..f8fb643c 100644 --- a/pdf/pdf_font.c +++ b/pdf/pdf_font.c @@ -175,9 +175,19 @@ static int lookup_mre_code(char *name) static void pdf_load_builtin_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname) { + char buf[256], *comma = NULL; unsigned char *data; unsigned int len; + if (strchr(fontname, ',')) + { + fz_strlcpy(buf, fontname, sizeof buf); + comma = strchr(buf, ','); + if (comma) + *comma++ = 0; + fontname = buf; + } + data = pdf_lookup_builtin_font(fontname, &len); if (!data) fz_throw(ctx, "cannot find builtin font: '%s'", fontname); @@ -187,6 +197,14 @@ pdf_load_builtin_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname) if (!strcmp(fontname, "Symbol") || !strcmp(fontname, "ZapfDingbats")) fontdesc->flags |= PDF_FD_SYMBOLIC; + + if (comma) + { + if (strstr(comma, "Italic")) + fontdesc->font->ft_italic = 1; + if (strstr(comma, "Bold")) + fontdesc->font->ft_bold = 1; + } } static void @@ -742,7 +760,7 @@ load_cid_font(pdf_document *xref, pdf_obj *dict, pdf_obj *encoding, pdf_obj *to_ fz_throw(ctx, "cid font is missing info"); obj = pdf_dict_gets(cidinfo, "Registry"); - tmplen = MIN(sizeof tmpstr - 1, pdf_to_str_len(obj)); + tmplen = fz_mini(sizeof tmpstr - 1, pdf_to_str_len(obj)); memcpy(tmpstr, pdf_to_str_buf(obj), tmplen); tmpstr[tmplen] = '\0'; fz_strlcpy(collection, tmpstr, sizeof collection); @@ -750,7 +768,7 @@ load_cid_font(pdf_document *xref, pdf_obj *dict, pdf_obj *encoding, pdf_obj *to_ fz_strlcat(collection, "-", sizeof collection); obj = pdf_dict_gets(cidinfo, "Ordering"); - tmplen = MIN(sizeof tmpstr - 1, pdf_to_str_len(obj)); + tmplen = fz_mini(sizeof tmpstr - 1, pdf_to_str_len(obj)); memcpy(tmpstr, pdf_to_str_buf(obj), tmplen); tmpstr[tmplen] = '\0'; fz_strlcat(collection, tmpstr, sizeof collection); @@ -1206,4 +1224,4 @@ float pdf_text_stride(fz_context *ctx, pdf_font_desc *fontdesc, float fontsize, *count = i; return x; -}
\ No newline at end of file +} diff --git a/pdf/pdf_form.c b/pdf/pdf_form.c index 3a9c7a46..dbc3a326 100644 --- a/pdf/pdf_form.c +++ b/pdf/pdf_form.c @@ -632,7 +632,7 @@ static int text_splitter_layout(fz_context *ctx, text_splitter *splitter) vstretchwidth = splitter->width * (splitter->max_lines + 1) * splitter->fontsize / splitter->height; - bestwidth = MIN(fitwidth, MIN(hstretchwidth, vstretchwidth)); + bestwidth = fz_min(fitwidth, fz_min(hstretchwidth, vstretchwidth)); if (bestwidth == vstretchwidth) splitter->max_lines ++; @@ -827,7 +827,7 @@ static fz_buffer *create_text_appearance(pdf_document *doc, fz_rect *bbox, fz_ma } else if (info->comb) { - int i, n = MIN((int)strlen(text), info->max_len); + int i, n = fz_mini((int)strlen(text), info->max_len); float comb_width = full_width/info->max_len; float char_width = pdf_text_stride(ctx, info->font_rec.font, fontsize, (unsigned char *)"M", 1, FLT_MAX, NULL); float init_skip = (comb_width - char_width)/2.0; diff --git a/pdf/pdf_function.c b/pdf/pdf_function.c index 9a3bf1c2..7c123476 100644 --- a/pdf/pdf_function.c +++ b/pdf/pdf_function.c @@ -209,7 +209,7 @@ ps_push_real(ps_stack *st, float n) * cause a divide by 0. Same reason as in fz_atof. */ n = 1.0; } - st->stack[st->sp].u.f = CLAMP(n, -FLT_MAX, FLT_MAX); + st->stack[st->sp].u.f = fz_clamp(n, -FLT_MAX, FLT_MAX); st->sp++; } } @@ -897,7 +897,7 @@ eval_postscript_func(fz_context *ctx, pdf_function *func, float *in, float *out) for (i = 0; i < func->m; i++) { - x = CLAMP(in[i], func->domain[i][0], func->domain[i][1]); + x = fz_clamp(in[i], func->domain[i][0], func->domain[i][1]); ps_push_real(&st, x); } @@ -906,7 +906,7 @@ eval_postscript_func(fz_context *ctx, pdf_function *func, float *in, float *out) for (i = func->n - 1; i >= 0; i--) { x = ps_pop_real(&st); - out[i] = CLAMP(x, func->range[i][0], func->range[i][1]); + out[i] = fz_clamp(x, func->range[i][0], func->range[i][1]); } } @@ -1068,10 +1068,10 @@ eval_sample_func(fz_context *ctx, pdf_function *func, float *in, float *out) /* encode input coordinates */ for (i = 0; i < func->m; i++) { - x = CLAMP(in[i], func->domain[i][0], func->domain[i][1]); + x = fz_clamp(in[i], func->domain[i][0], func->domain[i][1]); x = lerp(x, func->domain[i][0], func->domain[i][1], func->u.sa.encode[i][0], func->u.sa.encode[i][1]); - x = CLAMP(x, 0, func->u.sa.size[i] - 1); + x = fz_clamp(x, 0, func->u.sa.size[i] - 1); e0[i] = floorf(x); e1[i] = ceilf(x); efrac[i] = x - floorf(x); @@ -1091,7 +1091,7 @@ eval_sample_func(fz_context *ctx, pdf_function *func, float *in, float *out) float ab = a + (b - a) * efrac[0]; out[i] = lerp(ab, 0, 1, func->u.sa.decode[i][0], func->u.sa.decode[i][1]); - out[i] = CLAMP(out[i], func->range[i][0], func->range[i][1]); + out[i] = fz_clamp(out[i], func->range[i][0], func->range[i][1]); } else if (func->m == 2) @@ -1109,14 +1109,14 @@ eval_sample_func(fz_context *ctx, pdf_function *func, float *in, float *out) float abcd = ab + (cd - ab) * efrac[1]; out[i] = lerp(abcd, 0, 1, func->u.sa.decode[i][0], func->u.sa.decode[i][1]); - out[i] = CLAMP(out[i], func->range[i][0], func->range[i][1]); + out[i] = fz_clamp(out[i], func->range[i][0], func->range[i][1]); } else { float x = interpolate_sample(func, scale, e0, e1, efrac, func->m - 1, i); out[i] = lerp(x, 0, 1, func->u.sa.decode[i][0], func->u.sa.decode[i][1]); - out[i] = CLAMP(out[i], func->range[i][0], func->range[i][1]); + out[i] = fz_clamp(out[i], func->range[i][0], func->range[i][1]); } } } @@ -1177,7 +1177,7 @@ eval_exponential_func(fz_context *ctx, pdf_function *func, float in, float *out) float tmp; int i; - x = CLAMP(x, func->domain[0][0], func->domain[0][1]); + x = fz_clamp(x, func->domain[0][0], func->domain[0][1]); /* constraint */ if ((func->u.e.n != (int)func->u.e.n && x < 0) || (func->u.e.n < 0 && x == 0)) @@ -1191,7 +1191,7 @@ eval_exponential_func(fz_context *ctx, pdf_function *func, float in, float *out) { out[i] = func->u.e.c0[i] + tmp * (func->u.e.c1[i] - func->u.e.c0[i]); if (func->has_range) - out[i] = CLAMP(out[i], func->range[i][0], func->range[i][1]); + out[i] = fz_clamp(out[i], func->range[i][0], func->range[i][1]); } } @@ -1287,7 +1287,7 @@ eval_stitching_func(fz_context *ctx, pdf_function *func, float in, float *out) float *bounds = func->u.st.bounds; int i; - in = CLAMP(in, func->domain[0][0], func->domain[0][1]); + in = fz_clamp(in, func->domain[0][0], func->domain[0][1]); for (i = 0; i < k - 1; i++) { diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c index a2fdacb9..ab55ee66 100644 --- a/pdf/pdf_interpret.c +++ b/pdf/pdf_interpret.c @@ -556,10 +556,10 @@ pdf_flush_text(pdf_csi *csi) { pdf_gstate *gstate = csi->gstate + csi->gtop; fz_text *text; - int dofill = 0; - int dostroke = 0; - int doclip = 0; - int doinvisible = 0; + int dofill; + int dostroke; + int doclip; + int doinvisible; fz_context *ctx = csi->dev->ctx; if (!csi->text) @@ -590,14 +590,6 @@ pdf_flush_text(pdf_csi *csi) if (doinvisible) fz_ignore_text(csi->dev, text, gstate->ctm); - if (doclip) - { - if (csi->accumulate < 2) - gstate->clip_depth++; - fz_clip_text(csi->dev, text, gstate->ctm, csi->accumulate); - csi->accumulate = 2; - } - if (dofill) { switch (gstate->fill.kind) @@ -656,6 +648,14 @@ pdf_flush_text(pdf_csi *csi) } } + if (doclip) + { + if (csi->accumulate < 2) + gstate->clip_depth++; + fz_clip_text(csi->dev, text, gstate->ctm, csi->accumulate); + csi->accumulate = 2; + } + pdf_end_group(csi); } fz_catch(ctx) @@ -1521,10 +1521,10 @@ pdf_run_extgstate(pdf_csi *csi, pdf_obj *rdb, pdf_obj *extgstate) } else if (!strcmp(s, "CA")) - gstate->stroke.alpha = pdf_to_real(val); + gstate->stroke.alpha = fz_clamp(pdf_to_real(val), 0, 1); else if (!strcmp(s, "ca")) - gstate->fill.alpha = pdf_to_real(val); + gstate->fill.alpha = fz_clamp(pdf_to_real(val), 0, 1); else if (!strcmp(s, "BM")) { diff --git a/pdf/pdf_nametree.c b/pdf/pdf_nametree.c index 73755e22..7d8ac319 100644 --- a/pdf/pdf_nametree.c +++ b/pdf/pdf_nametree.c @@ -120,14 +120,16 @@ pdf_load_name_tree_imp(pdf_obj *dict, pdf_document *xref, pdf_obj *node) if (kids && !pdf_dict_mark(node)) { - for (i = 0; i < pdf_array_len(kids); i++) + int len = pdf_array_len(kids); + for (i = 0; i < len; i++) pdf_load_name_tree_imp(dict, xref, pdf_array_get(kids, i)); pdf_dict_unmark(node); } if (names) { - for (i = 0; i + 1 < pdf_array_len(names); i += 2) + int len = pdf_array_len(names); + for (i = 0; i + 1 < len; i += 2) { pdf_obj *key = pdf_array_get(names, i); pdf_obj *val = pdf_array_get(names, i + 1); diff --git a/pdf/pdf_object.c b/pdf/pdf_object.c index 2f96f213..531eb8eb 100644 --- a/pdf/pdf_object.c +++ b/pdf/pdf_object.c @@ -558,9 +558,10 @@ pdf_array_insert(pdf_obj *obj, pdf_obj *item) int pdf_array_contains(pdf_obj *arr, pdf_obj *obj) { - int i; + int i, len; - for (i = 0; i < pdf_array_len(arr); i++) + len = pdf_array_len(arr); + for (i = 0; i < len; i++) if (!pdf_objcmp(pdf_array_get(arr, i), obj)) return 1; diff --git a/pdf/pdf_page.c b/pdf/pdf_page.c index d348ad40..8715590c 100644 --- a/pdf/pdf_page.c +++ b/pdf/pdf_page.c @@ -290,6 +290,7 @@ pdf_load_page(pdf_document *xref, int number) pdf_obj *pageobj, *pageref, *obj; fz_rect mediabox, cropbox, realbox; fz_matrix ctm; + float userunit; pdf_load_page_tree(xref); if (number < 0 || number >= xref->page_len) @@ -305,6 +306,12 @@ pdf_load_page(pdf_document *xref, int number) page->links = NULL; page->annots = NULL; + obj = pdf_dict_gets(pageobj, "UserUnit"); + if (pdf_is_real(obj)) + userunit = pdf_to_real(obj); + else + userunit = 1; + mediabox = pdf_to_rect(ctx, pdf_dict_gets(pageobj, "MediaBox")); if (fz_is_empty_rect(mediabox)) { @@ -319,10 +326,10 @@ pdf_load_page(pdf_document *xref, int number) if (!fz_is_empty_rect(cropbox)) mediabox = fz_intersect_rect(mediabox, cropbox); - page->mediabox.x0 = MIN(mediabox.x0, mediabox.x1); - page->mediabox.y0 = MIN(mediabox.y0, mediabox.y1); - page->mediabox.x1 = MAX(mediabox.x0, mediabox.x1); - page->mediabox.y1 = MAX(mediabox.y0, mediabox.y1); + page->mediabox.x0 = fz_min(mediabox.x0, mediabox.x1) * userunit; + page->mediabox.y0 = fz_min(mediabox.y0, mediabox.y1) * userunit; + page->mediabox.x1 = fz_max(mediabox.x0, mediabox.x1) * userunit; + page->mediabox.y1 = fz_max(mediabox.y0, mediabox.y1) * userunit; if (page->mediabox.x1 - page->mediabox.x0 < 1 || page->mediabox.y1 - page->mediabox.y0 < 1) { @@ -342,7 +349,9 @@ pdf_load_page(pdf_document *xref, int number) ctm = fz_concat(fz_rotate(-page->rotate), fz_scale(1, -1)); realbox = fz_transform_rect(ctm, page->mediabox); - page->ctm = fz_concat(ctm, fz_translate(-realbox.x0, -realbox.y0)); + ctm = fz_concat(ctm, fz_scale(userunit, userunit)); + ctm = fz_concat(ctm, fz_translate(-realbox.x0, -realbox.y0)); + page->ctm = ctm; obj = pdf_dict_gets(pageobj, "Annots"); if (obj) diff --git a/pdf/pdf_parse.c b/pdf/pdf_parse.c index 5018844c..0ba6b0a4 100644 --- a/pdf/pdf_parse.c +++ b/pdf/pdf_parse.c @@ -9,10 +9,10 @@ pdf_to_rect(fz_context *ctx, pdf_obj *array) float b = pdf_to_real(pdf_array_get(array, 1)); float c = pdf_to_real(pdf_array_get(array, 2)); float d = pdf_to_real(pdf_array_get(array, 3)); - r.x0 = MIN(a, c); - r.y0 = MIN(b, d); - r.x1 = MAX(a, c); - r.y1 = MAX(b, d); + r.x0 = fz_min(a, c); + r.y0 = fz_min(b, d); + r.x1 = fz_max(a, c); + r.y1 = fz_max(b, d); return r; } diff --git a/pdf/pdf_repair.c b/pdf/pdf_repair.c index 85709219..0874c2f8 100644 --- a/pdf/pdf_repair.c +++ b/pdf/pdf_repair.c @@ -237,7 +237,7 @@ pdf_repair_xref(pdf_document *xref, pdf_lexbuf *buf) list = fz_malloc_array(ctx, listcap, sizeof(struct entry)); /* look for '%PDF' version marker within first kilobyte of file */ - n = fz_read(xref->file, (unsigned char *)buf->scratch, MIN(buf->size, 1024)); + n = fz_read(xref->file, (unsigned char *)buf->scratch, fz_mini(buf->size, 1024)); if (n < 0) fz_throw(ctx, "cannot read from file"); diff --git a/pdf/pdf_shade.c b/pdf/pdf_shade.c index 0847f4d2..2d9e74b8 100644 --- a/pdf/pdf_shade.c +++ b/pdf/pdf_shade.c @@ -177,14 +177,14 @@ draw_stripe(fz_context *ctx, pdf_tensor_patch *p, fz_shade *shade, int depth) if (depth == 0) { /* if no more subdividing, draw two new patches... */ - triangulate_patch(ctx, s0, shade); triangulate_patch(ctx, s1, shade); + triangulate_patch(ctx, s0, shade); } else { /* ...otherwise, continue subdividing. */ - draw_stripe(ctx, &s0, shade, depth); draw_stripe(ctx, &s1, shade, depth); + draw_stripe(ctx, &s0, shade, depth); } } diff --git a/pdf/pdf_write.c b/pdf/pdf_write.c index 8d32febe..3527961f 100644 --- a/pdf/pdf_write.c +++ b/pdf/pdf_write.c @@ -151,7 +151,6 @@ static void page_objects_insert(fz_context *ctx, page_objects **ppo, int i) { page_objects *po; - int j; /* Make a page_objects if we don't have one */ if (*ppo == NULL) @@ -165,7 +164,6 @@ page_objects_insert(fz_context *ctx, page_objects **ppo, int i) po->cap *= 2; *ppo = po; } - j = po->len; po->object[po->len++] = i; } @@ -585,11 +583,11 @@ static void removeduplicateobjs(pdf_document *xref, pdf_write_options *opts) continue; /* Keep the lowest numbered object */ - newnum = MIN(num, other); + newnum = fz_mini(num, other); opts->renumber_map[num] = newnum; opts->renumber_map[other] = newnum; opts->rev_renumber_map[newnum] = num; /* Either will do */ - opts->use_list[MAX(num, other)] = 0; + opts->use_list[fz_maxi(num, other)] = 0; /* One duplicate was found, do not look for another */ break; @@ -1516,6 +1514,34 @@ static void expandstream(pdf_document *xref, pdf_write_options *opts, pdf_obj *o pdf_drop_obj(obj); } +static int is_image_filter(char *s) +{ + if ( !strcmp(s, "CCITTFaxDecode") || !strcmp(s, "CCF") || + !strcmp(s, "DCTDecode") || !strcmp(s, "DCT") || + !strcmp(s, "RunLengthDecode") || !strcmp(s, "RL") || + !strcmp(s, "JBIG2Decode") || + !strcmp(s, "JPXDecode")) + return 1; + return 0; +} + +static int filter_implies_image(pdf_document *xref, pdf_obj *o) +{ + if (!o) + return 0; + if (pdf_is_name(o)) + return is_image_filter(pdf_to_name(o)); + if (pdf_is_array(o)) + { + int i, len; + len = pdf_array_len(o); + for (i = 0; i < len; i++) + if (is_image_filter(pdf_to_name(pdf_array_get(o, i)))) + return 1; + } + return 0; +} + static void writeobject(pdf_document *xref, pdf_write_options *opts, int num, int gen) { pdf_obj *obj; @@ -1578,6 +1604,10 @@ static void writeobject(pdf_document *xref, pdf_write_options *opts, int num, in dontexpand = !(opts->do_expand & fz_expand_fonts); if (o = pdf_dict_gets(obj, "Subtype"), !strcmp(pdf_to_name(o), "CIDFontType0C")) dontexpand = !(opts->do_expand & fz_expand_fonts); + if (o = pdf_dict_gets(obj, "Filter"), filter_implies_image(xref, o)) + dontexpand = !(opts->do_expand & fz_expand_images); + if (pdf_dict_gets(obj, "Width") != NULL && pdf_dict_gets(obj, "Height") != NULL) + dontexpand = !(opts->do_expand & fz_expand_images); } if (opts->do_expand && !dontexpand && !pdf_is_jpx_image(ctx, obj)) expandstream(xref, opts, obj, num, gen); diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c index 4da0577c..2deebfbd 100644 --- a/pdf/pdf_xref.c +++ b/pdf/pdf_xref.c @@ -36,7 +36,7 @@ pdf_read_start_xref(pdf_document *xref) xref->file_size = fz_tell(xref->file); - t = MAX(0, xref->file_size - (int)sizeof buf); + t = fz_maxi(0, xref->file_size - (int)sizeof buf); fz_seek(xref->file, t, 0); n = fz_read(xref->file, buf, sizeof buf); diff --git a/pdf/pdf_xref_aux.c b/pdf/pdf_xref_aux.c index 9acec96c..531a7e75 100644 --- a/pdf/pdf_xref_aux.c +++ b/pdf/pdf_xref_aux.c @@ -3,7 +3,7 @@ /* These functions have been split out of pdf_xref.c to allow tools - to be linked without pulling in the interpreter. The interpreter + to be linked without pulling in the interpreter. The interpreter references the built-in font and cmap resources which are quite big. Not linking those into the tools saves roughly 6MB in the resulting executables. |