VirtualBox

Ignore:
Timestamp:
Jul 2, 2009 2:34:49 PM (16 years ago)
Author:
vboxsync
Message:

xpcom: fix hopefully all remaining bitness issues

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  
    196196//-----------------------------------------------------------------------------
    197197
     198struct DConAddrPlusPtr
     199{
     200  DConAddr addr;
     201  void *p;
     202};
     203
     204//-----------------------------------------------------------------------------
     205
    198206ipcDConnectService *ipcDConnectService::mInstance = nsnull;
    199207
     
    533541    case nsXPTType::T_INTERFACE_IS:
    534542      {
    535         reader.GetBytes(&v.val.p, sizeof(void *));
     543        reader.GetBytes(&v.val.u64, sizeof(DConAddr));
    536544        // stub creation will be handled outside this routine.  we only
    537         // deserialize the DConAddr into v.val.p temporarily.
     545        // deserialize the DConAddr into v.val.u64 temporarily.
    538546      }
    539547      break;
     
    768776      {
    769777        // 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;
    774784      }
    775785      break;
     
    939949    case nsXPTType::T_CHAR_STR:       /* fall through */
    940950    case nsXPTType::T_WCHAR_STR:      /* fall through */
    941     case nsXPTType::T_INTERFACE:      /* fall through */
    942     case nsXPTType::T_INTERFACE_IS:   /* fall through */
    943951    case nsXPTType::T_ASTRING:        /* fall through */
    944952    case nsXPTType::T_DOMSTRING:      /* fall through */
     
    946954    case nsXPTType::T_CSTRING:        /* fall through */
    947955      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);
    948961      isSimple = PR_FALSE;
    949962      break;
     
    10971110    {
    10981111      // grab the DConAddr value temporarily stored in the param
    1099       PtrBits bits = (PtrBits) v.val.p;
     1112      PtrBits bits = v.val.u64;
    11001113
    11011114      // DeserializeInterfaceParamBits needs IID only if it's a remote object
     
    15251538  {
    15261539    // write null address
    1527     writer.PutBytes(&obj, sizeof(obj));
     1540    DConAddr nullobj = 0;
     1541    writer.PutBytes(&nullobj, sizeof(nullobj));
    15281542  }
    15291543  else
     
    15821596      // send address of the instance wrapper, and set the low bit to indicate
    15831597      // 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;
    15851599      writer.PutBytes(&bits, sizeof(bits));
    15861600    }
     
    19001914        // send address of the instance wrapper, and set the low bit to indicate
    19011915        // 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;
    19031917        writer.PutBytes(&bits, sizeof(bits));
    19041918
     
    19872001  PRUint32 len;
    19882002
    1989   void *instance = 0;
    1990   reader.GetBytes(&instance, sizeof(void *));
     2003  PtrBits bits = 0;
     2004  reader.GetBytes(&bits, sizeof(DConAddr));
    19912005  if (reader.HasError())
    19922006    return NS_ERROR_INVALID_ARG;
    1993 
    1994   PtrBits bits = (PtrBits) (instance);
    19952007
    19962008  if (bits & PTRBITS_REMOTE_BIT)
     
    25142526      if (aParams[i].val.p && (paramInfo.IsOut() || paramInfo.IsRetval()))
    25152527      {
    2516         void **pptr = (void **) aParams[i].val.p;
    25172528        const nsXPTType &type = paramInfo.GetType();
    25182529        if (type.IsInterfacePointer())
    25192530        {
    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);
    25232537
    25242538          // DeserializeInterfaceParamBits needs IID only if it's a remote object
     
    25332547            rv = dConnect->DeserializeInterfaceParamBits(bits, mPeerID, iid, obj);
    25342548            if (NS_SUCCEEDED(rv))
    2535               *pptr = obj;
     2549              *(void **)aParams[i].val.p = obj;
    25362550          }
    25372551        }
     
    25432557                                     paramInfo, PR_TRUE, array);
    25442558          if (NS_SUCCEEDED(rv))
    2545             *pptr = array;
     2559            *(void **)aParams[i].val.p = array;
    25462560        }
    25472561      }
     
    35893603  msg.flags = 0;
    35903604  msg.request_index = setup->request_index;
    3591   msg.instance = (DConAddr)wrapper;
     3605  msg.instance = (DConAddr)(uintptr_t)wrapper;
    35923606  msg.status = rv;
    35933607
     
    37323746      {
    37333747        // 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;
    37353749
    37363750        // DeserializeInterfaceParamBits needs IID only if it's a remote object
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.h

    r21113 r21169  
    188188// used elsewhere like nsAtomTable to safely represent the integral value
    189189// of an address.
    190 typedef unsigned long PtrBits;
     190typedef PRUint64 PtrBits;
    191191
    192192// bit flag that defines if a PtrBits value represents a remote object
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette