diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/fitz/base.h | 5 | ||||
-rw-r--r-- | include/fitz/cmap.h | 2 | ||||
-rw-r--r-- | include/fitz/file.h | 4 | ||||
-rw-r--r-- | include/fitz/geometry.h | 1 | ||||
-rw-r--r-- | include/fitz/math.h | 18 | ||||
-rw-r--r-- | include/fitz/object.h | 12 | ||||
-rw-r--r-- | include/fitz/path.h | 20 | ||||
-rw-r--r-- | include/fitz/render.h | 4 | ||||
-rw-r--r-- | include/fitz/scanconv.h | 1 | ||||
-rw-r--r-- | include/fitz/sysdep.h | 15 | ||||
-rw-r--r-- | include/fitz/tree.h | 15 | ||||
-rw-r--r-- | include/mupdf/syntax.h | 8 | ||||
-rw-r--r-- | include/mupdf/xref.h | 4 |
13 files changed, 58 insertions, 51 deletions
diff --git a/include/fitz/base.h b/include/fitz/base.h index d1c5343a..4741f297 100644 --- a/include/fitz/base.h +++ b/include/fitz/base.h @@ -37,10 +37,13 @@ extern fz_error fz_koutofmem; #ifdef WIN32 #define fz_throw(...) fz_throw0(__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) +#elif _ISOC99_SOURCE +#define fz_throw(...) fz_throw0(__func__, __FILE__, __LINE__, __VA_ARGS__) #else -#define fz_throw(fmt, ...) fz_throw0(__func__, __FILE__, __LINE__, fmt, ## __VA_ARGS__) +#define fz_throw fz_throw1 #endif fz_error *fz_throw0(const char *func, const char *file, int line, char *fmt, ...); +fz_error *fz_throw1(char *fmt, ...); void fz_warn(char *fmt, ...); void fz_abort(fz_error *eo); diff --git a/include/fitz/cmap.h b/include/fitz/cmap.h index 768d896a..c5a4ad6f 100644 --- a/include/fitz/cmap.h +++ b/include/fitz/cmap.h @@ -22,5 +22,5 @@ fz_error *fz_addcidrange(fz_cmap *cmap, int srclo, int srchi, int dstlo); fz_error *fz_endcidrange(fz_cmap *cmap); int fz_lookupcid(fz_cmap *cmap, int cpt); -char *fz_decodecpt(fz_cmap *cmap, unsigned char *s, int *cpt); +unsigned char *fz_decodecpt(fz_cmap *cmap, unsigned char *s, int *cpt); diff --git a/include/fitz/file.h b/include/fitz/file.h index 6179085a..c87ccf5d 100644 --- a/include/fitz/file.h +++ b/include/fitz/file.h @@ -26,13 +26,13 @@ int fz_tell(fz_file *f); int fz_readbyte(fz_file *f); int fz_peekbyte(fz_file *f); int fz_readline(fz_file *f, char *buf, int n); -int fz_read(fz_file *f, char *buf, int n); +int fz_read(fz_file *f, unsigned char *buf, int n); fz_error *fz_readfile(fz_buffer **bufp, fz_file *file); int fz_printstring(fz_file *f, char *s); int fz_printobj(fz_file *f, fz_obj *o, int tight); int fz_print(fz_file *f, char *fmt, ...); -int fz_write(fz_file *f, char *buf, int n); +int fz_write(fz_file *f, unsigned char *buf, int n); int fz_flush(fz_file *f); diff --git a/include/fitz/geometry.h b/include/fitz/geometry.h index 78e9e637..8909b229 100644 --- a/include/fitz/geometry.h +++ b/include/fitz/geometry.h @@ -49,6 +49,7 @@ int fz_isrectilinear(fz_matrix m); fz_rect fz_intersectrects(fz_rect a, fz_rect b); fz_rect fz_mergerects(fz_rect a, fz_rect b); +fz_irect fz_roundrect(fz_rect r); fz_irect fz_intersectirects(fz_irect a, fz_irect b); fz_irect fz_mergeirects(fz_irect a, fz_irect b); diff --git a/include/fitz/math.h b/include/fitz/math.h index b2f1bf24..4dee81fc 100644 --- a/include/fitz/math.h +++ b/include/fitz/math.h @@ -1,19 +1,7 @@ /* multiply 8-bit fixpoint (0..1) so that 0*0==0 and 255*255==255 */ -static inline unsigned char fz_mul255(unsigned char a, unsigned char b) -{ - return (a * ((unsigned int)b + 1)) >> 8; -} - -/* floor / ceil towards/from +/- inf */ -static inline float fz_floor(float x) -{ - return floor(x); -} - -static inline float fz_ceil(float x) -{ - return ceil(x); -} +#define fz_mul255(a,b) (((a) * ((b) + 1)) >> 8) +#define fz_floor(x) floor(x) +#define fz_ceil(x) ceil(x) /* divide and floor towards -inf */ static inline int fz_idiv(int a, int b) diff --git a/include/fitz/object.h b/include/fitz/object.h index 41025b8b..777e889f 100644 --- a/include/fitz/object.h +++ b/include/fitz/object.h @@ -1,8 +1,6 @@ typedef struct fz_obj_s fz_obj; -typedef enum fz_objkind_e fz_objkind; - -enum fz_objkind_e +typedef enum fz_objkind_e { FZ_NULL, FZ_BOOL, @@ -13,8 +11,8 @@ enum fz_objkind_e FZ_ARRAY, FZ_DICT, FZ_INDIRECT, - FZ_POINTER, -}; + FZ_POINTER +} fz_objkind; struct fz_keyval_s { @@ -33,9 +31,9 @@ struct fz_obj_s float f; struct { unsigned short len; - unsigned char buf[]; + char buf[1]; } s; - unsigned char n[1]; + char n[1]; struct { int len; int cap; diff --git a/include/fitz/path.h b/include/fitz/path.h index f128d86e..f0a3d573 100644 --- a/include/fitz/path.h +++ b/include/fitz/path.h @@ -1,11 +1,21 @@ -typedef enum fz_pathkind_e fz_pathkind; -typedef enum fz_pathelkind_e fz_pathelkind; typedef struct fz_stroke_s fz_stroke; typedef struct fz_dash_s fz_dash; typedef union fz_pathel_s fz_pathel; -enum fz_pathkind_e { FZ_STROKE, FZ_FILL, FZ_EOFILL }; -enum fz_pathelkind_e { FZ_MOVETO, FZ_LINETO, FZ_CURVETO, FZ_CLOSEPATH }; +typedef enum fz_pathkind_e +{ + FZ_STROKE, + FZ_FILL, + FZ_EOFILL +} fz_pathkind; + +typedef enum fz_pathelkind_e +{ + FZ_MOVETO, + FZ_LINETO, + FZ_CURVETO, + FZ_CLOSEPATH +} fz_pathelkind; struct fz_stroke_s { @@ -19,7 +29,7 @@ struct fz_dash_s { int len; float phase; - float array[]; + float array[FZ_FLEX]; }; union fz_pathel_s diff --git a/include/fitz/render.h b/include/fitz/render.h index ac25a09d..53030a9c 100644 --- a/include/fitz/render.h +++ b/include/fitz/render.h @@ -9,7 +9,7 @@ struct fz_renderer_s fz_gel *gel; fz_ael *ael; int mode; - int x, y, w, h; + fz_irect clip; fz_pixmap *tmp; fz_pixmap *acc; unsigned char r, g, b; @@ -23,5 +23,5 @@ fz_error *fz_rendermask(fz_renderer *gc, fz_masknode *mask, fz_matrix ctm); fz_error *fz_rendertransform(fz_renderer *gc, fz_transformnode *xform, fz_matrix ctm); fz_error *fz_rendertext(fz_renderer *gc, fz_textnode *text, fz_matrix ctm); fz_error *fz_rendernode(fz_renderer *gc, fz_node *node, fz_matrix ctm); -fz_error *fz_rendertree(fz_pixmap **out, fz_renderer *gc, fz_tree *tree, fz_matrix ctm, fz_rect bbox); +fz_error *fz_rendertree(fz_pixmap **out, fz_renderer *gc, fz_tree *tree, fz_matrix ctm, fz_irect bbox); diff --git a/include/fitz/scanconv.h b/include/fitz/scanconv.h index 8fefe271..675d6806 100644 --- a/include/fitz/scanconv.h +++ b/include/fitz/scanconv.h @@ -29,6 +29,7 @@ struct fz_ael_s fz_error *fz_newgel(fz_gel **gelp); fz_error *fz_insertgel(fz_gel *gel, float x0, float y0, float x1, float y1); +fz_irect fz_boundgel(fz_gel *gel); void fz_resetgel(fz_gel *gel, int hs, int vs); void fz_sortgel(fz_gel *gel); void fz_dropgel(fz_gel *gel); diff --git a/include/fitz/sysdep.h b/include/fitz/sysdep.h index 3e0f3232..dd4b8fd3 100644 --- a/include/fitz/sysdep.h +++ b/include/fitz/sysdep.h @@ -14,11 +14,17 @@ #include <errno.h> #include <fcntl.h> /* O_RDONLY & co */ -#ifdef _ISOC99_SOURCE -#elif __GNUC__ -#define restrict __restrict__ +#ifdef HAVE_C99 + +#define FZ_FLEX + #else + +#define FZ_FLEX 0 #define restrict +#define inline __inline__ +#define va_copy(a,b) (a) = (b) + #endif #ifdef WIN32 @@ -50,7 +56,10 @@ #else +#ifndef O_BINARY #define O_BINARY 0 +#endif + #include <unistd.h> #endif diff --git a/include/fitz/tree.h b/include/fitz/tree.h index b5cd8c8e..eebf2c38 100644 --- a/include/fitz/tree.h +++ b/include/fitz/tree.h @@ -19,9 +19,6 @@ void fz_insertnode(fz_node *parent, fz_node *child); /* node types */ -typedef enum fz_nodekind_e fz_nodekind; -typedef enum fz_blendkind_e fz_blendkind; - typedef struct fz_transformnode_s fz_transformnode; typedef struct fz_overnode_s fz_overnode; typedef struct fz_masknode_s fz_masknode; @@ -34,7 +31,7 @@ typedef struct fz_shadenode_s fz_shadenode; typedef struct fz_linknode_s fz_linknode; typedef struct fz_metanode_s fz_metanode; -enum fz_nodekind_e +typedef enum fz_nodekind_e { FZ_NTRANSFORM, FZ_NOVER, @@ -47,9 +44,9 @@ enum fz_nodekind_e FZ_NSHADE, FZ_NLINK, FZ_NMETA -}; +} fz_nodekind; -enum fz_blendkind_e +typedef enum fz_blendkind_e { /* PDF 1.4 -- standard separable */ FZ_BNORMAL, @@ -72,8 +69,8 @@ enum fz_blendkind_e FZ_BLUMINOSITY, FZ_BOVERPRINT, - FZ_BRASTEROP, -}; + FZ_BRASTEROP +} fz_blendkind; struct fz_node_s { @@ -113,7 +110,7 @@ struct fz_colornode_s fz_node super; fz_colorspace *cs; int n; - float samples[]; + float samples[FZ_FLEX]; }; struct fz_linknode_s diff --git a/include/mupdf/syntax.h b/include/mupdf/syntax.h index ce9d9c80..a56c5f18 100644 --- a/include/mupdf/syntax.h +++ b/include/mupdf/syntax.h @@ -20,10 +20,10 @@ enum int pdf_lex(fz_file *f, unsigned char *buf, int n, int *len); /* parse.c */ -fz_error *pdf_parsearray(fz_obj **op, fz_file *f, unsigned char *buf, int cap); -fz_error *pdf_parsedict(fz_obj **op, fz_file *f, unsigned char *buf, int cap); -fz_error *pdf_parsestmobj(fz_obj **op, fz_file *f, unsigned char *buf, int cap); -fz_error *pdf_parseindobj(fz_obj **op, fz_file *f, unsigned char *buf, int cap, int *oid, int *gid, int *stmofs); +fz_error *pdf_parsearray(fz_obj **op, fz_file *f, char *buf, int cap); +fz_error *pdf_parsedict(fz_obj **op, fz_file *f, char *buf, int cap); +fz_error *pdf_parsestmobj(fz_obj **op, fz_file *f, char *buf, int cap); +fz_error *pdf_parseindobj(fz_obj **op, fz_file *f, char *buf, int cap, int *oid, int *gid, int *stmofs); /* * Encryption diff --git a/include/mupdf/xref.h b/include/mupdf/xref.h index 2ccd3710..e189ba6a 100644 --- a/include/mupdf/xref.h +++ b/include/mupdf/xref.h @@ -34,7 +34,7 @@ struct pdf_xrefentry_s char type; /* 0=unset (f)ree i(n)use (o)bjstm (d)elete (a)dd */ char mark; /* for garbage collection etc */ fz_buffer *stmbuf; /* in-memory stream */ - unsigned int stmofs; /* on-disk stream */ + int stmofs; /* on-disk stream */ fz_obj *obj; /* stored/cached object */ }; @@ -70,6 +70,6 @@ fz_error *pdf_garbagecollect(pdf_xref *xref); fz_error *pdf_transplant(pdf_xref *dst, pdf_xref *src, fz_obj **newp, fz_obj *old); /* private */ -fz_error *pdf_loadobjstm(pdf_xref *xref, int oid, int gen, unsigned char *buf, int cap); +fz_error *pdf_loadobjstm(pdf_xref *xref, int oid, int gen, char *buf, int cap); fz_error *pdf_decryptpdf(pdf_xref *xref); |