diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-05-07 16:46:16 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-05-16 12:48:07 +0200 |
commit | f4cb197ad36f5ea3ab834abb41d2641daf152622 (patch) | |
tree | e5d7222f7ffb1308c1d060c367f363723151b739 /source | |
parent | b4e9bdcd4daa09e27e112979750d1f85e3c5496e (diff) | |
download | mupdf-f4cb197ad36f5ea3ab834abb41d2641daf152622.tar.xz |
Purge unused functions.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/color-lcms.c | 1 | ||||
-rw-r--r-- | source/fitz/colorspace-imp.h | 1 | ||||
-rw-r--r-- | source/fitz/colorspace.c | 20 | ||||
-rw-r--r-- | source/fitz/context.c | 48 | ||||
-rw-r--r-- | source/fitz/filter-basic.c | 8 | ||||
-rw-r--r-- | source/fitz/jmemcust.c | 10 | ||||
-rw-r--r-- | source/fitz/jmemcust.h | 3 | ||||
-rw-r--r-- | source/fitz/memory.c | 10 | ||||
-rw-r--r-- | source/fitz/pixmap.c | 25 | ||||
-rw-r--r-- | source/fitz/separation.c | 19 | ||||
-rw-r--r-- | source/fitz/stext-search.c | 53 | ||||
-rw-r--r-- | source/fitz/strtof.c | 18 | ||||
-rw-r--r-- | source/fitz/text.c | 50 | ||||
-rw-r--r-- | source/pdf/pdf-parse.c | 100 |
14 files changed, 3 insertions, 363 deletions
diff --git a/source/fitz/color-lcms.c b/source/fitz/color-lcms.c index 93a5e415..9efbb0b3 100644 --- a/source/fitz/color-lcms.c +++ b/source/fitz/color-lcms.c @@ -356,6 +356,5 @@ fz_cmm_engine fz_cmm_engine_lcms = { fz_lcms_fin_link, fz_lcms_init_profile, fz_lcms_fin_profile, - cmsFLAGS_NOWHITEONWHITEFIXUP }; #endif diff --git a/source/fitz/colorspace-imp.h b/source/fitz/colorspace-imp.h index 5fd1ffd0..8f3b85f6 100644 --- a/source/fitz/colorspace-imp.h +++ b/source/fitz/colorspace-imp.h @@ -12,7 +12,6 @@ #define FZ_ICC_PROFILE_CMYK "DeviceCMYK" #define FZ_ICC_PROFILE_LAB "Lab" -int fz_cmm_avoid_white_fix_flag(fz_context *ctx); void fz_cmm_transform_pixmap(fz_context *ctx, fz_icclink *link, fz_pixmap *dst, fz_pixmap *src); void fz_cmm_transform_color(fz_context *ctx, fz_icclink *link, unsigned short *dst, const unsigned short *src); void fz_cmm_init_link(fz_context *ctx, fz_icclink *link, const fz_iccprofile *dst, int dst_extras, const fz_iccprofile *src, int src_extras, const fz_iccprofile *prf, const fz_color_params *rend, int cmm_flags, int num_bytes, int copy_spots); diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c index cb35d54f..5d08b808 100644 --- a/source/fitz/colorspace.c +++ b/source/fitz/colorspace.c @@ -91,14 +91,6 @@ int fz_colorspace_device_n_has_cmyk(fz_context *ctx, const fz_colorspace *cs) /* CMM module */ -int -fz_cmm_avoid_white_fix_flag(fz_context *ctx) -{ - if (ctx && ctx->colorspace && ctx->colorspace->cmm && ctx->cmm_instance) - return ctx->colorspace->cmm->avoid_white_fix_flag; - return 0; -} - void fz_cmm_transform_pixmap(fz_context *ctx, fz_icclink *link, fz_pixmap *dst, fz_pixmap *src) { @@ -3746,18 +3738,6 @@ clamp_default_icc(const fz_colorspace *cs, const float *src, float *dst) dst[i] = fz_clamp(src[i], 0, 1); } -void fz_set_icc_bgr(fz_context *ctx, fz_colorspace *cs) -{ - fz_iccprofile *profile; - - if (cs == NULL || !fz_colorspace_is_icc(ctx, cs)) - return; - - profile = cs->data; - profile->bgr = 1; - return; -} - fz_colorspace * fz_new_icc_colorspace(fz_context *ctx, const char *name, int num, fz_buffer *buf) { diff --git a/source/fitz/context.c b/source/fitz/context.c index 67fef05b..77b6d18a 100644 --- a/source/fitz/context.c +++ b/source/fitz/context.c @@ -5,37 +5,6 @@ #include <stdio.h> #include <time.h> -struct fz_id_context_s -{ - int refs; - int id; -}; - -static void -fz_drop_id_context(fz_context *ctx) -{ - if (!ctx) - return; - if (fz_drop_imp(ctx, ctx->id, &ctx->id->refs)) - fz_free(ctx, ctx->id); -} - -static void -fz_new_id_context(fz_context *ctx) -{ - ctx->id = fz_malloc_struct(ctx, fz_id_context); - ctx->id->refs = 1; - ctx->id->id = 0; -} - -static fz_id_context * -fz_keep_id_context(fz_context *ctx) -{ - if (!ctx) - return NULL; - return fz_keep_imp(ctx, ctx->id, &ctx->id->refs); -} - struct fz_style_context_s { int refs; @@ -165,7 +134,6 @@ fz_drop_context(fz_context *ctx) fz_drop_colorspace_context(ctx); fz_drop_cmm_context(ctx); fz_drop_font_context(ctx); - fz_drop_id_context(ctx); fz_drop_output_context(ctx); if (ctx->warn) @@ -263,7 +231,6 @@ fz_new_context_imp(const fz_alloc_context *alloc, const fz_locks_context *locks, fz_new_cmm_context(ctx); fz_new_colorspace_context(ctx); fz_new_font_context(ctx); - fz_new_id_context(ctx); fz_new_document_handler_context(ctx); fz_new_style_context(ctx); fz_new_tuning_context(ctx); @@ -318,8 +285,6 @@ fz_clone_context_internal(fz_context *ctx) new_ctx->font = fz_keep_font_context(new_ctx); new_ctx->style = ctx->style; new_ctx->style = fz_keep_style_context(new_ctx); - new_ctx->id = ctx->id; - new_ctx->id = fz_keep_id_context(new_ctx); new_ctx->tuning = ctx->tuning; new_ctx->tuning = fz_keep_tuning_context(new_ctx); memcpy(new_ctx->seed48, ctx->seed48, sizeof ctx->seed48); @@ -329,19 +294,6 @@ fz_clone_context_internal(fz_context *ctx) return new_ctx; } -int -fz_gen_id(fz_context *ctx) -{ - int id; - fz_lock(ctx, FZ_LOCK_ALLOC); - /* We'll never wrap around in normal use, but if we do, then avoid 0. */ - do - id = ++ctx->id->id; - while (id == 0); - fz_unlock(ctx, FZ_LOCK_ALLOC); - return id; -} - void fz_set_user_context(fz_context *ctx, void *user) { if (ctx != NULL) diff --git a/source/fitz/filter-basic.c b/source/fitz/filter-basic.c index f558f43b..5e03a176 100644 --- a/source/fitz/filter-basic.c +++ b/source/fitz/filter-basic.c @@ -2,14 +2,6 @@ #include <string.h> -/* Pretend we have a filter that just copies data forever */ - -fz_stream * -fz_open_copy(fz_context *ctx, fz_stream *chain) -{ - return fz_keep_stream(ctx, chain); -} - /* Null filter copies a specified amount of data */ struct null_filter diff --git a/source/fitz/jmemcust.c b/source/fitz/jmemcust.c index d5318026..d0cb3048 100644 --- a/source/fitz/jmemcust.c +++ b/source/fitz/jmemcust.c @@ -155,14 +155,4 @@ jpeg_cust_mem_init(jpeg_cust_mem_data *custm, void *priv, return lcustm; } -GLOBAL(jpeg_cust_mem_data *) -jpeg_cust_mem_set_private(jpeg_cust_mem_data *custm, void *priv) -{ - if (custm) - { - custm->priv = priv; - } - return custm; -} - #endif /* !defined(SHARE_JPEG) || SHARE_JPEG==0 */ diff --git a/source/fitz/jmemcust.h b/source/fitz/jmemcust.h index 6e5f6ead..9447fd4d 100644 --- a/source/fitz/jmemcust.h +++ b/source/fitz/jmemcust.h @@ -46,6 +46,3 @@ GLOBAL(jpeg_cust_mem_data *) j_cust_mem_get_large_ptr get_large, j_custmem_free_large_ptr free_large, j_custmem_open_backing_store_ptr open_backing_store); - -GLOBAL(jpeg_cust_mem_data *) - jpeg_cust_mem_set_private(jpeg_cust_mem_data *custm, void *priv); diff --git a/source/fitz/memory.c b/source/fitz/memory.c index ad5b69aa..09df7cda 100644 --- a/source/fitz/memory.c +++ b/source/fitz/memory.c @@ -212,16 +212,6 @@ fz_strdup(fz_context *ctx, const char *s) return ns; } -char * -fz_strdup_no_throw(fz_context *ctx, const char *s) -{ - size_t len = strlen(s) + 1; - char *ns = fz_malloc_no_throw(ctx, len); - if (ns) - memcpy(ns, s, len); - return ns; -} - static void * fz_malloc_default(void *opaque, size_t size) { diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c index a0abb5de..9159fea0 100644 --- a/source/fitz/pixmap.c +++ b/source/fitz/pixmap.c @@ -727,31 +727,6 @@ fz_premultiply_pixmap(fz_context *ctx, fz_pixmap *pix) } } -void -fz_unmultiply_pixmap(fz_context *ctx, fz_pixmap *pix) -{ - unsigned char *s = pix->samples; - int a, inva; - int k, x, y; - int stride = pix->stride - pix->w * pix->n; - - if (!pix->alpha) - return; - - for (y = 0; y < pix->h; y++) - { - for (x = 0; x < pix->w; x++) - { - a = s[pix->n - 1]; - inva = a ? 255 * 256 / a : 0; - for (k = 0; k < pix->n - 1; k++) - s[k] = (s[k] * inva) >> 8; - s += pix->n; - } - s += stride; - } -} - fz_pixmap * fz_alpha_from_gray(fz_context *ctx, fz_pixmap *gray) { diff --git a/source/fitz/separation.c b/source/fitz/separation.c index fe1530a7..c0f01f28 100644 --- a/source/fitz/separation.c +++ b/source/fitz/separation.c @@ -89,11 +89,6 @@ void fz_add_separation_equivalents(fz_context *ctx, fz_separations *sep, uint32_ sep->num_separations++; } -int fz_separations_controllable(fz_context *ctx, const fz_separations *sep) -{ - return (!sep || sep->controllable); -} - void fz_set_separation_behavior(fz_context *ctx, fz_separations *sep, int separation, fz_separation_behavior beh) { int shift; @@ -147,20 +142,6 @@ fz_separation_behavior fz_separation_current_behavior(fz_context *ctx, const fz_ return beh; } -int fz_separations_all_composite(fz_context *ctx, const fz_separations *sep) -{ - int i; - - if (!sep) - return 1; - - for (i = 0; i < (FZ_MAX_SEPARATIONS + 31) / 32; i++) - if (sep_state(sep, i) != FZ_SEPARATION_COMPOSITE) - return 0; - - return 1; -} - const char *fz_separation_name(fz_context *ctx, const fz_separations *sep, int separation) { if (!sep || separation < 0 || separation >= sep->num_separations) diff --git a/source/fitz/stext-search.c b/source/fitz/stext-search.c index 3e2d08df..b73296e3 100644 --- a/source/fitz/stext-search.c +++ b/source/fitz/stext-search.c @@ -4,59 +4,6 @@ #include <limits.h> #include <assert.h> -int fz_stext_char_count(fz_context *ctx, fz_stext_page *page) -{ - fz_stext_block *block; - fz_stext_line *line; - fz_stext_char *ch; - int len = 0; - - for (block = page->first_block; block; block = block->next) - { - if (block->type != FZ_STEXT_BLOCK_TEXT) - continue; - for (line = block->u.t.first_line; line; line = line->next) - { - for (ch = line->first_char; ch; ch = ch->next) - ++len; - ++len; /* pseudo-newline */ - } - } - - return len; -} - -const fz_stext_char *fz_stext_char_at(fz_context *ctx, fz_stext_page *page, int idx) -{ - static const fz_stext_char space = { ' ', {0,0}, {0,0,0,0}, 0, NULL, NULL }; - static const fz_stext_char zero = { '\0', {0,0}, {0,0,0,0}, 0, NULL, NULL }; - fz_stext_block *block; - fz_stext_line *line; - fz_stext_char *ch; - int ofs = 0; - - for (block = page->first_block; block; block = block->next) - { - if (block->type != FZ_STEXT_BLOCK_TEXT) - continue; - for (line = block->u.t.first_line; line; line = line->next) - { - for (ch = line->first_char; ch; ch = ch->next) - { - if (ofs == idx) - return ch; - ++ofs; - } - - /* pseudo-newline */ - if (idx == ofs) - return &space; - ++ofs; - } - } - return &zero; -} - /* Enumerate marked selection */ static float dist2(float a, float b) diff --git a/source/fitz/strtof.c b/source/fitz/strtof.c index 2786a794..83679a75 100644 --- a/source/fitz/strtof.c +++ b/source/fitz/strtof.c @@ -332,8 +332,8 @@ starts_with(const char **s, const char *string) *tailptr = (char *) s; \ while (0) -static float -strtof_internal(const char *string, char **tailptr, int exp_format) +float +fz_strtof(const char *string, char **tailptr) { /* FIXME: error (1/2 + 1/256) ulp */ const char *s; @@ -421,7 +421,7 @@ strtof_internal(const char *string, char **tailptr, int exp_format) } /* Parse exponent. */ - if (exp_format && (*s == 'e' || *s == 'E')) + if (*s == 'e' || *s == 'E') { int exp_negative = 0; int exp = 0; @@ -457,15 +457,3 @@ strtof_internal(const char *string, char **tailptr, int exp_format) SET_TAILPTR(tailptr, s); return scale_integer_to_float(M, N, negative); } - -float -fz_strtof(const char *string, char **tailptr) -{ - return strtof_internal(string, tailptr, 1); -} - -float -fz_strtof_no_exp(const char *string, char **tailptr) -{ - return strtof_internal(string, tailptr, 0); -} diff --git a/source/fitz/text.c b/source/fitz/text.c index 8a01e550..90698125 100644 --- a/source/fitz/text.c +++ b/source/fitz/text.c @@ -171,56 +171,6 @@ fz_bound_text(fz_context *ctx, const fz_text *text, const fz_stroke_state *strok return bbox; } -fz_text * -fz_clone_text(fz_context *ctx, const fz_text *text) -{ - fz_text *new_text; - fz_text_span *span; - fz_text_span **tail; - - new_text = fz_malloc_struct(ctx, fz_text); - new_text->refs = 1; - span = text->head; - tail = &new_text->head; - - fz_var(span); - - fz_try(ctx) - { - while (span != NULL) - { - fz_text_span *new_span = fz_malloc_struct(ctx, fz_text_span); - *tail = new_span; - tail = &new_span->next; - new_text->tail = new_span; - new_span->font = fz_keep_font(ctx, span->font); - new_span->trm = span->trm; - new_span->wmode = span->wmode; - new_span->len = span->len; - new_span->cap = span->len; - new_span->items = fz_malloc(ctx, span->len * sizeof(*span->items)); - memcpy(new_span->items, span->items, span->len * sizeof(*span->items)); - span = span->next; - } - } - fz_catch(ctx) - { - span = new_text->head; - while (span != NULL) - { - fz_text_span *next = span->next; - fz_drop_font(ctx, span->font); - fz_free(ctx, span->items); - fz_free(ctx, span); - span = next; - } - fz_free(ctx, new_text); - fz_rethrow(ctx); - } - - return new_text; -} - fz_text_language fz_text_language_from_string(const char *str) { fz_text_language lang; diff --git a/source/pdf/pdf-parse.c b/source/pdf/pdf-parse.c index 104b117d..f4075c5a 100644 --- a/source/pdf/pdf-parse.c +++ b/source/pdf/pdf-parse.c @@ -208,106 +208,6 @@ pdf_load_stream_or_string_as_utf8(fz_context *ctx, pdf_obj *src) return pdf_to_utf8(ctx, src); } -/* Convert Unicode/PdfDocEncoding string into ucs-2 */ -unsigned short * -pdf_to_ucs2(fz_context *ctx, pdf_obj *src) -{ - unsigned char *srcptr = (unsigned char *) pdf_to_str_buf(ctx, src); - unsigned short *dstptr, *dst; - int srclen = pdf_to_str_len(ctx, src); - int i; - - if (srclen >= 2 && srcptr[0] == 254 && srcptr[1] == 255) - { - dstptr = dst = fz_malloc_array(ctx, (srclen - 2) / 2 + 1, sizeof(short)); - for (i = 2; i + 1 < srclen; i += 2) - *dstptr++ = srcptr[i] << 8 | srcptr[i+1]; - } - else if (srclen >= 2 && srcptr[0] == 255 && srcptr[1] == 254) - { - dstptr = dst = fz_malloc_array(ctx, (srclen - 2) / 2 + 1, sizeof(short)); - for (i = 2; i + 1 < srclen; i += 2) - *dstptr++ = srcptr[i] | srcptr[i+1] << 8; - } - else - { - dstptr = dst = fz_malloc_array(ctx, srclen + 1, sizeof(short)); - for (i = 0; i < srclen; i++) - *dstptr++ = pdf_doc_encoding[srcptr[i]]; - } - - *dstptr = '\0'; - return dst; -} - -/* allow conversion to UCS-2 without the need for a fz_context */ -/* (buffer must be at least (fz_to_str_len(src) + 1) * 2 bytes in size) */ -void -pdf_to_ucs2_buf(fz_context *ctx, unsigned short *buffer, pdf_obj *src) -{ - unsigned char *srcptr = (unsigned char *) pdf_to_str_buf(ctx, src); - unsigned short *dstptr = buffer; - int srclen = pdf_to_str_len(ctx, src); - int i; - - if (srclen >= 2 && srcptr[0] == 254 && srcptr[1] == 255) - { - for (i = 2; i + 1 < srclen; i += 2) - *dstptr++ = srcptr[i] << 8 | srcptr[i+1]; - } - else if (srclen >= 2 && srcptr[0] == 255 && srcptr[1] == 254) - { - for (i = 2; i + 1 < srclen; i += 2) - *dstptr++ = srcptr[i] | srcptr[i+1] << 8; - } - else - { - for (i = 0; i < srclen; i++) - *dstptr++ = pdf_doc_encoding[srcptr[i]]; - } - - *dstptr = '\0'; -} - -/* Convert UCS-2 string into PdfDocEncoding for authentication */ -char * -pdf_from_ucs2(fz_context *ctx, unsigned short *src) -{ - int i, j, len; - char *docstr; - - len = 0; - while (src[len]) - len++; - - docstr = fz_malloc(ctx, len + 1); - - for (i = 0; i < len; i++) - { - /* shortcut: check if the character has the same code point in both encodings */ - if (0 < src[i] && src[i] < 256 && pdf_doc_encoding[src[i]] == src[i]) { - docstr[i] = src[i]; - continue; - } - - /* search through pdf_docencoding for the character's code point */ - for (j = 0; j < 256; j++) - if (pdf_doc_encoding[j] == src[i]) - break; - docstr[i] = j; - - /* fail, if a character can't be encoded */ - if (!docstr[i]) - { - fz_free(ctx, docstr); - return NULL; - } - } - docstr[len] = '\0'; - - return docstr; -} - pdf_obj * pdf_to_utf8_name(fz_context *ctx, pdf_obj *src) { |