summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
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)