summaryrefslogtreecommitdiff
path: root/goo
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2019-01-04 22:13:43 +0100
committerAlbert Astals Cid <tsdgeos@yahoo.es>2019-01-18 15:22:47 +0000
commit748b4e58e384b806618fae2014b6e413a4168fed (patch)
tree8f95c872675d14ca35611a5ff65b65c6901050bb /goo
parent9f247fbb14df853274423035530a141405c90cda (diff)
all: Remove support for obsolete systems
https://gitlab.freedesktop.org/poppler/poppler/issues/709
Diffstat (limited to 'goo')
-rw-r--r--goo/gdir.h5
-rw-r--r--goo/gfile.cc182
-rw-r--r--goo/gfile.h7
3 files changed, 10 insertions, 184 deletions
diff --git a/goo/gdir.h b/goo/gdir.h
index 7d39c491..b9b8e2bf 100644
--- a/goo/gdir.h
+++ b/goo/gdir.h
@@ -77,13 +77,8 @@ private:
#if defined(_WIN32)
WIN32_FIND_DATAA ffd;
HANDLE hnd;
-#elif defined(ACORN)
-#elif defined(MACOS)
#else
DIR *dir; // the DIR structure from opendir()
-#ifdef VMS
- bool needParent; // need to return an entry for [-]
-#endif
#endif
};
diff --git a/goo/gfile.cc b/goo/gfile.cc
index e7710b5d..eae51207 100644
--- a/goo/gfile.cc
+++ b/goo/gfile.cc
@@ -37,21 +37,12 @@
#include <config.h>
#ifndef _WIN32
-# if defined(MACOS)
-# include <sys/stat.h>
-# elif !defined(ACORN)
-# include <sys/types.h>
-# include <sys/stat.h>
-# include <fcntl.h>
-# endif
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <fcntl.h>
# include <limits.h>
# include <string.h>
-# if !defined(VMS) && !defined(ACORN) && !defined(MACOS)
-# include <pwd.h>
-# endif
-# if defined(VMS) && (__DECCXX_VER < 50200000)
-# include <unixlib.h>
-# endif
+# include <pwd.h>
#endif // _WIN32
#include <stdio.h>
#include <limits>
@@ -108,47 +99,7 @@ inline const struct timespec& mtim(const struct stat& stbuf) {
//------------------------------------------------------------------------
GooString *appendToPath(GooString *path, const char *fileName) {
-#if defined(VMS)
- //---------- VMS ----------
- //~ this should handle everything necessary for file
- //~ requesters, but it's certainly not complete
- char *p0, *p1, *p2;
- char *q1;
-
- p0 = path->c_str();
- p1 = p0 + path->getLength() - 1;
- if (!strcmp(fileName, "-")) {
- if (*p1 == ']') {
- for (p2 = p1; p2 > p0 && *p2 != '.' && *p2 != '['; --p2) ;
- if (*p2 == '[')
- ++p2;
- path->del(p2 - p0, p1 - p2);
- } else if (*p1 == ':') {
- path->append("[-]");
- } else {
- path->clear();
- path->append("[-]");
- }
- } else if ((q1 = strrchr(fileName, '.')) && !strncmp(q1, ".DIR;", 5)) {
- if (*p1 == ']') {
- path->insert(p1 - p0, '.');
- path->insert(p1 - p0 + 1, fileName, q1 - fileName);
- } else if (*p1 == ':') {
- path->append('[');
- path->append(']');
- path->append(fileName, q1 - fileName);
- } else {
- path->clear();
- path->append(fileName, q1 - fileName);
- }
- } else {
- if (*p1 != ']' && *p1 != ':')
- path->clear();
- path->append(fileName);
- }
- return path;
-
-#elif defined(_WIN32)
+#ifdef _WIN32
//---------- Win32 ----------
GooString *tmp;
char buf[256];
@@ -163,80 +114,6 @@ GooString *appendToPath(GooString *path, const char *fileName) {
path->append(buf);
return path;
-#elif defined(ACORN)
- //---------- RISCOS ----------
- char *p;
- int i;
-
- path->append(".");
- i = path->getLength();
- path->append(fileName);
- for (p = path->c_str() + i; *p; ++p) {
- if (*p == '/') {
- *p = '.';
- } else if (*p == '.') {
- *p = '/';
- }
- }
- return path;
-
-#elif defined(MACOS)
- //---------- MacOS ----------
- char *p;
- int i;
-
- path->append(":");
- i = path->getLength();
- path->append(fileName);
- for (p = path->c_str() + i; *p; ++p) {
- if (*p == '/') {
- *p = ':';
- } else if (*p == '.') {
- *p = ':';
- }
- }
- return path;
-
-#elif defined(__EMX__)
- //---------- OS/2+EMX ----------
- int i;
-
- // appending "." does nothing
- if (!strcmp(fileName, "."))
- return path;
-
- // appending ".." goes up one directory
- if (!strcmp(fileName, "..")) {
- for (i = path->getLength() - 2; i >= 0; --i) {
- if (path->getChar(i) == '/' || path->getChar(i) == '\\' ||
- path->getChar(i) == ':')
- break;
- }
- if (i <= 0) {
- if (path->getChar(0) == '/' || path->getChar(0) == '\\') {
- path->del(1, path->getLength() - 1);
- } else if (path->getLength() >= 2 && path->getChar(1) == ':') {
- path->del(2, path->getLength() - 2);
- } else {
- path->clear();
- path->append("..");
- }
- } else {
- if (path->getChar(i-1) == ':')
- ++i;
- path->del(i, path->getLength() - i);
- }
- return path;
- }
-
- // otherwise, append "/" and new path component
- if (path->getLength() > 0 &&
- path->getChar(path->getLength() - 1) != '/' &&
- path->getChar(path->getLength() - 1) != '\\')
- path->append('/');
- path->append(fileName);
- return path;
-
#else
//---------- Unix ----------
int i;
@@ -534,11 +411,7 @@ Goffset GooFile::size() const {
}
GooFile* GooFile::open(const GooString *fileName) {
-#ifdef VMS
- int fd = ::open(fileName->c_str(), Q_RDONLY, "ctx=stm");
-#else
int fd = openFileDescriptor(fileName->c_str(), O_RDONLY);
-#endif
return fd < 0 ? nullptr : new GooFile(fd);
}
@@ -566,11 +439,8 @@ bool GooFile::modificationTimeChangedSinceOpen() const
//------------------------------------------------------------------------
GDirEntry::GDirEntry(const char *dirPath, const char *nameA, bool doStat) {
-#ifdef VMS
- char *p;
-#elif defined(_WIN32)
+#ifdef _WIN32
DWORD fa;
-#elif defined(ACORN)
#else
struct stat st;
#endif
@@ -580,12 +450,6 @@ GDirEntry::GDirEntry(const char *dirPath, const char *nameA, bool doStat) {
fullPath = new GooString(dirPath);
appendToPath(fullPath, nameA);
if (doStat) {
-#ifdef VMS
- if (!strcmp(nameA, "-") ||
- ((p = strrchr(nameA, '.')) && !strncmp(p, ".DIR;", 5)))
- dir = true;
-#elif defined(ACORN)
-#else
#ifdef _WIN32
fa = GetFileAttributesA(fullPath->c_str());
dir = (fa != 0xFFFFFFFF && (fa & FILE_ATTRIBUTE_DIRECTORY));
@@ -593,7 +457,6 @@ GDirEntry::GDirEntry(const char *dirPath, const char *nameA, bool doStat) {
if (stat(fullPath->c_str(), &st) == 0)
dir = S_ISDIR(st.st_mode);
#endif
-#endif
}
}
@@ -605,32 +468,25 @@ GDirEntry::~GDirEntry() {
GDir::GDir(const char *name, bool doStatA) {
path = new GooString(name);
doStat = doStatA;
-#if defined(_WIN32)
+#ifdef _WIN32
GooString *tmp;
tmp = path->copy();
tmp->append("/*.*");
hnd = FindFirstFileA(tmp->c_str(), &ffd);
delete tmp;
-#elif defined(ACORN)
-#elif defined(MACOS)
#else
dir = opendir(name);
-#ifdef VMS
- needParent = strchr(name, '[') != NULL;
-#endif
#endif
}
GDir::~GDir() {
delete path;
-#if defined(_WIN32)
+#ifdef _WIN32
if (hnd != INVALID_HANDLE_VALUE) {
FindClose(hnd);
hnd = INVALID_HANDLE_VALUE;
}
-#elif defined(ACORN)
-#elif defined(MACOS)
#else
if (dir)
closedir(dir);
@@ -640,7 +496,7 @@ GDir::~GDir() {
GDirEntry *GDir::getNextEntry() {
GDirEntry *e = nullptr;
-#if defined(_WIN32)
+#ifdef _WIN32
if (hnd != INVALID_HANDLE_VALUE) {
e = new GDirEntry(path->c_str(), ffd.cFileName, doStat);
if (!FindNextFileA(hnd, &ffd)) {
@@ -648,21 +504,6 @@ GDirEntry *GDir::getNextEntry() {
hnd = INVALID_HANDLE_VALUE;
}
}
-#elif defined(ACORN)
-#elif defined(MACOS)
-#elif defined(VMS)
- struct dirent *ent;
- if (dir) {
- if (needParent) {
- e = new GDirEntry(path->c_str(), "-", doStat);
- needParent = false;
- return e;
- }
- ent = readdir(dir);
- if (ent) {
- e = new GDirEntry(path->c_str(), ent->d_name, doStat);
- }
- }
#else
struct dirent *ent;
if (dir) {
@@ -689,13 +530,8 @@ void GDir::rewind() {
tmp->append("/*.*");
hnd = FindFirstFileA(tmp->c_str(), &ffd);
delete tmp;
-#elif defined(ACORN)
-#elif defined(MACOS)
#else
if (dir)
rewinddir(dir);
-#ifdef VMS
- needParent = strchr(path->c_str(), '[') != NULL;
-#endif
#endif
}
diff --git a/goo/gfile.h b/goo/gfile.h
index e6ab2d92..ace17be7 100644
--- a/goo/gfile.h
+++ b/goo/gfile.h
@@ -51,15 +51,10 @@ extern "C" {
# endif
# include <windows.h>
# endif
-#elif defined(ACORN)
-#elif defined(MACOS)
-# include <ctime.h>
#else
# include <unistd.h>
# include <sys/types.h>
-# if defined(VMS)
-# include "vms_dirent.h"
-# elif defined(HAVE_DIRENT_H)
+# if defined(HAVE_DIRENT_H)
# include <dirent.h>
# define NAMLEN(d) strlen((d)->d_name)
# else