OLE32: remove function prototypes, make functions static

Mike McCormack mike at codeweavers.com
Sat Mar 26 00:06:51 CST 2005


ChangeLog:
* remove function prototypes, make functions static
-------------- next part --------------
Index: dlls/ole32/bindctx.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/bindctx.c,v
retrieving revision 1.32
diff -u -p -r1.32 bindctx.c
--- dlls/ole32/bindctx.c	3 Jan 2005 14:56:42 -0000	1.32
+++ dlls/ole32/bindctx.c	26 Mar 2005 06:06:03 -0000
@@ -27,7 +27,6 @@
 #include "winerror.h"
 #include "windef.h"
 #include "winbase.h"
-#include "wine/unicode.h"
 #include "objbase.h"
 #include "wine/debug.h"
 
@@ -64,82 +63,42 @@ typedef struct BindCtxImpl{
 } BindCtxImpl;
 
 /* IBindCtx prototype functions : */
-
-/* IUnknown functions*/
-static HRESULT WINAPI BindCtxImpl_QueryInterface(IBindCtx* iface,REFIID riid,void** ppvObject);
-static ULONG   WINAPI BindCtxImpl_AddRef(IBindCtx* iface);
-static ULONG   WINAPI BindCtxImpl_Release(IBindCtx* iface);
-/* IBindCtx functions */
-static HRESULT WINAPI BindCtxImpl_RegisterObjectBound(IBindCtx* iface,IUnknown* punk);
-static HRESULT WINAPI BindCtxImpl_RevokeObjectBound(IBindCtx* iface, IUnknown* punk);
-static HRESULT WINAPI BindCtxImpl_ReleaseBoundObjects(IBindCtx* iface);
-static HRESULT WINAPI BindCtxImpl_SetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts);
-static HRESULT WINAPI BindCtxImpl_GetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts);
-static HRESULT WINAPI BindCtxImpl_GetRunningObjectTable(IBindCtx* iface,IRunningObjectTable** pprot);
-static HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown* punk);
-static HRESULT WINAPI BindCtxImpl_GetObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown** punk);
-static HRESULT WINAPI BindCtxImpl_EnumObjectParam(IBindCtx* iface,IEnumString** ppenum);
-static HRESULT WINAPI BindCtxImpl_RevokeObjectParam(IBindCtx* iface,LPOLESTR pszkey);
-/* Local functions*/
-HRESULT WINAPI BindCtxImpl_Construct(BindCtxImpl* This);
-HRESULT WINAPI BindCtxImpl_Destroy(BindCtxImpl* This);
-HRESULT WINAPI BindCtxImpl_GetObjectIndex(BindCtxImpl* This,IUnknown* punk,LPOLESTR pszkey,DWORD *index);
-
-/* Virtual function table for the BindCtx class. */
-static IBindCtxVtbl VT_BindCtxImpl =
-    {
-    BindCtxImpl_QueryInterface,
-    BindCtxImpl_AddRef,
-    BindCtxImpl_Release,
-    BindCtxImpl_RegisterObjectBound,
-    BindCtxImpl_RevokeObjectBound,
-    BindCtxImpl_ReleaseBoundObjects,
-    BindCtxImpl_SetBindOptions,
-    BindCtxImpl_GetBindOptions,
-    BindCtxImpl_GetRunningObjectTable,
-    BindCtxImpl_RegisterObjectParam,
-    BindCtxImpl_GetObjectParam,
-    BindCtxImpl_EnumObjectParam,
-    BindCtxImpl_RevokeObjectParam
-};
+static HRESULT WINAPI BindCtxImpl_ReleaseBoundObjects(IBindCtx*);
+static HRESULT BindCtxImpl_GetObjectIndex(BindCtxImpl*, IUnknown*, LPOLESTR, DWORD *);
 
 /*******************************************************************************
  *        BindCtx_QueryInterface
  *******************************************************************************/
-HRESULT WINAPI BindCtxImpl_QueryInterface(IBindCtx* iface,REFIID riid,void** ppvObject)
+static HRESULT WINAPI
+BindCtxImpl_QueryInterface(IBindCtx* iface,REFIID riid,void** ppvObject)
 {
-  BindCtxImpl *This = (BindCtxImpl *)iface;
-
-  TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
-
-  /* Perform a sanity check on the parameters.*/
-  if ( (This==0) || (ppvObject==0) )
-      return E_INVALIDARG;
+    BindCtxImpl *This = (BindCtxImpl *)iface;
 
-  /* Initialize the return parameter.*/
-  *ppvObject = 0;
+    TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
 
-  /* Compare the riid with the interface IDs implemented by this object.*/
-  if (IsEqualIID(&IID_IUnknown, riid))
-      *ppvObject = (IBindCtx*)This;
-  else
-      if (IsEqualIID(&IID_IBindCtx, riid))
-          *ppvObject = (IBindCtx*)This;
+    /* Perform a sanity check on the parameters.*/
+    if ( (This==0) || (ppvObject==0) )
+        return E_INVALIDARG;
 
-  /* Check that we obtained an interface.*/
-  if ((*ppvObject)==0)
-      return E_NOINTERFACE;
+    /* Initialize the return parameter.*/
+    *ppvObject = 0;
 
-   /* Query Interface always increases the reference count by one when it is successful */
-  BindCtxImpl_AddRef(iface);
+    /* Compare the riid with the interface IDs implemented by this object.*/
+    if (IsEqualIID(&IID_IUnknown, riid) ||
+        IsEqualIID(&IID_IBindCtx, riid))
+    {
+        *ppvObject = (IBindCtx*)This;
+        IBindCtx_AddRef(iface);
+        return S_OK;
+    }
 
-  return S_OK;
+    return E_NOINTERFACE;
 }
 
 /******************************************************************************
  *       BindCtx_AddRef
  ******************************************************************************/
-ULONG WINAPI BindCtxImpl_AddRef(IBindCtx* iface)
+static ULONG WINAPI BindCtxImpl_AddRef(IBindCtx* iface)
 {
     BindCtxImpl *This = (BindCtxImpl *)iface;
 
@@ -149,9 +108,25 @@ ULONG WINAPI BindCtxImpl_AddRef(IBindCtx
 }
 
 /******************************************************************************
+ *        BindCtx_Destroy    (local function)
+ *******************************************************************************/
+static HRESULT BindCtxImpl_Destroy(BindCtxImpl* This)
+{
+    TRACE("(%p)\n",This);
+
+    /* free the table space memory */
+    HeapFree(GetProcessHeap(),0,This->bindCtxTable);
+
+    /* free the bindctx structure */
+    HeapFree(GetProcessHeap(),0,This);
+
+    return S_OK;
+}
+
+/******************************************************************************
  *        BindCtx_Release
  ******************************************************************************/
-ULONG WINAPI BindCtxImpl_Release(IBindCtx* iface)
+static ULONG WINAPI BindCtxImpl_Release(IBindCtx* iface)
 {
     BindCtxImpl *This = (BindCtxImpl *)iface;
     ULONG ref;
@@ -159,8 +134,8 @@ ULONG WINAPI BindCtxImpl_Release(IBindCt
     TRACE("(%p)\n",This);
 
     ref = InterlockedDecrement(&This->ref);
-
-    if (ref == 0){
+    if (ref == 0)
+    {
         /* release all registered objects */
         BindCtxImpl_ReleaseBoundObjects((IBindCtx*)This);
 
@@ -171,59 +146,10 @@ ULONG WINAPI BindCtxImpl_Release(IBindCt
 
 
 /******************************************************************************
- *         BindCtx_Construct (local function)
- *******************************************************************************/
-HRESULT WINAPI BindCtxImpl_Construct(BindCtxImpl* This)
-{
-    TRACE("(%p)\n",This);
-
-    /* Initialize the virtual function table.*/
-    This->lpVtbl       = &VT_BindCtxImpl;
-    This->ref          = 0;
-
-    /* Initialize the BIND_OPTS2 structure */
-    This->bindOption2.cbStruct  = sizeof(BIND_OPTS2);
-    This->bindOption2.grfFlags = 0;
-    This->bindOption2.grfMode = STGM_READWRITE;
-    This->bindOption2.dwTickCountDeadline = 0;
-
-    This->bindOption2.dwTrackFlags = 0;
-    This->bindOption2.dwClassContext = CLSCTX_SERVER;
-    This->bindOption2.locale = 1033;
-    This->bindOption2.pServerInfo = 0;
-
-    /* Initialize the bindctx table */
-    This->bindCtxTableSize=BLOCK_TAB_SIZE;
-    This->bindCtxTableLastIndex=0;
-    This->bindCtxTable= HeapAlloc(GetProcessHeap(), 0,This->bindCtxTableSize*sizeof(BindCtxObject));
-
-    if (This->bindCtxTable==NULL)
-        return E_OUTOFMEMORY;
-
-    return S_OK;
-}
-
-/******************************************************************************
- *        BindCtx_Destroy    (local function)
- *******************************************************************************/
-HRESULT WINAPI BindCtxImpl_Destroy(BindCtxImpl* This)
-{
-    TRACE("(%p)\n",This);
-
-    /* free the table space memory */
-    HeapFree(GetProcessHeap(),0,This->bindCtxTable);
-
-    /* free the bindctx structure */
-    HeapFree(GetProcessHeap(),0,This);
-
-    return S_OK;
-}
-
-
-/******************************************************************************
  *        BindCtx_RegisterObjectBound
  ******************************************************************************/
-HRESULT WINAPI BindCtxImpl_RegisterObjectBound(IBindCtx* iface,IUnknown* punk)
+static HRESULT WINAPI
+BindCtxImpl_RegisterObjectBound(IBindCtx* iface,IUnknown* punk)
 {
     BindCtxImpl *This = (BindCtxImpl *)iface;
     DWORD lastIndex=This->bindCtxTableLastIndex;
@@ -261,7 +187,8 @@ HRESULT WINAPI BindCtxImpl_RegisterObjec
 /******************************************************************************
  *        BindCtx_RevokeObjectBound
  ******************************************************************************/
-HRESULT WINAPI BindCtxImpl_RevokeObjectBound(IBindCtx* iface, IUnknown* punk)
+static HRESULT WINAPI
+BindCtxImpl_RevokeObjectBound(IBindCtx* iface, IUnknown* punk)
 {
     DWORD index,j;
 
@@ -289,7 +216,8 @@ HRESULT WINAPI BindCtxImpl_RevokeObjectB
 /******************************************************************************
  *        BindCtx_ReleaseBoundObjects
  ******************************************************************************/
-HRESULT WINAPI BindCtxImpl_ReleaseBoundObjects(IBindCtx* iface)
+static HRESULT WINAPI
+BindCtxImpl_ReleaseBoundObjects(IBindCtx* iface)
 {
     DWORD i;
 
@@ -312,7 +240,8 @@ HRESULT WINAPI BindCtxImpl_ReleaseBoundO
 /******************************************************************************
  *        BindCtx_SetBindOptions
  ******************************************************************************/
-HRESULT WINAPI BindCtxImpl_SetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts)
+static HRESULT WINAPI
+BindCtxImpl_SetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts)
 {
     BindCtxImpl *This = (BindCtxImpl *)iface;
 
@@ -333,7 +262,8 @@ HRESULT WINAPI BindCtxImpl_SetBindOption
 /******************************************************************************
  *        BindCtx_GetBindOptions
  ******************************************************************************/
-HRESULT WINAPI BindCtxImpl_GetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts)
+static HRESULT WINAPI
+BindCtxImpl_GetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts)
 {
     BindCtxImpl *This = (BindCtxImpl *)iface;
 
@@ -354,7 +284,8 @@ HRESULT WINAPI BindCtxImpl_GetBindOption
 /******************************************************************************
  *        BindCtx_GetRunningObjectTable
  ******************************************************************************/
-HRESULT WINAPI BindCtxImpl_GetRunningObjectTable(IBindCtx* iface,IRunningObjectTable** pprot)
+static HRESULT WINAPI
+BindCtxImpl_GetRunningObjectTable(IBindCtx* iface,IRunningObjectTable** pprot)
 {
     HRESULT res;
 
@@ -373,7 +304,8 @@ HRESULT WINAPI BindCtxImpl_GetRunningObj
 /******************************************************************************
  *        BindCtx_RegisterObjectParam
  ******************************************************************************/
-HRESULT WINAPI BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown* punk)
+static HRESULT WINAPI
+BindCtxImpl_RegisterObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown* punk)
 {
     DWORD index=0;
     BindCtxImpl *This = (BindCtxImpl *)iface;
@@ -399,23 +331,26 @@ HRESULT WINAPI BindCtxImpl_RegisterObjec
 
         This->bindCtxTable[This->bindCtxTableLastIndex].pkeyObj=NULL;
 
-    else{
+    else
+    {
 
         This->bindCtxTable[This->bindCtxTableLastIndex].pkeyObj=
             HeapAlloc(GetProcessHeap(),0,(sizeof(WCHAR)*(1+lstrlenW(pszkey))));
 
         if (This->bindCtxTable[This->bindCtxTableLastIndex].pkeyObj==NULL)
             return E_OUTOFMEMORY;
-        strcpyW(This->bindCtxTable[This->bindCtxTableLastIndex].pkeyObj,pszkey);
+        lstrcpyW(This->bindCtxTable[This->bindCtxTableLastIndex].pkeyObj,pszkey);
     }
 
     This->bindCtxTableLastIndex++;
 
-    if (This->bindCtxTableLastIndex == This->bindCtxTableSize){ /* table is full ! must be resized */
+    if (This->bindCtxTableLastIndex == This->bindCtxTableSize)
+    {
+        /* table is full ! must be resized */
 
         This->bindCtxTableSize+=BLOCK_TAB_SIZE; /* new table size */
-
-        if (This->bindCtxTableSize > (MAX_TAB_SIZE-BLOCK_TAB_SIZE)){
+        if (This->bindCtxTableSize > (MAX_TAB_SIZE-BLOCK_TAB_SIZE))
+        {
             FIXME("This->bindCtxTableSize: %ld is out of data limite \n",This->bindCtxTableSize);
             return E_FAIL;
         }
@@ -431,7 +366,8 @@ HRESULT WINAPI BindCtxImpl_RegisterObjec
 /******************************************************************************
  *        BindCtx_GetObjectParam
  ******************************************************************************/
-HRESULT WINAPI BindCtxImpl_GetObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown** punk)
+static HRESULT WINAPI
+BindCtxImpl_GetObjectParam(IBindCtx* iface,LPOLESTR pszkey, IUnknown** punk)
 {
     DWORD index;
     BindCtxImpl *This = (BindCtxImpl *)iface;
@@ -456,7 +392,8 @@ HRESULT WINAPI BindCtxImpl_GetObjectPara
 /******************************************************************************
  *        BindCtx_RevokeObjectParam
  ******************************************************************************/
-HRESULT WINAPI BindCtxImpl_RevokeObjectParam(IBindCtx* iface,LPOLESTR ppenum)
+static HRESULT WINAPI
+BindCtxImpl_RevokeObjectParam(IBindCtx* iface,LPOLESTR ppenum)
 {
     DWORD index,j;
 
@@ -484,7 +421,8 @@ HRESULT WINAPI BindCtxImpl_RevokeObjectP
 /******************************************************************************
  *        BindCtx_EnumObjectParam
  ******************************************************************************/
-HRESULT WINAPI BindCtxImpl_EnumObjectParam(IBindCtx* iface,IEnumString** pszkey)
+static HRESULT WINAPI
+BindCtxImpl_EnumObjectParam(IBindCtx* iface,IEnumString** pszkey)
 {
     FIXME("(%p,%p),stub!\n",iface,pszkey);
     return E_NOTIMPL;
@@ -493,7 +431,7 @@ HRESULT WINAPI BindCtxImpl_EnumObjectPar
 /********************************************************************************
  *        GetObjectIndex (local function)
  ********************************************************************************/
-HRESULT WINAPI BindCtxImpl_GetObjectIndex(BindCtxImpl* This,
+static HRESULT BindCtxImpl_GetObjectIndex(BindCtxImpl* This,
                                           IUnknown* punk,
                                           LPOLESTR pszkey,
                                           DWORD *index)
@@ -506,8 +444,8 @@ HRESULT WINAPI BindCtxImpl_GetObjectInde
 
     if (punk==NULL)
         /* search object identified by a register key */
-        for(i=0; ( (i<This->bindCtxTableLastIndex) && (!found));i++){
-
+        for(i=0; ( (i<This->bindCtxTableLastIndex) && (!found));i++)
+        {
             if(This->bindCtxTable[i].regType==1){
 
                 if ( ( (This->bindCtxTable[i].pkeyObj==NULL) && (pszkey==NULL) ) ||
@@ -535,6 +473,58 @@ HRESULT WINAPI BindCtxImpl_GetObjectInde
     return S_FALSE;
 }
 
+/* Virtual function table for the BindCtx class. */
+static IBindCtxVtbl VT_BindCtxImpl =
+{
+    BindCtxImpl_QueryInterface,
+    BindCtxImpl_AddRef,
+    BindCtxImpl_Release,
+    BindCtxImpl_RegisterObjectBound,
+    BindCtxImpl_RevokeObjectBound,
+    BindCtxImpl_ReleaseBoundObjects,
+    BindCtxImpl_SetBindOptions,
+    BindCtxImpl_GetBindOptions,
+    BindCtxImpl_GetRunningObjectTable,
+    BindCtxImpl_RegisterObjectParam,
+    BindCtxImpl_GetObjectParam,
+    BindCtxImpl_EnumObjectParam,
+    BindCtxImpl_RevokeObjectParam
+};
+
+/******************************************************************************
+ *         BindCtx_Construct (local function)
+ *******************************************************************************/
+static HRESULT BindCtxImpl_Construct(BindCtxImpl* This)
+{
+    TRACE("(%p)\n",This);
+
+    /* Initialize the virtual function table.*/
+    This->lpVtbl       = &VT_BindCtxImpl;
+    This->ref          = 0;
+
+    /* Initialize the BIND_OPTS2 structure */
+    This->bindOption2.cbStruct  = sizeof(BIND_OPTS2);
+    This->bindOption2.grfFlags = 0;
+    This->bindOption2.grfMode = STGM_READWRITE;
+    This->bindOption2.dwTickCountDeadline = 0;
+
+    This->bindOption2.dwTrackFlags = 0;
+    This->bindOption2.dwClassContext = CLSCTX_SERVER;
+    This->bindOption2.locale = 1033;
+    This->bindOption2.pServerInfo = 0;
+
+    /* Initialize the bindctx table */
+    This->bindCtxTableSize=BLOCK_TAB_SIZE;
+    This->bindCtxTableLastIndex=0;
+    This->bindCtxTable = HeapAlloc(GetProcessHeap(), 0,
+                                This->bindCtxTableSize*sizeof(BindCtxObject));
+
+    if (This->bindCtxTable==NULL)
+        return E_OUTOFMEMORY;
+
+    return S_OK;
+}
+
 /******************************************************************************
  *        CreateBindCtx16
  ******************************************************************************/
@@ -556,14 +546,12 @@ HRESULT WINAPI CreateBindCtx(DWORD reser
     TRACE("(%ld,%p)\n",reserved,ppbc);
 
     newBindCtx = HeapAlloc(GetProcessHeap(), 0, sizeof(BindCtxImpl));
-
     if (newBindCtx == 0)
         return E_OUTOFMEMORY;
 
     hr = BindCtxImpl_Construct(newBindCtx);
-
-    if (FAILED(hr)){
-
+    if (FAILED(hr))
+    {
         HeapFree(GetProcessHeap(),0,newBindCtx);
         return hr;
     }


More information about the wine-patches mailing list