*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
-52
View File
@@ -1,5 +1,4 @@
// -*- C++ -*-
//=============================================================================
/**
* @file MEM_IO.h
@@ -10,35 +9,26 @@
*/
//=============================================================================
#ifndef ACE_MEM_IO_H
#define ACE_MEM_IO_H
#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
#include "ace/SOCK.h"
#include "ace/MEM_SAP.h"
#include "ace/Message_Block.h"
#include "ace/Process_Semaphore.h"
#include "ace/Process_Mutex.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Export ACE_Reactive_MEM_IO : public ACE_MEM_SAP
{
public:
ACE_Reactive_MEM_IO (void);
virtual ~ACE_Reactive_MEM_IO (void);
/**
* Initialize the MEM_SAP object.
*
@@ -48,7 +38,6 @@ public:
virtual int init (ACE_HANDLE handle,
const ACE_TCHAR *name,
MALLOC_OPTIONS *options);
/**
* Fetch location of next available data into <recv_buffer_>.
* As this operation read the address of the data off the socket
@@ -57,7 +46,6 @@ public:
virtual ssize_t recv_buf (ACE_MEM_SAP_Node *&buf,
int flags,
const ACE_Time_Value *timeout);
/**
* Wait to to @a timeout amount of time to send @a buf. If <send>
* times out a -1 is returned with @c errno == ETIME. If it succeeds
@@ -65,7 +53,6 @@ public:
virtual ssize_t send_buf (ACE_MEM_SAP_Node *buf,
int flags,
const ACE_Time_Value *timeout);
/**
* Convert the buffer offset <off> to absolute address to @a buf.
* Return the size of valid information containing in the @a buf,
@@ -73,7 +60,6 @@ public:
*/
ssize_t get_buf_len (const ACE_OFF_T off, ACE_MEM_SAP_Node *&buf);
};
#if defined (ACE_WIN32) || !defined (_ACE_USE_SV_SEM)
class ACE_Export ACE_MT_MEM_IO : public ACE_MEM_SAP
{
@@ -83,41 +69,32 @@ public:
ACE_MEM_SAP_Node::ACE_MEM_SAP_NODE_PTR head_;
ACE_MEM_SAP_Node::ACE_MEM_SAP_NODE_PTR tail_;
} MQ_Struct; // Structure for a simple queue
class Simple_Queue
{
public:
Simple_Queue (void);
Simple_Queue (MQ_Struct *mq);
int init (MQ_Struct *mq, ACE_MEM_SAP::MALLOC_TYPE *malloc);
int write (ACE_MEM_SAP_Node *new_msg);
ACE_MEM_SAP_Node *read (void);
private:
MQ_Struct *mq_;
ACE_MEM_SAP::MALLOC_TYPE *malloc_;
};
typedef struct
{
ACE_SYNCH_PROCESS_SEMAPHORE *sema_;
ACE_SYNCH_PROCESS_MUTEX *lock_;
Simple_Queue queue_;
} Channel;
ACE_MT_MEM_IO (void);
virtual ~ACE_MT_MEM_IO (void);
/**
* Initialize the MEM_SAP object.
*/
virtual int init (ACE_HANDLE handle,
const ACE_TCHAR *name,
MALLOC_OPTIONS *options);
/**
* Fetch location of next available data into <recv_buffer_>.
* As this operation read the address of the data off the socket
@@ -126,7 +103,6 @@ public:
virtual ssize_t recv_buf (ACE_MEM_SAP_Node *&buf,
int flags,
const ACE_Time_Value *timeout);
/**
* Wait to to @a timeout amount of time to send @a buf. If <send>
* times out a -1 is returned with @c errno == ETIME. If it succeeds
@@ -134,13 +110,11 @@ public:
virtual ssize_t send_buf (ACE_MEM_SAP_Node *buf,
int flags,
const ACE_Time_Value *timeout);
private:
Channel recv_channel_;
Channel send_channel_;
};
#endif /* ACE_WIN32 || !_ACE_USE_SV_SEM */
/**
* @class ACE_MEM_IO
*
@@ -173,49 +147,40 @@ public:
// = Initialization and termination methods.
/// Constructor.
ACE_MEM_IO (void);
/// Destructor.
~ACE_MEM_IO (void);
typedef enum
{
Reactive,
MT
} Signal_Strategy;
/**
* Initialize the MEM_SAP object.
*/
int init (const ACE_TCHAR *name,
ACE_MEM_IO::Signal_Strategy type = ACE_MEM_IO::Reactive,
ACE_MEM_SAP::MALLOC_OPTIONS *options = 0);
/**
* Finalizing the MEM_IO object. This method doesn't invoke
* the <remove> method.
*/
int fini (void);
/// Send an @a n byte buffer to the other process using shm_malloc_
/// connected thru the socket.
ssize_t send (const void *buf,
size_t n,
int flags) ;
/// Recv an @a n byte buffer from the shm_malloc_ thru connected socket.
ssize_t recv (void *buf,
size_t n,
int flags) ;
/// Send an @a n byte buffer to the other process using shm_malloc_
/// connected thru the socket.
ssize_t send (const void *buf,
size_t n) ;
/// Recv an @a n byte buffer from the shm_malloc_ thru connected socket.
ssize_t recv (void *buf,
size_t n) ;
/**
* Wait to to @a timeout amount of time to send up to @a n bytes into
* @a buf from <handle> (uses the <send> call). If <send> times out
@@ -225,7 +190,6 @@ public:
ssize_t send (const void *buf,
size_t n,
const ACE_Time_Value *timeout);
/**
* Wait to to @a timeout amount of time to send up to @a n bytes into
* @a buf from <handle> (uses the <send> call). If <send> times out
@@ -236,7 +200,6 @@ public:
size_t n,
int flags,
const ACE_Time_Value *timeout);
/**
* Wait to to @a timeout amount of time to send the @a message_block.
* If <send> times out a -1 is returned with @c errno == ETIME. If
@@ -244,7 +207,6 @@ public:
*/
ssize_t send (const ACE_Message_Block *message_block,
const ACE_Time_Value *timeout);
/**
* Wait up to @a timeout amount of time to receive up to @a n bytes
* into @a buf from <handle> (uses the <recv> call). If <recv> times
@@ -254,7 +216,6 @@ public:
ssize_t recv (void *buf,
size_t n,
const ACE_Time_Value *timeout);
/**
* Wait up to @a timeout amount of time to receive up to @a n bytes
* into @a buf from <handle> (uses the <recv> call). If <recv> times
@@ -266,46 +227,33 @@ public:
int flags,
const ACE_Time_Value *timeout);
/// Dump the state of an object.
void dump (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
/// Return the local endpoint port number. Returns 0 if successful,
/// else -1.
/* int get_local_port (u_short &) const;
/// Return the port number of the remotely connected peer (if there
/// is one). Returns 0 if successful, else -1.
int get_remote_port (u_short &) const;
*/
private:
ssize_t fetch_recv_buf (int flag, const ACE_Time_Value *timeout);
/// Actual deliverying mechanism.
ACE_MEM_SAP *deliver_strategy_;
/// Internal pointer for support recv/send.
ACE_MEM_SAP_Node *recv_buffer_;
/// Record the current total buffer size of <recv_buffer_>.
ssize_t buf_size_;
/// Record the current read pointer location in <recv_buffer_>.
ssize_t cur_offset_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "ace/MEM_IO.inl"
#endif /* __ACE_INLINE__ */
#endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */
#include /**/ "ace/post.h"
#endif /* ACE_SOCK_IO_H */