[ros-diffs] [cwittich] 46313: [WINDOWSCODECS] sync windowscodecs with wine 1.1.41

cwittich at svn.reactos.org cwittich at svn.reactos.org
Sun Mar 21 20:14:16 CET 2010


Author: cwittich
Date: Sun Mar 21 20:14:16 2010
New Revision: 46313

URL: http://svn.reactos.org/svn/reactos?rev=46313&view=rev
Log:
[WINDOWSCODECS]
sync windowscodecs with wine 1.1.41

Modified:
    trunk/reactos/dll/win32/windowscodecs/info.c
    trunk/reactos/dll/win32/windowscodecs/jpegformat.c
    trunk/reactos/dll/win32/windowscodecs/pngformat.c

Modified: trunk/reactos/dll/win32/windowscodecs/info.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/info.c?rev=46313&r1=46312&r2=46313&view=diff
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/info.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/info.c [iso-8859-1] Sun Mar 21 20:14:16 2010
@@ -726,6 +726,7 @@
     LONG ref;
     struct list objects;
     struct list *cursor;
+    CRITICAL_SECTION lock; /* Must be held when reading or writing cursor */
 } ComponentEnum;
 
 typedef struct {
@@ -783,6 +784,8 @@
             list_remove(&cursor->entry);
             HeapFree(GetProcessHeap(), 0, cursor);
         }
+        This->lock.DebugInfo->Spare[0] = 0;
+        DeleteCriticalSection(&This->lock);
         HeapFree(GetProcessHeap(), 0, This);
     }
 
@@ -795,15 +798,17 @@
     ComponentEnum *This = (ComponentEnum*)iface;
     int num_fetched=0;
     ComponentEnumItem *item;
+    HRESULT hr=S_OK;
 
     TRACE("(%p,%u,%p,%p)\n", iface, celt, rgelt, pceltFetched);
 
+    EnterCriticalSection(&This->lock);
     while (num_fetched<celt)
     {
         if (!This->cursor)
         {
-            *pceltFetched = num_fetched;
-            return S_FALSE;
+            hr = S_FALSE;
+            break;
         }
         item = LIST_ENTRY(This->cursor, ComponentEnumItem, entry);
         IUnknown_AddRef(item->unk);
@@ -811,24 +816,31 @@
         num_fetched++;
         This->cursor = list_next(&This->objects, This->cursor);
     }
+    LeaveCriticalSection(&This->lock);
     *pceltFetched = num_fetched;
-    return S_OK;
+    return hr;
 }
 
 static HRESULT WINAPI ComponentEnum_Skip(IEnumUnknown *iface, ULONG celt)
 {
     ComponentEnum *This = (ComponentEnum*)iface;
     int i;
+    HRESULT hr=S_OK;
 
     TRACE("(%p,%u)\n", iface, celt);
 
+    EnterCriticalSection(&This->lock);
     for (i=0; i<celt; i++)
     {
         if (!This->cursor)
-            return S_FALSE;
+        {
+            hr = S_FALSE;
+            break;
+        }
         This->cursor = list_next(&This->objects, This->cursor);
     }
-    return S_OK;
+    LeaveCriticalSection(&This->lock);
+    return hr;
 }
 
 static HRESULT WINAPI ComponentEnum_Reset(IEnumUnknown *iface)
@@ -837,7 +849,9 @@
 
     TRACE("(%p)\n", iface);
 
+    EnterCriticalSection(&This->lock);
     This->cursor = list_head(&This->objects);
+    LeaveCriticalSection(&This->lock);
     return S_OK;
 }
 
@@ -847,6 +861,7 @@
     ComponentEnum *new_enum;
     ComponentEnumItem *old_item, *new_item;
     HRESULT ret=S_OK;
+    struct list *old_cursor;
 
     new_enum = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentEnum));
     if (!new_enum)
@@ -858,8 +873,14 @@
     new_enum->IEnumUnknown_Vtbl = &ComponentEnumVtbl;
     new_enum->ref = 1;
     new_enum->cursor = NULL;
-
     list_init(&new_enum->objects);
+    InitializeCriticalSection(&new_enum->lock);
+    new_enum->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ComponentEnum.lock");
+
+    EnterCriticalSection(&This->lock);
+    old_cursor = This->cursor;
+    LeaveCriticalSection(&This->lock);
+
     LIST_FOR_EACH_ENTRY(old_item, &This->objects, ComponentEnumItem, entry)
     {
         new_item = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentEnumItem));
@@ -871,7 +892,7 @@
         new_item->unk = old_item->unk;
         list_add_tail(&new_enum->objects, &new_item->entry);
         IUnknown_AddRef(new_item->unk);
-        if (&old_item->entry == This->cursor) new_enum->cursor = &new_item->entry;
+        if (&old_item->entry == old_cursor) new_enum->cursor = &new_item->entry;
     }
 
     if (FAILED(ret))
@@ -923,6 +944,8 @@
     This->IEnumUnknown_Vtbl = &ComponentEnumVtbl;
     This->ref = 1;
     list_init(&This->objects);
+    InitializeCriticalSection(&This->lock);
+    This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ComponentEnum.lock");
 
     for (category=categories; category->type && hr == S_OK; category++)
     {

Modified: trunk/reactos/dll/win32/windowscodecs/jpegformat.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/jpegformat.c?rev=46313&r1=46312&r2=46313&view=diff
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/jpegformat.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/jpegformat.c [iso-8859-1] Sun Mar 21 20:14:16 2010
@@ -570,7 +570,7 @@
 
 HRESULT JpegDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
 {
-    ERR("Trying to load JPEG picture, but JPEG supported not compiled in.\n");
+    ERR("Trying to load JPEG picture, but JPEG support is not compiled in.\n");
     return E_FAIL;
 }
 

Modified: trunk/reactos/dll/win32/windowscodecs/pngformat.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/windowscodecs/pngformat.c?rev=46313&r1=46312&r2=46313&view=diff
==============================================================================
--- trunk/reactos/dll/win32/windowscodecs/pngformat.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/windowscodecs/pngformat.c [iso-8859-1] Sun Mar 21 20:14:16 2010
@@ -1320,13 +1320,13 @@
 
 HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
 {
-    ERR("Trying to load PNG picture, but PNG supported not compiled in.\n");
+    ERR("Trying to load PNG picture, but PNG support is not compiled in.\n");
     return E_FAIL;
 }
 
 HRESULT PngEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
 {
-    ERR("Trying to save PNG picture, but PNG supported not compiled in.\n");
+    ERR("Trying to save PNG picture, but PNG support is not compiled in.\n");
     return E_FAIL;
 }
 




More information about the Ros-diffs mailing list