"Fossies" - the Fresh Open Source Software Archive  

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

About: Xpdf is a PDF viewer for X.

gfile.cc  (xpdf-4.03):gfile.cc  (xpdf-4.04)
skipping to change at line 54 skipping to change at line 54
#define PATH_MAX 1024 #define PATH_MAX 1024
#endif #endif
//------------------------------------------------------------------------ //------------------------------------------------------------------------
GString *getHomeDir() { GString *getHomeDir() {
#ifdef VMS #ifdef VMS
//---------- VMS ---------- //---------- VMS ----------
return new GString("SYS$LOGIN:"); return new GString("SYS$LOGIN:");
#elif defined(__EMX__) || defined(_WIN32) #elif defined(_WIN32)
//---------- OS/2+EMX and Win32 ---------- //---------- Win32 ----------
char *s;
GString *ret;
if ((s = getenv("USERPROFILE")))
ret = new GString(s);
else
ret = new GString(".");
return ret;
#elif defined(__EMX__)
//---------- OS/2+EMX ----------
char *s; char *s;
GString *ret; GString *ret;
if ((s = getenv("HOME"))) if ((s = getenv("HOME")))
ret = new GString(s); ret = new GString(s);
else else
ret = new GString("."); ret = new GString(".");
return ret; return ret;
#elif defined(ACORN) #elif defined(ACORN)
skipping to change at line 331 skipping to change at line 342
if (!isAbsolutePath(path->getCString())) { if (!isAbsolutePath(path->getCString())) {
if (getcwd(buf, sizeof(buf))) { if (getcwd(buf, sizeof(buf))) {
path->insert(0, buf); path->insert(0, buf);
} }
} }
return path; return path;
#elif defined(_WIN32) #elif defined(_WIN32)
//---------- Win32 ---------- //---------- Win32 ----------
char buf[_MAX_PATH]; char buf[MAX_PATH];
char *fp; char *fp;
buf[0] = '\0'; buf[0] = '\0';
if (!GetFullPathNameA(path->getCString(), _MAX_PATH, buf, &fp)) { if (!GetFullPathNameA(path->getCString(), MAX_PATH, buf, &fp)) {
path->clear(); path->clear();
return path; return path;
} }
path->clear(); path->clear();
path->append(buf); path->append(buf);
return path; return path;
#elif defined(ACORN) #elif defined(ACORN)
//---------- RISCOS ---------- //---------- RISCOS ----------
path->insert(0, '@'); path->insert(0, '@');
skipping to change at line 394 skipping to change at line 405
#ifndef __EMX__ #ifndef __EMX__
path->insert(0, '/'); path->insert(0, '/');
#endif #endif
path->insert(0, buf); path->insert(0, buf);
} }
} }
return path; return path;
#endif #endif
} }
GBool pathIsFile(const char *path) {
#ifdef _WIN32
wchar_t wPath[winMaxLongPath + 1];
fileNameToUCS2(path, wPath, winMaxLongPath + 1);
DWORD attr = GetFileAttributesW(wPath);
return attr != INVALID_FILE_ATTRIBUTES &&
!(attr & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE));
#else
struct stat statBuf;
return stat(path, &statBuf) == 0 && S_ISREG(statBuf.st_mode);
#endif
}
time_t getModTime(char *fileName) { time_t getModTime(char *fileName) {
#ifdef _WIN32 #ifdef _WIN32
//~ should implement this, but it's (currently) only used in xpdf //~ should implement this, but it's (currently) only used in xpdf
return 0; return 0;
#else #else
struct stat statBuf; struct stat statBuf;
if (stat(fileName, &statBuf)) { if (stat(fileName, &statBuf)) {
return 0; return 0;
} }
skipping to change at line 525 skipping to change at line 549
delete *name; delete *name;
*name = NULL; *name = NULL;
return gFalse; return gFalse;
} }
return gTrue; return gTrue;
#endif #endif
} }
GBool createDir(char *path, int mode) { GBool createDir(char *path, int mode) {
#ifdef _WIN32 #ifdef _WIN32
return !mkdir(path); return !_mkdir(path);
#else #else
return !mkdir(path, mode); return !mkdir(path, mode);
#endif #endif
} }
GBool executeCommand(char *cmd) { GBool executeCommand(char *cmd) {
#ifdef VMS #ifdef VMS
return system(cmd) ? gTrue : gFalse; return system(cmd) ? gTrue : gFalse;
#else #else
return system(cmd) ? gFalse : gTrue; return system(cmd) ? gFalse : gTrue;
skipping to change at line 605 skipping to change at line 629
p += 1; p += 1;
} }
} }
out[i] = (wchar_t)0; out[i] = (wchar_t)0;
return out; return out;
} }
#endif #endif
FILE *openFile(const char *path, const char *mode) { FILE *openFile(const char *path, const char *mode) {
#if defined(_WIN32) #if defined(_WIN32)
wchar_t wPath[_MAX_PATH + 1]; wchar_t wPath[winMaxLongPath + 1];
wchar_t wMode[8]; wchar_t wMode[8];
int i; int i;
fileNameToUCS2(path, wPath, sizeof(wPath) / sizeof(wchar_t)); fileNameToUCS2(path, wPath, winMaxLongPath + 1);
for (i = 0; mode[i] && i < sizeof(wMode)/sizeof(wchar_t) - 1; ++i) { for (i = 0; mode[i] && i < sizeof(wMode)/sizeof(wchar_t) - 1; ++i) {
wMode[i] = (wchar_t)(mode[i] & 0xff); wMode[i] = (wchar_t)(mode[i] & 0xff);
} }
wMode[i] = (wchar_t)0; wMode[i] = (wchar_t)0;
readWindowsShortcut(wPath, _MAX_PATH + 1); readWindowsShortcut(wPath, winMaxLongPath + 1);
return _wfopen(wPath, wMode); return _wfopen(wPath, wMode);
#elif defined(VMS) #elif defined(VMS)
return fopen(path, mode, "ctx=stm"); return fopen(path, mode, "ctx=stm");
#else #else
return fopen(path, mode); return fopen(path, mode);
#endif #endif
} }
#ifdef _WIN32 #ifdef _WIN32
void readWindowsShortcut(wchar_t *wPath, size_t wPathSize) { void readWindowsShortcut(wchar_t *wPath, size_t wPathSize) {
skipping to change at line 653 skipping to change at line 677
IPersistFile *persistFile; IPersistFile *persistFile;
hres = shellLink->QueryInterface(IID_IPersistFile, (LPVOID *)&persistFile); hres = shellLink->QueryInterface(IID_IPersistFile, (LPVOID *)&persistFile);
if (FAILED(hres)) { if (FAILED(hres)) {
return; return;
} }
hres = persistFile->Load(wPath, STGM_READ); hres = persistFile->Load(wPath, STGM_READ);
if (FAILED(hres)) { if (FAILED(hres)) {
fprintf(stderr, "IPersistFile.Load failed: 0x%08x\n", hres); fprintf(stderr, "IPersistFile.Load failed: 0x%08x\n", hres);
exit(1); exit(1);
} }
wchar_t target[_MAX_PATH + 1]; wchar_t target[winMaxLongPath + 1];
hres = shellLink->GetPath(target, _MAX_PATH + 1, NULL, 0); hres = shellLink->GetPath(target, winMaxLongPath + 1, NULL, 0);
if (FAILED(hres)) { if (FAILED(hres)) {
return; return;
} }
shellLink->Release(); shellLink->Release();
if (needCoUninit) { if (needCoUninit) {
CoUninitialize(); CoUninitialize();
} }
if (wcslen(target) > wPathSize - 1) { if (wcslen(target) > wPathSize - 1) {
return; return;
} }
wcscpy(wPath, target); wcscpy(wPath, target);
} }
#endif #endif
int makeDir(const char *path, int mode) { int makeDir(const char *path, int mode) {
#ifdef _WIN32 #ifdef _WIN32
wchar_t wPath[_MAX_PATH + 1]; wchar_t wPath[winMaxLongPath + 1];
return _wmkdir(fileNameToUCS2(path, wPath, sizeof(wPath) / sizeof(wchar_t))); return _wmkdir(fileNameToUCS2(path, wPath, winMaxLongPath + 1));
#else #else
return mkdir(path, (mode_t)mode); return mkdir(path, (mode_t)mode);
#endif #endif
} }
char *getLine(char *buf, int size, FILE *f) { char *getLine(char *buf, int size, FILE *f) {
int c, i; int c, i;
i = 0; i = 0;
while (i < size - 1) { while (i < size - 1) {
 End of changes. 10 change blocks. 
12 lines changed or deleted 36 lines changed or added

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