diff --git a/CMakeLists.txt b/CMakeLists.txt index aa8e2095..14079bf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,7 +211,8 @@ if(WITH_PDF2HTMLEX) endif(WITH_PDF2HTMLEX) if(WITH_WVWARE) find_package(wvware REQUIRED) - target_link_libraries(odr PRIVATE wvware::wvware) + # target "meta" errors out if wvware is linked privately + target_link_libraries(odr PUBLIC wvware::wvware) endif(WITH_WVWARE) if (EXISTS "${PROJECT_SOURCE_DIR}/.git") diff --git a/src/odr/internal/html/wvWare_wrapper.cpp b/src/odr/internal/html/wvWare_wrapper.cpp index 46618890..deb3e4f2 100644 --- a/src/odr/internal/html/wvWare_wrapper.cpp +++ b/src/odr/internal/html/wvWare_wrapper.cpp @@ -8,7 +8,11 @@ extern "C" { int convert(char *inputFile, char *outputDir, const char *password); -int no_graphics; +int no_graphics = 1; +int documentId = 0; + +char *s_WVDATADIR = NULL; +char *s_HTMLCONFIG = NULL; } namespace odr::internal { @@ -20,15 +24,20 @@ Html wvWare_wrapper(const File &file, const std::string &output_path, throw FileNotFound(); } + // @TODO: getenv() +// s_WVDATADIR = NULL; +// s_HTMLCONFIG = NULL; + auto output_file_path = output_path + "/document.html"; char *input_file_path = strdup(disk_path->c_str()); char *output_dir = strdup(output_path.c_str()); - no_graphics = 1; - g_htmlOutputFileHandle = fopen(output_file_path.c_str(), "w"); + documentId++; + + // @TODO: password std::string password; int retVal = convert(input_file_path, output_dir, password.c_str()); free(output_dir); diff --git a/src/wvWare.c b/src/wvWare.c index 46128e3c..440e656c 100644 --- a/src/wvWare.c +++ b/src/wvWare.c @@ -17,9 +17,7 @@ * 02111-1307, USA. */ -//#ifdef HAVE_CONFIG_H #include -//#endif #include #include @@ -50,12 +48,6 @@ #define wvTrace( args ) #endif -/* strdup isn't declared in for `gcc -ansi'; declare it here */ -extern char *strdup (const char *); - -extern char *str_copy(char *d, size_t n, char *s); -extern char *str_append(char *d, size_t n, char *s); - extern char *s_WVDATADIR; extern char *s_HTMLCONFIG; extern int documentId; @@ -67,7 +59,18 @@ extern int documentId; } \ } -extern char * strdup_and_append_twice(const char * a, const char * b, const char * c); +char *strdup_and_append_twice(const char *a, const char *b, const char *c) { + const size_t szA = strlen(a); + const size_t szB = strlen(b); + const size_t szC = strlen(c); + + char *buf = malloc(szA + szB + szC + 1); + strcpy(buf, a); + strcpy(buf + szA, b); + strcpy(buf + szA + szB, c); + buf[szA + szB + szC] = '\0'; + return buf; +} /* Released under GPL, written by Caolan.McNamara@ul.ie.