summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-04-15 20:52:28 +0200
committerTor Andersson <tor@ghostscript.com>2010-04-15 20:52:28 +0200
commitda75f62bf264bcb2d942a6a1e58c8e13f85ab8b3 (patch)
tree6c15b193c71068be2cdea3f58b6659d208021f72 /fitz
parentd37913141667b83667b17d9591ff0e751ca953ce (diff)
downloadmupdf-da75f62bf264bcb2d942a6a1e58c8e13f85ab8b3.tar.xz
Simplify API for opening a PDF document.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/base_matrix.c2
-rw-r--r--fitz/fitz_base.h45
-rw-r--r--fitz/fitz_stream.h6
3 files changed, 26 insertions, 27 deletions
diff --git a/fitz/base_matrix.c b/fitz/base_matrix.c
index 0bd700fc..ff5074d6 100644
--- a/fitz/base_matrix.c
+++ b/fitz/base_matrix.c
@@ -142,7 +142,7 @@ fz_invertmatrix(fz_matrix src)
int
fz_isrectilinear(fz_matrix m)
{
- return (fabs(m.b) < FLT_EPSILON && fabs(m.c) < FLT_EPSILON) ||
+ return (fabs(m.b) < FLT_EPSILON && fabs(m.c) < FLT_EPSILON) ||
(fabs(m.a) < FLT_EPSILON && fabs(m.d) < FLT_EPSILON);
}
diff --git a/fitz/fitz_base.h b/fitz/fitz_base.h
index 5c9f03c1..ffcf630c 100644
--- a/fitz/fitz_base.h
+++ b/fitz/fitz_base.h
@@ -33,16 +33,6 @@
#define M_SQRT2 1.41421356237309504880
#endif
-/* Some useful semi-standard functions */
-
-extern char *fz_strsep(char **stringp, const char *delim);
-extern int fz_strlcpy(char *dst, const char *src, int n);
-extern int fz_strlcat(char *dst, const char *src, int n);
-
-extern int fz_getopt(int nargc, char * const * nargv, const char *ostr);
-extern int fz_opterr, fz_optind, fz_optopt;
-extern char *fz_optarg;
-
#ifdef _MSC_VER /* stupid stone-age compiler */
#include <io.h>
@@ -99,7 +89,7 @@ extern unsigned fz_cpuflags;
#ifndef __printflike
#if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7
#define __printflike(fmtarg, firstvararg) \
- __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
+ __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
#else
#define __printflike(fmtarg, firstvararg)
#endif
@@ -133,32 +123,44 @@ extern unsigned fz_cpuflags;
#define CLAMP(x,a,b) ( (x) > (b) ? (b) : ( (x) < (a) ? (a) : (x) ) )
#endif
-/* plan9 stuff for utf-8 */
+/* utf-8 encoding and decoding */
int chartorune(int *rune, char *str);
int runetochar(char *str, int *rune);
int runelen(int c);
+/* useful string functions */
+extern char *fz_strsep(char **stringp, const char *delim);
+extern int fz_strlcpy(char *dst, const char *src, int n);
+extern int fz_strlcat(char *dst, const char *src, int n);
+
+/* getopt */
+extern int fz_getopt(int nargc, char * const * nargv, const char *ostr);
+extern int fz_opterr, fz_optind, fz_optopt;
+extern char *fz_optarg;
+
+/* memory allocation */
+void *fz_malloc(int n);
+void *fz_realloc(void *p, int n);
+void fz_free(void *p);
+char *fz_strdup(char *s);
+
/*
* Error handling.
*/
+
typedef int fz_error;
extern char fz_errorbuf[];
-#define fz_throw(...) fz_throwimp(__FILE__, __LINE__, __func__, __VA_ARGS__)
-#define fz_rethrow(cause, ...) fz_rethrowimp(cause, __FILE__, __LINE__, __func__, __VA_ARGS__)
-#define fz_catch(cause, ...) fz_catchimp(cause, __FILE__, __LINE__, __func__, __VA_ARGS__)
-#define fz_okay ((fz_error)0)
-
void fz_warn(char *fmt, ...) __printflike(1,2);
fz_error fz_throwimp(const char *file, int line, const char *func, char *fmt, ...) __printflike(4, 5);
fz_error fz_rethrowimp(fz_error cause, const char *file, int line, const char *func, char *fmt, ...) __printflike(5, 6);
fz_error fz_catchimp(fz_error cause, const char *file, int line, const char *func, char *fmt, ...) __printflike(5, 6);
-void *fz_malloc(int n);
-void *fz_realloc(void *p, int n);
-void fz_free(void *p);
-char *fz_strdup(char *s);
+#define fz_throw(...) fz_throwimp(__FILE__, __LINE__, __func__, __VA_ARGS__)
+#define fz_rethrow(cause, ...) fz_rethrowimp(cause, __FILE__, __LINE__, __func__, __VA_ARGS__)
+#define fz_catch(cause, ...) fz_catchimp(cause, __FILE__, __LINE__, __func__, __VA_ARGS__)
+#define fz_okay ((fz_error)0)
/*
* Generic hash-table with fixed-length keys.
@@ -202,7 +204,6 @@ extern fz_rect fz_infiniterect;
| c d 0 |
\ e f 1 /
*/
-
struct fz_matrix_s
{
float a, b, c, d, e, f;
diff --git a/fitz/fitz_stream.h b/fitz/fitz_stream.h
index 3f7e5326..1aa3f8f5 100644
--- a/fitz/fitz_stream.h
+++ b/fitz/fitz_stream.h
@@ -7,8 +7,6 @@
#ifndef _FITZ_STREAM_H_
#define _FITZ_STREAM_H_
-typedef struct pdf_xref_s pdf_xref; /* this file is about to be merged with mupdf */
-
typedef struct fz_obj_s fz_obj;
typedef struct fz_keyval_s fz_keyval;
@@ -59,7 +57,7 @@ struct fz_obj_s
struct {
int num;
int gen;
- pdf_xref *xref;
+ struct pdf_xref_s *xref;
fz_obj *obj;
} r;
} u;
@@ -71,7 +69,7 @@ fz_obj * fz_newint(int i);
fz_obj * fz_newreal(float f);
fz_obj * fz_newname(char *str);
fz_obj * fz_newstring(char *str, int len);
-fz_obj * fz_newindirect(int num, int gen, pdf_xref *xref);
+fz_obj * fz_newindirect(int num, int gen, struct pdf_xref_s *xref);
fz_obj * fz_newarray(int initialcap);
fz_obj * fz_newdict(int initialcap);