[poppler] Branch 'poppler-0.18' - 2 commits - CMakeLists.txt qt4/src

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Nov 3 12:47:23 PDT 2011


 CMakeLists.txt              |    1 +
 qt4/src/poppler-document.cc |    6 +++---
 qt4/src/poppler-private.h   |   17 +++++++++++++++--
 3 files changed, 19 insertions(+), 5 deletions(-)

New commits:
commit d4da0fc45cf36c481570b37bf6c6938a45f70303
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Nov 2 20:20:41 2011 +0100

    Compile with MSVC needed for last change in the qt4 frontend
    (cherry picked from commit 955cd0c7bd3a72340deba098f4242a4904adc60f)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5614238..8b96580 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -347,6 +347,7 @@ endif(TIFF_FOUND)
 
 if(MSVC)
 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+set(CMAKE_CXX_FLAGS "/Zc:wchar_t- ${CMAKE_CXX_FLAGS}")
 add_library(poppler STATIC ${poppler_SRCS})
 else(MSVC)
 add_library(poppler SHARED ${poppler_SRCS})
commit 5294d0b017ce6643207fce5cc9e85ba4e29f4d86
Author: Hib Eris <hib at hiberis.nl>
Date:   Tue Nov 1 14:15:09 2011 +0100

    qt4: Use PDFDoc(wchar_t *, ...) on Windows
    
    Bug 35378
    (cherry picked from commit e0f5bc1deebaa9861baffd7c9ba31ea31585cd1d)

diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
index 04c56c6..7b3e1af 100644
--- a/qt4/src/poppler-document.cc
+++ b/qt4/src/poppler-document.cc
@@ -3,7 +3,7 @@
  * Copyright (C) 2005, 2008, Brad Hards <bradh at frogmouth.net>
  * Copyright (C) 2005-2010, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2006-2010, Pino Toscano <pino at kde.org>
- * Copyright (C) 2010 Hib Eris <hib at hiberis.nl>
+ * Copyright (C) 2010, 2011 Hib Eris <hib at hiberis.nl>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ namespace Poppler {
   Document *Document::load(const QString &filePath, const QByteArray &ownerPassword,
 			   const QByteArray &userPassword)
     {
-	DocumentData *doc = new DocumentData(new GooString(QFile::encodeName(filePath)), 
+	DocumentData *doc = new DocumentData(filePath, 
 					     new GooString(ownerPassword.data()),
 					     new GooString(userPassword.data()));
 	return DocumentData::checkDocument(doc);
@@ -128,7 +128,7 @@ namespace Poppler {
 	    }
 	    else
 	    {
-		doc2 = new DocumentData(new GooString(m_doc->doc->getFileName()),
+		doc2 = new DocumentData(m_doc->m_filePath,
 					new GooString(ownerPassword.data()),
 					new GooString(userPassword.data()));
 	    }
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index 6d2b315..36af055 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -4,6 +4,7 @@
  * Copyright (C) 2006-2009, 2011 by Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2007-2009, 2011 by Pino Toscano <pino at kde.org>
  * Copyright (C) 2011 Andreas Hartmetz <ahartmetz at gmail.com>
+ * Copyright (C) 2011 Hib Eris <hib at hiberis.nl>
  * Inspired on code by
  * Copyright (C) 2004 by Albert Astals Cid <tsdgeos at terra.es>
  * Copyright (C) 2004 by Enrico Ros <eros.kde at email.it>
@@ -75,10 +76,21 @@ namespace Poppler {
 
     class DocumentData {
     public:
-	DocumentData(GooString *filePath, GooString *ownerPassword, GooString *userPassword)
+	DocumentData(const QString &filePath, GooString *ownerPassword, GooString *userPassword)
 	    {
 		init();
-		doc = new PDFDoc(filePath, ownerPassword, userPassword);
+		m_filePath = filePath;	
+
+#if defined(_WIN32)
+		wchar_t *fileName = new WCHAR[filePath.length()];
+		int length = filePath.toWCharArray(fileName); 
+		doc = new PDFDoc(fileName, length, ownerPassword, userPassword);
+		delete fileName;
+#else
+		GooString *fileName = new GooString(QFile::encodeName(filePath));
+		doc = new PDFDoc(fileName, ownerPassword, userPassword);
+#endif
+
 		delete ownerPassword;
 		delete userPassword;
 	    }
@@ -173,6 +185,7 @@ namespace Poppler {
 	static Document *checkDocument(DocumentData *doc);
 
 	PDFDoc *doc;
+	QString m_filePath;
 	QByteArray fileContents;
 	bool locked;
 	FontIterator *m_fontInfoIterator;


More information about the poppler mailing list