goo/gbasename.cc | 10 +++++++++- utils/InMemoryFile.cc | 4 +++- utils/InMemoryFile.h | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-)
New commits: commit e4b72ca0694d86915676a47642fa3c319f8b936b Author: <[email protected]> Date: Sun Feb 10 16:25:35 2019 -0500 tidyup: #if to #ifdef in HAVE_IN_MEMORY_FILE_FOPENCOOKIE as per aacid diff --git a/utils/InMemoryFile.cc b/utils/InMemoryFile.cc index b7865fe9..702a105a 100644 --- a/utils/InMemoryFile.cc +++ b/utils/InMemoryFile.cc @@ -58,7 +58,7 @@ int InMemoryFile::_seek(off64_t* offset, int whence) FILE* InMemoryFile::open(const char* mode) { -#if HAVE_IN_MEMORY_FILE_FOPENCOOKIE +#ifdef HAVE_IN_MEMORY_FILE_FOPENCOOKIE if (fptr != nullptr) { fprintf(stderr, "InMemoryFile: BUG: Why is this opened more than once?"); return nullptr; // maybe there's some legit reason for it, whoever comes up with one can remove this line commit 7b9b3a924d6b63e25e6e6157be5c5e471c43e406 Author: <[email protected]> Date: Sun Feb 10 16:25:18 2019 -0500 MSVC/Mac build fix: Hide the private methods in InMemoryFile behind a HAVE_IN_MEMORY_FILE_FOPENCOOKIE guard. These use datatypes like off64_t which don't seem to port to MSVC/Mac. diff --git a/utils/InMemoryFile.cc b/utils/InMemoryFile.cc index d4ed0f48..b7865fe9 100644 --- a/utils/InMemoryFile.cc +++ b/utils/InMemoryFile.cc @@ -25,6 +25,7 @@ InMemoryFile::InMemoryFile() { } +#ifdef HAVE_IN_MEMORY_FILE_FOPENCOOKIE ssize_t InMemoryFile::_read(char* buf, size_t sz) { auto toRead = std::min<size_t>(data.size() - iohead, sz); @@ -53,6 +54,7 @@ int InMemoryFile::_seek(off64_t* offset, int whence) iohead = static_cast<size_t>(*offset); return 0; } +#endif // def HAVE_IN_MEMORY_FILE_FOPENCOOKIE FILE* InMemoryFile::open(const char* mode) { diff --git a/utils/InMemoryFile.h b/utils/InMemoryFile.h index 6af7d503..293e1016 100644 --- a/utils/InMemoryFile.h +++ b/utils/InMemoryFile.h @@ -32,9 +32,11 @@ private: std::vector<char> data; FILE *fptr; +#ifdef HAVE_IN_MEMORY_FILE_FOPENCOOKIE ssize_t _read(char* buf, size_t sz); ssize_t _write(const char* buf, size_t sz); int _seek(off64_t* offset, int whence); +#endif public: InMemoryFile(); commit 2d1c8327c936600deca28a15230804a448e3f8a2 Author: <[email protected]> Date: Sun Feb 10 16:24:29 2019 -0500 MSVC build fix: gbasename: basename()/libgen.h don't exist in MSVC-land. Instead, use _splitpath_s. diff --git a/goo/gbasename.cc b/goo/gbasename.cc index dd4607b4..819de885 100644 --- a/goo/gbasename.cc +++ b/goo/gbasename.cc @@ -39,13 +39,21 @@ //======================================================================== #include "gbasename.h" -#include <libgen.h> +#ifndef _MSC_VER +# include <libgen.h> +#endif #include <string.h> std::string gbasename(const char* filename) { +#ifdef _MSC_VER + char fname[_MAX_FNAME] = {}, fext[_MAX_EXT] = {}; + errno_t z = _splitpath_s(filename, NULL, 0, NULL, 0, fname, _countof(fname), fext, _countof(fext)); + return std::string(fname) + std::string(fext); +#else char* mutabl = strdup(filename); std::string retu = basename(mutabl); free(mutabl); return retu; +#endif } _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
