Huw Davies : ole32: Change helper function to return the matching entry.

Alexandre Julliard julliard at winehq.org
Thu Apr 16 14:34:49 CDT 2009


Module: wine
Branch: master
Commit: b958dfdc4769515c0ef56c401430dd3e3980aabf
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b958dfdc4769515c0ef56c401430dd3e3980aabf

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Apr 16 11:51:45 2009 +0100

ole32: Change helper function to return the matching entry.

---

 dlls/ole32/clipboard.c |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c
index bfb9c72..5cede9d 100644
--- a/dlls/ole32/clipboard.c
+++ b/dlls/ole32/clipboard.c
@@ -528,6 +528,21 @@ static HRESULT render_embed_source_hack(IDataObject *data, LPFORMATETC fmt)
     return hr;
 }
 
+/************************************************************************
+ *           find_format_in_list
+ *
+ * Returns the first entry that matches the provided clipboard format.
+ */
+static inline ole_priv_data_entry *find_format_in_list(ole_priv_data_entry *entries, DWORD num, UINT cf)
+{
+    DWORD i;
+    for(i = 0; i < num; i++)
+        if(entries[i].fmtetc.cfFormat == cf)
+            return &entries[i];
+
+    return NULL;
+}
+
 /***********************************************************************
  *                render_format
  *
@@ -1211,16 +1226,6 @@ static HWND OLEClipbrd_CreateWindow(void)
   return hwnd;
 }
 
-static inline BOOL is_format_in_list(ole_priv_data_entry *entries, DWORD num, UINT cf)
-{
-    DWORD i;
-    for(i = 0; i < num; i++)
-        if(entries[i].fmtetc.cfFormat == cf)
-            return TRUE;
-
-    return FALSE;
-}
-
 /*********************************************************************
  *          set_clipboard_formats
  *
@@ -1294,7 +1299,7 @@ static HRESULT set_clipboard_formats(ole_clipbrd *clipbrd, IDataObject *data)
             CoTaskMemFree(fmt.ptd);
         }
 
-        priv_data->entries[idx].first_use = !is_format_in_list(priv_data->entries, idx, fmt.cfFormat);
+        priv_data->entries[idx].first_use = !find_format_in_list(priv_data->entries, idx, fmt.cfFormat);
         priv_data->entries[idx].unk[0] = 0;
         priv_data->entries[idx].unk[1] = 0;
 




More information about the wine-cvs mailing list