Bug 1402065 Add the pdfium patch to the repo and update.sh draft
authorTom Ritter <tom@mozilla.com>
Fri, 22 Sep 2017 00:30:29 -0500
changeset 668902 54e367ae0a64690404476ad9a9161299f540019c
parent 668901 c2ddd93ba3bdddddf39f8075f9c235d9fc75b8ef
child 732797 0553bc182ec8c44c34d756116a9208c139b7df6a
push id81148
push userbmo:tom@mozilla.com
push dateFri, 22 Sep 2017 05:30:55 +0000
bugs1402065
milestone58.0a1
Bug 1402065 Add the pdfium patch to the repo and update.sh MozReview-Commit-ID: 19BisRwSWXM
modules/pdfium/patches/bug1402065_remove___in_and___out.patch
modules/pdfium/update.sh
new file mode 100644
--- /dev/null
+++ b/modules/pdfium/patches/bug1402065_remove___in_and___out.patch
@@ -0,0 +1,78 @@
+# HG changeset patch
+# User Tom Ritter <tom@mozilla.com>
+# Date 1506019436 18000
+#      Thu Sep 21 13:43:56 2017 -0500
+# Node ID 83cf64a1a5e6d104cb699ac4fde07048bdd87543
+# Parent  838dc505b85e966a325736271f6027e70b34fdd6
+Bug 1402065 Remove __in and __out from our in-tree copy of pdfium
+
+These macros are not used by anything other than Microsoft static analysis
+tools, but they break the MinGW compile. MinGW cannot define these macros
+in C++ code, because they conflict with libstdc++ arguement names.
+
+See Line 222 of https://sourceforge.net/p/mingw-w64/mingw-w64/ci/cef07470773f3c56e5189125f6b82bf278265e69/tree/mingw-w64-headers/include/sal.h
+
+diff --git a/modules/pdfium/pdfium/core/fxge/win32/fx_win32_dwrite.cpp b/modules/pdfium/pdfium/core/fxge/win32/fx_win32_dwrite.cpp
+--- a/modules/pdfium/pdfium/core/fxge/win32/fx_win32_dwrite.cpp
++++ b/modules/pdfium/pdfium/core/fxge/win32/fx_win32_dwrite.cpp
+@@ -6,19 +6,19 @@
+ 
+ #include <dwrite.h>
+ 
+ #include "core/fxcrt/fx_system.h"
+ #include "core/fxge/ge/cfx_cliprgn.h"
+ #include "core/fxge/win32/dwrite_int.h"
+ 
+ typedef HRESULT(__stdcall* FuncType_DWriteCreateFactory)(
+-    __in DWRITE_FACTORY_TYPE,
+-    __in REFIID,
+-    __out IUnknown**);
++    DWRITE_FACTORY_TYPE,
++    REFIID,
++    IUnknown**);
+ template <typename InterfaceType>
+ inline void SafeRelease(InterfaceType** currentObject) {
+   if (*currentObject) {
+     (*currentObject)->Release();
+     *currentObject = nullptr;
+   }
+ }
+ template <typename InterfaceType>
+@@ -109,17 +109,17 @@ class CDwGdiTextRenderer {
+   ~CDwGdiTextRenderer();
+ 
+   HRESULT STDMETHODCALLTYPE DrawGlyphRun(const FX_RECT& text_bbox,
+                                          __in_opt CFX_ClipRgn* pClipRgn,
+                                          __in_opt DWRITE_MATRIX const* pMatrix,
+                                          FLOAT baselineOriginX,
+                                          FLOAT baselineOriginY,
+                                          DWRITE_MEASURING_MODE measuringMode,
+-                                         __in DWRITE_GLYPH_RUN const* glyphRun,
++                                         DWRITE_GLYPH_RUN const* glyphRun,
+                                          const COLORREF& textColor);
+ 
+  private:
+   CFX_DIBitmap* pBitmap_;
+   IDWriteBitmapRenderTarget* pRenderTarget_;
+   IDWriteRenderingParams* pRenderingParams_;
+ };
+ 
+@@ -408,17 +408,17 @@ CDwGdiTextRenderer::~CDwGdiTextRenderer(
+ 
+ STDMETHODIMP CDwGdiTextRenderer::DrawGlyphRun(
+     const FX_RECT& text_bbox,
+     __in_opt CFX_ClipRgn* pClipRgn,
+     __in_opt DWRITE_MATRIX const* pMatrix,
+     FLOAT baselineOriginX,
+     FLOAT baselineOriginY,
+     DWRITE_MEASURING_MODE measuringMode,
+-    __in DWRITE_GLYPH_RUN const* glyphRun,
++    DWRITE_GLYPH_RUN const* glyphRun,
+     const COLORREF& textColor) {
+   HRESULT hr = S_OK;
+   if (pMatrix) {
+     hr = pRenderTarget_->SetCurrentTransform(pMatrix);
+     if (FAILED(hr)) {
+       return hr;
+     }
+   }
--- a/modules/pdfium/update.sh
+++ b/modules/pdfium/update.sh
@@ -115,16 +115,20 @@ apply_patches() {
 
     # Patch to avoid using GDIPlusExt while rendering EMF
     echo "Applying patches/bug1367948_avoid_using_GDIPlusExt.patch"
     patch -p3 < patches/bug1367948_avoid_using_GDIPlusExt.patch
 
     # Patch for compatibility with freetype 2.8
     echo "Applying patches/bug1364714_freetype28_compat.patch"
     patch -p3 < patches/bug1364714_freetype28_compat.patch
+
+    # Patch to remove __in and __out macros
+    echo "Applying patches/bug1402065_remove___in_and___out.patch"
+    patch -p3 < patches/bug1402065_remove___in_and___out.patch
 }
 
 update_readme() {
     echo "Updating README_MOZILLA"
     PREFIX="The git commit ID last used to import was"
     perl -p -i -e "s/${PREFIX} [0-9A-Fa-f]+ \(.+\)/${PREFIX} ${COMMIT} (${COMMIT_DATE})/" README_MOZILLA
 }