From d77aa7cb424e76e846db431e756fac3482ff919f Mon Sep 17 00:00:00 2001 From: mpv Date: Mon, 16 Oct 2006 13:22:12 +0000 Subject: [PATCH] MPV: fix for bug 13534 Result of GetLocalImp methods is pointer. For 64-bits platforms it is 8 bytes. Use CORBA::LongLong to send 8 bytes. --- idl/SALOMEDS.idl | 8 ++++---- src/SALOMEDS/SALOMEDS_GenericAttribute.cxx | 2 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx | 4 ++-- src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_SObject.cxx | 6 +----- src/SALOMEDS/SALOMEDS_SObject_i.cxx | 4 ++-- src/SALOMEDS/SALOMEDS_SObject_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_Study.cxx | 6 +----- src/SALOMEDS/SALOMEDS_StudyManager.cxx | 4 ++-- src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 4 ++-- src/SALOMEDS/SALOMEDS_StudyManager_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_Study_i.cxx | 4 ++-- src/SALOMEDS/SALOMEDS_Study_i.hxx | 2 +- 13 files changed, 21 insertions(+), 29 deletions(-) diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index c82d3f331..8920ec25b 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -400,7 +400,7 @@ during each working session. \param thePID is a process ID of the caller \param isLocal is set True if the Study is launched locally with the caller */ - long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); /*! @@ -842,7 +842,7 @@ Gets the list of open studies \param thePID is a process ID of the caller \param isLocal is set True if the StudyManager is launched locally with the caller */ - long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); }; @@ -959,7 +959,7 @@ Gets the list of open studies \param thePID is a process ID of the caller \param isLocal is set True if the SObject is launched locally with the caller */ - long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); }; @@ -996,7 +996,7 @@ Gets the list of open studies \param thePID is a process ID of the caller \param isLocal is set True if the GenericAttribute is launched locally with the caller */ - long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); }; diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx index f7d837568..dbbe153e0 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx @@ -58,7 +58,7 @@ SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ long pid = (long)getpid(); #endif - long addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = ((SALOMEDSImpl_GenericAttribute*)(addr)); _corba_impl = SALOMEDS::GenericAttribute::_nil(); diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx index 8ab64d6ab..e51e4609f 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx @@ -131,7 +131,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== -CORBA::Long SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +CORBA::LongLong SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) { #ifdef WIN32 long pid = (long)_getpid(); @@ -140,5 +140,5 @@ CORBA::Long SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostname, C #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; TDF_Attribute* local_impl = _impl.operator->(); - return ((long)local_impl); + return ((CORBA::LongLong)local_impl); } diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx index 6835caa3a..32176a41a 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx @@ -57,7 +57,7 @@ public: static SALOMEDS::GenericAttribute_ptr CreateAttribute(const Handle(TDF_Attribute)& theAttr, CORBA::ORB_ptr theOrb); - virtual CORBA::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); + virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif diff --git a/src/SALOMEDS/SALOMEDS_SObject.cxx b/src/SALOMEDS/SALOMEDS_SObject.cxx index 1e551766d..5db300efd 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -62,11 +62,7 @@ SALOMEDS_SObject::SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject) long pid = (long)getpid(); #endif -#if SIZEOF_LONG == 4 - long addr = -#else - int addr = -#endif + CORBA::LongLong addr = // mpv: fix for IPAL13534: for 64-bit platforms use 8-bytes long for pointer storage theSObject->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); if(_isLocal) { diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index f3d1602ed..59b0e30a0 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -318,7 +318,7 @@ char* SALOMEDS_SObject_i::GetIOR() //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== -CORBA::Long SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +CORBA::LongLong SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) { #ifdef WIN32 long pid = (long)_getpid(); @@ -327,5 +327,5 @@ CORBA::Long SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA::Lon #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; SALOMEDSImpl_SObject* local_impl = _impl.operator->(); - return ((long)local_impl); + return ((CORBA::LongLong)local_impl); } diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.hxx b/src/SALOMEDS/SALOMEDS_SObject_i.hxx index 29e434bf6..fe16e357f 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.hxx @@ -76,7 +76,7 @@ public: virtual CORBA::Short Tag(); virtual CORBA::Short Depth(); - virtual CORBA::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); + virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index 01a0ca2d1..e6e306bea 100644 --- a/src/SALOMEDS/SALOMEDS_Study.cxx +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -83,11 +83,7 @@ SALOMEDS_Study::SALOMEDS_Study(SALOMEDS::Study_ptr theStudy) long pid = (long)getpid(); #endif -#if SIZEOF_LONG == 4 - long addr = -#else - int addr = -#endif + CORBA::LongLong addr = // mpv: fix for IPAL13534: for 64 bit platform use 8-bytes long for pointer storage theStudy->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); if(_isLocal) { diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.cxx b/src/SALOMEDS/SALOMEDS_StudyManager.cxx index cae5cfba5..335123165 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager.cxx @@ -61,7 +61,7 @@ SALOMEDS_StudyManager::SALOMEDS_StudyManager(SALOMEDS::StudyManager_ptr theManag long pid = (long)getpid(); #endif - long addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = ((SALOMEDSImpl_StudyManager*)(addr)); _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager); @@ -89,7 +89,7 @@ SALOMEDS_StudyManager::SALOMEDS_StudyManager() long pid = (long)getpid(); #endif - long addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = ((SALOMEDSImpl_StudyManager*)(addr)); _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager); diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index 617f7c194..b13fd9bab 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -456,7 +456,7 @@ PortableServer::POA_ptr SALOMEDS_StudyManager_i::GetPOA(const SALOMEDS::Study_pt //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== -CORBA::Long SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +CORBA::LongLong SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) { #ifdef WIN32 long pid = (long)_getpid(); @@ -465,7 +465,7 @@ CORBA::Long SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, CORBA #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; SALOMEDSImpl_StudyManager* aManager = _impl.operator->(); - return ((long)aManager); + return ((CORBA::LongLong)aManager); } //=========================================================================== diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx index 3f3c3d831..31c486f7b 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx @@ -142,7 +142,7 @@ public: void ping(){}; - virtual CORBA::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); + virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); static PortableServer::POA_ptr GetPOA(const SALOMEDS::Study_ptr theStudy); }; diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index dcf58e808..b0874efbd 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -883,7 +883,7 @@ char* SALOMEDS_Study_i::GetDefaultScript(const char* theModuleName, const char* //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== -CORBA::Long SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +CORBA::LongLong SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) { #ifdef WIN32 long pid = (long)_getpid(); @@ -892,5 +892,5 @@ CORBA::Long SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::Long #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; SALOMEDSImpl_Study* local_impl = _impl.operator->(); - return ((long)local_impl); + return ((CORBA::LongLong)local_impl); } diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index dc617fe12..d1e6fae52 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -298,6 +298,6 @@ public: virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; } - virtual CORBA::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); + virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif -- 2.39.2