This commit is contained in:
David Rose 2004-08-06 22:52:10 +00:00
parent 2fb3521f56
commit 4f7f89164d
16 changed files with 535 additions and 535 deletions

View File

@ -93,7 +93,7 @@ void HelixClient::do_event() {
// dirty so that it will be updated in memory.
TEXTURES::iterator iter;
for(iter = _textures.begin(); iter != _textures.end(); iter++) {
iter->second->mark_dirty(Texture::DF_image);
iter->second->mark_dirty(Texture::DF_image);
}
}
@ -119,14 +119,14 @@ void HelixClient::do_events() {
end_time = start_time + _time_delta;
i = 0;
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
DispatchMessage(&msg);
if((i % check_interval) == 0) {
if(GetTickCount() > end_time) {
break;
}
++i;
}
sleep = FALSE;
DispatchMessage(&msg);
if((i % check_interval) == 0) {
if(GetTickCount() > end_time) {
break;
}
++i;
}
sleep = FALSE;
}
if(sleep) {
Sleep(_sleep_time);
@ -153,88 +153,88 @@ void HelixClient::create_player(const string &name, Texture* tex, bool sink_on)
// instantiated, otherwise, players cannot be created!
if (_engine != 0) {
// For now, check if there is an actual Panda texture present. If not,
// then this player should not be created.
// NOTE: This portion of the interface must be redesigned as the current
// design forces the user to specify a valid texture. A more suitable
// approach would be to automatically generate a panda texture and allow
// the user to retreive that texture and set it for any piece of geometry
// within the world.
if( tex == 0 ) {
STDOUT("ERROR: HelixClient::CreatePlayer, INVALID Texture Object!\n");
STDOUT("ERROR: NO PLAYER CREATED!!\n");
return;
}
// Initialize necessary Helix pointers.
IHXPlayer* tmp_player = 0;
HxClientContext* context = 0;
IHXErrorSinkControl* controller = 0;
IHXErrorSink* error_sink = 0;
// For now, check if there is an actual Panda texture present. If not,
// then this player should not be created.
// Tell the texture object to keep the actual image buffer in memory. If
// the image buffer is deallocated, which is the default in panda, Helix
// and Panda because the engine will try to Blit to an invalid buffer.
tex->set_keep_ram_image(true);
// NOTE: This portion of the interface must be redesigned as the current
// design forces the user to specify a valid texture. A more suitable
// approach would be to automatically generate a panda texture and allow
// the user to retreive that texture and set it for any piece of geometry
// within the world.
if( tex == 0 ) {
STDOUT("ERROR: HelixClient::CreatePlayer, INVALID Texture Object!\n");
STDOUT("ERROR: NO PLAYER CREATED!!\n");
return;
}
// Try and create a valid helix player on the engine
if (HXR_OK != _engine->CreatePlayer(tmp_player)) {
STDOUT("ERROR: HelixClient::CreatePlayer, Failed Player Creation!\n");
}
else {
// Initialize necessary Helix pointers.
IHXPlayer* tmp_player = 0;
HxClientContext* context = 0;
IHXErrorSinkControl* controller = 0;
IHXErrorSink* error_sink = 0;
// Tell the texture object to keep the actual image buffer in memory. If
// the image buffer is deallocated, which is the default in panda, Helix
// and Panda because the engine will try to Blit to an invalid buffer.
tex->set_keep_ram_image(true);
// Try and create a valid helix player on the engine
if (HXR_OK != _engine->CreatePlayer(tmp_player)) {
STDOUT("ERROR: HelixClient::CreatePlayer, Failed Player Creation!\n");
}
else {
// Since a player has been successfully instantiated, a context
// for that player must be created.
context = new HxClientContext(_players.size());
if(context != 0) {
context->AddRef();
// Specify a default GUID. Not really necessary, but here for
// convenience if needed later on.
char guid[_guid_length + 1];
IHXPreferences * pref = 0;
guid[0] = '\0';
// for that player must be created.
context = new HxClientContext(_players.size());
if(context != 0) {
context->AddRef();
// Query the Preferences Interface for the player.
tmp_player->QueryInterface(IID_IHXPreferences, (void**)&pref);
// Send the Texture buffer down into the Context. It will then
// ship the buffer to the site supplier, where the actual site
// and surface are generated.
context->init(tmp_player, pref, guid, sink_on, tex);
tmp_player->SetClientContext(context);
HX_RELEASE(pref);
// Specify a default GUID. Not really necessary, but here for
// convenience if needed later on.
char guid[_guid_length + 1];
IHXPreferences * pref = 0;
guid[0] = '\0';
// Query the Error Sink Controller
tmp_player->QueryInterface(IID_IHXErrorSinkControl, (void**)&controller);
if(controller != 0) {
context->QueryInterface(IID_IHXErrorSink, (void**)&error_sink);
if(error_sink != 0) {
controller->AddErrorSink(error_sink, HXLOG_EMERG, HXLOG_INFO);
}
HX_RELEASE(error_sink);
error_sink = 0;
}
HX_RELEASE(controller);
controller = 0;
context = 0;
}
// Query the Preferences Interface for the player.
tmp_player->QueryInterface(IID_IHXPreferences, (void**)&pref);
// Create a new map object for the player and its respective texture.
pair<string, IHXPlayer*> player(name, tmp_player);
pair<string, PT(Texture)> texture(name, tex);
// Now that the pair has been created, set the tmp_player
// address to 0 to protect against dangling references.
tmp_player = 0;
// Send the Texture buffer down into the Context. It will then
// ship the buffer to the site supplier, where the actual site
// and surface are generated.
context->init(tmp_player, pref, guid, sink_on, tex);
tmp_player->SetClientContext(context);
HX_RELEASE(pref);
// Now, actually insert the pairs into their respective maps.
_players.insert(player);
_textures.insert(texture);
}
// Query the Error Sink Controller
tmp_player->QueryInterface(IID_IHXErrorSinkControl, (void**)&controller);
if(controller != 0) {
context->QueryInterface(IID_IHXErrorSink, (void**)&error_sink);
if(error_sink != 0) {
controller->AddErrorSink(error_sink, HXLOG_EMERG, HXLOG_INFO);
}
HX_RELEASE(error_sink);
error_sink = 0;
}
HX_RELEASE(controller);
controller = 0;
context = 0;
}
// Create a new map object for the player and its respective texture.
pair<string, IHXPlayer*> player(name, tmp_player);
pair<string, PT(Texture)> texture(name, tex);
// Now that the pair has been created, set the tmp_player
// address to 0 to protect against dangling references.
tmp_player = 0;
// Now, actually insert the pairs into their respective maps.
_players.insert(player);
_textures.insert(texture);
}
}
else {
STDOUT("ERROR: In HelixClient::CreatePlayer, pEngine = NULL");
STDOUT("ERROR: In HelixClient::CreatePlayer, pEngine = NULL");
}
}
@ -256,21 +256,21 @@ void HelixClient::close_player(const string &name) {
if (_engine != 0) {
IUnknown* context = 0;
// Determine if the player is in the map. If so, go about
// removing that player from the engine.
PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) {
iter->second->Stop();
iter->second->GetClientContext(context);
context->Release();
context = 0;
_engine->ClosePlayer(iter->second);
iter->second->Release();
iter->second = 0;
// Remove the player its associated texture from their
// respective maps.
_players.erase(name);
_textures.erase(name);
}
// removing that player from the engine.
PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) {
iter->second->Stop();
iter->second->GetClientContext(context);
context->Release();
context = 0;
_engine->ClosePlayer(iter->second);
iter->second->Release();
iter->second = 0;
// Remove the player its associated texture from their
// respective maps.
_players.erase(name);
_textures.erase(name);
}
}
}
@ -289,15 +289,15 @@ void HelixClient::close_all_players() {
if (_engine != 0) {
if (!_players.empty()) {
IUnknown* context = 0;
PLAYERS::iterator iter;
PLAYERS::iterator iter;
// Iterate through the _players map to close each player
// currently associated with the engine.
unsigned int total_players = _players.size();
for (unsigned int cntr = 0; cntr <= total_players; cntr++) {
close_player(_players.begin()->first);
}
}
// Iterate through the _players map to close each player
// currently associated with the engine.
unsigned int total_players = _players.size();
for (unsigned int cntr = 0; cntr <= total_players; cntr++) {
close_player(_players.begin()->first);
}
}
}
}
@ -344,17 +344,17 @@ bool HelixClient::init() {
STDOUT("HelixClient is looking for the client core at %s\n", _dll_home.c_str());
if(DLLAccess::DLL_OK != _dll_access->open(string(_dll_home+"\\clntcore.dll").c_str())) {
const char * error_string = 0;
error_string = _dll_access->getErrorString();
STDERR("HelixClient: %s\n\n", error_string);
error_string = _dll_access->getErrorString();
STDERR("HelixClient: %s\n\n", error_string);
// Print out an explanation of what is wrong.
STDERR("You must tell the player where to find the client core and\n");
STDERR("all of its supporting DLLs and codecs.\n");
STDERR("You must tell the player where to find the client core and\n");
STDERR("all of its supporting DLLs and codecs.\n");
// Deallocate the memory from the heap to avoid a memory leak.
delete _dll_access;
_dll_access = 0;
return false;
// Deallocate the memory from the heap to avoid a memory leak.
delete _dll_access;
_dll_access = 0;
return false;
}
// Now that the client core has been loaded, retrieve the function pointer
@ -367,10 +367,10 @@ bool HelixClient::init() {
// initialization of the engine.
if((create_engine == 0) || (set_dll_access_path == 0)) {
STDOUT("---{ERROR: HelixClient::Init, set_dll_access_path}---");
delete _dll_access;
_dll_access = 0;
return false;
delete _dll_access;
_dll_access = 0;
return false;
}
// Now that the clntcore.dll has been succesfully loaded. Specify where it
@ -429,9 +429,9 @@ bool HelixClient::init() {
if (HXR_OK != create_engine((IHXClientEngine**) &_engine)) {
STDOUT("---{ERROR: HelixClient::Init, Creating Engine Problem}---");
delete _dll_access;
_dll_access = 0;
return false;
delete _dll_access;
_dll_access = 0;
return false;
}
return false;
}
@ -451,24 +451,24 @@ void HelixClient::shutdown() {
// given Helix Engine.
close_all_players();
// Retrieve the Function Pointer for closing the Helix engine.
FPRMCLOSEENGINE close_engine = (FPRMCLOSEENGINE) _dll_access->getSymbol("CloseEngine");
// If the function pointer was successfully retrieved, close
// the helix engine.
if (close_engine != 0) {
STDOUT("Closing Helix Engine...\n");
close_engine(_engine);
_engine = 0;
}
// Close the link with the clntCore.dll and freeing the DLLAccess
// object from memory to prevent a memory leak on the heap.
STDOUT("Closing the link to clntCore.dll...\n");
_dll_access->close();
delete _dll_access;
_dll_access = 0;
// Retrieve the Function Pointer for closing the Helix engine.
FPRMCLOSEENGINE close_engine = (FPRMCLOSEENGINE) _dll_access->getSymbol("CloseEngine");
// If the function pointer was successfully retrieved, close
// the helix engine.
if (close_engine != 0) {
STDOUT("Closing Helix Engine...\n");
close_engine(_engine);
_engine = 0;
}
// Close the link with the clntCore.dll and freeing the DLLAccess
// object from memory to prevent a memory leak on the heap.
STDOUT("Closing the link to clntCore.dll...\n");
_dll_access->close();
delete _dll_access;
_dll_access = 0;
}
}
@ -487,19 +487,19 @@ void HelixClient::begin(const string &name) {
if (_engine != 0) {
// Search for the specified player in the map. If the player
// is found, begin playback of the media file.
// is found, begin playback of the media file.
PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) {
iter->second->Begin();
}
if (iter != _players.end()) {
iter->second->Begin();
}
// This is legacy code from the test application, however, it
// was necessary for helix to function since do_events was called
// to give helix the necessary time-slice of the CPU. I think this
// most likely can be removed since Panda calls the necessary
// Win32 API Message calls.
//UINT curr_time = 0;
//UINT32 start_time = GetTickCount();
// This is legacy code from the test application, however, it
// was necessary for helix to function since do_events was called
// to give helix the necessary time-slice of the CPU. I think this
// most likely can be removed since Panda calls the necessary
// Win32 API Message calls.
//UINT curr_time = 0;
//UINT32 start_time = GetTickCount();
//UINT32 end_time = start_time + _time_delta;
//while(1) {
// do_events();
@ -522,21 +522,21 @@ void HelixClient::begin(const string &name) {
////////////////////////////////////////////////////////////////////
void HelixClient::begin_all() {
if (_engine != 0) {
// Iterate through the _players map and call the Begin
// routine to start playback of the media.
PLAYERS::iterator iter;
for(iter = _players.begin(); iter != _players.end(); iter++) {
iter->second->Begin();
}
// This is legacy code from the test application, however, it
// was necessary for helix to function since do_events was called
// to give helix the necessary time-slice of the CPU. I think this
// most likely can be removed since Panda calls the necessary
// Win32 API Message calls.
// UINT curr_time = 0;
// UINT32 start_time = GetTickCount();
// Iterate through the _players map and call the Begin
// routine to start playback of the media.
PLAYERS::iterator iter;
for(iter = _players.begin(); iter != _players.end(); iter++) {
iter->second->Begin();
}
// This is legacy code from the test application, however, it
// was necessary for helix to function since do_events was called
// to give helix the necessary time-slice of the CPU. I think this
// most likely can be removed since Panda calls the necessary
// Win32 API Message calls.
// UINT curr_time = 0;
// UINT32 start_time = GetTickCount();
// UINT32 end_time = start_time + _time_delta;
// while(1) {
// do_events();
@ -563,9 +563,9 @@ void HelixClient::pause(const string &name) {
// is found, pause the playback of the media file.
if (_engine != 0) {
PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) {
iter->second->Pause();
}
if (iter != _players.end()) {
iter->second->Pause();
}
}
}
@ -581,12 +581,12 @@ void HelixClient::pause(const string &name) {
////////////////////////////////////////////////////////////////////
void HelixClient::pause_all() {
if (_engine != 0) {
// Iterate through the _players map and call the Pause
// routine to start playback of the media.
PLAYERS::iterator iter;
for(iter = _players.begin(); iter != _players.end(); iter++) {
iter->second->Pause();
}
// Iterate through the _players map and call the Pause
// routine to start playback of the media.
PLAYERS::iterator iter;
for(iter = _players.begin(); iter != _players.end(); iter++) {
iter->second->Pause();
}
}
}
@ -605,13 +605,13 @@ void HelixClient::pause_all() {
////////////////////////////////////////////////////////////////////
void HelixClient::seek_time(const string &name, long time) {
if (_engine != 0) {
// Search for the specified player in the map. If the player
// is found, seek to the current time in the playback of the
// media file.
// Search for the specified player in the map. If the player
// is found, seek to the current time in the playback of the
// media file.
PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) {
iter->second->Seek(time);
}
if (iter != _players.end()) {
iter->second->Seek(time);
}
}
}
@ -629,12 +629,12 @@ void HelixClient::seek_time(const string &name, long time) {
////////////////////////////////////////////////////////////////////
void HelixClient::stop(const string &name) {
if (_engine != 0) {
// Search for the specified player in the map. If the player
// Search for the specified player in the map. If the player
// is found, stop the playback of the media file.
PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) {
iter->second->Stop();
}
if (iter != _players.end()) {
iter->second->Stop();
}
}
}
@ -650,12 +650,12 @@ void HelixClient::stop(const string &name) {
////////////////////////////////////////////////////////////////////
void HelixClient::stop_all() {
if (_engine != 0) {
// Iterate through the _players map and call the Pause
// routine to stop playback of the media.
PLAYERS::iterator iter;
for(iter = _players.begin(); iter != _players.end(); iter++) {
iter->second->Stop();
}
// Iterate through the _players map and call the Pause
// routine to stop playback of the media.
PLAYERS::iterator iter;
for(iter = _players.begin(); iter != _players.end(); iter++) {
iter->second->Stop();
}
}
}
@ -679,19 +679,19 @@ void HelixClient::stop_all() {
void HelixClient::open_url(const string &name, string url) {
if (_engine != 0) {
// Determine if a URL has been specified within the string.
// If it hasn't, assume that the request has been made for
// a local file, so insert, file://, at the beginning of the
// string.
if (url.find("://")==string::npos) {
url.insert(0,"file://");
}
// If it hasn't, assume that the request has been made for
// a local file, so insert, file://, at the beginning of the
// string.
if (url.find("://")==string::npos) {
url.insert(0,"file://");
}
// Check wheter the player specified exists
// within the map. If it does, call the IHXPlayer::OpenURL(...)
// Check wheter the player specified exists
// within the map. If it does, call the IHXPlayer::OpenURL(...)
PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) {
iter->second->OpenURL(url.c_str());
}
if (iter != _players.end()) {
iter->second->OpenURL(url.c_str());
}
}
}
@ -710,12 +710,12 @@ void HelixClient::open_url(const string &name, string url) {
////////////////////////////////////////////////////////////////////
bool HelixClient::is_live(const string &name) {
if (_engine != 0) {
// Search for the specified player in the map. If the player
// Search for the specified player in the map. If the player
// is found, check to see if it contains a live media source.
PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) {
return (iter->second->IsLive()) ? true : false;
}
if (iter != _players.end()) {
return (iter->second->IsLive()) ? true : false;
}
}
return false;
}
@ -736,13 +736,13 @@ bool HelixClient::is_live(const string &name) {
////////////////////////////////////////////////////////////////////
bool HelixClient::is_done(const string &name) {
if (_engine != 0) {
// Search for the specified player in the map. If the player
// Search for the specified player in the map. If the player
// is found, check to see if it has finished playing the
// the current presentation.
// the current presentation.
PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) {
return iter->second->IsDone();
}
if (iter != _players.end()) {
return iter->second->IsDone();
}
}
return true;
}
@ -763,13 +763,13 @@ bool HelixClient::is_done(const string &name) {
bool HelixClient::are_players_done() {
if (_engine != 0) {
bool done = true;
PLAYERS::iterator iter;
for(iter = _players.begin(); iter != _players.end(); iter++) {
PLAYERS::iterator iter;
for(iter = _players.begin(); iter != _players.end(); iter++) {
if(!iter->second->IsDone()) {
done = false;
}
}
return done;
done = false;
}
}
return done;
}
return true;
}
@ -791,11 +791,11 @@ int HelixClient::get_source_count(const string &name) {
if (_engine != 0) {
// Search for the specified player in the map. If the player
// is found, check to see if it has finished playing the
// the current presentation.
// the current presentation.
PLAYERS::iterator iter = _players.find(name);
if (iter != _players.end()) {
return iter->second->GetSourceCount();
}
if (iter != _players.end()) {
return iter->second->GetSourceCount();
}
}
return -1;
}
}

View File

@ -120,4 +120,4 @@ private:
PLAYERS _players;
TEXTURES _textures;
};
#endif
#endif

View File

@ -38,32 +38,32 @@
HxAdviseSink::HxAdviseSink(IUnknown* unknown, LONG32 client_index, bool sink_on)
: _ref_count (0),
_client_index (client_index),
_unknown (0),
_unknown (0),
_registry (0),
_scheduler (0),
_current_bandwidth(0),
_average_bandwidth(0),
_on_stop(0),
_sink_on(sink_on)
_sink_on(sink_on)
{
if (unknown != 0) {
_unknown = unknown;
_unknown->AddRef();
_unknown = unknown;
_unknown->AddRef();
if (HXR_OK != _unknown->QueryInterface(IID_IHXRegistry, (void**)&_registry)) {
_registry = 0;
}
if (HXR_OK != _unknown->QueryInterface(IID_IHXRegistry, (void**)&_registry)) {
_registry = 0;
}
if (HXR_OK != _unknown->QueryInterface(IID_IHXScheduler, (void**)&_scheduler)) {
_scheduler = 0;
}
if (HXR_OK != _unknown->QueryInterface(IID_IHXScheduler, (void**)&_scheduler)) {
_scheduler = 0;
}
IHXPlayer* player;
if(HXR_OK == _unknown->QueryInterface(IID_IHXPlayer, (void**)&player)) {
player->AddAdviseSink(this);
player->Release();
}
}
IHXPlayer* player;
if(HXR_OK == _unknown->QueryInterface(IID_IHXPlayer, (void**)&player)) {
player->AddAdviseSink(this);
player->Release();
}
}
}
////////////////////////////////////////////////////////////////////
@ -79,18 +79,18 @@ HxAdviseSink::~HxAdviseSink() {
// Release components and set the member variables to the
// NULL-state.
if (_scheduler != 0) {
_scheduler->Release();
_scheduler = 0;
_scheduler->Release();
_scheduler = 0;
}
if (_registry != 0) {
_registry->Release();
_registry = 0;
_registry = 0;
}
if (_unknown != 0) {
_unknown->Release();
_unknown = 0;
_unknown = 0;
}
}
@ -112,24 +112,24 @@ HxAdviseSink::~HxAdviseSink() {
STDMETHODIMP HxAdviseSink::QueryInterface(REFIID id, void** interface_obj) {
// Determine if the IUnknown and ClientAdviseSink interfaces
// are supported.
if (IsEqualIID(id, IID_IUnknown)) {
// Increase the reference count, set the Interface Object,
// and return that the interface is supported within this
// object.
AddRef();
*interface_obj = (IUnknown*)(IHXClientAdviseSink*)this;
}
else if (IsEqualIID(id, IID_IHXClientAdviseSink)) {
// Same as above.
AddRef();
*interface_obj = (IHXClientAdviseSink*)this;
}
else {
// This Interface is not supported by this object. Set the
// Interface Object to the NULL-state and return.
*interface_obj = 0;
return HXR_NOINTERFACE;
}
if (IsEqualIID(id, IID_IUnknown)) {
// Increase the reference count, set the Interface Object,
// and return that the interface is supported within this
// object.
AddRef();
*interface_obj = (IUnknown*)(IHXClientAdviseSink*)this;
}
else if (IsEqualIID(id, IID_IHXClientAdviseSink)) {
// Same as above.
AddRef();
*interface_obj = (IHXClientAdviseSink*)this;
}
else {
// This Interface is not supported by this object. Set the
// Interface Object to the NULL-state and return.
*interface_obj = 0;
return HXR_NOINTERFACE;
}
return HXR_OK;
}
@ -190,7 +190,7 @@ STDMETHODIMP_(ULONG32) HxAdviseSink::Release() {
STDMETHODIMP HxAdviseSink::OnPosLength(ULONG32 ulPosition, ULONG32 ulLength) {
// Initialize Variables
if(_sink_on) {
STDOUT("OnPosLength(%ld, %ld)\n", ulPosition, ulLength);
STDOUT("OnPosLength(%ld, %ld)\n", ulPosition, ulLength);
}
return HXR_OK;
}
@ -250,58 +250,58 @@ STDMETHODIMP HxAdviseSink::OnPresentationClosed() {
////////////////////////////////////////////////////////////////////
void HxAdviseSink::get_statistics(char* registry_key) {
if(_sink_on) {
char RegistryValue[MAX_DISPLAY_NAME] = {0};
char RegistryValue[MAX_DISPLAY_NAME] = {0};
INT32 lValue = 0;
INT32 i = 0;
INT32 lStatistics = 8;
UINT32 *plValue;
// Collect all of the necessary statistics from the registry
// and print them to the screen.
// and print them to the screen.
for (i = 0; i < lStatistics; i++) {
plValue = NULL;
switch (i) {
case 0:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Normal", registry_key);
break;
case 1:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Recovered", registry_key);
break;
case 2:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Received", registry_key);
break;
case 3:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Lost", registry_key);
break;
case 4:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Late", registry_key);
break;
case 5:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.ClipBandwidth", registry_key);
break;
case 6:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s._average_bandwidth", registry_key);
plValue = &_average_bandwidth;
break;
case 7:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s._current_bandwidth", registry_key);
plValue = &_current_bandwidth;
break;
default:
break;
}
plValue = NULL;
switch (i) {
case 0:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Normal", registry_key);
break;
case 1:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Recovered", registry_key);
break;
case 2:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Received", registry_key);
break;
case 3:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Lost", registry_key);
break;
case 4:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.Late", registry_key);
break;
case 5:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s.ClipBandwidth", registry_key);
break;
case 6:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s._average_bandwidth", registry_key);
plValue = &_average_bandwidth;
break;
case 7:
SafeSprintf(RegistryValue, MAX_DISPLAY_NAME, "%s._current_bandwidth", registry_key);
plValue = &_current_bandwidth;
break;
default:
break;
}
_registry->GetIntByName(RegistryValue, lValue);
if (plValue) {
if (_on_stop || lValue == 0) {
lValue = *plValue;
}
else {
*plValue = lValue;
}
}
STDOUT("%s = %ld\n", RegistryValue, lValue);
}
_registry->GetIntByName(RegistryValue, lValue);
if (plValue) {
if (_on_stop || lValue == 0) {
lValue = *plValue;
}
else {
*plValue = lValue;
}
}
STDOUT("%s = %ld\n", RegistryValue, lValue);
}
}
}
@ -327,35 +327,35 @@ void HxAdviseSink::get_all_statistics() {
// Display the content of whole statistic registry
if (_registry) {
// Start from the first player.
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld", RegistryPrefix, _client_index);
if (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) {
// Display player statistic
get_statistics(RegistryName);
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld", RegistryPrefix, _client_index);
if (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) {
// Display player statistic
get_statistics(RegistryName);
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Source%ld", RegistryName, SourceIndex);
while (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) {
// Display source statistic
get_statistics(RegistryName);
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Source%ld", RegistryName, SourceIndex);
while (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) {
// Display source statistic
get_statistics(RegistryName);
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Stream%ld", RegistryName, StreamIndex);
while (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) {
// Display stream statistic
get_statistics(RegistryName);
StreamIndex++;
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Stream%ld", RegistryName, StreamIndex);
while (PT_COMPOSITE == _registry->GetTypeByName(RegistryName)) {
// Display stream statistic
get_statistics(RegistryName);
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld.Source%ld.Stream%ld",
RegistryPrefix, PlayerIndex, SourceIndex, StreamIndex);
}
StreamIndex++;
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld.Source%ld.Stream%ld",
RegistryPrefix, PlayerIndex, SourceIndex, StreamIndex);
}
SourceIndex++;
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld.Source%ld",
RegistryPrefix, PlayerIndex, SourceIndex);
}
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld.Source%ld",
RegistryPrefix, PlayerIndex, SourceIndex);
}
PlayerIndex++;
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld",
RegistryPrefix, PlayerIndex);
}
SafeSprintf(RegistryName, MAX_DISPLAY_NAME, "%s.Player%ld",
RegistryPrefix, PlayerIndex);
}
}
}
}
@ -370,7 +370,7 @@ void HxAdviseSink::get_all_statistics() {
////////////////////////////////////////////////////////////////////
STDMETHODIMP HxAdviseSink::OnStatisticsChanged() {
if(_sink_on) {
char Buff[1024];
char Buff[1024];
HX_RESULT res = HXR_OK;
UINT16 Player = 0;
@ -397,7 +397,7 @@ STDMETHODIMP HxAdviseSink::OnStatisticsChanged() {
// Return: HX_RESULT - result varies.
////////////////////////////////////////////////////////////////////
HX_RESULT HxAdviseSink::dump_reg_tree(const char* tree_name) {
//Initialize Local Variables related to the Registry Tree
//Initialize Local Variables related to the Registry Tree
const char* pszName = NULL;
ULONG32 ulRegID = 0;
HX_RESULT res = HXR_OK;
@ -444,9 +444,9 @@ HX_RESULT HxAdviseSink::dump_reg_tree(const char* tree_name) {
_registry->GetStrById( ulRegID, pBuff );
STDOUT("%s : \"", pszName );
if( pBuff ) {
if( pBuff ) {
STDOUT("%s", (const char *)(pBuff->GetBuffer()) );
}
}
STDOUT("\"\n" );
HX_RELEASE(pBuff);
break;
@ -459,7 +459,7 @@ HX_RESULT HxAdviseSink::dump_reg_tree(const char* tree_name) {
default:
STDOUT("%s Unkown registry type entry\n", pszName );
break;
}
}
res = pValues->GetNextPropertyULONG32(pszName, ulRegID);
}
@ -650,4 +650,4 @@ STDMETHODIMP HxAdviseSink::OnContacting(const char* host_name) {
STDOUT("OnContacting(\"%s\")\n", host_name);
}
return HXR_OK;
}
}

View File

@ -73,25 +73,25 @@ class HxAdviseSink : public IHXClientAdviseSink {
STDMETHOD(OnBuffering) (THIS_ ULONG32 flags, UINT16 percent_complete);
STDMETHOD(OnContacting) (THIS_ const char* host_name);
private:
// Private Member Functions
// Private Member Functions
~HxAdviseSink();
HX_RESULT dump_reg_tree(const char* tree_name );
void get_statistics (char* registry_key);
HX_RESULT dump_reg_tree(const char* tree_name );
void get_statistics (char* registry_key);
void get_all_statistics (void);
// Private Member variables
LONG32 _ref_count;
// Private Member variables
LONG32 _ref_count;
LONG32 _client_index;
UINT32 _start_time;
UINT32 _start_time;
UINT32 _stop_time;
UINT32 _current_bandwidth;
UINT32 _current_bandwidth;
UINT32 _average_bandwidth;
BOOL _on_stop;
bool _sink_on;
bool _sink_on;
IUnknown* _unknown;
IHXRegistry* _registry;
IHXScheduler* _scheduler;
};
#endif
#endif

View File

@ -86,21 +86,21 @@ HX_RESULT HxAuthenticationManager::QueryInterface(THIS_ REFIID id, void** ppInte
// are supported.
if (IsEqualIID(id, IID_IUnknown)) {
// Increase the reference count, set the Interface Object,
// and return that the interface is supported within this
// object.
// and return that the interface is supported within this
// object.
AddRef();
*ppInterfaceObj = (IUnknown*)(IHXAuthenticationManager *)this;
*ppInterfaceObj = (IUnknown*)(IHXAuthenticationManager *)this;
}
else if (IsEqualIID(id, IID_IHXAuthenticationManager)) {
// Same as above.
AddRef();
*ppInterfaceObj = (IHXAuthenticationManager *)this;
AddRef();
*ppInterfaceObj = (IHXAuthenticationManager *)this;
}
else {
// This Interface is not supported by this object. Set the
// Interface Object to the NULL-state and return.
*ppInterfaceObj = 0;
return HXR_NOINTERFACE;
// This Interface is not supported by this object. Set the
// Interface Object to the NULL-state and return.
*ppInterfaceObj = 0;
return HXR_NOINTERFACE;
}
return HXR_OK;
}
@ -119,7 +119,7 @@ HX_RESULT HxAuthenticationManager::QueryInterface(THIS_ REFIID id, void** ppInte
// Return: ULONG32 - The new reference count.
////////////////////////////////////////////////////////////////////
STDMETHODIMP_(ULONG32) HxAuthenticationManager::AddRef(THIS) {
return InterlockedIncrement(&_ref_count);
return InterlockedIncrement(&_ref_count);
}
@ -173,12 +173,12 @@ STDMETHODIMP_(ULONG32) HxAuthenticationManager::Release(THIS) {
////////////////////////////////////////////////////////////////////
STDMETHODIMP HxAuthenticationManager::HandleAuthenticationRequest(IHXAuthenticationManagerResponse* pResponse)
{
char username[1024] = ""; /* Flawfinder: ignore */
char password[1024] = ""; /* Flawfinder: ignore */
HX_RESULT res = HXR_FAIL;
if( !_sent_password )
{
char username[1024] = ""; /* Flawfinder: ignore */
char password[1024] = ""; /* Flawfinder: ignore */
HX_RESULT res = HXR_FAIL;
if( !_sent_password )
{
res = HXR_OK;
STDOUT("\nSending Username and Password...\n");
@ -202,9 +202,9 @@ STDMETHODIMP HxAuthenticationManager::HandleAuthenticationRequest(IHXAuthenticat
_sent_password = TRUE;
}
if (FAILED(res))
if (FAILED(res))
STDOUT("\nInvalid Username and/or Password.\n");
pResponse->AuthenticationRequestDone(res, username, password);
return res;
}
}

View File

@ -64,4 +64,4 @@ class HxAuthenticationManager : public IHXAuthenticationManager {
INT32 _ref_count;
BOOL _sent_password;
};
#endif
#endif

View File

@ -33,11 +33,11 @@
HxClientContext::HxClientContext(LONG32 client_index)
: _ref_count(0),
_client_index(client_index),
_client_sink(0),
_error_sink(0),
_auth_mgr(0),
_site_supplier(0),
_default_prefs(0) {
_client_sink(0),
_error_sink(0),
_auth_mgr(0),
_site_supplier(0),
_default_prefs(0) {
}
////////////////////////////////////////////////////////////////////
@ -99,11 +99,11 @@ void HxClientContext::init(IUnknown* unknown, IHXPreferences* prefs, char* guid,
#endif
if (_client_sink != 0) {
_client_sink->AddRef();
_client_sink->AddRef();
}
if (_error_sink != 0) {
_error_sink->AddRef();
_error_sink->AddRef();
}
if (_auth_mgr != 0) {
@ -116,13 +116,13 @@ void HxClientContext::init(IUnknown* unknown, IHXPreferences* prefs, char* guid,
if (prefs != 0) {
_default_prefs = prefs;
_default_prefs->AddRef();
_default_prefs->AddRef();
}
if (guid && *guid) {
// Encode GUID
cipher = Cipher(guid);
SafeStrCpy(_guid, cipher, 256);
// Encode GUID
cipher = Cipher(guid);
SafeStrCpy(_guid, cipher, 256);
}
else {
_guid[0] = '\0';
@ -172,41 +172,41 @@ HX_RESULT HxClientContext::QueryInterface(THIS_ REFIID id, void** interface_obj)
HX_RESULT result = HXR_NOINTERFACE;
// Determine if the IUnknown and ClientAdviseSink interfaces
// are supported.
if (IsEqualIID(id, IID_IUnknown)) {
// Increase the reference count, set the Interface Object,
// and return that the interface is supported within this
// object.
AddRef();
*interface_obj = (IUnknown*)(IHXClientAdviseSink*)this;
result = HXR_OK;
}
else if (IsEqualIID(id, IID_IHXPreferences)) {
// Same as above.
AddRef();
*interface_obj = (IHXPreferences*)this;
result = HXR_OK;
}
else if ((_client_sink != 0) &&
(_client_sink->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else if ((_error_sink != 0) &&
(_error_sink->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else if ((_auth_mgr != 0) &&
(_auth_mgr->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else if ((_site_supplier != 0) &&
(_site_supplier->QueryInterface(id, interface_obj) == HXR_OK)) {
if (IsEqualIID(id, IID_IUnknown)) {
// Increase the reference count, set the Interface Object,
// and return that the interface is supported within this
// object.
AddRef();
*interface_obj = (IUnknown*)(IHXClientAdviseSink*)this;
result = HXR_OK;
}
else {
// This Interface is not supported by this object. Set the
// Interface Object to the NULL-state and return.
*interface_obj = 0;
}
}
else if (IsEqualIID(id, IID_IHXPreferences)) {
// Same as above.
AddRef();
*interface_obj = (IHXPreferences*)this;
result = HXR_OK;
}
else if ((_client_sink != 0) &&
(_client_sink->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else if ((_error_sink != 0) &&
(_error_sink->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else if ((_auth_mgr != 0) &&
(_auth_mgr->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else if ((_site_supplier != 0) &&
(_site_supplier->QueryInterface(id, interface_obj) == HXR_OK)) {
result = HXR_OK;
}
else {
// This Interface is not supported by this object. Set the
// Interface Object to the NULL-state and return.
*interface_obj = 0;
}
return result;
}
@ -288,18 +288,18 @@ STDMETHODIMP HxClientContext::ReadPref(const char* pref_key, IHXBuffer*& buffer)
char * cipher = 0;
if ((stricmp(pref_key, CLIENT_GUID_REGNAME) == 0) &&
(*_guid != 0 )) {
(*_guid != 0 )) {
// Create a buffer
buffer = new CHXBuffer();
buffer->AddRef();
buffer->AddRef();
buffer->Set((UCHAR*)_guid, strlen(_guid) + 1);
buffer->Set((UCHAR*)_guid, strlen(_guid) + 1);
}
else if (_default_prefs != 0) {
result = _default_prefs->ReadPref(pref_key, buffer);
}
else {
result = HXR_NOTIMPL;
result = HXR_NOTIMPL;
}
return result;
}
@ -322,6 +322,6 @@ STDMETHODIMP HxClientContext::WritePref(const char* pref_key, IHXBuffer *buffer)
return _default_prefs->WritePref(pref_key, buffer);
}
else {
return HXR_OK;
return HXR_OK;
}
}

View File

@ -85,4 +85,4 @@ private:
HxSiteSupplier * _site_supplier;
IHXPreferences * _default_prefs;
};
#endif
#endif

View File

@ -39,7 +39,7 @@ HxErrorSink::HxErrorSink(IUnknown* unknown)
: ref_count(0),
_player(0)
{
IHXClientEngine* pEngine = 0;
IHXClientEngine* pEngine = 0;
unknown->QueryInterface(IID_IHXClientEngine, (void**)&pEngine );
if( pEngine != 0 )
{
@ -174,8 +174,8 @@ STDMETHODIMP_(ULONG32) HxErrorSink::Release() {
// Return: None
////////////////////////////////////////////////////////////////////
STDMETHODIMP HxErrorSink::ErrorOccurred(const UINT8 severity, const UINT32 hx_code,
const UINT32 user_code, const char* user_string,
const char* more_info_url) {
const UINT32 user_code, const char* user_string,
const char* more_info_url) {
// Initialize Local Variables to the Method.
char HXDefine[256];
@ -191,23 +191,23 @@ STDMETHODIMP HxErrorSink::ErrorOccurred(const UINT8 severity, const UINT32 hx_co
}
////////////////////////////////////////////////////////////////////
// Member: HxErrorSink::ConvertErrorToText
// Access: Protected
// Purpose: Converts the Helix error code to text for the
// client to display.
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Params: hx_code - the error code to be translated to text.
// buffer - Text buffer that holds the code.
// buffer_length - The length of the text buffer.
@ -226,4 +226,4 @@ void HxErrorSink::convert_to_string(const ULONG32 hx_code, char* buffer, UINT32
if (strlen(buffer) == 0) {
SafeSprintf(buffer, buffer_length, "Can't convert the error code %p", hx_code);
}
}
}

View File

@ -52,8 +52,8 @@ public:
// be called when an error message is generated.
////////////////////////////////////////////////////////////////////
STDMETHOD (ErrorOccurred) (THIS_ const UINT8 severity, const UINT32 hx_code,
const UINT32 user_code, const char* user_string,
const char* more_info_url);
const UINT32 user_code, const char* user_string,
const char* more_info_url);
////////////////////////////////////////////////////////////////////
// IHUnkown Interface Methods Prototypes
@ -74,4 +74,4 @@ protected:
INT32 ref_count;
IHXPlayer* _player;
};
#endif
#endif

View File

@ -40,15 +40,15 @@
HxSiteSupplier::HxSiteSupplier(IUnknown* unknown, Texture* tex)
: _ref_count(0),
_site_manager(0),
_ccf(0),
_unknown(unknown),
_dest_buffer(0),
_texture(tex) {
_ccf(0),
_unknown(unknown),
_dest_buffer(0),
_texture(tex) {
if(_unknown) {
_unknown->QueryInterface(IID_IHXSiteManager, (void**)&_site_manager);
_unknown->QueryInterface(IID_IHXCommonClassFactory, (void**)&_ccf);
_unknown->AddRef();
if(_unknown) {
_unknown->QueryInterface(IID_IHXSiteManager, (void**)&_site_manager);
_unknown->QueryInterface(IID_IHXCommonClassFactory, (void**)&_ccf);
_unknown->AddRef();
}
}
@ -83,14 +83,14 @@ HxSiteSupplier::~HxSiteSupplier() {
////////////////////////////////////////////////////////////////////
STDMETHODIMP HxSiteSupplier::QueryInterface(REFIID _id, void** _interface_obj) {
if (IsEqualIID(_id, IID_IUnknown)) {
AddRef();
*_interface_obj = (IUnknown*)(IHXSiteSupplier*)this;
return HXR_OK;
AddRef();
*_interface_obj = (IUnknown*)(IHXSiteSupplier*)this;
return HXR_OK;
}
else if (IsEqualIID(_id, IID_IHXSiteSupplier)) {
AddRef();
*_interface_obj = (IHXSiteSupplier*)this;
return HXR_OK;
AddRef();
*_interface_obj = (IHXSiteSupplier*)this;
return HXR_OK;
}
*_interface_obj = NULL;
return HXR_NOINTERFACE;
@ -148,49 +148,49 @@ STDMETHODIMP_(ULONG32)HxSiteSupplier::Release() {
// IHXValues * pProps - The properties of the requested site
// Return: None
////////////////////////////////////////////////////////////////////
STDMETHODIMP HxSiteSupplier::SitesNeeded(UINT32 request_id, IHXValues* pProps) {
STDMETHODIMP HxSiteSupplier::SitesNeeded(UINT32 request_id, IHXValues* pProps) {
// Determine if there are valid properties. If not then a site
// can not properly be created.
if (!pProps) {
return HXR_INVALID_PARAMETER;
return HXR_INVALID_PARAMETER;
}
// Local Variable Declaration and Intialization
HRESULT hres = HXR_OK;
IHXValues* site_props = NULL;
IHXSiteWindowed* pSiteWindowed = NULL;
IHXBuffer* pValue = NULL;
IHXValues* site_props = NULL;
IHXSiteWindowed* pSiteWindowed = NULL;
IHXBuffer* pValue = NULL;
UINT32 style = 0;
IHXSite* pSite = NULL;
// Just let the Helix client core create a windowed site for us.
hres = _ccf->CreateInstance(CLSID_IHXSiteWindowed,(void**)&pSiteWindowed);
if (HXR_OK != hres) {
goto exit;
goto exit;
}
hres = pSiteWindowed->QueryInterface(IID_IHXSite,(void**)&pSite);
if (HXR_OK != hres) {
goto exit;
goto exit;
}
hres = pSiteWindowed->QueryInterface(IID_IHXValues,(void**)&site_props);
if (HXR_OK != hres) {
goto exit;
goto exit;
}
// Figures out what type of site must be created.
hres = pProps->GetPropertyCString("playto",pValue);
if (HXR_OK == hres) {
site_props->SetPropertyCString("channel",pValue);
HX_RELEASE(pValue);
site_props->SetPropertyCString("channel",pValue);
HX_RELEASE(pValue);
}
else {
hres = pProps->GetPropertyCString("name",pValue);
if (HXR_OK == hres) {
site_props->SetPropertyCString("LayoutGroup",pValue);
HX_RELEASE(pValue);
}
hres = pProps->GetPropertyCString("name",pValue);
if (HXR_OK == hres) {
site_props->SetPropertyCString("LayoutGroup",pValue);
HX_RELEASE(pValue);
}
}
#ifdef _WINDOWS
@ -201,34 +201,34 @@ STDMETHODIMP HxSiteSupplier::SitesNeeded(UINT32 request_id, IHXValues* pProps) {
// so that it may be sent down into the sites video
// surface object.
if( _texture->has_ram_image() ) {
pSiteWindowed->SetDstBuffer(_texture->_pbuffer->_image,
_texture->_pbuffer->get_xsize(),
_texture->_pbuffer->get_ysize());
pSiteWindowed->SetDstBuffer(_texture->_pbuffer->_image,
_texture->_pbuffer->get_xsize(),
_texture->_pbuffer->get_ysize());
}
else {
cout << "--- {{ HxSiteSupplier.cxx, RELOADED RAM IMAGE!!! }}---" << endl;
PixelBuffer* fake = _texture->get_ram_image();
if( fake ) {
pSiteWindowed->SetDstBuffer(fake->_image,
_texture->_pbuffer->get_xsize(),
_texture->_pbuffer->get_ysize());
}
else {
cout << "--- {{ HxSiteSupplier.cxx, NO RAM IMAGE PRESENT!!! }} ---" << endl;
}
PixelBuffer* fake = _texture->get_ram_image();
if( fake ) {
pSiteWindowed->SetDstBuffer(fake->_image,
_texture->_pbuffer->get_xsize(),
_texture->_pbuffer->get_ysize());
}
else {
cout << "--- {{ HxSiteSupplier.cxx, NO RAM IMAGE PRESENT!!! }} ---" << endl;
}
}
// Create the window. Not necessary later on.
hres = pSiteWindowed->Create(NULL, style);
//hres = pSiteWindowed->AttachWindow(NULL);
if (HXR_OK != hres) {
goto exit;
goto exit;
}
// Add the site to the site manager.
hres = _site_manager->AddSite(pSite);
if (HXR_OK != hres) {
goto exit;
goto exit;
}
_created_sites.SetAt((void*)request_id,pSite);
@ -258,13 +258,13 @@ STDMETHODIMP HxSiteSupplier::SitesNeeded(UINT32 request_id, IHXValues* pProps) {
////////////////////////////////////////////////////////////////////
STDMETHODIMP HxSiteSupplier::SitesNotNeeded(UINT32 request_id) {
// Local Variable Declaration and Initialization
IHXSite* pSite = NULL;
IHXSiteWindowed* pSiteWindowed = NULL;
void* pVoid = NULL;
IHXSite* pSite = NULL;
IHXSiteWindowed* pSiteWindowed = NULL;
void* pVoid = NULL;
// search for the site id in the map
if (!_created_sites.Lookup((void*)request_id,pVoid)) {
return HXR_INVALID_PARAMETER;
return HXR_INVALID_PARAMETER;
}
//SITES::iterator iter = _created_sites.find(request_id);
//if(iter == _created_sites.end()) {
@ -319,4 +319,4 @@ STDMETHODIMP HxSiteSupplier::BeginChangeLayout() {
////////////////////////////////////////////////////////////////////
STDMETHODIMP HxSiteSupplier::DoneChangeLayout() {
return HXR_OK;
}
}

View File

@ -64,4 +64,4 @@ private:
UCHAR* _dest_buffer;
Texture* _texture;
};
#endif
#endif

View File

@ -71,4 +71,4 @@ typedef HX_RESULT (HXEXPORT_PTR FPRMSETDLLACCESSPATH) (const char*);
//#include "fivemmap.h"
#include <common/system/pub/dllacces.h>
#include <common/system/pub/dllpath.h>
#include <common/util/pub/hxstrutl.h> */
#include <common/util/pub/hxstrutl.h> */

View File

@ -73,12 +73,12 @@ BOOL FiveMinuteMap::Lookup(void* Key, void*& Value) const
// If Key is alrady in the list, replace value
for (; nIndex < m_nMapSize; nIndex++)
{
if (KeyArray[nIndex] == Key)
{
Value = ValueArray[nIndex];
bFound = TRUE;
goto exit;
}
if (KeyArray[nIndex] == Key)
{
Value = ValueArray[nIndex];
bFound = TRUE;
goto exit;
}
}
exit:
@ -93,16 +93,16 @@ void FiveMinuteMap::RemoveKey(void* Key)
// If Key is alrady in the list, replace value
for (; nIndex < m_nMapSize; nIndex++)
{
if (KeyArray[nIndex] == Key)
{
if (nIndex < (m_nMapSize-1))
{
memmove(&(KeyArray[nIndex]),&(KeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
memmove(&(ValueArray[nIndex]),&(ValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
}
m_nMapSize--;
goto exit;
}
if (KeyArray[nIndex] == Key)
{
if (nIndex < (m_nMapSize-1))
{
memmove(&(KeyArray[nIndex]),&(KeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
memmove(&(ValueArray[nIndex]),&(ValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
}
m_nMapSize--;
goto exit;
}
}
exit:
@ -117,16 +117,16 @@ void FiveMinuteMap::RemoveValue(void* Value)
// If Value is alrady in the list, replace value
for (; nIndex < m_nMapSize; nIndex++)
{
if (ValueArray[nIndex] == Value)
{
if (nIndex < (m_nMapSize-1))
{
memmove(&(KeyArray[nIndex]),&(KeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
memmove(&(ValueArray[nIndex]),&(ValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
}
m_nMapSize--;
goto exit;
}
if (ValueArray[nIndex] == Value)
{
if (nIndex < (m_nMapSize-1))
{
memmove(&(KeyArray[nIndex]),&(KeyArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
memmove(&(ValueArray[nIndex]),&(ValueArray[nIndex+1]),sizeof(void*)*(m_nMapSize-(nIndex+1)));
}
m_nMapSize--;
goto exit;
}
}
exit:
@ -141,28 +141,28 @@ void FiveMinuteMap::SetAt(void* Key, void* Value)
// If Key is alrady in the list, replace value
for (; nIndex < m_nMapSize; nIndex++)
{
if (KeyArray[nIndex] == Key)
{
ValueArray[nIndex] = Value;
goto exit;
}
if (KeyArray[nIndex] == Key)
{
ValueArray[nIndex] = Value;
goto exit;
}
}
// If we have room, add it to the end!
if (m_nAllocSize == m_nMapSize)
{
m_nAllocSize += AllocationSize;
void** pNewKeys = new void*[m_nAllocSize];
void** pNewValues = new void*[m_nAllocSize];
m_nAllocSize += AllocationSize;
void** pNewKeys = new void*[m_nAllocSize];
void** pNewValues = new void*[m_nAllocSize];
memcpy(pNewKeys,KeyArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
memcpy(pNewValues,ValueArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
memcpy(pNewKeys,KeyArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
memcpy(pNewValues,ValueArray,sizeof(void*)*m_nMapSize); /* Flawfinder: ignore */
delete [] KeyArray;
delete [] ValueArray;
delete [] KeyArray;
delete [] ValueArray;
KeyArray = pNewKeys;
ValueArray = pNewValues;
KeyArray = pNewKeys;
ValueArray = pNewValues;
}
KeyArray[m_nMapSize] = Key;

View File

@ -50,24 +50,24 @@ class FiveMinuteMap {
void** KeyArray;
void** ValueArray;
int m_nMapSize;
int m_nAllocSize;
int m_nMapSize;
int m_nAllocSize;
int m_nCursor;
public:
FiveMinuteMap()
: KeyArray(NULL)
, ValueArray(NULL)
, m_nMapSize(0)
, m_nAllocSize(0)
: KeyArray(NULL)
, ValueArray(NULL)
, m_nMapSize(0)
, m_nAllocSize(0)
, m_nCursor(0)
, AllocationSize(10)
{};
, AllocationSize(10)
{};
~FiveMinuteMap()
{
delete [] KeyArray;
delete [] ValueArray;
};
{
delete [] KeyArray;
delete [] ValueArray;
};
int GetCount() {return m_nMapSize;}

View File

@ -35,8 +35,8 @@ int main( int argc, char *argv[] )
//Do Nothing for now
MSG msg;
GetMessage(&msg, NULL, 0, 0);
DispatchMessage(&msg);
GetMessage(&msg, NULL, 0, 0);
DispatchMessage(&msg);
}
delete myClient;
@ -59,4 +59,4 @@ int main( int argc, char *argv[] )