VirtualBox

Changeset 21113 in vbox


Ignore:
Timestamp:
Jul 1, 2009 11:48:47 AM (16 years ago)
Author:
vboxsync
Message:

xpcom: first go at making xpcom bitness-safe

Location:
trunk/src/libs/xpcom18a4
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp

    r17381 r21113  
    15331533    if (NS_SUCCEEDED(rv) && (stub->PeerID() == peer))
    15341534    {
    1535       void *p = stub->Instance();
     1535      DConAddr p = stub->Instance();
    15361536      writer.PutBytes(&p, sizeof(p));
    15371537    }
     
    18501850      {
    18511851        // send the wrapper instance back to the peer
    1852         void *p = stub->Stub()->Instance();
     1852        DConAddr p = stub->Stub()->Instance();
    18531853        writer.PutBytes(&p, sizeof(p));
    18541854      }
     
    34733473    {
    34743474      const DConnectSetupQueryInterface *setupQI = (const DConnectSetupQueryInterface *) setup;
     3475      DConnectInstance *instance = (DConnectInstance *)setupQI->instance;
    34753476
    34763477      // make sure we've been sent a valid wrapper
    3477       if (!CheckInstanceAndAddRef(setupQI->instance, peer))
     3478      if (!CheckInstanceAndAddRef(instance, peer))
    34783479      {
    34793480        NS_NOTREACHED("instance wrapper not found");
     
    34823483      else
    34833484      {
    3484         rv = setupQI->instance->RealInstance()->QueryInterface(setupQI->iid, (void **) &instance);
    3485         setupQI->instance->Release();
     3485        rv = instance->RealInstance()->QueryInterface(setupQI->iid, (void **) &instance);
     3486        instance->Release();
    34863487      }
    34873488      break;
     
    35883589  msg.flags = 0;
    35893590  msg.request_index = setup->request_index;
    3590   msg.instance = wrapper;
     3591  msg.instance = (DConAddr)wrapper;
    35913592  msg.status = rv;
    35923593
     
    36233624       peer, release->instance));
    36243625
    3625   DConnectInstance *wrapper = release->instance;
     3626  DConnectInstance *wrapper = (DConnectInstance *)release->instance;
    36263627
    36273628  nsAutoLock lock (mLock);
     
    36583659      peer, invoke->instance, invoke->method_index));
    36593660
    3660   DConnectInstance *wrapper = invoke->instance;
     3661  DConnectInstance *wrapper = (DConnectInstance *)invoke->instance;
    36613662
    36623663  ipcMessageReader reader((const PRUint8 *) (invoke + 1), opLen - sizeof(*invoke));
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.h

    r7154 r21113  
    144144};
    145145
    146 typedef class DConnectInstance* DConAddr;
     146typedef PRUint64 DConAddr;
    147147
    148148// a key class used to identify DConnectStub objects stored in a hash table
  • trunk/src/libs/xpcom18a4/xpcom/base/nscore.h

    r11440 r21113  
    431431#endif
    432432 
     433#ifndef VBOX
    433434/*
    434435 * Use these macros to do 64bit safe pointer conversions.
     
    437438#define NS_PTR_TO_INT32(x) ((char *)(x) - (char *)0)
    438439#define NS_INT32_TO_PTR(x) ((void *)((char *)0 + (x)))
     440#else /* VBOX */
     441// This stuff is (contrary to the comment) totally 64bit unsafe, so strip
     442// it down to only do one direction, which is used by the hashing code.
     443#define NS_PTR_TO_INT32(x) ((PRInt32)((char *)(x) - (char *)0))
     444#endif /* VBOX */
    439445
    440446/*
  • trunk/src/libs/xpcom18a4/xpcom/ds/nsCheapSets.h

    r1 r21113  
    8383
    8484private:
    85   typedef unsigned long PtrBits;
     85  typedef PRUint64 PtrBits;
    8686
    8787  /** Get the hash pointer (or null if we're not a hash) */
     
    156156
    157157private:
    158   typedef unsigned long PtrBits;
     158  typedef PRUint64 PtrBits;
    159159
    160160  /** Get the hash pointer (or null if we're not a hash) */
  • trunk/src/libs/xpcom18a4/xpcom/ds/nsVoidArray.h

    r1 r21113  
    376376
    377377private:
    378   typedef unsigned long PtrBits;
     378  typedef PRUint64 PtrBits;
    379379
    380380  PRBool HasSingleChild() const
  • trunk/src/libs/xpcom18a4/xpcom/io/nsFastLoadService.cpp

    r1 r21113  
    395395        return rv;
    396396
     397#ifndef VBOX
    397398    mChecksumTable.Put(&key, NS_INT32_TO_PTR(checksum));
     399#else /* VBOX */
     400    mChecksumTable.Put(&key, (void *)checksum);
     401#endif /* VBOX */
    398402    *aChecksum = checksum;
    399403    return NS_OK;
     
    418422
    419423    nsCStringKey key(path);
     424#ifndef VBOX
    420425    mChecksumTable.Put(&key, NS_INT32_TO_PTR(checksum));
     426#else /* VBOX */
     427    mChecksumTable.Put(&key, (void *)checksum);
     428#endif /* VBOX */
    421429    return NS_OK;
    422430}
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