fix for 78288
This commit is contained in:
idk%eng.sun.com 2001-05-01 03:10:03 +00:00
Родитель ac40b90f6b
Коммит bea42689a3
2 изменённых файлов: 32 добавлений и 7 удалений

Просмотреть файл

@ -22,20 +22,42 @@
#include "ORB.h"
#include "Call.h"
#include "nsHashtable.h"
class bcOIDKey : public nsHashKey {
protected:
bcOID key;
public:
bcOIDKey(bcOID oid) {
key = oid;
}
virtual ~bcOIDKey() {
}
PRUint32 HashCode(void) const {
return (PRUint32)key;
}
PRBool Equals(const nsHashKey *aKey) const {
return (key == ((const bcOIDKey *) aKey)->key);
}
nsHashKey *Clone() const {
return new bcOIDKey(key);
}
};
ORB::ORB() {
currentID = 1;
for (int i = 0; i < STUBS_COUNT; i++) {
stubs[i] = 0;
}
stubs = new nsHashtable(256,PR_TRUE);
}
ORB::~ORB() {
delete stubs;
}
bcOID ORB::RegisterStub(bcIStub *stub) {
stubs[currentID] = stub;
stubs->Put(new bcOIDKey(currentID),stub);
return currentID++;
}
@ -58,7 +80,10 @@ int ORB::SendReceive(bcICall *call) {
}
bcIStub * ORB::GetStub(bcOID *oid) {
return stubs[*oid];
bcOIDKey *key = new bcOIDKey(*oid);
void *tmp = stubs->Get(key);
delete key;
return (bcIStub*)tmp;
}

Просмотреть файл

@ -24,7 +24,7 @@
#define __ORB_h
#include "bcIORB.h"
#define STUBS_COUNT (50000)
class nsHashtable;
class ORB : public bcIORB {
public:
ORB();
@ -34,7 +34,7 @@ public:
virtual int SendReceive(bcICall *);
private:
bcIStub * GetStub(bcOID *);
bcIStub * stubs[STUBS_COUNT]; //nb :) it's jast for now. (Mon Mar 13 16:53:03 PST 2000)
nsHashtable *stubs;
int currentID;
};
#endif