Title: [264741] trunk/Source/WebCore
Revision
264741
Author
hironori.fu...@sony.com
Date
2020-07-22 18:49:25 -0700 (Wed, 22 Jul 2020)

Log Message

[WinCairo][32bit] JPEG2000ImageDecoder.cpp: error C2664: 'std::unique_ptr<...>::unique_ptr(...)': cannot convert argument 2 from 'void (__stdcall *)(opj_codec_t *)' to 'const _Dx &'
https://bugs.webkit.org/show_bug.cgi?id=214657

Reviewed by Darin Adler.

__cdecl and __stdcall calling conventions don't match.
<https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions>

* platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp:
(WebCore::JPEG2000ImageDecoder::decode): Use decltype for the second template argument of unique_ptr.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (264740 => 264741)


--- trunk/Source/WebCore/ChangeLog	2020-07-23 01:44:59 UTC (rev 264740)
+++ trunk/Source/WebCore/ChangeLog	2020-07-23 01:49:25 UTC (rev 264741)
@@ -1,3 +1,16 @@
+2020-07-22  Fujii Hironori  <hironori.fu...@sony.com>
+
+        [WinCairo][32bit] JPEG2000ImageDecoder.cpp: error C2664: 'std::unique_ptr<...>::unique_ptr(...)': cannot convert argument 2 from 'void (__stdcall *)(opj_codec_t *)' to 'const _Dx &'
+        https://bugs.webkit.org/show_bug.cgi?id=214657
+
+        Reviewed by Darin Adler.
+
+        __cdecl and __stdcall calling conventions don't match.
+        <https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions>
+
+        * platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp:
+        (WebCore::JPEG2000ImageDecoder::decode): Use decltype for the second template argument of unique_ptr.
+
 2020-07-22  Jon Davis  <j...@apple.com>
 
         Add feature status for CSS Containment Module Level 1

Modified: trunk/Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp (264740 => 264741)


--- trunk/Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp	2020-07-23 01:44:59 UTC (rev 264740)
+++ trunk/Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp	2020-07-23 01:49:25 UTC (rev 264741)
@@ -360,7 +360,7 @@
     if (failed())
         return;
 
-    std::unique_ptr<opj_codec_t, void(*)(opj_codec_t*)> decoder(opj_create_decompress(m_format == Format::JP2 ? OPJ_CODEC_JP2 : OPJ_CODEC_J2K), opj_destroy_codec);
+    std::unique_ptr<opj_codec_t, decltype(&opj_destroy_codec)> decoder(opj_create_decompress(m_format == Format::JP2 ? OPJ_CODEC_JP2 : OPJ_CODEC_J2K), opj_destroy_codec);
     if (!decoder) {
         setFailed();
         return;
@@ -373,7 +373,7 @@
         return;
     }
 
-    std::unique_ptr<opj_stream_t, void(*)(opj_stream_t*)> stream(opj_stream_default_create(OPJ_TRUE), opj_stream_destroy);
+    std::unique_ptr<opj_stream_t, decltype(&opj_stream_destroy)> stream(opj_stream_default_create(OPJ_TRUE), opj_stream_destroy);
     if (!stream) {
         setFailed();
         return;
@@ -424,7 +424,7 @@
         return;
     }
 
-    std::unique_ptr<opj_image_t, void(*)(opj_image_t*)> image(imagePtr, opj_image_destroy);
+    std::unique_ptr<opj_image_t, decltype(&opj_image_destroy)> image(imagePtr, opj_image_destroy);
     setSize({ static_cast<int>(image->x1 - image->x0), static_cast<int>(image->y1 - image->y0) });
     if (onlySize)
         return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to