Commit 748b4e58 authored by Christian Persch's avatar Christian Persch Committed by Albert Astals Cid

all: Remove support for obsolete systems

poppler/poppler#709
parent 9f247fbb
......@@ -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
};
......
......@@ -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,19 +450,12 @@ 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));
#else
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
}
......@@ -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
......
......@@ -402,8 +402,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
textEncoding = new GooString("UTF-8");
#if defined(_WIN32)
textEOL = eolDOS;
#elif defined(MACOS)
textEOL = eolMac;
#else
textEOL = eolUnix;
#endif
......
......@@ -86,11 +86,6 @@
#include "PSOutputDev.h"
#include "PDFDoc.h"
#ifdef MACOS
// needed for setting type/creator of MacOS files
#include "ICSupport.h"
#endif
// the MSVC math.h doesn't define this
#ifndef M_PI
#define M_PI 3.14159265358979323846
......@@ -1471,9 +1466,6 @@ PSOutputDev::~PSOutputDev() {
}
}
if (fileType == psFile) {
#ifdef MACOS
ICS_MapRefNumAndAssign((short)((FILE *)outputStream)->handle);
#endif
fclose((FILE *)outputStream);
}
#ifdef HAVE_POPEN
......
......@@ -77,12 +77,6 @@
#include "SplashOutputDev.h"
#include <algorithm>
#ifdef VMS
#if (__VMS_VER < 70000000)
extern "C" int unlink(char *filename);
#endif
#endif
static const double s_minLineWidth = 0.0;
static inline void convertGfxColor(SplashColorPtr dest,
......
......@@ -82,14 +82,6 @@
static bool setDJSYSFLAGS = false;
#endif
#ifdef VMS
#ifdef __GNUC__
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#endif
#endif
//------------------------------------------------------------------------
// Stream (base class)
//------------------------------------------------------------------------
......
......@@ -75,11 +75,6 @@
#include "Annot.h"
#include "UTF.h"
#ifdef MACOS
// needed for setting type/creator of MacOS files
#include "ICSupport.h"
#endif
//------------------------------------------------------------------------
// parameters
//------------------------------------------------------------------------
......@@ -5674,9 +5669,6 @@ TextOutputDev::TextOutputDev(TextOutputFunc func, void *stream,
TextOutputDev::~TextOutputDev() {
if (needClose) {
#ifdef MACOS
ICS_MapRefNumAndAssign((short)((FILE *)outputStream)->handle);
#endif
fclose((FILE *)outputStream);
}
if (text) {
......
......@@ -36,12 +36,6 @@
#include "SplashFTFontFile.h"
#include "SplashFTFontEngine.h"
#ifdef VMS
#if (__VMS_VER < 70000000)
extern "C" int unlink(char *filename);
#endif
#endif
//------------------------------------------------------------------------
// SplashFTFontEngine
//------------------------------------------------------------------------
......
......@@ -44,18 +44,6 @@
#include "SplashFont.h"
#include "SplashFontEngine.h"
#ifdef VMS
#if (__VMS_VER < 70000000)
extern "C" int unlink(char *filename);
#endif
#endif
#ifdef VMS
#if (__VMS_VER < 70000000)
extern "C" int unlink(char *filename);
#endif
#endif
//------------------------------------------------------------------------
// SplashFontEngine
//------------------------------------------------------------------------
......
......@@ -30,12 +30,6 @@
#include "SplashFontFile.h"
#include "SplashFontFileID.h"
#ifdef VMS
#if (__VMS_VER < 70000000)
extern "C" int unlink(char *filename);
#endif
#endif
//------------------------------------------------------------------------
// SplashFontFile
//------------------------------------------------------------------------
......
......@@ -964,11 +964,7 @@ int main(int argc, char *argv[]) {
// print info
long long filesize = 0;
#ifdef VMS
f = fopen(fileName->c_str(), "rb", "ctx=stm");
#else
f = fopen(fileName->c_str(), "rb");
#endif
if (f) {
Gfseek(f, 0, SEEK_END);
filesize = Gftell(f);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment