Changeset 101996 in vbox
- Timestamp:
- Nov 8, 2023 5:57:26 PM (13 months ago)
- Location:
- trunk/src/libs/xpcom18a4/ipc/ipcd
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/ipc/ipcd/daemon/src/ipcd.cpp
r101933 r101996 36 36 * ***** END LICENSE BLOCK ***** */ 37 37 38 #include "prlog.h"39 38 #include "prio.h" 40 39 … … 47 46 #include "ipcd.h" 48 47 48 #include <iprt/assert.h> 49 49 50 //----------------------------------------------------------------------------- 50 51 … … 65 66 IPC_DispatchMsg(ipcClient *client, const ipcMessage *msg) 66 67 { 67 PR_ASSERT(client);68 PR_ASSERT(msg);68 Assert(client); 69 Assert(msg); 69 70 70 71 // remember if client is expecting SYNC_REPLY. we'll add that flag to the 71 72 // next message sent to the client. 72 73 if (msg->TestFlag(IPC_MSG_FLAG_SYNC_QUERY)) { 73 PR_ASSERT(client->GetExpectsSyncReply() == PR_FALSE);74 Assert(client->GetExpectsSyncReply() == PR_FALSE); 74 75 // XXX shouldn't we remember the TargetID as well, and only set the 75 76 // SYNC_REPLY flag on the next message sent to the same TargetID? … … 88 89 IPC_SendMsg(ipcClient *client, ipcMessage *msg) 89 90 { 90 PR_ASSERT(msg);91 Assert(msg); 91 92 92 93 if (client == NULL) { … … 172 173 IPC_EnumClients(ipcClientEnumFunc func, void *closure) 173 174 { 174 PR_ASSERT(func);175 Assert(func); 175 176 for (int i = 0; i < ipcClientCount; ++i) { 176 177 if (func(closure, &ipcClients[i], ipcClients[i].ID()) == PR_FALSE) … … 182 183 IPC_GetClientID(ipcClient *client) 183 184 { 184 PR_ASSERT(client);185 Assert(client); 185 186 return client->ID(); 186 187 } … … 189 190 IPC_ClientHasName(ipcClient *client, const char *name) 190 191 { 191 PR_ASSERT(client);192 PR_ASSERT(name);192 Assert(client); 193 Assert(name); 193 194 return client->HasName(name); 194 195 } … … 197 198 IPC_ClientHasTarget(ipcClient *client, const nsID &target) 198 199 { 199 PR_ASSERT(client);200 Assert(client); 200 201 return client->HasTarget(target); 201 202 } … … 204 205 IPC_EnumClientNames(ipcClient *client, ipcClientNameEnumFunc func, void *closure) 205 206 { 206 PR_ASSERT(client);207 PR_ASSERT(func);207 Assert(client); 208 Assert(func); 208 209 const ipcStringNode *node = client->Names(); 209 210 while (node) { … … 217 218 IPC_EnumClientTargets(ipcClient *client, ipcClientTargetEnumFunc func, void *closure) 218 219 { 219 PR_ASSERT(client);220 PR_ASSERT(func);220 Assert(client); 221 Assert(func); 221 222 const ipcIDNode *node = client->Targets(); 222 223 while (node) { -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/lock/src/ipcLockProtocol.cpp
r1 r101996 38 38 #include <stdlib.h> 39 39 #include <string.h> 40 #include "prlog.h"41 40 #include "ipcLockProtocol.h" 41 42 #include <iprt/assert.h> 42 43 43 44 //----------------------------------------------------------------------------- … … 81 82 IPC_UnflattenLockMsg(const PRUint8 *buf, PRUint32 bufLen, ipcLockMsg *msg) 82 83 { 83 PR_ASSERT(bufLen > 2); // malformed buffer otherwise84 Assert(bufLen > 2); // malformed buffer otherwise 84 85 msg->opcode = get_opcode(buf); 85 86 msg->flags = get_flags(buf); -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/common/tmUtils.h
r1 r101996 42 42 #include "nsError.h" 43 43 #include "nsID.h" 44 #include "prlog.h"45 44 #include <stdio.h> 45 46 #include <iprt/assert.h> 46 47 47 48 // UUID used to identify the Transaction Module in both daemon and client -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/common/tmVector.cpp
r31259 r101996 38 38 #include <stdlib.h> 39 39 #include "tmVector.h" 40 #ifdef VBOX_USE_IPRT_IN_XPCOM 41 # include <iprt/mem.h> 42 #endif 40 41 #include <iprt/mem.h> 43 42 44 43 //////////////////////////////////////////////////////////////////////////// … … 49 48 tmVector::~tmVector() { 50 49 if (mElements) 51 #ifdef VBOX_USE_IPRT_IN_XPCOM52 50 RTMemFree((void*)mElements); 53 #else54 free((void*)mElements);55 #endif56 51 } 57 52 … … 62 57 tmVector::Init() { 63 58 64 #ifdef VBOX_USE_IPRT_IN_XPCOM65 59 mElements = (void**) RTMemAllocZ (mCapacity * sizeof(void*)); 66 #else67 mElements = (void**) calloc (mCapacity, sizeof(void*));68 #endif69 60 if (!mElements) 70 61 return NS_ERROR_OUT_OF_MEMORY; … … 77 68 PRInt32 78 69 tmVector::Append(void *aElement){ 79 PR_ASSERT(aElement);70 Assert(aElement); 80 71 81 72 // make sure there is room … … 94 85 void 95 86 tmVector::Remove(void *aElement) { 96 PR_ASSERT(aElement);87 Assert(aElement); 97 88 98 89 for (PRUint32 index = 0; index < mNext; index++) { … … 111 102 void 112 103 tmVector::RemoveAt(PRUint32 aIndex) { 113 PR_ASSERT(aIndex < mNext);104 Assert(aIndex < mNext); 114 105 115 106 // remove the element if it isn't already nsnull … … 148 139 149 140 PRUint32 newcap = mCapacity + GROWTH_INC; 150 #ifdef VBOX_USE_IPRT_IN_XPCOM151 141 mElements = (void**) RTMemRealloc(mElements, (newcap * sizeof(void*))); 152 #else153 mElements = (void**) realloc(mElements, (newcap * sizeof(void*)));154 #endif155 142 if (mElements) { 156 143 mCapacity = newcap; … … 167 154 PRUint32 newcap = mCapacity - GROWTH_INC; 168 155 if (mNext < newcap) { 169 #ifdef VBOX_USE_IPRT_IN_XPCOM170 156 mElements = (void**) RTMemRealloc(mElements, newcap * sizeof(void*)); 171 #else172 mElements = (void**) realloc(mElements, newcap * sizeof(void*));173 #endif174 157 if (!mElements) 175 158 return NS_ERROR_OUT_OF_MEMORY; -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/common/tmVector.h
r1 r101996 118 118 */ 119 119 void* operator[](PRUint32 index) { 120 PR_ASSERT(index < mNext);120 Assert(index < mNext); 121 121 return mElements[index]; 122 122 } -
trunk/src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcMessage.cpp
r31259 r101996 38 38 #include <stdlib.h> 39 39 #include <string.h> 40 #include "prlog.h"41 40 #include "ipcMessage.h" 42 #ifdef VBOX_USE_IPRT_IN_XPCOM 43 # include <iprt/mem.h> 44 #endif 41 42 #include <iprt/assert.h> 43 #include <iprt/mem.h> 44 45 45 46 46 ipcMessage::~ipcMessage() 47 47 { 48 48 if (mMsgHdr) 49 #ifdef VBOX_USE_IPRT_IN_XPCOM50 49 RTMemFree(mMsgHdr); 51 #else52 free(mMsgHdr);53 #endif54 50 } 55 51 … … 58 54 { 59 55 if (mMsgHdr) { 60 #ifdef VBOX_USE_IPRT_IN_XPCOM61 56 RTMemFree(mMsgHdr); 62 #else63 free(mMsgHdr);64 #endif65 57 mMsgHdr = NULL; 66 58 } … … 79 71 // copy buf if non-null 80 72 if (mMsgHdr) { 81 #ifdef VBOX_USE_IPRT_IN_XPCOM82 73 clone->mMsgHdr = (ipcMessageHeader *) RTMemDup(mMsgHdr, mMsgHdr->mLen); 83 #else84 clone->mMsgHdr = (ipcMessageHeader *) malloc(mMsgHdr->mLen);85 memcpy(clone->mMsgHdr, mMsgHdr, mMsgHdr->mLen);86 #endif87 74 } 88 75 else … … 99 86 { 100 87 if (mMsgHdr) 101 #ifdef VBOX_USE_IPRT_IN_XPCOM102 88 RTMemFree(mMsgHdr); 103 #else 104 free(mMsgHdr); 105 #endif 89 106 90 mMsgComplete = PR_FALSE; 107 91 108 92 // allocate message data 109 93 PRUint32 msgLen = IPC_MSG_HEADER_SIZE + dataLen; 110 #ifdef VBOX_USE_IPRT_IN_XPCOM111 94 mMsgHdr = (ipcMessageHeader *) RTMemAlloc(msgLen); 112 #else113 mMsgHdr = (ipcMessageHeader *) malloc(msgLen);114 #endif115 95 if (!mMsgHdr) { 116 96 mMsgHdr = NULL; … … 134 114 ipcMessage::SetData(PRUint32 offset, const char *data, PRUint32 dataLen) 135 115 { 136 PR_ASSERT(mMsgHdr != NULL);116 Assert(mMsgHdr != NULL); 137 117 138 118 if (offset + dataLen > DataLen())
Note:
See TracChangeset
for help on using the changeset viewer.