summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2012-01-11 23:27:22 +0100
committerTor Andersson <tor.andersson@artifex.com>2012-01-11 23:27:22 +0100
commitaaf451799bb046b6758a73fdb3c8fb88692ac776 (patch)
tree13ede9863b14778c3e1feee9e9f2fa230842d6df
parent209f30bee3121bbae32799b0bbb10f5e6db4158c (diff)
downloadmupdf-aaf451799bb046b6758a73fdb3c8fb88692ac776.tar.xz
Use enum for FZ_STORE_DEFAULT default size.
-rw-r--r--android/jni/mupdf.c3
-rw-r--r--apps/pdfclean.c2
-rw-r--r--apps/pdfdraw.c2
-rw-r--r--apps/pdfextract.c2
-rw-r--r--apps/pdfinfo.c2
-rw-r--r--apps/pdfshow.c2
-rw-r--r--apps/win_main.c2
-rw-r--r--apps/x11_main.c2
-rw-r--r--apps/xpsdraw.c2
-rw-r--r--fitz/base_context.c2
-rw-r--r--fitz/fitz.h3
-rw-r--r--scripts/cmapdump.c2
12 files changed, 13 insertions, 13 deletions
diff --git a/android/jni/mupdf.c b/android/jni/mupdf.c
index 48ffbe87..ee6a9cc5 100644
--- a/android/jni/mupdf.c
+++ b/android/jni/mupdf.c
@@ -51,7 +51,8 @@ Java_com_artifex_mupdf_MuPDFCore_openFile(JNIEnv * env, jobject thiz, jstring jf
if (accelerate)
fz_accelerate();
- ctx = fz_new_context(&fz_alloc_default, FZ_STORE_UNLIMITED);
+ /* 128 MB store for low memory devices. Tweak as necessary. */
+ ctx = fz_new_context(NULL, 128 << 20);
if (!ctx)
{
LOGE("Failed to initialise context");
diff --git a/apps/pdfclean.c b/apps/pdfclean.c
index 583da83f..0f3474ce 100644
--- a/apps/pdfclean.c
+++ b/apps/pdfclean.c
@@ -768,7 +768,7 @@ int main(int argc, char **argv)
if (argc - fz_optind > 0)
subset = 1;
- ctx = fz_new_context(NULL, 0);
+ ctx = fz_new_context(NULL, FZ_STORE_UNLIMITED);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c
index b0ed7707..885103bc 100644
--- a/apps/pdfdraw.c
+++ b/apps/pdfdraw.c
@@ -408,7 +408,7 @@ int main(int argc, char **argv)
if (accelerate)
fz_accelerate();
- ctx = fz_new_context(NULL, 0);
+ ctx = fz_new_context(NULL, FZ_STORE_DEFAULT);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/pdfextract.c b/apps/pdfextract.c
index ef8383ad..0e87cf9f 100644
--- a/apps/pdfextract.c
+++ b/apps/pdfextract.c
@@ -182,7 +182,7 @@ int main(int argc, char **argv)
infile = argv[fz_optind++];
- ctx = fz_new_context(NULL, 0);
+ ctx = fz_new_context(NULL, FZ_STORE_UNLIMITED);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/pdfinfo.c b/apps/pdfinfo.c
index c0f5c6c6..a38e4f09 100644
--- a/apps/pdfinfo.c
+++ b/apps/pdfinfo.c
@@ -971,7 +971,7 @@ int main(int argc, char **argv)
if (fz_optind == argc)
infousage();
- ctx = fz_new_context(NULL, 0);
+ ctx = fz_new_context(NULL, FZ_STORE_UNLIMITED);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/pdfshow.c b/apps/pdfshow.c
index ec2fedbd..a84e962b 100644
--- a/apps/pdfshow.c
+++ b/apps/pdfshow.c
@@ -198,7 +198,7 @@ int main(int argc, char **argv)
filename = argv[fz_optind++];
- ctx = fz_new_context(NULL, 0);
+ ctx = fz_new_context(NULL, FZ_STORE_UNLIMITED);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/win_main.c b/apps/win_main.c
index a618cf44..8ccdee65 100644
--- a/apps/win_main.c
+++ b/apps/win_main.c
@@ -831,7 +831,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShow
fz_accelerate();
- ctx = fz_new_context(NULL, 0);
+ ctx = fz_new_context(NULL, FZ_STORE_DEFAULT);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/x11_main.c b/apps/x11_main.c
index 45c6fc49..8ab20674 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -587,7 +587,7 @@ int main(int argc, char **argv)
struct timeval tmo;
struct timeval *timeout;
- ctx = fz_new_context(NULL, 0);
+ ctx = fz_new_context(NULL, FZ_STORE_DEFAULT);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/apps/xpsdraw.c b/apps/xpsdraw.c
index 8509605c..cbf7f802 100644
--- a/apps/xpsdraw.c
+++ b/apps/xpsdraw.c
@@ -319,7 +319,7 @@ int main(int argc, char **argv)
if (accelerate)
fz_accelerate();
- ctx = fz_new_context(NULL, 0);
+ ctx = fz_new_context(NULL, FZ_STORE_DEFAULT);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
diff --git a/fitz/base_context.c b/fitz/base_context.c
index f77d3987..8991a565 100644
--- a/fitz/base_context.c
+++ b/fitz/base_context.c
@@ -43,8 +43,6 @@ fz_new_context(fz_alloc_context *alloc, unsigned int max_store)
if (!alloc)
alloc = &fz_alloc_default;
- if (max_store == 0)
- max_store = 256 << 20;
ctx = alloc->malloc(alloc->user, sizeof(fz_context));
if (!ctx)
diff --git a/fitz/fitz.h b/fitz/fitz.h
index 7bb12397..d38945b8 100644
--- a/fitz/fitz.h
+++ b/fitz/fitz.h
@@ -729,7 +729,8 @@ struct fz_storable_s {
} while (0)
enum {
- FZ_STORE_UNLIMITED = 0
+ FZ_STORE_UNLIMITED = 0,
+ FZ_STORE_DEFAULT = 256 << 20,
};
void fz_new_store_context(fz_context *ctx, unsigned int max);
diff --git a/scripts/cmapdump.c b/scripts/cmapdump.c
index 99983992..2d318f14 100644
--- a/scripts/cmapdump.c
+++ b/scripts/cmapdump.c
@@ -49,7 +49,7 @@ main(int argc, char **argv)
return 1;
}
- ctx = fz_new_context(&fz_alloc_default, FZ_STORE_UNLIMITED);
+ ctx = fz_new_context(NULL, FZ_STORE_UNLIMITED);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");