diff options
author | maximius <none@none> | 2009-10-17 15:35:07 -0700 |
---|---|---|
committer | maximius <none@none> | 2009-10-17 15:35:07 -0700 |
commit | 26b5e033ffde3d161382fc9addbfa99738379641 (patch) | |
tree | a344f369ca32945f787a02dee35c3dbe342bed7e /dep/ACE_wrappers/ace/DLL.cpp | |
parent | f21f47005dcb6b76e1abc9f35fbcd03eed191bff (diff) |
*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)
*Fix a possible crash in Spell::DoAllEffectOnTarget
--HG--
branch : trunk
Diffstat (limited to 'dep/ACE_wrappers/ace/DLL.cpp')
-rw-r--r-- | dep/ACE_wrappers/ace/DLL.cpp | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/dep/ACE_wrappers/ace/DLL.cpp b/dep/ACE_wrappers/ace/DLL.cpp index 43cfa2efa84..73d7f0459f5 100644 --- a/dep/ACE_wrappers/ace/DLL.cpp +++ b/dep/ACE_wrappers/ace/DLL.cpp @@ -1,23 +1,16 @@ // $Id: DLL.cpp 80826 2008-03-04 14:51:23Z wotte $ - #include "ace/DLL.h" - #include "ace/Log_Msg.h" #include "ace/ACE.h" #include "ace/DLL_Manager.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_dlfcn.h" #include "ace/OS_NS_Thread.h" - #include <algorithm> - ACE_RCSID(ace, DLL, "$Id: DLL.cpp 80826 2008-03-04 14:51:23Z wotte $") - ACE_BEGIN_VERSIONED_NAMESPACE_DECL - // Default constructor. Also, by default, the object will be closed // before it is destroyed. - ACE_DLL::ACE_DLL (bool close_handle_on_destruction) : open_mode_ (0), dll_name_ (0), @@ -27,7 +20,6 @@ ACE_DLL::ACE_DLL (bool close_handle_on_destruction) { ACE_TRACE ("ACE_DLL::ACE_DLL (int)"); } - ACE_DLL::ACE_DLL (const ACE_DLL &rhs) : open_mode_ (0), dll_name_ (0), @@ -36,7 +28,6 @@ ACE_DLL::ACE_DLL (const ACE_DLL &rhs) error_ (0) { ACE_TRACE ("ACE_DLL::ACE_DLL (const ACE_DLL &)"); - if (rhs.dll_name_ // This will automatically up the refcount. && this->open (rhs.dll_name_, @@ -47,30 +38,23 @@ ACE_DLL::ACE_DLL (const ACE_DLL &rhs) ACE_TEXT ("ACE_DLL::copy_ctor: error: %s\n"), this->error ())); } - // Assignment operator - ACE_DLL & ACE_DLL::operator= (const ACE_DLL &rhs) { ACE_TRACE ("ACE_DLL::operator= (const ACE_DLL &)"); - ACE_DLL tmp (rhs); - std::swap (this->open_mode_, tmp.open_mode_); std::swap (this->dll_name_, tmp.dll_name_); std::swap (this->close_handle_on_destruction_, tmp.close_handle_on_destruction_); std::swap (this->dll_handle_, tmp.dll_handle_); std::swap (this->error_, tmp.error_); - return *this; } - // If the library name and the opening mode are specified than on // object creation the library is implicitly opened. - ACE_DLL::ACE_DLL (const ACE_TCHAR *dll_name, int open_mode, bool close_handle_on_destruction) @@ -81,31 +65,25 @@ ACE_DLL::ACE_DLL (const ACE_TCHAR *dll_name, error_ (0) { ACE_TRACE ("ACE_DLL::ACE_DLL"); - if (this->open (dll_name, this->open_mode_, close_handle_on_destruction) != 0 && ACE::debug ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_DLL::open: error calling open: %s\n"), this->error ())); } - // The library is closed before the class gets destroyed depending on // the close_handle_on_destruction value specified which is stored in // close_handle_on_destruction_. - ACE_DLL::~ACE_DLL (void) { ACE_TRACE ("ACE_DLL::~ACE_DLL"); - this->close (); - // Normally delete()d in ACE_DLL::close(). However, that may not // occur if full ACE_DLL initialization is interrupted due to errors // (e.g. attempting to open a DSO/DLL that does not exist). Make // sure this->dll_name_ is deallocated. delete [] this->dll_name_; } - // This method opens the library based on the mode specified using the // ACE_SHLIB_HANDLE which is obtained on making the ACE_OS::dlopen call. // The default mode is: @@ -116,17 +94,14 @@ ACE_DLL::~ACE_DLL (void) // object is first loaded. // RTLD_GLOBAL The object symbols are made available for the // relocation processing of any other object. - int ACE_DLL::open (const ACE_TCHAR *dll_filename, int open_mode, bool close_handle_on_destruction) { ACE_TRACE ("ACE_DLL::open"); - return open_i (dll_filename, open_mode, close_handle_on_destruction); } - int ACE_DLL::open_i (const ACE_TCHAR *dll_filename, int open_mode, @@ -134,9 +109,7 @@ ACE_DLL::open_i (const ACE_TCHAR *dll_filename, ACE_SHLIB_HANDLE handle) { ACE_TRACE ("ACE_DLL::open_i"); - this->error_ = 0; - if (!dll_filename) { if (ACE::debug ()) @@ -146,7 +119,6 @@ ACE_DLL::open_i (const ACE_TCHAR *dll_filename, : this->dll_name_)); return -1; } - if (this->dll_handle_) { // If we have a good handle and its the same name, just return. @@ -155,69 +127,50 @@ ACE_DLL::open_i (const ACE_TCHAR *dll_filename, else this->close (); } - if (!this->dll_name_) this->dll_name_ = ACE::strnew (dll_filename); - this->open_mode_ = open_mode; this->close_handle_on_destruction_ = close_handle_on_destruction; - this->dll_handle_ = ACE_DLL_Manager::instance()->open_dll (this->dll_name_, this->open_mode_, handle); - if (!this->dll_handle_) this->error_ = 1; - return this->error_ ? -1 : 0; } - // The symbol refernce of the name specified is obtained. - void * ACE_DLL::symbol (const ACE_TCHAR *sym_name, int ignore_errors) { ACE_TRACE ("ACE_DLL::symbol"); - this->error_ = 0; - void *sym = 0; if (this->dll_handle_) sym = this->dll_handle_->symbol (sym_name, ignore_errors); - if (!sym) this->error_ = 1; - return sym; } - // The library is closed using the ACE_SHLIB_HANDLE object, i.e., the // shared object is now disassociated form the current process. - int ACE_DLL::close (void) { ACE_TRACE ("ACE_DLL::close"); - int retval = 0; - if (this->dll_handle_ && this->close_handle_on_destruction_ && this->dll_name_ && (retval = ACE_DLL_Manager::instance ()->close_dll (this->dll_name_)) != 0) this->error_ = 1; - // Even if close_dll() failed, go ahead and cleanup. this->dll_handle_ = 0; delete [] this->dll_name_; this->dll_name_ = 0; this->close_handle_on_destruction_ = false; - return retval; } - // This method is used return the last error of a library operation. - ACE_TCHAR * ACE_DLL::error (void) const { @@ -226,43 +179,32 @@ ACE_DLL::error (void) const { return ACE_OS::dlerror (); } - return 0; } - // Return the handle to the user either temporarily or forever, thus // orphaning it. If 0 means the user wants the handle forever and if 1 // means the user temporarily wants to take the handle. - ACE_SHLIB_HANDLE ACE_DLL::get_handle (int become_owner) const { ACE_TRACE ("ACE_DLL::get_handle"); - ACE_SHLIB_HANDLE handle = ACE_SHLIB_INVALID_HANDLE; - if (this->dll_handle_) handle = this->dll_handle_->get_handle (become_owner); - return handle; } - // Set the handle for the DLL. By default, the object will be closed // before it is destroyed. - int ACE_DLL::set_handle (ACE_SHLIB_HANDLE handle, bool close_handle_on_destruction) { ACE_TRACE ("ACE_DLL::set_handle"); - // Create a unique name. Note that this name is only quaranteed // to be unique for the life of this object. ACE_TCHAR temp[ACE_UNIQUE_NAME_LEN]; ACE_OS::unique_name (this, temp, ACE_UNIQUE_NAME_LEN); - return this->open_i (temp, 1, close_handle_on_destruction, handle); } - ACE_END_VERSIONED_NAMESPACE_DECL |