[poppler] poppler/PDFDoc.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Mar 25 13:12:30 PDT 2009


 poppler/PDFDoc.cc |   39 ++++++++++-----------------------------
 1 file changed, 10 insertions(+), 29 deletions(-)

New commits:
commit 4acde05ac4d0b03466c949138321cc3445a14158
Author: Eric Toombs <ewtoombs at uwaterloo.ca>
Date:   Wed Mar 25 21:11:03 2009 +0100

    Remove case-insensitive matching of filenames in PDFDoc constructor

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index e83652c..d0d7e22 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -90,40 +90,21 @@ PDFDoc::PDFDoc(GooString *fileNameA, GooString *ownerPassword,
   fileName = fileNameA;
 
   // try to open file
-  GooString *fn = fileName->copy(); //a modifiable copy of fileName
-  for (int trial = 1; trial <= 3; trial++) {
 #ifdef VMS
-    file = fopen(fn->getCString(), "rb", "ctx=stm");
+  file = fopen(fileName->getCString(), "rb", "ctx=stm");
 #else
-    file = fopen(fn->getCString(), "rb");
+  file = fopen(fileName->getCString(), "rb");
 #endif
-    if (file != NULL)
-      // fopen() has succeeded!
-      break;
-
+  if (file == NULL) {
     // 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.", fileName->getCString(),
-                                                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();
-    else //if (trial == 2) implicit; 3 and 1 have already been checked for.
-      fn->upperCase();
+    // Keep a copy of the errno returned by fopen so that it can be 
+    // referred to later.
+    fopenErrno = errno;
+    error(-1, "Couldn't open file '%s': %s.", fileName->getCString(),
+                                              strerror(errno));
+    errCode = errOpenFile;
+    return;
   }
-  delete fn;
 
   // create stream
   obj.initNull();


More information about the poppler mailing list