Changeset 31259 in vbox for trunk/src/libs/xpcom18a4/ipc/ipcd/extensions
- Timestamp:
- Jul 30, 2010 8:02:05 PM (14 years ago)
- Location:
- trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/common/tmTransaction.cpp
r1 r31259 38 38 #include <stdlib.h> 39 39 #include "tmTransaction.h" 40 #ifdef VBOX_USE_IPRT_IN_XPCOM 41 # include <iprt/mem.h> 42 #endif 40 43 41 44 /////////////////////////////////////////////////////////////////////////////// … … 44 47 tmTransaction::~tmTransaction() { 45 48 if (mHeader) 49 #ifdef VBOX_USE_IPRT_IN_XPCOM 50 RTMemFree(mHeader); 51 #else 46 52 free(mHeader); 53 #endif 47 54 } 48 55 … … 51 58 nsresult 52 59 tmTransaction::Init(PRUint32 aOwnerID, 53 PRInt32 aQueueID, 54 PRUint32 aAction, 55 PRInt32 aStatus, 56 const PRUint8 *aMessage, 60 PRInt32 aQueueID, 61 PRUint32 aAction, 62 PRInt32 aStatus, 63 const PRUint8 *aMessage, 57 64 PRUint32 aLength) { 58 65 nsresult rv = NS_OK; … … 61 68 // indicates the message is the entire raw message 62 69 if (aQueueID == TM_INVALID_ID) { 70 #ifdef VBOX_USE_IPRT_IN_XPCOM 71 header = (tmHeader*) RTMemAlloc(aLength); 72 #else 63 73 header = (tmHeader*) malloc(aLength); 74 #endif 64 75 if (header) { 65 76 mRawMessageLength = aLength; … … 70 81 } 71 82 else { // need to create the tmHeader and concat the message 83 #ifdef VBOX_USE_IPRT_IN_XPCOM 84 header = (tmHeader*) RTMemAlloc (sizeof(tmHeader) + aLength); 85 #else 72 86 header = (tmHeader*) malloc (sizeof(tmHeader) + aLength); 87 #endif 73 88 if (header) { 74 89 mRawMessageLength = sizeof(tmHeader) + aLength; -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/common/tmVector.cpp
r1 r31259 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 43 41 44 //////////////////////////////////////////////////////////////////////////// … … 46 49 tmVector::~tmVector() { 47 50 if (mElements) 51 #ifdef VBOX_USE_IPRT_IN_XPCOM 52 RTMemFree((void*)mElements); 53 #else 48 54 free((void*)mElements); 55 #endif 49 56 } 50 57 … … 55 62 tmVector::Init() { 56 63 64 #ifdef VBOX_USE_IPRT_IN_XPCOM 65 mElements = (void**) RTMemAllocZ (mCapacity * sizeof(void*)); 66 #else 57 67 mElements = (void**) calloc (mCapacity, sizeof(void*)); 68 #endif 58 69 if (!mElements) 59 70 return NS_ERROR_OUT_OF_MEMORY; … … 117 128 //tmVector::operator[](int index) { 118 129 // if (index < mNext && index >= 0) 119 // return mElements[index]; 130 // return mElements[index]; 120 131 // return nsnull; 121 132 //} … … 137 148 138 149 PRUint32 newcap = mCapacity + GROWTH_INC; 150 #ifdef VBOX_USE_IPRT_IN_XPCOM 151 mElements = (void**) RTMemRealloc(mElements, (newcap * sizeof(void*))); 152 #else 139 153 mElements = (void**) realloc(mElements, (newcap * sizeof(void*))); 154 #endif 140 155 if (mElements) { 141 156 mCapacity = newcap; … … 152 167 PRUint32 newcap = mCapacity - GROWTH_INC; 153 168 if (mNext < newcap) { 169 #ifdef VBOX_USE_IPRT_IN_XPCOM 170 mElements = (void**) RTMemRealloc(mElements, newcap * sizeof(void*)); 171 #else 154 172 mElements = (void**) realloc(mElements, newcap * sizeof(void*)); 173 #endif 155 174 if (!mElements) 156 175 return NS_ERROR_OUT_OF_MEMORY;
Note:
See TracChangeset
for help on using the changeset viewer.