summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/xpdf-src/goo
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/xpdf/xpdf-src/goo')
-rw-r--r--Build/source/libs/xpdf/xpdf-src/goo/FixedPoint.cc4
-rw-r--r--Build/source/libs/xpdf/xpdf-src/goo/FixedPoint.h4
-rw-r--r--Build/source/libs/xpdf/xpdf-src/goo/GHash.cc4
-rw-r--r--Build/source/libs/xpdf/xpdf-src/goo/GHash.h4
-rw-r--r--Build/source/libs/xpdf/xpdf-src/goo/GList.cc9
-rw-r--r--Build/source/libs/xpdf/xpdf-src/goo/GList.h7
-rw-r--r--Build/source/libs/xpdf/xpdf-src/goo/GString.cc6
-rw-r--r--Build/source/libs/xpdf/xpdf-src/goo/GString.h4
-rw-r--r--Build/source/libs/xpdf/xpdf-src/goo/gfile.cc25
-rw-r--r--Build/source/libs/xpdf/xpdf-src/goo/gfile.h6
10 files changed, 40 insertions, 33 deletions
diff --git a/Build/source/libs/xpdf/xpdf-src/goo/FixedPoint.cc b/Build/source/libs/xpdf/xpdf-src/goo/FixedPoint.cc
index 503a06aa9c7..8c4c474f5f1 100644
--- a/Build/source/libs/xpdf/xpdf-src/goo/FixedPoint.cc
+++ b/Build/source/libs/xpdf/xpdf-src/goo/FixedPoint.cc
@@ -12,10 +12,6 @@
#if USE_FIXEDPOINT
-#ifdef USE_GCC_PRAGMAS
-#pragma implementation
-#endif
-
#include "gmempp.h"
#include "FixedPoint.h"
diff --git a/Build/source/libs/xpdf/xpdf-src/goo/FixedPoint.h b/Build/source/libs/xpdf/xpdf-src/goo/FixedPoint.h
index 9f0c3240627..31f2ca4dad2 100644
--- a/Build/source/libs/xpdf/xpdf-src/goo/FixedPoint.h
+++ b/Build/source/libs/xpdf/xpdf-src/goo/FixedPoint.h
@@ -15,10 +15,6 @@
#if USE_FIXEDPOINT
-#ifdef USE_GCC_PRAGMAS
-#pragma interface
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include "gtypes.h"
diff --git a/Build/source/libs/xpdf/xpdf-src/goo/GHash.cc b/Build/source/libs/xpdf/xpdf-src/goo/GHash.cc
index e6b32440fb9..c77a1b90db0 100644
--- a/Build/source/libs/xpdf/xpdf-src/goo/GHash.cc
+++ b/Build/source/libs/xpdf/xpdf-src/goo/GHash.cc
@@ -8,10 +8,6 @@
#include <aconf.h>
-#ifdef USE_GCC_PRAGMAS
-#pragma implementation
-#endif
-
#include "gmem.h"
#include "gmempp.h"
#include "GString.h"
diff --git a/Build/source/libs/xpdf/xpdf-src/goo/GHash.h b/Build/source/libs/xpdf/xpdf-src/goo/GHash.h
index 179753a50b4..92ce226d7bd 100644
--- a/Build/source/libs/xpdf/xpdf-src/goo/GHash.h
+++ b/Build/source/libs/xpdf/xpdf-src/goo/GHash.h
@@ -11,10 +11,6 @@
#include <aconf.h>
-#ifdef USE_GCC_PRAGMAS
-#pragma interface
-#endif
-
#include "gtypes.h"
class GString;
diff --git a/Build/source/libs/xpdf/xpdf-src/goo/GList.cc b/Build/source/libs/xpdf/xpdf-src/goo/GList.cc
index c194818a743..7aaa5d7176f 100644
--- a/Build/source/libs/xpdf/xpdf-src/goo/GList.cc
+++ b/Build/source/libs/xpdf/xpdf-src/goo/GList.cc
@@ -8,10 +8,6 @@
#include <aconf.h>
-#ifdef USE_GCC_PRAGMAS
-#pragma implementation
-#endif
-
#include <stdlib.h>
#include <string.h>
#include "gmem.h"
@@ -100,6 +96,11 @@ void GList::sort(int (*cmp)(const void *obj1, const void *obj2)) {
qsort(data, length, sizeof(void *), cmp);
}
+void GList::sort(int first, int n,
+ int (*cmp)(const void *ptr1, const void *ptr2)) {
+ qsort(data + first, n, sizeof(void *), cmp);
+}
+
void GList::reverse() {
void *t;
int n, i;
diff --git a/Build/source/libs/xpdf/xpdf-src/goo/GList.h b/Build/source/libs/xpdf/xpdf-src/goo/GList.h
index 005043726a5..ee12346c5cf 100644
--- a/Build/source/libs/xpdf/xpdf-src/goo/GList.h
+++ b/Build/source/libs/xpdf/xpdf-src/goo/GList.h
@@ -11,10 +11,6 @@
#include <aconf.h>
-#ifdef USE_GCC_PRAGMAS
-#pragma interface
-#endif
-
#include "gtypes.h"
//------------------------------------------------------------------------
@@ -70,6 +66,9 @@ public:
// be double-dereferenced.
void sort(int (*cmp)(const void *ptr1, const void *ptr2));
+ // Sort <n> items starting at <first>.
+ void sort(int first, int n, int (*cmp)(const void *ptr1, const void *ptr2));
+
// Reverse the list.
void reverse();
diff --git a/Build/source/libs/xpdf/xpdf-src/goo/GString.cc b/Build/source/libs/xpdf/xpdf-src/goo/GString.cc
index 54de35b0a75..1e41bcaa172 100644
--- a/Build/source/libs/xpdf/xpdf-src/goo/GString.cc
+++ b/Build/source/libs/xpdf/xpdf-src/goo/GString.cc
@@ -10,10 +10,6 @@
#include <aconf.h>
-#ifdef USE_GCC_PRAGMAS
-#pragma implementation
-#endif
-
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
@@ -416,6 +412,8 @@ GString *GString::appendfv(const char *fmt, va_list argList) {
// format the argument
arg = args[idx];
+ str = NULL;
+ len = 0;
switch (ft) {
case fmtIntDecimal:
formatInt(arg.i, buf, sizeof(buf), zeroFill, width, 10, &str, &len);
diff --git a/Build/source/libs/xpdf/xpdf-src/goo/GString.h b/Build/source/libs/xpdf/xpdf-src/goo/GString.h
index 6b342f85ec7..2e67fd0c0d0 100644
--- a/Build/source/libs/xpdf/xpdf-src/goo/GString.h
+++ b/Build/source/libs/xpdf/xpdf-src/goo/GString.h
@@ -13,10 +13,6 @@
#include <aconf.h>
-#ifdef USE_GCC_PRAGMAS
-#pragma interface
-#endif
-
#include <limits.h> // for LLONG_MAX and ULLONG_MAX
#include <stdarg.h>
#include "gtypes.h"
diff --git a/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc b/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc
index c2e7512e188..e1fdf297689 100644
--- a/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc
+++ b/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc
@@ -418,6 +418,18 @@ GBool pathIsFile(const char *path) {
#endif
}
+GBool pathIsDir(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);
+#else
+ struct stat statBuf;
+ return stat(path, &statBuf) == 0 && S_ISDIR(statBuf.st_mode);
+#endif
+}
+
time_t getModTime(char *fileName) {
#ifdef _WIN32
//~ should implement this, but it's (currently) only used in xpdf
@@ -602,6 +614,17 @@ GString *fileNameToUTF8(wchar_t *path) {
return s;
}
+GString *fileNameMultiByteToUTF8(char *path) {
+ wchar_t fileNameW[winMaxLongPath + 1];
+ if (MultiByteToWideChar(CP_OEMCP, 0, path, -1,
+ fileNameW, sizeof(fileNameW) / sizeof(wchar_t))) {
+ return fileNameToUTF8(fileNameW);
+ } else {
+ // shouldn't happen, but just in case...
+ return new GString(path);
+ }
+}
+
wchar_t *fileNameToUCS2(const char *path, wchar_t *out, size_t outSize) {
const char *p;
size_t i;
@@ -680,7 +703,7 @@ void readWindowsShortcut(wchar_t *wPath, size_t wPathSize) {
}
hres = persistFile->Load(wPath, STGM_READ);
if (FAILED(hres)) {
- fprintf(stderr, "IPersistFile.Load failed: 0x%08x\n", hres);
+ fprintf(stderr, "IPersistFile.Load failed: 0x%08lx\n", hres);
exit(1);
}
wchar_t target[winMaxLongPath + 1];
diff --git a/Build/source/libs/xpdf/xpdf-src/goo/gfile.h b/Build/source/libs/xpdf/xpdf-src/goo/gfile.h
index d0d2ad6f9e1..9dbb1c9b8ee 100644
--- a/Build/source/libs/xpdf/xpdf-src/goo/gfile.h
+++ b/Build/source/libs/xpdf/xpdf-src/goo/gfile.h
@@ -64,6 +64,9 @@ extern GString *makePathAbsolute(GString *path);
// Returns true if [path] exists and is a regular file.
extern GBool pathIsFile(const char *path);
+// Returns true if [path] exists and is a directory.
+extern GBool pathIsDir(const char *path);
+
// Get the modification time for <fileName>. Returns 0 if there is an
// error.
extern time_t getModTime(char *fileName);
@@ -90,6 +93,9 @@ extern GString *fileNameToUTF8(char *path);
// Convert a file name from UCS-2 to UTF-8.
extern GString *fileNameToUTF8(wchar_t *path);
+// Convert a file name from the OEM code page to UTF-8.
+extern GString *fileNameMultiByteToUTF8(char *path);
+
// Convert a file name from UTF-8 to UCS-2. [out] has space for
// [outSize] wchar_t elements (including the trailing zero). Returns
// [out].