static Boolean setGroupsockBySocket(UsageEnvironment& env, int sock, Groupsock* groupsock) { do { // Make sure the "sock" parameter is in bounds: if (sock < 0) { char buf[100]; sprintf(buf, "trying to use bad socket (%d)", sock); env.setResultMsg(buf); break; } HashTable* sockets = getSocketTable(env); if (sockets == NULL) break; // Make sure we're not replacing an existing Groupsock // That shouldn't happen Boolean alreadyExists = (sockets->Lookup((char*)(long)sock) != 0); if (alreadyExists) { char buf[100]; sprintf(buf, "Attempting to replace an existing socket (%d", sock); env.setResultMsg(buf); break; } sockets->Add((char*)(long)sock, groupsock); return True; } while (0); return False; }
static Boolean unsetGroupsockBySocket(Groupsock const* groupsock) { do { if (groupsock == NULL) break; int sock = groupsock->socketNum(); // Make sure "sock" is in bounds: if (sock < 0) break; HashTable* sockets = getSocketTable(groupsock->env()); if (sockets == NULL) break; Groupsock* gs = (Groupsock*)sockets->Lookup((char*)(long)sock); if (gs == NULL || gs != groupsock) break; sockets->Remove((char*)(long)sock); if (sockets->IsEmpty()) { // We can also delete the table (to reclaim space): delete sockets; (gs->env()).groupsockPriv = NULL; } return True; } while (0); return False; }
static Groupsock* getGroupsockBySocket(UsageEnvironment& env, int sock) { do { // Make sure the "sock" parameter is in bounds: if (sock < 0) break; HashTable* sockets = getSocketTable(env); return (Groupsock*)sockets->Lookup((char*)(long)sock); } while (0); return NULL; }
Medium* MediaLookupTable::lookup(char const* name) const { return (Medium*)(fTable->Lookup(name)); }
OggTrack* OggTrackTable::lookup(u_int32_t trackNumber) { return (OggTrack*)fTable->Lookup((char const*)trackNumber); }