[PATCH 1/5] windowscodecs: Move stream wrappers to stream.c.

Rémi Bernon rbernon at codeweavers.com
Thu Jan 14 15:20:51 CST 2021


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

Although JPEG-XR is already upstream (supposedly) in 6.0, this is a
bit of refactoring to make windowscodecs.dll decoder.c, and its unix
lib interfaces usable directly from wmphoto.dll, in order to later
integrate jxrlib for decoding JPEG-XR images.

We could also duplicate the code, but that doesn't feel very nice.

 dlls/windowscodecs/main.c   | 37 -------------------------------------
 dlls/windowscodecs/stream.c | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/dlls/windowscodecs/main.c b/dlls/windowscodecs/main.c
index e78acc3f34f..efc6bc2c227 100644
--- a/dlls/windowscodecs/main.c
+++ b/dlls/windowscodecs/main.c
@@ -190,43 +190,6 @@ HRESULT write_source(IWICBitmapFrameEncode *iface,
     return hr;
 }
 
-HRESULT CDECL stream_getsize(IStream *stream, ULONGLONG *size)
-{
-    STATSTG statstg;
-    HRESULT hr;
-
-    hr = IStream_Stat(stream, &statstg, STATFLAG_NONAME);
-
-    if (SUCCEEDED(hr))
-        *size = statstg.cbSize.QuadPart;
-
-    return hr;
-}
-
-HRESULT CDECL stream_read(IStream *stream, void *buffer, ULONG read, ULONG *bytes_read)
-{
-    return IStream_Read(stream, buffer, read, bytes_read);
-}
-
-HRESULT CDECL stream_seek(IStream *stream, LONGLONG ofs, DWORD origin, ULONGLONG *new_position)
-{
-    HRESULT hr;
-    LARGE_INTEGER ofs_large;
-    ULARGE_INTEGER pos_large;
-
-    ofs_large.QuadPart = ofs;
-    hr = IStream_Seek(stream, ofs_large, origin, &pos_large);
-    if (new_position)
-        *new_position = pos_large.QuadPart;
-
-    return hr;
-}
-
-HRESULT CDECL stream_write(IStream *stream, const void *buffer, ULONG write, ULONG *bytes_written)
-{
-    return IStream_Write(stream, buffer, write, bytes_written);
-}
-
 HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp)
 {
     HRESULT hr;
diff --git a/dlls/windowscodecs/stream.c b/dlls/windowscodecs/stream.c
index 68b9148bd5e..8c36825b641 100644
--- a/dlls/windowscodecs/stream.c
+++ b/dlls/windowscodecs/stream.c
@@ -1167,3 +1167,40 @@ HRESULT StreamImpl_Create(IWICStream **stream)
 
     return S_OK;
 }
+
+HRESULT CDECL stream_getsize(IStream *stream, ULONGLONG *size)
+{
+    STATSTG statstg;
+    HRESULT hr;
+
+    hr = IStream_Stat(stream, &statstg, STATFLAG_NONAME);
+
+    if (SUCCEEDED(hr))
+        *size = statstg.cbSize.QuadPart;
+
+    return hr;
+}
+
+HRESULT CDECL stream_read(IStream *stream, void *buffer, ULONG read, ULONG *bytes_read)
+{
+    return IStream_Read(stream, buffer, read, bytes_read);
+}
+
+HRESULT CDECL stream_seek(IStream *stream, LONGLONG ofs, DWORD origin, ULONGLONG *new_position)
+{
+    HRESULT hr;
+    LARGE_INTEGER ofs_large;
+    ULARGE_INTEGER pos_large;
+
+    ofs_large.QuadPart = ofs;
+    hr = IStream_Seek(stream, ofs_large, origin, &pos_large);
+    if (new_position)
+        *new_position = pos_large.QuadPart;
+
+    return hr;
+}
+
+HRESULT CDECL stream_write(IStream *stream, const void *buffer, ULONG write, ULONG *bytes_written)
+{
+    return IStream_Write(stream, buffer, write, bytes_written);
+}
-- 
2.30.0




More information about the wine-devel mailing list