Changeset 5522 in vbox for trunk/src/libs/xpcom18a4/ipc/ipcd/extensions
- Timestamp:
- Oct 26, 2007 5:21:00 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 25742
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp
r4863 r5522 122 122 // dconnect minor opcodes for INVOKE 123 123 124 #pragma pack(1) 125 124 126 struct DConnectOp 125 127 { … … 186 188 // (see ipcDConnectService::SerializeException) 187 189 }; 190 191 #pragma pack() 188 192 189 193 //----------------------------------------------------------------------------- … … 471 475 case nsXPTType::T_IID: 472 476 { 473 nsID *buf = (nsID *) malloc(sizeof(nsID));477 nsID *buf = (nsID *) nsMemory::Alloc(sizeof(nsID)); 474 478 reader.GetBytes(buf, sizeof(nsID)); 475 479 v.val.p = v.ptr = buf; … … 489 493 else 490 494 { 491 char *buf = (char *) malloc(len + 1);495 char *buf = (char *) nsMemory::Alloc(len + 1); 492 496 reader.GetBytes(buf, len); 493 497 buf[len] = char(0); … … 510 514 else 511 515 { 512 PRUnichar *buf = (PRUnichar *) malloc(len + 2);516 PRUnichar *buf = (PRUnichar *) nsMemory::Alloc(len + 2); 513 517 reader.GetBytes(buf, len); 514 518 buf[len / 2] = PRUnichar(0); … … 621 625 v.type = t; 622 626 v.flags = nsXPTCVariant::PTR_IS_DATA; 627 628 // nsID, string and wstring types are not understood as dippers (see 629 // DIPPER_TYPE in xpidl.h) but they behave like dippers too. Therefore we 630 // need to treat them so manually. 631 switch (t.TagPart()) 632 { 633 case nsXPTType::T_IID: 634 case nsXPTType::T_CHAR_STR: 635 case nsXPTType::T_WCHAR_STR: 636 // add VAL_IS_ALLOCD to cause FinishParam() to do cleanup 637 v.flags |= nsXPTCVariant::VAL_IS_ALLOCD; 638 break; 639 default: 640 break; 641 } 623 642 } 624 643 … … 633 652 634 653 if (v.IsValAllocated()) 635 free(v.val.p);654 nsMemory::Free(v.val.p); 636 655 else if (v.IsValInterface()) 637 656 ((nsISupports *) v.val.p)->Release(); … … 1786 1805 1787 1806 // check if this object is nsISupports itself 1788 nsIID *iid = 0; 1789 rv = mIInfo->GetInterfaceIID(&iid); 1790 NS_ASSERTION(NS_SUCCEEDED(rv) && iid, 1791 "nsIInterfaceInfo::GetInterfaceIID failed"); 1792 if (NS_SUCCEEDED(rv) && iid && 1793 iid->Equals(NS_GET_IID(nsISupports))) 1794 { 1795 // nsISupports is queried on nsISupports, return ourselves 1796 *aInstancePtr = this; 1797 NS_ADDREF_THIS(); 1798 // cache ourselves weakly 1799 mCachedISupports = this; 1800 1801 PR_Unlock(dConnect->StubQILock()); 1802 return NS_OK; 1807 { 1808 nsIID *iid = 0; 1809 rv = mIInfo->GetInterfaceIID(&iid); 1810 NS_ASSERTION(NS_SUCCEEDED(rv) && iid, 1811 "nsIInterfaceInfo::GetInterfaceIID failed"); 1812 if (NS_SUCCEEDED(rv) && iid && 1813 iid->Equals(NS_GET_IID(nsISupports))) 1814 { 1815 nsMemory::Free((void*)iid); 1816 1817 // nsISupports is queried on nsISupports, return ourselves 1818 *aInstancePtr = this; 1819 NS_ADDREF_THIS(); 1820 // cache ourselves weakly 1821 mCachedISupports = this; 1822 1823 PR_Unlock(dConnect->StubQILock()); 1824 return NS_OK; 1825 } 1826 if (iid) 1827 nsMemory::Free((void*)iid); 1803 1828 } 1804 1829
Note:
See TracChangeset
for help on using the changeset viewer.