[poppler] Branch 'poppler-0.12' - glib/poppler-document.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Thu Jan 7 01:34:14 PST 2010


 glib/poppler-document.cc |   22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

New commits:
commit 2bd99c5a48782bcd85be8801221446038ec35c2d
Author: Hib Eris <hib at hiberis.nl>
Date:   Thu Dec 31 17:52:33 2009 +0100

    [glib] Use PDFDoc(wchar_t *, ...) on Windows
    
    Fixes bug #25032

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index e5b2854..fad45c8 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -161,9 +161,6 @@ poppler_document_new_from_file (const char  *uri,
   if (!filename)
     return NULL;
 
-  filename_g = new GooString (filename);
-  g_free (filename);
-
   password_g = NULL;
   if (password != NULL) {
     if (g_utf8_validate (password, -1, NULL)) {
@@ -180,7 +177,26 @@ poppler_document_new_from_file (const char  *uri,
     }
   }
 
+#ifdef G_OS_WIN32
+  wchar_t *filenameW;
+  int length;
+
+  length = MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0);
+
+  filenameW = new WCHAR[length];
+  if (!filenameW)
+      return NULL;
+
+  length = MultiByteToWideChar(CP_UTF8, 0, filename, -1, filenameW, length);
+
+  newDoc = new PDFDoc(filenameW, length, password_g, password_g);
+  delete filenameW;
+#else
+  filename_g = new GooString (filename);
   newDoc = new PDFDoc(filename_g, password_g, password_g);
+#endif
+  g_free (filename);
+
   delete password_g;
 
   return _poppler_document_new_from_pdfdoc (newDoc, error);


More information about the poppler mailing list