summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2013-07-14 15:52:08 +0200
committerSebastian Rasmussen <sebras@gmail.com>2013-07-26 01:58:56 +0200
commit13fea96f5290a7abd52611bb96c2486e2ecc2169 (patch)
tree3884657b6655f6bae2aae716cf55da7ab9500a24 /docs
parentcbf0c46d67df087483d577372a3c4cb43e670ac9 (diff)
downloadmupdf-13fea96f5290a7abd52611bb96c2486e2ecc2169.tar.xz
Update single- and multi-threaded example mupdf usage.
Diffstat (limited to 'docs')
-rw-r--r--docs/example.c8
-rw-r--r--docs/multi-threaded.c13
2 files changed, 14 insertions, 7 deletions
diff --git a/docs/example.c b/docs/example.c
index 1a21c200..cf7d0176 100644
--- a/docs/example.c
+++ b/docs/example.c
@@ -2,7 +2,11 @@
// Compile a debug build of mupdf, then compile and run this example:
//
-// gcc -g -o build/debug/example -Iinclude doc/example.c build/debug/lib*.a -lm
+// gcc -g -o build/debug/example -Iinclude docs/example.c \
+// build/debug/libmupdf.a build/debug/libmupdf-js-none.a \
+// build/debug/libfreetype.a build/debug/libjbig2dec.a \
+// build/debug/libjpeg.a build/debug/libopenjpeg.a \
+// build/debug/libz.a -lm
//
// build/debug/example /path/to/document.pdf 1 200 25
@@ -90,7 +94,7 @@ render(char *filename, int pagenumber, int zoom, int rotation)
int main(int argc, char **argv)
{
- char *filename = argv[1];
+ char *filename = argc >= 2 ? argv[1] : "";
int pagenumber = argc > 2 ? atoi(argv[2]) : 1;
int zoom = argc > 3 ? atoi(argv[3]) : 100;
int rotation = argc > 4 ? atoi(argv[4]) : 0;
diff --git a/docs/multi-threaded.c b/docs/multi-threaded.c
index 3141e3c4..57e76070 100644
--- a/docs/multi-threaded.c
+++ b/docs/multi-threaded.c
@@ -13,8 +13,11 @@
// Compile a debug build of mupdf, then compile and run this example:
//
-// gcc -g -o build/debug/example-mt -Iinclude doc/multi-threading.c \
-// build/debug/lib*.a -lpthread -lm
+// gcc -g -o build/debug/example-mt -Iinclude docs/multi-threaded.c \
+// build/debug/libmupdf.a build/debug/libmupdf-js-none.a \
+// build/debug/libfreetype.a build/debug/libjbig2dec.a \
+// build/debug/libjpeg.a build/debug/libopenjpeg.a \
+// build/debug/libz.a -lpthread -lm
//
// build/debug/example-mt /path/to/document.pdf
//
@@ -32,7 +35,7 @@
void
fail(char *msg)
{
- fprintf(stderr, "%s", msg);
+ fprintf(stderr, "%s\n", msg);
abort();
}
@@ -127,7 +130,7 @@ void unlock_mutex(void *user, int lock)
int main(int argc, char **argv)
{
- char *filename = argv[1];
+ char *filename = argc >= 2 ? argv[1] : "";
pthread_t *thread = NULL;
fz_locks_context locks;
pthread_mutex_t mutex[FZ_LOCK_MAX];
@@ -243,7 +246,7 @@ int main(int argc, char **argv)
// they were allocated by the main thread above.
fz_drop_pixmap(ctx, data->pix);
- fz_free_display_list(ctx, data->list);
+ fz_drop_display_list(ctx, data->list);
// Free the data structured passed back and forth
// between the main thread and rendering thread.