diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2014-02-17 15:45:22 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2014-02-17 16:36:06 +0100 |
commit | 41084f0023df8706fadfa2e2b6373ec03a7c7ca4 (patch) | |
tree | 0e2f4be0832654f5b5d3c8411822ab9de50a5abb /source | |
parent | 3f0004acad7da3fcac4687844cb36e2b1ee855b0 (diff) | |
download | mupdf-41084f0023df8706fadfa2e2b6373ec03a7c7ca4.tar.xz |
Add const to colorspace source arguments and dependencies.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/colorspace.c | 42 | ||||
-rw-r--r-- | source/fitz/function.c | 8 | ||||
-rw-r--r-- | source/fitz/hash.c | 16 | ||||
-rw-r--r-- | source/pdf/pdf-colorspace.c | 6 | ||||
-rw-r--r-- | source/pdf/pdf-function.c | 6 |
5 files changed, 39 insertions, 39 deletions
diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c index 3426e26f..01a319de 100644 --- a/source/fitz/colorspace.c +++ b/source/fitz/colorspace.c @@ -41,14 +41,14 @@ fz_drop_colorspace(fz_context *ctx, fz_colorspace *cs) /* Device colorspace definitions */ -static void gray_to_rgb(fz_context *ctx, fz_colorspace *cs, float *gray, float *rgb) +static void gray_to_rgb(fz_context *ctx, fz_colorspace *cs, const float *gray, float *rgb) { rgb[0] = gray[0]; rgb[1] = gray[0]; rgb[2] = gray[0]; } -static void rgb_to_gray(fz_context *ctx, fz_colorspace *cs, float *rgb, float *gray) +static void rgb_to_gray(fz_context *ctx, fz_colorspace *cs, const float *rgb, float *gray) { float r = rgb[0]; float g = rgb[1]; @@ -56,28 +56,28 @@ static void rgb_to_gray(fz_context *ctx, fz_colorspace *cs, float *rgb, float *g gray[0] = r * 0.3f + g * 0.59f + b * 0.11f; } -static void rgb_to_rgb(fz_context *ctx, fz_colorspace *cs, float *rgb, float *xyz) +static void rgb_to_rgb(fz_context *ctx, fz_colorspace *cs, const float *rgb, float *xyz) { xyz[0] = rgb[0]; xyz[1] = rgb[1]; xyz[2] = rgb[2]; } -static void bgr_to_rgb(fz_context *ctx, fz_colorspace *cs, float *bgr, float *rgb) +static void bgr_to_rgb(fz_context *ctx, fz_colorspace *cs, const float *bgr, float *rgb) { rgb[0] = bgr[2]; rgb[1] = bgr[1]; rgb[2] = bgr[0]; } -static void rgb_to_bgr(fz_context *ctx, fz_colorspace *cs, float *rgb, float *bgr) +static void rgb_to_bgr(fz_context *ctx, fz_colorspace *cs, const float *rgb, float *bgr) { bgr[0] = rgb[2]; bgr[1] = rgb[1]; bgr[2] = rgb[0]; } -static void cmyk_to_rgb(fz_context *ctx, fz_colorspace *cs, float *cmyk, float *rgb) +static void cmyk_to_rgb(fz_context *ctx, fz_colorspace *cs, const float *cmyk, float *rgb) { #ifdef SLOWCMYK /* from poppler */ float c = cmyk[0], m = cmyk[1], y = cmyk[2], k = cmyk[3]; @@ -156,7 +156,7 @@ static void cmyk_to_rgb(fz_context *ctx, fz_colorspace *cs, float *cmyk, float * #endif } -static void rgb_to_cmyk(fz_context *ctx, fz_colorspace *cs, float *rgb, float *cmyk) +static void rgb_to_cmyk(fz_context *ctx, fz_colorspace *cs, const float *rgb, float *cmyk) { float c, m, y, k; c = 1 - rgb[0]; @@ -990,7 +990,7 @@ fz_convert_pixmap(fz_context *ctx, fz_pixmap *dp, fz_pixmap *sp) /* Convert a single color */ static void -std_conv_color(fz_color_converter *cc, float *dstv, float *srcv) +std_conv_color(fz_color_converter *cc, float *dstv, const float *srcv) { float rgb[3]; int i; @@ -1014,7 +1014,7 @@ std_conv_color(fz_color_converter *cc, float *dstv, float *srcv) } static void -g2rgb(fz_color_converter *cc, float *dv, float *sv) +g2rgb(fz_color_converter *cc, float *dv, const float *sv) { dv[0] = sv[0]; dv[1] = sv[0]; @@ -1022,7 +1022,7 @@ g2rgb(fz_color_converter *cc, float *dv, float *sv) } static void -g2cmyk(fz_color_converter *cc, float *dv, float *sv) +g2cmyk(fz_color_converter *cc, float *dv, const float *sv) { dv[0] = 0; dv[1] = 0; @@ -1031,13 +1031,13 @@ g2cmyk(fz_color_converter *cc, float *dv, float *sv) } static void -rgb2g(fz_color_converter *cc, float *dv, float *sv) +rgb2g(fz_color_converter *cc, float *dv, const float *sv) { dv[0] = sv[0] * 0.3f + sv[1] * 0.59f + sv[2] * 0.11f; } static void -rgb2bgr(fz_color_converter *cc, float *dv, float *sv) +rgb2bgr(fz_color_converter *cc, float *dv, const float *sv) { dv[0] = sv[2]; dv[1] = sv[1]; @@ -1045,7 +1045,7 @@ rgb2bgr(fz_color_converter *cc, float *dv, float *sv) } static void -rgb2cmyk(fz_color_converter *cc, float *dv, float *sv) +rgb2cmyk(fz_color_converter *cc, float *dv, const float *sv) { float c = 1 - sv[0]; float m = 1 - sv[1]; @@ -1058,13 +1058,13 @@ rgb2cmyk(fz_color_converter *cc, float *dv, float *sv) } static void -bgr2g(fz_color_converter *cc, float *dv, float *sv) +bgr2g(fz_color_converter *cc, float *dv, const float *sv) { dv[0] = sv[0] * 0.11f + sv[1] * 0.59f + sv[2] * 0.3f; } static void -bgr2cmyk(fz_color_converter *cc, float *dv, float *sv) +bgr2cmyk(fz_color_converter *cc, float *dv, const float *sv) { float c = 1 - sv[2]; float m = 1 - sv[1]; @@ -1077,7 +1077,7 @@ bgr2cmyk(fz_color_converter *cc, float *dv, float *sv) } static void -cmyk2g(fz_color_converter *cc, float *dv, float *sv) +cmyk2g(fz_color_converter *cc, float *dv, const float *sv) { float c = sv[0] * 0.3f; float m = sv[1] * 0.59f; @@ -1086,7 +1086,7 @@ cmyk2g(fz_color_converter *cc, float *dv, float *sv) } static void -cmyk2rgb(fz_color_converter *cc, float *dv, float *sv) +cmyk2rgb(fz_color_converter *cc, float *dv, const float *sv) { #ifdef SLOWCMYK cmyk_to_rgb(cc->ctx, NULL, sv, dv); @@ -1098,7 +1098,7 @@ cmyk2rgb(fz_color_converter *cc, float *dv, float *sv) } static void -cmyk2bgr(fz_color_converter *cc, float *dv, float *sv) +cmyk2bgr(fz_color_converter *cc, float *dv, const float *sv) { #ifdef SLOWCMYK float rgb[3]; @@ -1169,7 +1169,7 @@ void fz_lookup_color_converter(fz_color_converter *cc, fz_context *ctx, fz_color } void -fz_convert_color(fz_context *ctx, fz_colorspace *ds, float *dv, fz_colorspace *ss, float *sv) +fz_convert_color(fz_context *ctx, fz_colorspace *ds, float *dv, fz_colorspace *ss, const float *sv) { fz_color_converter cc; fz_lookup_color_converter(&cc, ctx, ds, ss); @@ -1186,7 +1186,7 @@ struct indexed }; static void -indexed_to_rgb(fz_context *ctx, fz_colorspace *cs, float *color, float *rgb) +indexed_to_rgb(fz_context *ctx, fz_colorspace *cs, const float *color, float *rgb) { struct indexed *idx = cs->data; float alt[FZ_MAX_COLORS]; @@ -1283,7 +1283,7 @@ typedef struct fz_cached_color_converter } fz_cached_color_converter; -static void fz_cached_color_convert(fz_color_converter *cc_, float *ds, float *ss) +static void fz_cached_color_convert(fz_color_converter *cc_, float *ds, const float *ss) { fz_cached_color_converter *cc = cc_->opaque; fz_context *ctx = cc->base.ctx; diff --git a/source/fitz/function.c b/source/fitz/function.c index b5ba4815..7ebdb912 100644 --- a/source/fitz/function.c +++ b/source/fitz/function.c @@ -1,18 +1,18 @@ #include "mupdf/fitz.h" void -fz_eval_function(fz_context *ctx, fz_function *func, float *in_, int inlen, float *out_, int outlen) +fz_eval_function(fz_context *ctx, fz_function *func, const float *in_, int inlen, float *out_, int outlen) { float fakein[FZ_FN_MAXM]; float fakeout[FZ_FN_MAXN]; - float *in = in_; + const float *in = in_; float *out = out_; if (inlen < func->m) { in = fakein; - memset(in, 0, sizeof(float) * func->m); - memcpy(in, in_, sizeof(float) * inlen); + memset(fakein, 0, sizeof(float) * func->m); + memcpy(fakein, in_, sizeof(float) * inlen); } if (outlen < func->n) diff --git a/source/fitz/hash.c b/source/fitz/hash.c index 624cc305..708d72f2 100644 --- a/source/fitz/hash.c +++ b/source/fitz/hash.c @@ -26,7 +26,7 @@ struct fz_hash_table_s fz_hash_entry *ents; }; -static unsigned hash(unsigned char *s, int len) +static unsigned hash(const unsigned char *s, int len) { unsigned val = 0; int i; @@ -101,7 +101,7 @@ fz_free_hash(fz_context *ctx, fz_hash_table *table) } static void * -do_hash_insert(fz_context *ctx, fz_hash_table *table, void *key, void *val, unsigned *pos_ptr) +do_hash_insert(fz_context *ctx, fz_hash_table *table, const void *key, void *val, unsigned *pos_ptr) { fz_hash_entry *ents; unsigned size; @@ -199,7 +199,7 @@ fz_resize_hash(fz_context *ctx, fz_hash_table *table, int newsize) } void * -fz_hash_find(fz_context *ctx, fz_hash_table *table, void *key) +fz_hash_find(fz_context *ctx, fz_hash_table *table, const void *key) { fz_hash_entry *ents = table->ents; unsigned size = table->size; @@ -221,7 +221,7 @@ fz_hash_find(fz_context *ctx, fz_hash_table *table, void *key) } void * -fz_hash_insert(fz_context *ctx, fz_hash_table *table, void *key, void *val) +fz_hash_insert(fz_context *ctx, fz_hash_table *table, const void *key, void *val) { if (table->load > table->size * 8 / 10) { @@ -232,7 +232,7 @@ fz_hash_insert(fz_context *ctx, fz_hash_table *table, void *key, void *val) } void * -fz_hash_insert_with_pos(fz_context *ctx, fz_hash_table *table, void *key, void *val, unsigned *pos) +fz_hash_insert_with_pos(fz_context *ctx, fz_hash_table *table, const void *key, void *val, unsigned *pos) { if (table->load > table->size * 8 / 10) { @@ -243,7 +243,7 @@ fz_hash_insert_with_pos(fz_context *ctx, fz_hash_table *table, void *key, void * } static void -do_removal(fz_context *ctx, fz_hash_table *table, void *key, unsigned hole) +do_removal(fz_context *ctx, fz_hash_table *table, const void *key, unsigned hole) { fz_hash_entry *ents = table->ents; unsigned size = table->size; @@ -279,7 +279,7 @@ do_removal(fz_context *ctx, fz_hash_table *table, void *key, unsigned hole) } void -fz_hash_remove(fz_context *ctx, fz_hash_table *table, void *key) +fz_hash_remove(fz_context *ctx, fz_hash_table *table, const void *key) { fz_hash_entry *ents = table->ents; unsigned size = table->size; @@ -309,7 +309,7 @@ fz_hash_remove(fz_context *ctx, fz_hash_table *table, void *key) } void -fz_hash_remove_fast(fz_context *ctx, fz_hash_table *table, void *key, unsigned pos) +fz_hash_remove_fast(fz_context *ctx, fz_hash_table *table, const void *key, unsigned pos) { fz_hash_entry *ents = table->ents; diff --git a/source/pdf/pdf-colorspace.c b/source/pdf/pdf-colorspace.c index 12bc6a34..4b250f6c 100644 --- a/source/pdf/pdf-colorspace.c +++ b/source/pdf/pdf-colorspace.c @@ -54,7 +54,7 @@ static inline float fung(float x) } static void -lab_to_rgb(fz_context *ctx, fz_colorspace *cs, float *lab, float *rgb) +lab_to_rgb(fz_context *ctx, fz_colorspace *cs, const float *lab, float *rgb) { /* input is in range (0..100, -128..127, -128..127) not (0..1, 0..1, 0..1) */ float lstar, astar, bstar, l, m, n, x, y, z, r, g, b; @@ -76,7 +76,7 @@ lab_to_rgb(fz_context *ctx, fz_colorspace *cs, float *lab, float *rgb) } static void -rgb_to_lab(fz_context *ctx, fz_colorspace *cs, float *rgb, float *lab) +rgb_to_lab(fz_context *ctx, fz_colorspace *cs, const float *rgb, float *lab) { fz_warn(ctx, "cannot convert into L*a*b colorspace"); lab[0] = rgb[0]; @@ -96,7 +96,7 @@ struct separation }; static void -separation_to_rgb(fz_context *ctx, fz_colorspace *cs, float *color, float *rgb) +separation_to_rgb(fz_context *ctx, fz_colorspace *cs, const float *color, float *rgb) { struct separation *sep = cs->data; float alt[FZ_MAX_COLORS]; diff --git a/source/pdf/pdf-function.c b/source/pdf/pdf-function.c index 1972a10d..a8faae32 100644 --- a/source/pdf/pdf-function.c +++ b/source/pdf/pdf-function.c @@ -879,7 +879,7 @@ load_postscript_func(pdf_function *func, pdf_document *doc, pdf_obj *dict, int n } static void -eval_postscript_func(fz_context *ctx, pdf_function *func, float *in, float *out) +eval_postscript_func(fz_context *ctx, pdf_function *func, const float *in, float *out) { ps_stack st; float x; @@ -1060,7 +1060,7 @@ interpolate_sample(pdf_function *func, int *scale, int *e0, int *e1, float *efra } static void -eval_sample_func(fz_context *ctx, pdf_function *func, float *in, float *out) +eval_sample_func(fz_context *ctx, pdf_function *func, const float *in, float *out) { int e0[FZ_FN_MAXM], e1[FZ_FN_MAXM], scale[FZ_FN_MAXM]; float efrac[FZ_FN_MAXM]; @@ -1383,7 +1383,7 @@ pdf_free_function_imp(fz_context *ctx, fz_storable *func_) } static void -pdf_eval_function(fz_context *ctx, fz_function *func_, float *in, float *out) +pdf_eval_function(fz_context *ctx, fz_function *func_, const float *in, float *out) { pdf_function *func = (pdf_function *)func_; |