summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2011-11-16 22:49:26 +0100
committerAlbert Astals Cid <aacid@kde.org>2011-11-16 22:49:26 +0100
commit3144c042d60e1bbb1ba0ee9b430a78ab2c8e155e (patch)
tree774af532f65ecb745f7e460e1de269024af4d6e8
parentd97cbcb990cf10ce16e152139004e1b19ae86ddf (diff)
xpdf303: Add fileNameU to windows builds
-rw-r--r--ALL_DIFF160
1 files changed, 3 insertions, 157 deletions
diff --git a/ALL_DIFF b/ALL_DIFF
index e74e3e8..844f196 100644
--- a/ALL_DIFF
+++ b/ALL_DIFF
@@ -12542,131 +12542,6 @@ diff -ru xpdf-3.02/xpdf/PDFDoc.cc xpdf-3.03/xpdf/PDFDoc.cc
#include "PDFDoc.h"
//------------------------------------------------------------------------
-@@ -48,14 +49,17 @@
- //------------------------------------------------------------------------
-
- PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword,
- GString *userPassword, void *guiDataA) {
- Object obj;
- GString *fileName1, *fileName2;
-+#ifdef WIN32
-+ int n, i;
-+#endif
-
- ok = gFalse;
- errCode = errNone;
-
- guiData = guiDataA;
-
- file = NULL;
- str = NULL;
-@@ -64,16 +68,25 @@
- #ifndef DISABLE_OUTLINE
- outline = NULL;
- #endif
-+ optContent = NULL;
-
- fileName = fileNameA;
-- fileName1 = fileName;
-+#ifdef WIN32
-+ n = fileName->getLength();
-+ fileNameU = (wchar_t *)gmallocn(n + 1, sizeof(wchar_t));
-+ for (i = 0; i < n; ++i) {
-+ fileNameU[i] = (wchar_t)(fileName->getChar(i) & 0xff);
-+ }
-+ fileNameU[n] = L'\0';
-+#endif
-
-+ fileName1 = fileName;
-
- // try to open file
- fileName2 = NULL;
- #ifdef VMS
- if (!(file = fopen(fileName1->getCString(), "rb", "ctx=stm"))) {
- error(errIO, -1, "Couldn't open file '{0:t}'", fileName1);
- errCode = errOpenFile;
- return;
- }
-@@ -103,16 +116,15 @@
-
- #ifdef WIN32
- PDFDoc::PDFDoc(wchar_t *fileNameA, int fileNameLen, GString *ownerPassword,
- GString *userPassword, void *guiDataA) {
- OSVERSIONINFO version;
-- wchar_t fileName2[_MAX_PATH + 1];
- Object obj;
- int i;
-
- ok = gFalse;
- errCode = errNone;
-
- guiData = guiDataA;
-
- file = NULL;
- str = NULL;
-@@ -121,26 +133,24 @@
- #ifndef DISABLE_OUTLINE
- outline = NULL;
- #endif
-+ optContent = NULL;
-
-- //~ file name should be stored in Unicode (?)
-+ // save both Unicode and 8-bit copies of the file name
- fileName = new GString();
-+ fileNameU = (wchar_t *)gmallocn(fileNameLen + 1, sizeof(wchar_t));
- for (i = 0; i < fileNameLen; ++i) {
- fileName->append((char)fileNameA[i]);
-+ fileNameU[i] = fileNameA[i];
- }
--
-- // zero-terminate the file name string
-- for (i = 0; i < fileNameLen && i < _MAX_PATH; ++i) {
-- fileName2[i] = fileNameA[i];
-- }
-- fileName2[i] = 0;
-+ fileNameU[fileNameLen] = L'\0';
-
- // try to open file
- // NB: _wfopen is only available in NT
- version.dwOSVersionInfoSize = sizeof(version);
- GetVersionEx(&version);
- if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
-- file = _wfopen(fileName2, L"rb");
-+ file = _wfopen(fileNameU, L"rb");
- } else {
- file = fopen(fileName->getCString(), "rb");
- }
- if (!file) {
-@@ -158,14 +168,29 @@
- #endif
-
- PDFDoc::PDFDoc(BaseStream *strA, GString *ownerPassword,
- GString *userPassword, void *guiDataA) {
-+#ifdef WIN32
-+ int n, i;
-+#endif
-+
- ok = gFalse;
- errCode = errNone;
- guiData = guiDataA;
- if (strA->getFileName()) {
- fileName = strA->getFileName()->copy();
-+#ifdef WIN32
-+ n = fileName->getLength();
-+ fileNameU = (wchar_t *)gmallocn(n + 1, sizeof(wchar_t));
-+ for (i = 0; i < n; ++i) {
-+ fileNameU[i] = (wchar_t)(fileName->getChar(i) & 0xff);
-+ }
-+ fileNameU[n] = L'\0';
-+#endif
- } else {
- fileName = NULL;
-+#ifdef WIN32
-+ fileNameU = NULL;
-+#endif
- }
- file = NULL;
- str = strA;
@@ -174,6 +199,7 @@
#ifndef DISABLE_OUTLINE
outline = NULL;
@@ -12756,18 +12631,6 @@ diff -ru xpdf-3.02/xpdf/PDFDoc.cc xpdf-3.03/xpdf/PDFDoc.cc
#ifndef DISABLE_OUTLINE
if (outline) {
delete outline;
-@@ -235,6 +294,11 @@
- if (fileName) {
- delete fileName;
- }
-+#ifdef WIN32
-+ if (fileNameU) {
-+ gfree(fileNameU);
-+ }
-+#endif
- }
-
- // Check for a PDF header on this stream. Skip past some garbage
@@ -280,7 +345,10 @@
xref->getTrailerDict()->dictLookup("Encrypt", &encrypt);
if ((encrypted = encrypt.isDict())) {
@@ -12805,20 +12668,9 @@ diff -ru xpdf-3.02/xpdf/PDFDoc.h xpdf-3.03/xpdf/PDFDoc.h
class LinkDest;
class Outline;
+class OptionalContent;
-+class PDFCore;
//------------------------------------------------------------------------
// PDFDoc
-@@ -53,6 +55,9 @@
-
- // Get file name.
- GString *getFileName() { return fileName; }
-+#ifdef WIN32
-+ wchar_t *getFileNameU() { return fileNameU; }
-+#endif
-
- // Get the xref table.
- XRef *getXRef() { return xref; }
@@ -128,6 +133,9 @@
Outline *getOutline() { return outline; }
#endif
@@ -12830,12 +12682,6 @@ diff -ru xpdf-3.02/xpdf/PDFDoc.h xpdf-3.03/xpdf/PDFDoc.h
GBool isEncrypted() { return xref->isEncrypted(); }
@@ -154,27 +162,44 @@
- // Save this file with another name.
- GBool saveAs(GString *name);
-
- // Return a pointer to the GUI (XPDFCore or WinPDFCore object).
- void *getGUIData() { return guiData; }
-
private:
GBool setup(GString *ownerPassword, GString *userPassword);
@@ -12845,9 +12691,9 @@ diff -ru xpdf-3.02/xpdf/PDFDoc.h xpdf-3.03/xpdf/PDFDoc.h
GBool checkEncryption(GString *ownerPassword, GString *userPassword);
GString *fileName;
-+#ifdef WIN32
-+ wchar_t *fileNameU;
-+#endif
+ #ifdef WIN32
+ wchar_t *fileNameU;
+ #endif
FILE *file;
BaseStream *str;
void *guiData;