Changeset 21169 in vbox for trunk/src/libs/xpcom18a4/ipc/ipcd/extensions
- Timestamp:
- Jul 2, 2009 2:34:49 PM (16 years ago)
- Location:
- trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp
r21147 r21169 196 196 //----------------------------------------------------------------------------- 197 197 198 struct DConAddrPlusPtr 199 { 200 DConAddr addr; 201 void *p; 202 }; 203 204 //----------------------------------------------------------------------------- 205 198 206 ipcDConnectService *ipcDConnectService::mInstance = nsnull; 199 207 … … 533 541 case nsXPTType::T_INTERFACE_IS: 534 542 { 535 reader.GetBytes(&v.val. p, sizeof(void *));543 reader.GetBytes(&v.val.u64, sizeof(DConAddr)); 536 544 // stub creation will be handled outside this routine. we only 537 // deserialize the DConAddr into v.val. ptemporarily.545 // deserialize the DConAddr into v.val.u64 temporarily. 538 546 } 539 547 break; … … 768 776 { 769 777 // stub creation will be handled outside this routine. we only 770 // deserialize the DConAddr into v.val.p temporarily. 771 void *ptr; 772 reader.GetBytes(&ptr, sizeof(void *)); 773 *((void **) v.val.p) = ptr; 778 // deserialize the DConAddr and the original value of v.val.p 779 // into v.val.p temporarily. needs temporary memory alloc. 780 DConAddrPlusPtr *buf = (DConAddrPlusPtr *) nsMemory::Alloc(sizeof(DConAddrPlusPtr)); 781 reader.GetBytes(&buf->addr, sizeof(DConAddr)); 782 buf->p = v.val.p; 783 v.val.p = buf; 774 784 } 775 785 break; … … 939 949 case nsXPTType::T_CHAR_STR: /* fall through */ 940 950 case nsXPTType::T_WCHAR_STR: /* fall through */ 941 case nsXPTType::T_INTERFACE: /* fall through */942 case nsXPTType::T_INTERFACE_IS: /* fall through */943 951 case nsXPTType::T_ASTRING: /* fall through */ 944 952 case nsXPTType::T_DOMSTRING: /* fall through */ … … 946 954 case nsXPTType::T_CSTRING: /* fall through */ 947 955 size = sizeof(void *); 956 isSimple = PR_FALSE; 957 break; 958 case nsXPTType::T_INTERFACE: /* fall through */ 959 case nsXPTType::T_INTERFACE_IS: /* fall through */ 960 size = sizeof(DConAddr); 948 961 isSimple = PR_FALSE; 949 962 break; … … 1097 1110 { 1098 1111 // grab the DConAddr value temporarily stored in the param 1099 PtrBits bits = (PtrBits) v.val.p;1112 PtrBits bits = v.val.u64; 1100 1113 1101 1114 // DeserializeInterfaceParamBits needs IID only if it's a remote object … … 1525 1538 { 1526 1539 // write null address 1527 writer.PutBytes(&obj, sizeof(obj)); 1540 DConAddr nullobj = 0; 1541 writer.PutBytes(&nullobj, sizeof(nullobj)); 1528 1542 } 1529 1543 else … … 1582 1596 // send address of the instance wrapper, and set the low bit to indicate 1583 1597 // to the remote party that this is a remote instance wrapper. 1584 PtrBits bits = ((PtrBits) wrapper) | PTRBITS_REMOTE_BIT;1598 PtrBits bits = ((PtrBits)(uintptr_t) wrapper) | PTRBITS_REMOTE_BIT; 1585 1599 writer.PutBytes(&bits, sizeof(bits)); 1586 1600 } … … 1900 1914 // send address of the instance wrapper, and set the low bit to indicate 1901 1915 // to the remote party that this is a remote instance wrapper. 1902 PtrBits bits = ((PtrBits) wrapper) | PTRBITS_REMOTE_BIT;1916 PtrBits bits = ((PtrBits)(uintptr_t) wrapper) | PTRBITS_REMOTE_BIT; 1903 1917 writer.PutBytes(&bits, sizeof(bits)); 1904 1918 … … 1987 2001 PRUint32 len; 1988 2002 1989 void *instance= 0;1990 reader.GetBytes(& instance, sizeof(void *));2003 PtrBits bits = 0; 2004 reader.GetBytes(&bits, sizeof(DConAddr)); 1991 2005 if (reader.HasError()) 1992 2006 return NS_ERROR_INVALID_ARG; 1993 1994 PtrBits bits = (PtrBits) (instance);1995 2007 1996 2008 if (bits & PTRBITS_REMOTE_BIT) … … 2514 2526 if (aParams[i].val.p && (paramInfo.IsOut() || paramInfo.IsRetval())) 2515 2527 { 2516 void **pptr = (void **) aParams[i].val.p;2517 2528 const nsXPTType &type = paramInfo.GetType(); 2518 2529 if (type.IsInterfacePointer()) 2519 2530 { 2520 // grab the DConAddr value temporarily stored in the param 2521 PtrBits bits = (PtrBits) *pptr; 2522 *pptr = nsnull; 2531 // grab the DConAddr value temporarily stored in the param, restore 2532 // the pointer and free the temporarily allocated memory. 2533 DConAddrPlusPtr *dptr = (DConAddrPlusPtr *)aParams[i].val.p; 2534 PtrBits bits = dptr->addr; 2535 aParams[i].val.p = dptr->p; 2536 nsMemory::Free((void *)dptr); 2523 2537 2524 2538 // DeserializeInterfaceParamBits needs IID only if it's a remote object … … 2533 2547 rv = dConnect->DeserializeInterfaceParamBits(bits, mPeerID, iid, obj); 2534 2548 if (NS_SUCCEEDED(rv)) 2535 * pptr= obj;2549 *(void **)aParams[i].val.p = obj; 2536 2550 } 2537 2551 } … … 2543 2557 paramInfo, PR_TRUE, array); 2544 2558 if (NS_SUCCEEDED(rv)) 2545 * pptr= array;2559 *(void **)aParams[i].val.p = array; 2546 2560 } 2547 2561 } … … 3589 3603 msg.flags = 0; 3590 3604 msg.request_index = setup->request_index; 3591 msg.instance = (DConAddr) wrapper;3605 msg.instance = (DConAddr)(uintptr_t)wrapper; 3592 3606 msg.status = rv; 3593 3607 … … 3732 3746 { 3733 3747 // grab the DConAddr value temporarily stored in the param 3734 PtrBits bits = (PtrBits) params[i].val.p;3748 PtrBits bits = (PtrBits)(uintptr_t) params[i].val.p; 3735 3749 3736 3750 // DeserializeInterfaceParamBits needs IID only if it's a remote object -
trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.h
r21113 r21169 188 188 // used elsewhere like nsAtomTable to safely represent the integral value 189 189 // of an address. 190 typedef unsigned longPtrBits;190 typedef PRUint64 PtrBits; 191 191 192 192 // bit flag that defines if a PtrBits value represents a remote object
Note:
See TracChangeset
for help on using the changeset viewer.