summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mupdf/fitz/colorspace.h4
-rw-r--r--include/mupdf/fitz/context.h36
2 files changed, 26 insertions, 14 deletions
diff --git a/include/mupdf/fitz/colorspace.h b/include/mupdf/fitz/colorspace.h
index 289955c9..971f2ebe 100644
--- a/include/mupdf/fitz/colorspace.h
+++ b/include/mupdf/fitz/colorspace.h
@@ -101,7 +101,7 @@ typedef fz_colorspace *(fz_colorspace_base_fn)(const fz_colorspace *cs);
typedef void (fz_colorspace_clamp_fn)(const fz_colorspace *cs, const float *src, float *dst);
-fz_colorspace *fz_new_colorspace(fz_context *ctx, char *name, int is_static, int n, int is_subtractive, fz_colorspace_convert_fn *to_ccs, fz_colorspace_convert_fn *from_ccs, fz_colorspace_base_fn *base, fz_colorspace_clamp_fn *clamp, fz_colorspace_destruct_fn *destruct, void *data, size_t size);
+fz_colorspace *fz_new_colorspace(fz_context *ctx, char *name, int n, int is_subtractive, fz_colorspace_convert_fn *to_ccs, fz_colorspace_convert_fn *from_ccs, fz_colorspace_base_fn *base, fz_colorspace_clamp_fn *clamp, fz_colorspace_destruct_fn *destruct, void *data, size_t size);
fz_colorspace *fz_new_indexed_colorspace(fz_context *ctx, fz_colorspace *base, int high, unsigned char *lookup);
fz_colorspace *fz_keep_colorspace(fz_context *ctx, fz_colorspace *colorspace);
void fz_drop_colorspace(fz_context *ctx, fz_colorspace *colorspace);
@@ -154,7 +154,7 @@ struct fz_cal_colorspace_s {
/*
icc methods
*/
-fz_colorspace *fz_new_icc_colorspace(fz_context *ctx, int is_static, int num, fz_buffer *buf, const char *name);
+fz_colorspace *fz_new_icc_colorspace(fz_context *ctx, int num, fz_buffer *buf, const char *name);
fz_colorspace *fz_new_cal_colorspace(fz_context *ctx, float *wp, float *bp, float *gamma, float *matrix);
fz_buffer *fz_new_icc_data_from_cal_colorspace(fz_context *ctx, fz_cal_colorspace *cal);
fz_buffer *fz_icc_data_from_icc_colorspace(fz_context *ctx, const fz_colorspace *cs);
diff --git a/include/mupdf/fitz/context.h b/include/mupdf/fitz/context.h
index 78e64bbc..36d908e8 100644
--- a/include/mupdf/fitz/context.h
+++ b/include/mupdf/fitz/context.h
@@ -612,11 +612,13 @@ fz_keep_imp(fz_context *ctx, void *p, int *refs)
{
if (p)
{
- if (*refs > 0)
- (void)Memento_takeRef(p);
+ (void)Memento_checkIntPointerOrNull(refs);
fz_lock(ctx, FZ_LOCK_ALLOC);
if (*refs > 0)
+ {
+ (void)Memento_takeRef(p);
++*refs;
+ }
fz_unlock(ctx, FZ_LOCK_ALLOC);
}
return p;
@@ -627,11 +629,13 @@ fz_keep_imp8(fz_context *ctx, void *p, int8_t *refs)
{
if (p)
{
- if (*refs > 0)
- (void)Memento_takeRef(p);
+ (void)Memento_checkBytePointerOrNull(refs);
fz_lock(ctx, FZ_LOCK_ALLOC);
if (*refs > 0)
+ {
+ (void)Memento_takeRef(p);
++*refs;
+ }
fz_unlock(ctx, FZ_LOCK_ALLOC);
}
return p;
@@ -642,11 +646,13 @@ fz_keep_imp16(fz_context *ctx, void *p, int16_t *refs)
{
if (p)
{
- if (*refs > 0)
- (void)Memento_takeRef(p);
+ (void)Memento_checkShortPointerOrNull(refs);
fz_lock(ctx, FZ_LOCK_ALLOC);
if (*refs > 0)
+ {
+ (void)Memento_takeRef(p);
++*refs;
+ }
fz_unlock(ctx, FZ_LOCK_ALLOC);
}
return p;
@@ -658,11 +664,13 @@ fz_drop_imp(fz_context *ctx, void *p, int *refs)
if (p)
{
int drop;
- if (*refs > 0)
- (void)Memento_dropRef(p);
+ (void)Memento_checkIntPointerOrNull(refs);
fz_lock(ctx, FZ_LOCK_ALLOC);
if (*refs > 0)
+ {
+ (void)Memento_dropIntRef(p);
drop = --*refs == 0;
+ }
else
drop = 0;
fz_unlock(ctx, FZ_LOCK_ALLOC);
@@ -677,11 +685,13 @@ fz_drop_imp8(fz_context *ctx, void *p, int8_t *refs)
if (p)
{
int drop;
- if (*refs > 0)
- (void)Memento_dropRef(p);
+ (void)Memento_checkBytePointerOrNull(refs);
fz_lock(ctx, FZ_LOCK_ALLOC);
if (*refs > 0)
+ {
+ (void)Memento_dropByteRef(p);
drop = --*refs == 0;
+ }
else
drop = 0;
fz_unlock(ctx, FZ_LOCK_ALLOC);
@@ -696,11 +706,13 @@ fz_drop_imp16(fz_context *ctx, void *p, int16_t *refs)
if (p)
{
int drop;
- if (*refs > 0)
- (void)Memento_dropRef(p);
+ (void)Memento_checkShortPointerOrNull(refs);
fz_lock(ctx, FZ_LOCK_ALLOC);
if (*refs > 0)
+ {
+ (void)Memento_dropShortRef(p);
drop = --*refs == 0;
+ }
else
drop = 0;
fz_unlock(ctx, FZ_LOCK_ALLOC);