summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@hotmail.com>2008-03-22 12:09:34 +0100
committerSebastian Rasmussen <sebras@hotmail.com>2008-03-22 12:09:34 +0100
commite8d620594f97876ebfda5ea393a8bf3d70db3201 (patch)
tree3e0fb1ec90e6c6a0eeb11bbef3434b45f55ddef6 /apps
parent9d4afbcd0ccc98159ff72fe580e217069b742577 (diff)
downloadmupdf-e8d620594f97876ebfda5ea393a8bf3d70db3201.tar.xz
Revert to using boolean to indicate good/bad password.
Diffstat (limited to 'apps')
-rw-r--r--apps/common/pdfapp.c9
-rw-r--r--apps/mozilla/moz_main.c12
-rw-r--r--apps/pdftool.c6
3 files changed, 9 insertions, 18 deletions
diff --git a/apps/common/pdfapp.c b/apps/common/pdfapp.c
index 9174cbc1..9e0d4962 100644
--- a/apps/common/pdfapp.c
+++ b/apps/common/pdfapp.c
@@ -105,15 +105,14 @@ void pdfapp_open(pdfapp_t *app, char *filename)
if (app->xref->crypt)
{
- error = pdf_setpassword(app->xref->crypt, password);
- while (error)
+ int okay = pdf_setpassword(app->xref->crypt, password);
+ while (!okay)
{
- fz_droperror(error);
password = winpassword(app, filename);
if (!password)
exit(1);
- error = pdf_setpassword(app->xref->crypt, password);
- if (error)
+ okay = pdf_setpassword(app->xref->crypt, password);
+ if (!okay)
pdfapp_warn(app, "Invalid password.");
}
}
diff --git a/apps/mozilla/moz_main.c b/apps/mozilla/moz_main.c
index 4c38b78b..4e78596f 100644
--- a/apps/mozilla/moz_main.c
+++ b/apps/mozilla/moz_main.c
@@ -115,17 +115,9 @@ void pdfmoz_open(pdfmoz_t *moz, char *filename)
if (moz->xref->crypt)
{
- error = pdf_setpassword(moz->xref->crypt, password);
- // while (error)
- // {
- // fz_droperror(error);
- // password = winpassword(moz, filename);
- // if (!password)
- // exit(1);
- // error = pdf_setpassword(moz->xref->crypt, password);
- if (error)
+ int okay = pdf_setpassword(moz->xref->crypt, password);
+ if (!okay)
pdfmoz_warn(moz, "Invalid password.");
- // }
}
/*
diff --git a/apps/pdftool.c b/apps/pdftool.c
index 559eca03..3daeb777 100644
--- a/apps/pdftool.c
+++ b/apps/pdftool.c
@@ -83,9 +83,9 @@ void opensrc(char *filename, char *password, int loadpages)
if (src->crypt)
{
- error = pdf_setpassword(src->crypt, password);
- if (error)
- die(fz_rethrow(error, "invalid password"));
+ int okay = pdf_setpassword(src->crypt, password);
+ if (!okay)
+ die(fz_throw("invalid password"));
}
if (loadpages)