Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Advertising

Windows declspec add
Friday, August 3rd, 2012 at 5:33:24am MDT 

  1. Index: goo/GooString.h
  2. ===================================================================
  3. --- goo/GooString.h     (revision 2952)
  4. +++ goo/GooString.h     (working copy)
  5. @@ -35,15 +35,16 @@
  6.  #include <stdarg.h>
  7.  #include <stdlib.h> // for NULL
  8.  #include "gtypes.h"
  9. +#include "poppler-config.h"
  10.  
  11.  class GooString {
  12.  public:
  13.  
  14.    // Create an empty string.
  15. -  GooString();
  16. +  POPPLER_API GooString();
  17.  
  18.    // Create a string from a C string.
  19. explicit GooString(const char *sA);
  20. +  POPPLER_API explicit GooString(const char *sA);
  21.  
  22.    // Create a string from <lengthA> chars at <sA>.  This string
  23.    // can contain null characters.
  24. @@ -95,7 +96,7 @@
  25.    static GooString *formatv(const char *fmt, va_list argList);
  26.  
  27.    // Destructor.
  28. -  ~GooString();
  29. +  POPPLER_API ~GooString();
  30.  
  31.    // Get length.
  32.    int getLength() { return length; }
  33. Index: poppler/GlobalParams.cc
  34. ===================================================================
  35. --- poppler/GlobalParams.cc     (revision 2952)
  36. +++ poppler/GlobalParams.cc     (working copy)
  37. @@ -123,7 +123,7 @@
  38.  
  39.  //------------------------------------------------------------------------
  40.  
  41. -GlobalParams *globalParams = NULL;
  42. +POPPLER_API GlobalParams *globalParams = NULL;
  43.  
  44.  //------------------------------------------------------------------------
  45.  // PSFontParam16
  46. Index: poppler/GlobalParams.h
  47. ===================================================================
  48. --- poppler/GlobalParams.h      (revision 2952)
  49. +++ poppler/GlobalParams.h      (working copy)
  50. @@ -67,7 +67,7 @@
  51.  //------------------------------------------------------------------------
  52.  
  53.  // The global parameters object.
  54. -extern GlobalParams *globalParams;
  55. +POPPLER_API extern GlobalParams *globalParams;
  56.  
  57.  //------------------------------------------------------------------------
  58.  
  59. @@ -129,9 +129,9 @@
  60.  
  61.    // Initialize the global parameters by attempting to read a config
  62.    // file.
  63. -  GlobalParams(const char *customPopplerDataDir = NULL);
  64. +  POPPLER_API GlobalParams(const char *customPopplerDataDir = NULL);
  65.  
  66. -  ~GlobalParams();
  67. +  POPPLER_API ~GlobalParams();
  68.  
  69.    void setBaseDir(const char *dir);
  70.    void setupBaseFonts(char *dir);
  71. Index: poppler/PDFDoc.cc
  72. ===================================================================
  73. --- poppler/PDFDoc.cc   (revision 2952)
  74. +++ poppler/PDFDoc.cc   (working copy)
  75. @@ -50,8 +50,6 @@
  76.  #include <time.h>
  77.  #ifdef _WIN32
  78.  #include <windows.h>
  79. -//Definition of our own memmem()
  80. -void *memmem(const void *haystack, size_t n, const void *needle, size_t m);
  81.  #endif
  82.  #include <sys/stat.h>
  83.  #include "goo/gstrtod.h"
  84. @@ -77,6 +75,13 @@
  85.  #include "PDFDoc.h"
  86.  #include "Hints.h"
  87.  
  88. +#ifdef _WIN32
  89. +//Definition of our own memmem()
  90. +extern "C"
  91. +{
  92. +POPPLER_API extern void *memmem(const void *haystack, size_t n, const void *needle, size_t m);
  93. +}
  94. +#endif
  95.  //------------------------------------------------------------------------
  96.  
  97.  #define headerSearchSize 1024  // read this many bytes at beginning of
  98. @@ -90,7 +95,6 @@
  99.  #define xrefSearchSize 1024    // read this many bytes at end of file
  100.                              //   to look for 'startxref'
  101.  
  102. -
  103.  //------------------------------------------------------------------------
  104.  // PDFDoc
  105.  //------------------------------------------------------------------------
  106. @@ -639,18 +643,19 @@
  107.         //dump_to_file(mem_stream.getData(), (int)mem_stream.size());
  108.         //
  109.         long found =
  110. -              (long)memmem((char *)mem_stream.getData(), mem_stream.size(),
  111. +              (int)memmem((char *)mem_stream.getData(), mem_stream.size(),
  112.                                      (const void *) needle, sizeof(needle)-1);
  113. -       long haystack = (long)mem_stream.getData();
  114. +       long haystack = (int)mem_stream.getData();
  115.         if (found == 0)
  116.                fprintf(stderr, "Warning: can't find /Type /Sig... Abort!!\n");
  117.         unsigned long offset = found - haystack + 21;
  118.  
  119.         //Save it for getSigByteArray()
  120.         m_sig_offset = offset;
  121. +       unsigned long estimated_len = 15000;
  122.         //fprintf(stderr, "Signature offset: %ld\n", offset);
  123.         
  124. -       getCatalog()->setSignatureByteRange(offset, ESTIMATED_LEN, mem_stream.size());
  125. +       getCatalog()->setSignatureByteRange(offset, estimated_len, mem_stream.size());
  126.  
  127.  
  128.  }
  129. @@ -660,22 +665,23 @@
  130.  */
  131.  unsigned long PDFDoc::getSigByteArray(unsigned char **byte_array)
  132.  {
  133. -       MemOutStream mem_stream(this->fileSize+ESTIMATED_LEN +1000);
  134. +       MemOutStream mem_stream(this->fileSize+16000);
  135. +       unsigned int estimated_len = 15000;
  136.         unsigned int i = 0, ret_len = 0;
  137.         OutStream * str = &mem_stream;
  138.         saveAs(str, writeForceRewrite);
  139.  
  140.         char * base_ptr = (char *)mem_stream.getData();
  141.  
  142. -       ret_len = mem_stream.size() - ESTIMATED_LEN - 2;
  143. +       ret_len = mem_stream.size() - estimated_len - 2;
  144.         *byte_array = (unsigned char *)gmalloc(ret_len);
  145.  
  146.         memcpy((*byte_array)+i, base_ptr, m_sig_offset);
  147.         i+= m_sig_offset;
  148.  
  149. -       int len2 = mem_stream.size() - m_sig_offset - ESTIMATED_LEN -2;
  150. +       int len2 = mem_stream.size() - m_sig_offset - estimated_len -2;
  151.         memcpy((*byte_array)+i, base_ptr + m_sig_offset+
  152. -                     ESTIMATED_LEN + 2, len2);
  153. +                     estimated_len + 2, len2);
  154.  
  155.         //DEBUG
  156.         //dump_to_file(*byte_array, (int)ret_len);
  157. @@ -686,7 +692,8 @@
  158.  
  159.  void PDFDoc::closeSignature(const char *signature_contents)
  160.  {
  161. -       getCatalog()->closeSignature(signature_contents, ESTIMATED_LEN);
  162. +       unsigned long estimated_len = 15000;
  163. +       getCatalog()->closeSignature(signature_contents, estimated_len);
  164.  }
  165.  
  166.  unsigned int PDFDoc::getSignedVersionLen()
  167. Index: poppler/PDFDoc.h
  168. ===================================================================
  169. --- poppler/PDFDoc.h    (revision 2952)
  170. +++ poppler/PDFDoc.h    (working copy)
  171. @@ -61,6 +61,7 @@
  172.    writeForceIncremental
  173.  };
  174.  
  175. +
  176.  //------------------------------------------------------------------------
  177.  // PDFDoc
  178.  //------------------------------------------------------------------------
  179. @@ -68,22 +69,22 @@
  180.  class PDFDoc {
  181.  public:
  182.  
  183. -  PDFDoc(GooString *fileNameA, GooString *ownerPassword = NULL,
  184. +  POPPLER_API PDFDoc(GooString *fileNameA, GooString *ownerPassword = NULL,
  185.          GooString *userPassword = NULL, void *guiDataA = NULL);
  186.  
  187.  #ifdef _WIN32
  188. -  PDFDoc(wchar_t *fileNameA, int fileNameLen, GooString *ownerPassword = NULL,
  189. +  POPPLER_API PDFDoc(wchar_t *fileNameA, int fileNameLen, GooString *ownerPassword = NULL,
  190.          GooString *userPassword = NULL, void *guiDataA = NULL);
  191.  #endif
  192.  
  193.    PDFDoc(BaseStream *strA, GooString *ownerPassword = NULL,
  194.          GooString *userPassword = NULL, void *guiDataA = NULL);
  195. -  ~PDFDoc();
  196. +  POPPLER_API ~PDFDoc();
  197.  
  198.    static PDFDoc *ErrorPDFDoc(int errorCode, GooString *fileNameA = NULL);
  199.  
  200.    // Was PDF document successfully opened?
  201. -  GBool isOk() { return ok; }
  202. +  POPPLER_API GBool isOk() { return ok; }
  203.  
  204.    // Get the error code (if isOk() returns false).
  205.    int getErrorCode() { return errCode; }
  206. @@ -136,7 +137,7 @@
  207.    Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); }
  208.  
  209.    // Get page.
  210. -  Page *getPage(int page);
  211. + POPPLER_API Page *getPage(int page);
  212.  
  213.    // Display a page.
  214.    void displayPage(OutputDev *out, int page,
  215. @@ -189,21 +190,21 @@
  216.  #endif
  217.  
  218.    // Is the file encrypted?
  219. -  GBool isEncrypted() { return xref->isEncrypted(); }
  220. +  POPPLER_API GBool isEncrypted() { return xref->isEncrypted(); }
  221.  
  222.    /* PTEID-Changes */
  223.    // Is the file signed?
  224. -  GBool isSigned();
  225. unsigned long getSigByteArray(unsigned char **byte_array);
  226. int getSignatureContents(unsigned char **);
  227. +  POPPLER_API GBool isSigned();
  228. +  POPPLER_API unsigned long getSigByteArray(unsigned char **byte_array);
  229. +  POPPLER_API int getSignatureContents(unsigned char **);
  230.  
  231. -  Object *getByteRange();
  232. +  POPPLER_API Object *getByteRange();
  233.  
  234.  
  235. void prepareSignature(const char * name, const char *location, const char *reason);
  236. +  POPPLER_API void prepareSignature(const char * name, const char *location, const char *reason);
  237.  
  238. void closeSignature(const char *signature_contents);
  239. unsigned int getSignedVersionLen();
  240. +  POPPLER_API void closeSignature(const char *signature_contents);
  241. +  POPPLER_API unsigned int getSignedVersionLen();
  242.  
  243.    /* End of PTEID Changes */
  244.  
  245. @@ -241,15 +242,15 @@
  246.    GBool getID(GooString *permanent_id, GooString *update_id);
  247.  
  248.    // Save one page with another name.
  249. int savePageAs(GooString *name, int pageNo);
  250. +  POPPLER_API int savePageAs(GooString *name, int pageNo);
  251.    // Save this file with another name.
  252. int saveAs(GooString *name, PDFWriteMode mode=writeStandard);
  253. +  POPPLER_API int saveAs(GooString *name, PDFWriteMode mode=writeStandard);
  254.    // Save this file in the given output stream.
  255. int saveAs(OutStream *outStr, PDFWriteMode mode=writeStandard);
  256. +  POPPLER_API int saveAs(OutStream *outStr, PDFWriteMode mode=writeStandard);
  257.    // Save this file with another name without saving changes
  258. int saveWithoutChangesAs(GooString *name);
  259. +  POPPLER_API int saveWithoutChangesAs(GooString *name);
  260.    // Save this file in the given output stream without saving changes
  261. int saveWithoutChangesAs(OutStream *outStr);
  262. +  POPPLER_API int saveWithoutChangesAs(OutStream *outStr);
  263.  
  264.    // Return a pointer to the GUI (XPDFCore or WinPDFCore object).
  265.    void *getGUIData() { return guiData; }
  266. Index: poppler/poppler-config.h
  267. ===================================================================
  268. --- poppler/poppler-config.h    (revision 2952)
  269. +++ poppler/poppler-config.h    (working copy)
  270. @@ -27,6 +27,17 @@
  271.  
  272.  #undef HAVE_SPLASH
  273.  
  274. +/* On Windows we need to export symbols... */
  275. +#ifdef _WIN32
  276. +#ifdef _EXPORTING
  277. +   #define POPPLER_API __declspec(dllexport)
  278. +#else
  279. +   #define POPPLER_API __declspec(dllimport)
  280. +#endif
  281. +#else
  282. +#define POPPLER_API
  283. +#endif
  284. +
  285.  /* Use fixedpoint. */
  286.  #ifndef USE_FIXEDPOINT
  287.  /* #undef USE_FIXEDPOINT */
  288. @@ -51,8 +62,8 @@
  289.  #undef WITH_FONTCONFIGURATION_FONTCONFIG
  290.  
  291.  /* Use win32 font configuration backend */
  292. -#ifndef WITH_FONTCONFIGURATION_WIN32
  293. -/* #undef WITH_FONTCONFIGURATION_WIN32 */
  294. +#ifdef _WIN32
  295. +#define WITH_FONTCONFIGURATION_WIN32 1
  296.  #endif
  297.  
  298.  /* Support for curl is compiled in. */
  299. @@ -87,7 +98,7 @@
  300.  #endif
  301.  
  302.  /* Defines if gettimeofday is available on your system */
  303. -#ifndef HAVE_GETTIMEOFDAY
  304. +#ifndef _WIN32
  305.  #define HAVE_GETTIMEOFDAY 1
  306.  #endif
  307.  

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.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



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.

fantasy-obligation