"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xpdf/PDFDoc.cc" between
xpdf-4.01.01.tar.gz and xpdf-4.02.tar.gz

About: Xpdf is a PDF viewer for X.

PDFDoc.cc  (xpdf-4.01.01):PDFDoc.cc  (xpdf-4.02)
skipping to change at line 49 skipping to change at line 49
#include "Outline.h" #include "Outline.h"
#endif #endif
#include "OptionalContent.h" #include "OptionalContent.h"
#include "PDFDoc.h" #include "PDFDoc.h"
//------------------------------------------------------------------------ //------------------------------------------------------------------------
#define headerSearchSize 1024 // read this many bytes at beginning of #define headerSearchSize 1024 // read this many bytes at beginning of
// file to look for '%PDF' // file to look for '%PDF'
// Avoid sharing files with child processes on Windows, where sharing
// can cause problems.
#ifdef _WIN32
# define fopenReadMode "rbN"
# define wfopenReadMode L"rbN"
#else
# define fopenReadMode "rb"
#endif
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// PDFDoc // PDFDoc
//------------------------------------------------------------------------ //------------------------------------------------------------------------
PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword, PDFDoc::PDFDoc(GString *fileNameA, GString *ownerPassword,
GString *userPassword, PDFCore *coreA) { GString *userPassword, PDFCore *coreA) {
Object obj; Object obj;
GString *fileName1, *fileName2; GString *fileName1, *fileName2;
#ifdef _WIN32 #ifdef _WIN32
int n, i; int n, i;
skipping to change at line 78 skipping to change at line 87
fileNameU[i] = (wchar_t)(fileName->getChar(i) & 0xff); fileNameU[i] = (wchar_t)(fileName->getChar(i) & 0xff);
} }
fileNameU[n] = L'\0'; fileNameU[n] = L'\0';
#endif #endif
fileName1 = fileName; fileName1 = fileName;
// try to open file // try to open file
fileName2 = NULL; fileName2 = NULL;
#ifdef VMS #ifdef VMS
if (!(file = fopen(fileName1->getCString(), "rb", "ctx=stm"))) { if (!(file = fopen(fileName1->getCString(), fopenReadMode, "ctx=stm"))) {
error(errIO, -1, "Couldn't open file '{0:t}'", fileName1); error(errIO, -1, "Couldn't open file '{0:t}'", fileName1);
errCode = errOpenFile; errCode = errOpenFile;
return; return;
} }
#else #else
if (!(file = fopen(fileName1->getCString(), "rb"))) { if (!(file = fopen(fileName1->getCString(), fopenReadMode))) {
fileName2 = fileName->copy(); fileName2 = fileName->copy();
fileName2->lowerCase(); fileName2->lowerCase();
if (!(file = fopen(fileName2->getCString(), "rb"))) { if (!(file = fopen(fileName2->getCString(), fopenReadMode))) {
fileName2->upperCase(); fileName2->upperCase();
if (!(file = fopen(fileName2->getCString(), "rb"))) { if (!(file = fopen(fileName2->getCString(), fopenReadMode))) {
error(errIO, -1, "Couldn't open file '{0:t}'", fileName); error(errIO, -1, "Couldn't open file '{0:t}'", fileName);
delete fileName2; delete fileName2;
errCode = errOpenFile; errCode = errOpenFile;
return; return;
} }
} }
delete fileName2; delete fileName2;
} }
#endif #endif
skipping to change at line 130 skipping to change at line 139
fileName->append((char)fileNameA[i]); fileName->append((char)fileNameA[i]);
fileNameU[i] = fileNameA[i]; fileNameU[i] = fileNameA[i];
} }
fileNameU[fileNameLen] = L'\0'; fileNameU[fileNameLen] = L'\0';
// try to open file // try to open file
// NB: _wfopen is only available in NT // NB: _wfopen is only available in NT
version.dwOSVersionInfoSize = sizeof(version); version.dwOSVersionInfoSize = sizeof(version);
GetVersionEx(&version); GetVersionEx(&version);
if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) { if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
file = _wfopen(fileNameU, L"rb"); file = _wfopen(fileNameU, wfopenReadMode);
} else { } else {
file = fopen(fileName->getCString(), "rb"); file = fopen(fileName->getCString(), fopenReadMode);
} }
if (!file) { if (!file) {
error(errIO, -1, "Couldn't open file '{0:t}'", fileName); error(errIO, -1, "Couldn't open file '{0:t}'", fileName);
errCode = errOpenFile; errCode = errOpenFile;
return; return;
} }
// create stream // create stream
obj.initNull(); obj.initNull();
str = new FileStream(file, 0, gFalse, 0, &obj); str = new FileStream(file, 0, gFalse, 0, &obj);
skipping to change at line 179 skipping to change at line 188
fileNameU = (wchar_t *)gmallocn(n + 1, sizeof(wchar_t)); fileNameU = (wchar_t *)gmallocn(n + 1, sizeof(wchar_t));
i = j = 0; i = j = 0;
while (j < n && getUTF8(fileName, &i, &u)) { while (j < n && getUTF8(fileName, &i, &u)) {
fileNameU[j++] = (wchar_t)u; fileNameU[j++] = (wchar_t)u;
} }
fileNameU[n] = L'\0'; fileNameU[n] = L'\0';
// NB: _wfopen is only available in NT // NB: _wfopen is only available in NT
version.dwOSVersionInfoSize = sizeof(version); version.dwOSVersionInfoSize = sizeof(version);
GetVersionEx(&version); GetVersionEx(&version);
if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) { if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
file = _wfopen(fileNameU, L"rb"); file = _wfopen(fileNameU, wfopenReadMode);
} else { } else {
file = fopen(fileName->getCString(), "rb"); file = fopen(fileName->getCString(), fopenReadMode);
} }
#elif defined(VMS) #elif defined(VMS)
file = fopen(fileName->getCString(), "rb", "ctx=stm"); file = fopen(fileName->getCString(), fopenReadMode, "ctx=stm");
#else #else
file = fopen(fileName->getCString(), "rb"); file = fopen(fileName->getCString(), fopenReadMode);
#endif #endif
if (!file) { if (!file) {
error(errIO, -1, "Couldn't open file '{0:t}'", fileName); error(errIO, -1, "Couldn't open file '{0:t}'", fileName);
errCode = errOpenFile; errCode = errOpenFile;
return; return;
} }
// create stream // create stream
obj.initNull(); obj.initNull();
 End of changes. 11 change blocks. 
10 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)