Advertising
- Windows declspec add
- Friday, August 3rd, 2012 at 5:33:24am MDT
- Index: goo/GooString.h
- ===================================================================
- --- goo/GooString.h (revision 2952)
- +++ goo/GooString.h (working copy)
- @@ -35,15 +35,16 @@
- #include <stdarg.h>
- #include <stdlib.h> // for NULL
- #include "gtypes.h"
- +#include "poppler-config.h"
- class GooString {
- public:
- // Create an empty string.
- - GooString();
- + POPPLER_API GooString();
- // Create a string from a C string.
- - explicit GooString(const char *sA);
- + POPPLER_API explicit GooString(const char *sA);
- // Create a string from <lengthA> chars at <sA>. This string
- // can contain null characters.
- @@ -95,7 +96,7 @@
- static GooString *formatv(const char *fmt, va_list argList);
- // Destructor.
- - ~GooString();
- + POPPLER_API ~GooString();
- // Get length.
- int getLength() { return length; }
- Index: poppler/GlobalParams.cc
- ===================================================================
- --- poppler/GlobalParams.cc (revision 2952)
- +++ poppler/GlobalParams.cc (working copy)
- @@ -123,7 +123,7 @@
- //------------------------------------------------------------------------
- -GlobalParams *globalParams = NULL;
- +POPPLER_API GlobalParams *globalParams = NULL;
- //------------------------------------------------------------------------
- // PSFontParam16
- Index: poppler/GlobalParams.h
- ===================================================================
- --- poppler/GlobalParams.h (revision 2952)
- +++ poppler/GlobalParams.h (working copy)
- @@ -67,7 +67,7 @@
- //------------------------------------------------------------------------
- // The global parameters object.
- -extern GlobalParams *globalParams;
- +POPPLER_API extern GlobalParams *globalParams;
- //------------------------------------------------------------------------
- @@ -129,9 +129,9 @@
- // Initialize the global parameters by attempting to read a config
- // file.
- - GlobalParams(const char *customPopplerDataDir = NULL);
- + POPPLER_API GlobalParams(const char *customPopplerDataDir = NULL);
- - ~GlobalParams();
- + POPPLER_API ~GlobalParams();
- void setBaseDir(const char *dir);
- void setupBaseFonts(char *dir);
- Index: poppler/PDFDoc.cc
- ===================================================================
- --- poppler/PDFDoc.cc (revision 2952)
- +++ poppler/PDFDoc.cc (working copy)
- @@ -50,8 +50,6 @@
- #include <time.h>
- #ifdef _WIN32
- #include <windows.h>
- -//Definition of our own memmem()
- -void *memmem(const void *haystack, size_t n, const void *needle, size_t m);
- #endif
- #include <sys/stat.h>
- #include "goo/gstrtod.h"
- @@ -77,6 +75,13 @@
- #include "PDFDoc.h"
- #include "Hints.h"
- +#ifdef _WIN32
- +//Definition of our own memmem()
- +extern "C"
- +{
- +POPPLER_API extern void *memmem(const void *haystack, size_t n, const void *needle, size_t m);
- +}
- +#endif
- //------------------------------------------------------------------------
- #define headerSearchSize 1024 // read this many bytes at beginning of
- @@ -90,7 +95,6 @@
- #define xrefSearchSize 1024 // read this many bytes at end of file
- // to look for 'startxref'
- -
- //------------------------------------------------------------------------
- // PDFDoc
- //------------------------------------------------------------------------
- @@ -639,18 +643,19 @@
- //dump_to_file(mem_stream.getData(), (int)mem_stream.size());
- //
- long found =
- - (long)memmem((char *)mem_stream.getData(), mem_stream.size(),
- + (int)memmem((char *)mem_stream.getData(), mem_stream.size(),
- (const void *) needle, sizeof(needle)-1);
- - long haystack = (long)mem_stream.getData();
- + long haystack = (int)mem_stream.getData();
- if (found == 0)
- fprintf(stderr, "Warning: can't find /Type /Sig... Abort!!\n");
- unsigned long offset = found - haystack + 21;
- //Save it for getSigByteArray()
- m_sig_offset = offset;
- + unsigned long estimated_len = 15000;
- //fprintf(stderr, "Signature offset: %ld\n", offset);
- - getCatalog()->setSignatureByteRange(offset, ESTIMATED_LEN, mem_stream.size());
- + getCatalog()->setSignatureByteRange(offset, estimated_len, mem_stream.size());
- }
- @@ -660,22 +665,23 @@
- */
- unsigned long PDFDoc::getSigByteArray(unsigned char **byte_array)
- {
- - MemOutStream mem_stream(this->fileSize+ESTIMATED_LEN +1000);
- + MemOutStream mem_stream(this->fileSize+16000);
- + unsigned int estimated_len = 15000;
- unsigned int i = 0, ret_len = 0;
- OutStream * str = &mem_stream;
- saveAs(str, writeForceRewrite);
- char * base_ptr = (char *)mem_stream.getData();
- - ret_len = mem_stream.size() - ESTIMATED_LEN - 2;
- + ret_len = mem_stream.size() - estimated_len - 2;
- *byte_array = (unsigned char *)gmalloc(ret_len);
- memcpy((*byte_array)+i, base_ptr, m_sig_offset);
- i+= m_sig_offset;
- - int len2 = mem_stream.size() - m_sig_offset - ESTIMATED_LEN -2;
- + int len2 = mem_stream.size() - m_sig_offset - estimated_len -2;
- memcpy((*byte_array)+i, base_ptr + m_sig_offset+
- - ESTIMATED_LEN + 2, len2);
- + estimated_len + 2, len2);
- //DEBUG
- //dump_to_file(*byte_array, (int)ret_len);
- @@ -686,7 +692,8 @@
- void PDFDoc::closeSignature(const char *signature_contents)
- {
- - getCatalog()->closeSignature(signature_contents, ESTIMATED_LEN);
- + unsigned long estimated_len = 15000;
- + getCatalog()->closeSignature(signature_contents, estimated_len);
- }
- unsigned int PDFDoc::getSignedVersionLen()
- Index: poppler/PDFDoc.h
- ===================================================================
- --- poppler/PDFDoc.h (revision 2952)
- +++ poppler/PDFDoc.h (working copy)
- @@ -61,6 +61,7 @@
- writeForceIncremental
- };
- +
- //------------------------------------------------------------------------
- // PDFDoc
- //------------------------------------------------------------------------
- @@ -68,22 +69,22 @@
- class PDFDoc {
- public:
- - PDFDoc(GooString *fileNameA, GooString *ownerPassword = NULL,
- + POPPLER_API PDFDoc(GooString *fileNameA, GooString *ownerPassword = NULL,
- GooString *userPassword = NULL, void *guiDataA = NULL);
- #ifdef _WIN32
- - PDFDoc(wchar_t *fileNameA, int fileNameLen, GooString *ownerPassword = NULL,
- + POPPLER_API PDFDoc(wchar_t *fileNameA, int fileNameLen, GooString *ownerPassword = NULL,
- GooString *userPassword = NULL, void *guiDataA = NULL);
- #endif
- PDFDoc(BaseStream *strA, GooString *ownerPassword = NULL,
- GooString *userPassword = NULL, void *guiDataA = NULL);
- - ~PDFDoc();
- + POPPLER_API ~PDFDoc();
- static PDFDoc *ErrorPDFDoc(int errorCode, GooString *fileNameA = NULL);
- // Was PDF document successfully opened?
- - GBool isOk() { return ok; }
- + POPPLER_API GBool isOk() { return ok; }
- // Get the error code (if isOk() returns false).
- int getErrorCode() { return errCode; }
- @@ -136,7 +137,7 @@
- Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); }
- // Get page.
- - Page *getPage(int page);
- + POPPLER_API Page *getPage(int page);
- // Display a page.
- void displayPage(OutputDev *out, int page,
- @@ -189,21 +190,21 @@
- #endif
- // Is the file encrypted?
- - GBool isEncrypted() { return xref->isEncrypted(); }
- + POPPLER_API GBool isEncrypted() { return xref->isEncrypted(); }
- /* PTEID-Changes */
- // Is the file signed?
- - GBool isSigned();
- - unsigned long getSigByteArray(unsigned char **byte_array);
- - int getSignatureContents(unsigned char **);
- + POPPLER_API GBool isSigned();
- + POPPLER_API unsigned long getSigByteArray(unsigned char **byte_array);
- + POPPLER_API int getSignatureContents(unsigned char **);
- - Object *getByteRange();
- + POPPLER_API Object *getByteRange();
- - void prepareSignature(const char * name, const char *location, const char *reason);
- + POPPLER_API void prepareSignature(const char * name, const char *location, const char *reason);
- - void closeSignature(const char *signature_contents);
- - unsigned int getSignedVersionLen();
- + POPPLER_API void closeSignature(const char *signature_contents);
- + POPPLER_API unsigned int getSignedVersionLen();
- /* End of PTEID Changes */
- @@ -241,15 +242,15 @@
- GBool getID(GooString *permanent_id, GooString *update_id);
- // Save one page with another name.
- - int savePageAs(GooString *name, int pageNo);
- + POPPLER_API int savePageAs(GooString *name, int pageNo);
- // Save this file with another name.
- - int saveAs(GooString *name, PDFWriteMode mode=writeStandard);
- + POPPLER_API int saveAs(GooString *name, PDFWriteMode mode=writeStandard);
- // Save this file in the given output stream.
- - int saveAs(OutStream *outStr, PDFWriteMode mode=writeStandard);
- + POPPLER_API int saveAs(OutStream *outStr, PDFWriteMode mode=writeStandard);
- // Save this file with another name without saving changes
- - int saveWithoutChangesAs(GooString *name);
- + POPPLER_API int saveWithoutChangesAs(GooString *name);
- // Save this file in the given output stream without saving changes
- - int saveWithoutChangesAs(OutStream *outStr);
- + POPPLER_API int saveWithoutChangesAs(OutStream *outStr);
- // Return a pointer to the GUI (XPDFCore or WinPDFCore object).
- void *getGUIData() { return guiData; }
- Index: poppler/poppler-config.h
- ===================================================================
- --- poppler/poppler-config.h (revision 2952)
- +++ poppler/poppler-config.h (working copy)
- @@ -27,6 +27,17 @@
- #undef HAVE_SPLASH
- +/* On Windows we need to export symbols... */
- +#ifdef _WIN32
- +#ifdef _EXPORTING
- + #define POPPLER_API __declspec(dllexport)
- +#else
- + #define POPPLER_API __declspec(dllimport)
- +#endif
- +#else
- +#define POPPLER_API
- +#endif
- +
- /* Use fixedpoint. */
- #ifndef USE_FIXEDPOINT
- /* #undef USE_FIXEDPOINT */
- @@ -51,8 +62,8 @@
- #undef WITH_FONTCONFIGURATION_FONTCONFIG
- /* Use win32 font configuration backend */
- -#ifndef WITH_FONTCONFIGURATION_WIN32
- -/* #undef WITH_FONTCONFIGURATION_WIN32 */
- +#ifdef _WIN32
- +#define WITH_FONTCONFIGURATION_WIN32 1
- #endif
- /* Support for curl is compiled in. */
- @@ -87,7 +98,7 @@
- #endif
- /* Defines if gettimeofday is available on your system */
- -#ifndef HAVE_GETTIMEOFDAY
- +#ifndef _WIN32
- #define HAVE_GETTIMEOFDAY 1
- #endif
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.