"Fossies" - the Fresh Open Source Software Archive  

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

About: Xpdf is a PDF viewer for X.

PDFDoc.cc  (xpdf-4.03):PDFDoc.cc  (xpdf-4.04)
skipping to change at line 127 skipping to change at line 127
#ifdef _WIN32 #ifdef _WIN32
PDFDoc::PDFDoc(wchar_t *fileNameA, int fileNameLen, GString *ownerPassword, PDFDoc::PDFDoc(wchar_t *fileNameA, int fileNameLen, GString *ownerPassword,
GString *userPassword, PDFCore *coreA) { GString *userPassword, PDFCore *coreA) {
OSVERSIONINFO version; OSVERSIONINFO version;
Object obj; Object obj;
int i; int i;
init(coreA); init(coreA);
// handle a Windows shortcut // handle a Windows shortcut
wchar_t wPath[MAX_PATH + 1]; wchar_t wPath[winMaxLongPath + 1];
int n = fileNameLen < MAX_PATH ? fileNameLen : MAX_PATH; int n = fileNameLen < winMaxLongPath ? fileNameLen : winMaxLongPath;
memcpy(wPath, fileNameA, n * sizeof(wchar_t)); memcpy(wPath, fileNameA, n * sizeof(wchar_t));
wPath[n] = L'\0'; wPath[n] = L'\0';
readWindowsShortcut(wPath, MAX_PATH + 1); readWindowsShortcut(wPath, winMaxLongPath + 1);
int wPathLen = (int)wcslen(wPath); int wPathLen = (int)wcslen(wPath);
// save both Unicode and 8-bit copies of the file name // save both Unicode and 8-bit copies of the file name
fileName = new GString(); fileName = new GString();
fileNameU = (wchar_t *)gmallocn(wPathLen + 1, sizeof(wchar_t)); fileNameU = (wchar_t *)gmallocn(wPathLen + 1, sizeof(wchar_t));
memcpy(fileNameU, wPath, (wPathLen + 1) * sizeof(wchar_t)); memcpy(fileNameU, wPath, (wPathLen + 1) * sizeof(wchar_t));
for (i = 0; i < wPathLen; ++i) { for (i = 0; i < wPathLen; ++i) {
fileName->append((char)fileNameA[i]); fileName->append((char)fileNameA[i]);
} }
skipping to change at line 181 skipping to change at line 181
#ifdef _WIN32 #ifdef _WIN32
Unicode u; Unicode u;
int i, j; int i, j;
#endif #endif
init(coreA); init(coreA);
fileName = new GString(fileNameA); fileName = new GString(fileNameA);
#if defined(_WIN32) #if defined(_WIN32)
wchar_t wPath[MAX_PATH + 1]; wchar_t wPath[winMaxLongPath + 1];
i = 0; i = 0;
j = 0; j = 0;
while (j < MAX_PATH && getUTF8(fileName, &i, &u)) { while (j < winMaxLongPath && getUTF8(fileName, &i, &u)) {
wPath[j++] = (wchar_t)u; wPath[j++] = (wchar_t)u;
} }
wPath[j] = L'\0'; wPath[j] = L'\0';
readWindowsShortcut(wPath, MAX_PATH + 1); readWindowsShortcut(wPath, winMaxLongPath + 1);
int wPathLen = (int)wcslen(wPath); int wPathLen = (int)wcslen(wPath);
fileNameU = (wchar_t *)gmallocn(wPathLen + 1, sizeof(wchar_t)); fileNameU = (wchar_t *)gmallocn(wPathLen + 1, sizeof(wchar_t));
memcpy(fileNameU, wPath, (wPathLen + 1) * sizeof(wchar_t)); memcpy(fileNameU, wPath, (wPathLen + 1) * sizeof(wchar_t));
// 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, wfopenReadMode); file = _wfopen(fileNameU, wfopenReadMode);
skipping to change at line 454 skipping to change at line 454
} }
void PDFDoc::displayPages(OutputDev *out, int firstPage, int lastPage, void PDFDoc::displayPages(OutputDev *out, int firstPage, int lastPage,
double hDPI, double vDPI, int rotate, double hDPI, double vDPI, int rotate,
GBool useMediaBox, GBool crop, GBool printing, GBool useMediaBox, GBool crop, GBool printing,
GBool (*abortCheckCbk)(void *data), GBool (*abortCheckCbk)(void *data),
void *abortCheckCbkData) { void *abortCheckCbkData) {
int page; int page;
for (page = firstPage; page <= lastPage; ++page) { for (page = firstPage; page <= lastPage; ++page) {
if (globalParams->getPrintStatusInfo()) {
fflush(stderr);
printf("[processing page %d]\n", page);
fflush(stdout);
}
displayPage(out, page, hDPI, vDPI, rotate, useMediaBox, crop, printing, displayPage(out, page, hDPI, vDPI, rotate, useMediaBox, crop, printing,
abortCheckCbk, abortCheckCbkData); abortCheckCbk, abortCheckCbkData);
catalog->doneWithPage(page); catalog->doneWithPage(page);
} }
} }
void PDFDoc::displayPageSlice(OutputDev *out, int page, void PDFDoc::displayPageSlice(OutputDev *out, int page,
double hDPI, double vDPI, int rotate, double hDPI, double vDPI, int rotate,
GBool useMediaBox, GBool crop, GBool printing, GBool useMediaBox, GBool crop, GBool printing,
int sliceX, int sliceY, int sliceW, int sliceH, int sliceX, int sliceY, int sliceW, int sliceH,
skipping to change at line 599 skipping to change at line 604
} }
ret = saveEmbeddedFile2(idx, f); ret = saveEmbeddedFile2(idx, f);
fclose(f); fclose(f);
return ret; return ret;
} }
#ifdef _WIN32 #ifdef _WIN32
GBool PDFDoc::saveEmbeddedFile(int idx, const wchar_t *path, int pathLen) { GBool PDFDoc::saveEmbeddedFile(int idx, const wchar_t *path, int pathLen) {
FILE *f; FILE *f;
OSVERSIONINFO version; OSVERSIONINFO version;
wchar_t path2w[_MAX_PATH + 1]; wchar_t path2w[winMaxLongPath + 1];
char path2c[_MAX_PATH + 1]; char path2c[MAX_PATH + 1];
int i; int i;
GBool ret; GBool ret;
// 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) {
for (i = 0; i < pathLen && i < _MAX_PATH; ++i) { for (i = 0; i < pathLen && i < winMaxLongPath; ++i) {
path2w[i] = path[i]; path2w[i] = path[i];
} }
path2w[i] = 0; path2w[i] = 0;
f = _wfopen(path2w, L"wb"); f = _wfopen(path2w, L"wb");
} else { } else {
for (i = 0; i < pathLen && i < _MAX_PATH; ++i) { for (i = 0; i < pathLen && i < MAX_PATH; ++i) {
path2c[i] = (char)path[i]; path2c[i] = (char)path[i];
} }
path2c[i] = 0; path2c[i] = 0;
f = fopen(path2c, "wb"); f = fopen(path2c, "wb");
} }
if (!f) { if (!f) {
return gFalse; return gFalse;
} }
ret = saveEmbeddedFile2(idx, f); ret = saveEmbeddedFile2(idx, f);
fclose(f); fclose(f);
 End of changes. 9 change blocks. 
10 lines changed or deleted 15 lines changed or added

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