From c53dffba5c52f325f598f56efbddf4be8812393e Mon Sep 17 00:00:00 2001 From: Eric Toombs Date: Tue, 17 Mar 2009 00:34:54 -0400 Subject: [PATCH] minor adjustments and added commentary in PDFDoc::PDFDoc() --- poppler/PDFDoc.cc | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 8292bf8..e3582db 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -99,20 +99,30 @@ PDFDoc::PDFDoc(GooString *fileNameA, GooString *ownerPassword, file = fopen(fn->getCString(), "rb"); #endif if (file != NULL) + // fopen() has succeeded! break; + + // fopen() has failed. if (errno != ENOENT || trial == 3) { + /* + * Either an error has occurred other than "No such file or + * directory", or we are on trial 3 and we are out of alternative file + * names. + */ error(-1, "Couldn't open file '%s': %s.", fn->getCString(), - strerror(errno)); + strerror(errno)); errCode = errOpenFile; // Keep a copy of the errno returned by fopen so that it can be // referred to later. fopenErrno = errno; return; } + + // fn wasn't found. if (trial == 1) - fn->lowerCase(); - if (trial == 2) - fn->upperCase(); + fn->lowerCase(); + else //if (trial == 2) implicit; 3 and 1 have already been checked for. + fn->upperCase(); } delete fn; } -- 1.6.0.6