*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
This commit is contained in:
maximius
2009-10-17 15:35:07 -07:00
parent f21f47005d
commit 26b5e033ff
2257 changed files with 750 additions and 103852 deletions
-45
View File
@@ -1,52 +1,39 @@
#include "ace/Token_Collection.h"
#if defined (ACE_HAS_TOKENS_LIBRARY)
#if !defined (__ACE_INLINE__)
#include "ace/Token_Collection.inl"
#endif /* __ACE_INLINE__ */
ACE_RCSID (ace,
Token_Collection,
"$Id: Token_Collection.cpp 80826 2008-03-04 14:51:23Z wotte $")
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_Token_Collection::ACE_Token_Collection (bool debug,
const ACE_TCHAR *name)
: debug_ (debug)
{
ACE_TRACE ("ACE_Token_Collection::ACE_Token_Collection");
if (name == 0)
name = ACE_TEXT ("no name");
ACE_OS::strsncpy (this->name_,
const_cast<ACE_TCHAR *> (name),
ACE_MAXTOKENNAMELEN);
}
int
ACE_Token_Collection::insert (ACE_Token_Proxy &new_token)
{
ACE_TRACE ("ACE_Token_Collection::insert");
TOKEN_NAME name (new_token.name ());
// Check if the new_proxy is already in the list.
if (collection_.find (name) == 1)
// One already exists, so fail.
return -1;
// Clone the new token.
ACE_Token_Proxy *temp = new_token.clone ();
if (collection_.bind (name, temp) == -1)
ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed\n")), -1);
return 0;
}
int
ACE_Token_Collection::extract (const ACE_TCHAR *token_name, ACE_Token_Proxy *&proxy)
{
@@ -54,7 +41,6 @@ ACE_Token_Collection::extract (const ACE_TCHAR *token_name, ACE_Token_Proxy *&pr
TOKEN_NAME name (token_name);
return collection_.unbind (token_name, proxy);
}
ACE_Token_Proxy *
ACE_Token_Collection::is_member (const ACE_TCHAR *token_name)
{
@@ -64,7 +50,6 @@ ACE_Token_Collection::is_member (const ACE_TCHAR *token_name)
// Get the token from the collection.
return collection_.find (name, temp) == -1 ? 0 : temp;
}
int
ACE_Token_Collection::is_member (const ACE_Token_Proxy &token)
{
@@ -72,16 +57,13 @@ ACE_Token_Collection::is_member (const ACE_Token_Proxy &token)
TOKEN_NAME token_name (token.name ());
return collection_.find (token_name) == 0;
}
int
ACE_Token_Collection::acquire (int notify,
void (*sleep_hook)(void *),
ACE_Synch_Options &options)
{
ACE_TRACE ("ACE_Token_Collection::acquire");
COLLECTION::ITERATOR iterator (collection_);
for (COLLECTION::ENTRY *temp = 0;
iterator.next (temp) != 0;
iterator.advance ())
@@ -100,10 +82,8 @@ ACE_Token_Collection::acquire (int notify,
ACE_RETURN (-1);
}
}
return 0;
}
int
ACE_Token_Collection::acquire (const ACE_TCHAR *token_name,
int notify,
@@ -122,7 +102,6 @@ ACE_Token_Collection::acquire (const ACE_TCHAR *token_name,
return temp->acquire (notify, sleep_hook, options);
}
int
ACE_Token_Collection::tryacquire (const ACE_TCHAR *token_name,
void (*sleep_hook)(void *))
@@ -135,18 +114,14 @@ ACE_Token_Collection::tryacquire (const ACE_TCHAR *token_name,
// did we find it?
if (result == -1)
return result;
// perform the operation
return temp->tryacquire (sleep_hook);
}
int
ACE_Token_Collection::tryacquire (void (*sleep_hook)(void *))
{
ACE_TRACE ("ACE_Token_Collection::tryacquire");
COLLECTION::ITERATOR iterator (collection_);
for (COLLECTION::ENTRY *temp = 0;
iterator.next (temp) != 0;
iterator.advance ())
@@ -158,18 +133,14 @@ ACE_Token_Collection::tryacquire (void (*sleep_hook)(void *))
if (temp->int_id_->tryacquire (sleep_hook) == -1)
return -1;
}
return 0;
}
int
ACE_Token_Collection::renew (int requeue_position,
ACE_Synch_Options &options)
{
ACE_TRACE ("ACE_Token_Collection::renew");
COLLECTION::ITERATOR iterator (collection_);
for (COLLECTION::ENTRY *temp = 0;
iterator.next (temp) != 0;
iterator.advance ())
@@ -180,10 +151,8 @@ ACE_Token_Collection::renew (int requeue_position,
if (temp->int_id_->renew (requeue_position, options) == -1)
return -1;
}
return 0;
}
int
ACE_Token_Collection::renew (const ACE_TCHAR *token_name,
int requeue_position,
@@ -192,10 +161,8 @@ ACE_Token_Collection::renew (const ACE_TCHAR *token_name,
ACE_TRACE ("ACE_Token_Collection::renew");
TOKEN_NAME name (token_name);
ACE_Token_Proxy *temp;
// Get the token from the collection.
int result = collection_.find (name, temp);
// Did we find it?
if (result == -1)
ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT ("%p %s\n"),
@@ -204,14 +171,11 @@ ACE_Token_Collection::renew (const ACE_TCHAR *token_name,
// perform the operation
return temp->renew (requeue_position, options);
}
int
ACE_Token_Collection::release (ACE_Synch_Options &)
{
ACE_TRACE ("ACE_Token_Collection::release");
COLLECTION::ITERATOR iterator (collection_);
for (COLLECTION::ENTRY *temp = 0;
iterator.next (temp) != 0;
iterator.advance ())
@@ -221,10 +185,8 @@ ACE_Token_Collection::release (ACE_Synch_Options &)
temp->int_id_->name ()));
temp->int_id_->release ();
}
return 0;
}
int
ACE_Token_Collection::release (const ACE_TCHAR *token_name,
ACE_Synch_Options &options)
@@ -240,12 +202,10 @@ ACE_Token_Collection::release (const ACE_TCHAR *token_name,
// perform the operation
return temp->release (options);
}
ACE_Token_Collection::~ACE_Token_Collection (void)
{
ACE_TRACE ("ACE_Token_Collection::~ACE_Token_Collection");
COLLECTION::ITERATOR iterator (collection_);
for (COLLECTION::ENTRY *temp = 0;
iterator.next (temp) != 0;
iterator.advance ())
@@ -256,7 +216,6 @@ ACE_Token_Collection::~ACE_Token_Collection (void)
}
}
// This method doesn't mean anything for a collection.
ACE_Token_Proxy *
ACE_Token_Collection::clone (void) const
@@ -264,7 +223,6 @@ ACE_Token_Collection::clone (void) const
ACE_TRACE ("ACE_Token_Collection::clone");
return (ACE_Token_Proxy *) 0;
}
// This method doesn't mean anything for a collection.
ACE_Tokens *
ACE_Token_Collection::create_token (const ACE_TCHAR *)
@@ -272,7 +230,6 @@ ACE_Token_Collection::create_token (const ACE_TCHAR *)
ACE_TRACE ("ACE_Token_Collection::create_token");
return (ACE_Tokens *) 0;
}
void
ACE_Token_Collection::dump (void) const
{
@@ -288,8 +245,6 @@ ACE_Token_Collection::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_HAS_TOKENS_LIBRARY */