summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1999-06-07 06:45:00 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1999-06-07 06:45:00 +0000
commit301f6de0c0719e95d4bdf766d1aae0a3debda263 (patch)
tree4c496c170b9af34f4e4261b5f011b94af3247e03
parentf868ff49bd916a0de5d694eb9371c0db858e416f (diff)
downloadATCD-301f6de0c0719e95d4bdf766d1aae0a3debda263.tar.gz
.
-rw-r--r--ace/RB_Tree.h12
-rw-r--r--examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp2
-rw-r--r--examples/IPC_SAP/SPIPE_SAP/NPClient.cpp5
-rw-r--r--examples/IPC_SAP/SPIPE_SAP/NPServer.cpp4
-rw-r--r--examples/Mem_Map/IO-tests/IO_Test.cpp82
-rw-r--r--examples/Mem_Map/IO-tests/IO_Test.h49
-rw-r--r--examples/Mem_Map/IO-tests/test_io.cpp93
-rw-r--r--examples/Naming/test_non_existent.cpp2
-rw-r--r--examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp9
-rw-r--r--examples/Service_Configurator/IPC-tests/client/local_fifo_client_test.cpp40
-rw-r--r--examples/Service_Configurator/IPC-tests/client/local_pipe_client_test.cpp82
-rw-r--r--examples/Service_Configurator/IPC-tests/client/local_spipe_client_test.cpp38
-rw-r--r--examples/Service_Configurator/IPC-tests/client/local_stream_client_test.cpp58
-rw-r--r--examples/Service_Configurator/Misc/main.cpp6
-rw-r--r--examples/Shared_Malloc/test_malloc.cpp5
-rw-r--r--examples/Shared_Malloc/test_persistence.cpp2
-rw-r--r--examples/System_V_IPC/SV_Message_Queues/test.h8
-rw-r--r--performance-tests/Misc/childbirth_time.cpp2
18 files changed, 331 insertions, 168 deletions
diff --git a/ace/RB_Tree.h b/ace/RB_Tree.h
index 5d20fcb6aee..2c54983e515 100644
--- a/ace/RB_Tree.h
+++ b/ace/RB_Tree.h
@@ -52,8 +52,7 @@ class ACE_RB_Tree_Node : public ACE_RB_Tree_Node_Base
// Implements a node in a Red-Black Tree ADT.
//
public:
-
- // Initialization and termination methods.
+ // = Initialization and termination methods.
ACE_RB_Tree_Node (const EXT_ID &k, const INT_ID &t);
// Constructor.
@@ -112,7 +111,6 @@ private:
// Pointer to node's right child.
};
-
class ACE_RB_Tree_Base
{
public:
@@ -537,11 +535,8 @@ protected:
};
-
-
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
-class ACE_RB_Tree_Iterator :
- public ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
+class ACE_RB_Tree_Iterator : public ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
{
// = TITLE
// Implements an iterator for a Red-Black Tree ADT.
@@ -619,8 +614,7 @@ public:
};
template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK>
-class ACE_RB_Tree_Reverse_Iterator :
- public ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
+class ACE_RB_Tree_Reverse_Iterator : public ACE_RB_Tree_Iterator_Base<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>
{
// = TITLE
// Implements a reverse iterator for a Red-Black Tree ADT.
diff --git a/examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp b/examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp
index 5e15bdf137a..c6095cc4909 100644
--- a/examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp
+++ b/examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp
@@ -39,7 +39,7 @@ Consumer_Router::open (void *)
char *argv[3];
argv[0] = (char *) this->name ();
- argv[1] = options.consumer_file ();
+ argv[1] = (char *) options.consumer_file ();
argv[2] = 0;
if (this->init (1, &argv[1]) == -1)
diff --git a/examples/IPC_SAP/SPIPE_SAP/NPClient.cpp b/examples/IPC_SAP/SPIPE_SAP/NPClient.cpp
index 036d30aeb20..ccc9e055618 100644
--- a/examples/IPC_SAP/SPIPE_SAP/NPClient.cpp
+++ b/examples/IPC_SAP/SPIPE_SAP/NPClient.cpp
@@ -22,12 +22,11 @@ main (int argc, char *argv[])
char *buf;
ACE_NEW_RETURN (buf,
- new char[size],
+ char[size],
1);
const char *pipe_name = "acepipe";
- char *rendezvous;
- rendezvous = MAKE_PIPE_NAME (pipe_name);
+ const char *rendezvous = MAKE_PIPE_NAME (pipe_name);
ACE_SPIPE_Stream cli_stream;
ACE_SPIPE_Connector con;
diff --git a/examples/IPC_SAP/SPIPE_SAP/NPServer.cpp b/examples/IPC_SAP/SPIPE_SAP/NPServer.cpp
index b1decbc976f..e23e21c53b3 100644
--- a/examples/IPC_SAP/SPIPE_SAP/NPServer.cpp
+++ b/examples/IPC_SAP/SPIPE_SAP/NPServer.cpp
@@ -19,9 +19,7 @@ main (int /* argc */, char * /* argv */ [])
char buf[BUFSIZ];
int n;
const char *pipe_name = "acepipe";
-
- char *rendezvous;
- rendezvous = MAKE_PIPE_NAME (pipe_name);
+ const char *rendezvous = MAKE_PIPE_NAME (pipe_name);
// Initialize named pipe listener.
diff --git a/examples/Mem_Map/IO-tests/IO_Test.cpp b/examples/Mem_Map/IO-tests/IO_Test.cpp
index 2376b7b1ec6..aa981c439b1 100644
--- a/examples/Mem_Map/IO-tests/IO_Test.cpp
+++ b/examples/Mem_Map/IO-tests/IO_Test.cpp
@@ -6,7 +6,8 @@
ACE_RCSID(IO_tests, IO_Test, "$Id$")
-IO_Test::IO_Test (const char *name, ACE_Profile_Timer &tm)
+IO_Test::IO_Test (const char *name,
+ ACE_Profile_Timer &tm)
: name_ (name), tm_ (tm)
{
}
@@ -17,13 +18,16 @@ IO_Test::name (void)
return this->name_;
}
-Slow_Read_Write_Test::Slow_Read_Write_Test (char *name, ACE_Profile_Timer &tm)
+Slow_Read_Write_Test::Slow_Read_Write_Test (const char *name,
+ ACE_Profile_Timer &tm)
: IO_Test (name, tm)
{
}
int
-Slow_Read_Write_Test::run_test (int iterations, FILE *input_fp, FILE *output_fp)
+Slow_Read_Write_Test::run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp)
{
int ifd = fileno (input_fp);
int ofd = fileno (output_fp);
@@ -45,13 +49,16 @@ Slow_Read_Write_Test::run_test (int iterations, FILE *input_fp, FILE *output_fp)
return 0;
}
-Stdio_Test::Stdio_Test (char *name, ACE_Profile_Timer &tm)
+Stdio_Test::Stdio_Test (const char *name,
+ ACE_Profile_Timer &tm)
: IO_Test (name, tm)
{
}
int
-Stdio_Test::run_test (int iterations, FILE *input_fp, FILE *output_fp)
+Stdio_Test::run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp)
{
this->tm_.start ();
@@ -69,13 +76,16 @@ Stdio_Test::run_test (int iterations, FILE *input_fp, FILE *output_fp)
return 0;
}
-Block_Read_Write_Test::Block_Read_Write_Test (char *name, ACE_Profile_Timer &tm)
+Block_Read_Write_Test::Block_Read_Write_Test (const char *name,
+ ACE_Profile_Timer &tm)
: IO_Test (name, tm)
{
}
int
-Block_Read_Write_Test::run_test (int iterations, FILE *input_fp, FILE *output_fp)
+Block_Read_Write_Test::run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp)
{
int ifd = fileno (input_fp);
int ofd = fileno (output_fp);
@@ -87,7 +97,9 @@ Block_Read_Write_Test::run_test (int iterations, FILE *input_fp, FILE *output_fp
char buf[BUFSIZ];
ssize_t n;
- while ((n = ACE_OS::read (ifd, buf, sizeof buf)) > 0)
+ while ((n = ACE_OS::read (ifd,
+ buf,
+ sizeof buf)) > 0)
::write (ofd, buf, n);
ACE_OS::lseek (ifd, 0, SEEK_SET);
@@ -98,13 +110,16 @@ Block_Read_Write_Test::run_test (int iterations, FILE *input_fp, FILE *output_fp
return 0;
}
-Block_Fread_Fwrite_Test::Block_Fread_Fwrite_Test (char *name, ACE_Profile_Timer &tm)
+Block_Fread_Fwrite_Test::Block_Fread_Fwrite_Test (const char *name,
+ ACE_Profile_Timer &tm)
: IO_Test (name, tm)
{
}
int
-Block_Fread_Fwrite_Test::run_test (int iterations, FILE *input_fp, FILE *output_fp)
+Block_Fread_Fwrite_Test::run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp)
{
this->tm_.start ();
@@ -113,7 +128,10 @@ Block_Fread_Fwrite_Test::run_test (int iterations, FILE *input_fp, FILE *output_
char buf[BUFSIZ];
ssize_t n;
- while ((n = ACE_OS::fread (buf, 1, sizeof buf, input_fp)) != 0)
+ while ((n = ACE_OS::fread (buf,
+ 1,
+ sizeof buf,
+ input_fp)) != 0)
::fwrite (buf, n, 1, output_fp);
ACE_OS::rewind (input_fp);
@@ -124,50 +142,72 @@ Block_Fread_Fwrite_Test::run_test (int iterations, FILE *input_fp, FILE *output_
return 0;
}
-Mmap1_Test::Mmap1_Test (char *name, ACE_Profile_Timer &tm)
+Mmap1_Test::Mmap1_Test (const char *name,
+ ACE_Profile_Timer &tm)
: IO_Test (name, tm)
{
}
int
-Mmap1_Test::run_test (int iterations, FILE *input_fp, FILE *output_fp)
+Mmap1_Test::run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp)
{
ACE_Mem_Map map_input (fileno (input_fp));
void *src = map_input.addr ();
if (src == MAP_FAILED)
- ACE_ERROR_RETURN ((LM_ERROR, "%s", this->name ()), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s",
+ this->name ()),
+ -1);
else
{
this->tm_.start ();
while (--iterations >= 0)
{
- if (ACE_OS::write (fileno (output_fp), src, map_input.size ()) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%s", this->name ()), -1);
- ACE_OS::lseek (fileno (output_fp), 0, SEEK_SET);
+ if (ACE_OS::write (fileno (output_fp),
+ src,
+ map_input.size ()) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s",
+ this->name ()),
+ -1);
+ ACE_OS::lseek (fileno (output_fp),
+ 0,
+ SEEK_SET);
}
this->tm_.stop ();
}
if (map_input.unmap () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%s", this->name ()), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s",
+ this->name ()),
+ -1);
else
return 0;
}
-Mmap2_Test::Mmap2_Test (char *name, ACE_Profile_Timer &tm)
+Mmap2_Test::Mmap2_Test (const char *name,
+ ACE_Profile_Timer &tm)
: IO_Test (name, tm)
{
}
int
-Mmap2_Test::run_test (int iterations, FILE *input_fp, FILE *output_fp)
+Mmap2_Test::run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp)
{
ACE_Mem_Map map_input (fileno (input_fp));
int size = map_input.size ();
- ACE_Mem_Map map_output (fileno (output_fp), size, PROT_WRITE, MAP_SHARED);
+ ACE_Mem_Map map_output (fileno (output_fp),
+ size,
+ PROT_WRITE,
+ MAP_SHARED);
void *src = map_input.addr ();
void *dst = map_output.addr ();
diff --git a/examples/Mem_Map/IO-tests/IO_Test.h b/examples/Mem_Map/IO-tests/IO_Test.h
index 22dcf578d7f..38e73778edc 100644
--- a/examples/Mem_Map/IO-tests/IO_Test.h
+++ b/examples/Mem_Map/IO-tests/IO_Test.h
@@ -15,13 +15,16 @@ class IO_Test
{
public:
// Initialize the test name
- IO_Test (const char *name, ACE_Profile_Timer &tm);
+ IO_Test (const char *name,
+ ACE_Profile_Timer &tm);
// Return the name of the test
const char *name (void);
// Execute the IO test (note this is a pure virtual function...)
- virtual int run_test (int iterations, FILE *input_fp, FILE *output_fp) = 0;
+ virtual int run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp) = 0;
protected:
// Name of the test
@@ -34,42 +37,60 @@ protected:
class Slow_Read_Write_Test : public IO_Test
{
public:
- Slow_Read_Write_Test (char *name, ACE_Profile_Timer &tm);
- virtual int run_test (int iterations, FILE *input_fp, FILE *output_fp);
+ Slow_Read_Write_Test (const char *name,
+ ACE_Profile_Timer &tm);
+ virtual int run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp);
};
class Stdio_Test : public IO_Test
{
public:
- Stdio_Test (char *name, ACE_Profile_Timer &tm);
- virtual int run_test (int iterations, FILE *input_fp, FILE *output_fp);
+ Stdio_Test (const char *name,
+ ACE_Profile_Timer &tm);
+ virtual int run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp);
};
class Block_Read_Write_Test : public IO_Test
{
public:
- Block_Read_Write_Test (char *name, ACE_Profile_Timer &tm);
- virtual int run_test (int iterations, FILE *input_fp, FILE *output_fp);
+ Block_Read_Write_Test (const char *name,
+ ACE_Profile_Timer &tm);
+ virtual int run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp);
};
class Block_Fread_Fwrite_Test : public IO_Test
{
public:
- Block_Fread_Fwrite_Test (char *name, ACE_Profile_Timer &tm);
- virtual int run_test (int iterations, FILE *input_fp, FILE *output_fp);
+ Block_Fread_Fwrite_Test (const char *name,
+ ACE_Profile_Timer &tm);
+ virtual int run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp);
};
class Mmap1_Test : public IO_Test
{
public:
- Mmap1_Test (char *name, ACE_Profile_Timer &tm);
- virtual int run_test (int iterations, FILE *input_fp, FILE *output_fp);
+ Mmap1_Test (const char *name,
+ ACE_Profile_Timer &tm);
+ virtual int run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp);
};
class Mmap2_Test : public IO_Test
{
public:
- Mmap2_Test (char *name, ACE_Profile_Timer &tm);
- virtual int run_test (int iterations, FILE *input_fp, FILE *output_fp);
+ Mmap2_Test (const char *name,
+ ACE_Profile_Timer &tm);
+ virtual int run_test (int iterations,
+ FILE *input_fp,
+ FILE *output_fp);
};
diff --git a/examples/Mem_Map/IO-tests/test_io.cpp b/examples/Mem_Map/IO-tests/test_io.cpp
index 15c0b131e9d..3a6d2a0c015 100644
--- a/examples/Mem_Map/IO-tests/test_io.cpp
+++ b/examples/Mem_Map/IO-tests/test_io.cpp
@@ -14,10 +14,10 @@ ACE_RCSID(IO_tests, test_io, "$Id$")
static const char *program_name;
// Name of default input file.
-static char *input_filename = "/usr/dict/words";
+static const char *input_filename = "/usr/dict/words";
// Name of default output file.
-static char *output_filename = "/tmp/foo";
+static const char *output_filename = "/tmp/foo";
// Check if removing output file upon completion...
static int remove_output = 1;
@@ -85,21 +85,37 @@ static IO_Test *test_vector[100];
static int
run_tests (int iterations, FILE *input_fp, FILE *output_fp)
{
- // If HP/UX didn't suck so badly we could initialize in the global
- // scope...
int i = 0;
- ACE_NEW_RETURN (test_vector[i], Stdio_Test ("Stdio_Test", profile_timer), -1);
+ ACE_NEW_RETURN (test_vector[i],
+ Stdio_Test ("Stdio_Test",
+ profile_timer),
+ -1);
i++;
- ACE_NEW_RETURN (test_vector[i], Block_Fread_Fwrite_Test ("Block_Fread_Fwrite_Test", profile_timer), -1);
+ ACE_NEW_RETURN (test_vector[i],
+ Block_Fread_Fwrite_Test ("Block_Fread_Fwrite_Test",
+ profile_timer),
+ -1);
i++;
- ACE_NEW_RETURN (test_vector[i], Block_Read_Write_Test ("Block_Read_Write_Test", profile_timer), -1);
+ ACE_NEW_RETURN (test_vector[i],
+ Block_Read_Write_Test ("Block_Read_Write_Test",
+ profile_timer),
+ -1);
i++;
- ACE_NEW_RETURN (test_vector[i], Mmap1_Test ("Mmap1_Test", profile_timer), -1);
+ ACE_NEW_RETURN (test_vector[i],
+ Mmap1_Test ("Mmap1_Test",
+ profile_timer),
+ -1);
i++;
- ACE_NEW_RETURN (test_vector[i], Mmap2_Test ("Mmap2_Test", profile_timer), -1);
+ ACE_NEW_RETURN (test_vector[i],
+ Mmap2_Test ("Mmap2_Test",
+ profile_timer),
+ -1);
i++;
- ACE_NEW_RETURN (test_vector[i], Slow_Read_Write_Test ("Slow_Read_Write_Test", profile_timer), -1);
+ ACE_NEW_RETURN (test_vector[i],
+ Slow_Read_Write_Test ("Slow_Read_Write_Test",
+ profile_timer),
+ -1);
i++;
test_vector[i] = (IO_Test *) 0;
@@ -107,19 +123,26 @@ run_tests (int iterations, FILE *input_fp, FILE *output_fp)
for (i = 0; test_vector[i] != 0; i++)
{
if (ACE_OS::ftruncate (fileno (output_fp), 0) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%s\n", "ftruncate"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s\n",
+ "ftruncate"),
+ -1);
- ACE_DEBUG ((LM_DEBUG, "--------------------\n"
+ ACE_DEBUG ((LM_DEBUG,
+ "--------------------\n"
"starting %s for %d iterations(s):\n",
test_vector[i]->name (),
iterations));
- test_vector[i]->run_test (iterations, input_fp, output_fp);
+ test_vector[i]->run_test (iterations,
+ input_fp,
+ output_fp);
ACE_Profile_Timer::ACE_Elapsed_Time et;
profile_timer.elapsed_time (et);
- ACE_DEBUG ((LM_DEBUG, "wallclock time = %f, user time = %f, system time = %f\n",
+ ACE_DEBUG ((LM_DEBUG,
+ "wallclock time = %f, user time = %f, system time = %f\n",
et.real_time,
et.user_time,
et.system_time));
@@ -127,42 +150,54 @@ run_tests (int iterations, FILE *input_fp, FILE *output_fp)
delete test_vector[i];
}
- ACE_DEBUG ((LM_DEBUG, "--------------------\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "--------------------\n"));
return 0;
}
int
main (int argc, char *argv[])
{
-#if defined (ACE_WIN32)
- char delim = '\\';
-#else
- char delim = '/';
-#endif /* ACE_WIN32 */
- program_name = ACE::basename (argv[0], delim);
+ program_name = ACE::basename (argv[0],
+ ACE_DIRECTORY_SEPARATOR_CHAR);
parse_args (argc, argv);
ACE_Sig_Action sa ((ACE_SignalHandler) cleanup, SIGINT);
ACE_UNUSED_ARG (sa);
- FILE *input_fp = ACE_OS::fopen (input_filename, "r");
- FILE *output_fp = ACE_OS::fopen (output_filename, "w+");
+ FILE *input_fp =
+ ACE_OS::fopen (input_filename, "r");
+ FILE *output_fp =
+ ACE_OS::fopen (output_filename, "w+");
if (input_fp == 0)
- ACE_ERROR_RETURN ((LM_ERROR, "%s\n", "input_filename"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s\n",
+ "input_filename"),
+ -1);
if (output_fp == 0)
- ACE_ERROR_RETURN ((LM_ERROR, "%s\n", "output_filename"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s\n",
+ "output_filename"),
+ -1);
ACE_OS::unlink (output_filename);
- if (run_tests (iteration_count, input_fp, output_fp) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "run_tests"), -1);
+ if (run_tests (iteration_count,
+ input_fp,
+ output_fp) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "run_tests"),
+ -1);
if (ACE_OS::fclose (input_fp) == -1
|| ACE_OS::fclose (output_fp) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%s\n", "fclose"), -1);
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%s\n",
+ "fclose"),
+ -1);
cleanup ();
return 0;
}
diff --git a/examples/Naming/test_non_existent.cpp b/examples/Naming/test_non_existent.cpp
index c2ffb5cd0b6..f8785ad0f81 100644
--- a/examples/Naming/test_non_existent.cpp
+++ b/examples/Naming/test_non_existent.cpp
@@ -31,7 +31,7 @@ int main (int, char *[])
sizeof (m_argv) / sizeof (char *) -1;
name_options->parse_args (m_argc,
- m_argv);
+ (char **) m_argv);
i = ns_ptr->open (ACE_Naming_Context::NODE_LOCAL);
ACE_DEBUG ((LM_DEBUG,
diff --git a/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp b/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp
index f4f5430f925..b38824ed432 100644
--- a/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp
+++ b/examples/Service_Configurator/IPC-tests/client/local_dgram_client_test.cpp
@@ -14,13 +14,14 @@ ACE_RCSID(client, local_dgram_client_test, "$Id$")
static char *program_name;
// Name of rendezvous point.
-static char *rendezvous_codgram = "/tmp/foo_codgram";
-static char *rendezvous_dgram = "/tmp/foo_dgram";
+static const char *rendezvous_codgram = "/tmp/foo_codgram";
+static const char *rendezvous_dgram = "/tmp/foo_dgram";
// Name of file to send.
-static char *file_name = "local_data";
+static const char *file_name = "local_data";
-static void print_usage_and_die (void)
+static void
+print_usage_and_die (void)
{
ACE_ERROR ((LM_ERROR,
"usage: %s [-r rendezvous_dgram] [-c rendezvous_codgram] [-f file]\n%a",
diff --git a/examples/Service_Configurator/IPC-tests/client/local_fifo_client_test.cpp b/examples/Service_Configurator/IPC-tests/client/local_fifo_client_test.cpp
index d75ca07e5ed..b8a617d0108 100644
--- a/examples/Service_Configurator/IPC-tests/client/local_fifo_client_test.cpp
+++ b/examples/Service_Configurator/IPC-tests/client/local_fifo_client_test.cpp
@@ -15,15 +15,16 @@ static char *program_name;
// debug state on or off
static int debug = 0;
-char *rendezvous_fifo = "/tmp/foo_fifo";
+static const char *rendezvous_fifo = "/tmp/foo_fifo";
-/* Name of file to send. */
-static char *file_name = "./local_data";
+// Name of file to send.
+static const char *file_name = "./local_data";
static void
print_usage_and_die (void)
{
- ACE_ERROR ((LM_ERROR, "usage: %s [-d] [-f rendezvous_fifo]\n%a",
+ ACE_ERROR ((LM_ERROR,
+ "usage: %s [-d] [-f rendezvous_fifo]\n%a",
program_name, -1));
}
@@ -53,7 +54,8 @@ parse_arguments (int argc, char *argv[])
ACE_DEBUG ((LM_DEBUG,
"rendezvous_fifo = %s\n"
"trace = %s\n",
- rendezvous_fifo, tracing ? "on" : "off"));
+ rendezvous_fifo,
+ tracing ? "on" : "off"));
}
int
@@ -63,22 +65,32 @@ main(int argc, char *argv[])
ACE_FIFO_Send_Msg fifo;
- if (fifo.open ((const char *) rendezvous_fifo, O_WRONLY, 0666) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "Cannot open %s for requesting a new communication channel"
- "in local_fifo_client_test\n", rendezvous_fifo), -1);
-
-
+ if (fifo.open ((const char *) rendezvous_fifo,
+ O_WRONLY,
+ 0666) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open %s for requesting a new communication channel"
+ "in local_fifo_client_test\n",
+ rendezvous_fifo),
+ -1);
void *cp;
ACE_Mem_Map mmap (file_name);
if (mmap (cp) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "mmap"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "mmap"),
+ -1);
- /* Next, send the file's contents. */
+ // Next, send the file's contents.
- ACE_Str_Buf msg (cp, int (mmap.size ()));
+ ACE_Str_Buf msg (cp,
+ int (mmap.size ()));
if (fifo.send (msg) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "send"),
+ -1);
return 0;
}
diff --git a/examples/Service_Configurator/IPC-tests/client/local_pipe_client_test.cpp b/examples/Service_Configurator/IPC-tests/client/local_pipe_client_test.cpp
index aaa3cda4d38..92820417a4c 100644
--- a/examples/Service_Configurator/IPC-tests/client/local_pipe_client_test.cpp
+++ b/examples/Service_Configurator/IPC-tests/client/local_pipe_client_test.cpp
@@ -11,19 +11,20 @@
ACE_RCSID(client, local_pipe_client_test, "$Id$")
#if defined (ACE_HAS_MSG) && !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
-/* Name of the program. */
+// Name of the program.
static char *program_name;
-/* Name of rendezvous point. */
-static char *rendezvous = "/tmp/foo_pipe";
+// Name of rendezvous point.
+static const char *rendezvous = "/tmp/foo_pipe";
-/* Name of file to send. */
-static char *file_name = "local_data";
+// Name of file to send.
+static const char *file_name = "local_data";
static void
print_usage_and_die (void)
{
- ACE_ERROR ((LM_ERROR, "usage: %s [-r rendezvous] [-f file]\n%a",
+ ACE_ERROR ((LM_ERROR,
+ "usage: %s [-r rendezvous] [-f file]\n%a",
program_name, -1));
}
@@ -49,14 +50,13 @@ parse_args (int argc, char *argv[])
}
}
-int
+static int
do_client_processing (ACE_LSOCK_Stream &sc)
{
- int fd_read[2];
- int fd_write[2];
- char buf[BUFSIZ];
- int n;
- int fd1;
+ ACE_HANDLE fd_read[2];
+ ACE_HANDLE fd_write[2];
+ char buf[BUFSIZ];
+ int n;
if (ACE_OS::pipe (fd_read) == -1 || ACE_OS::pipe (fd_write) == -1)
return -1;
@@ -64,23 +64,37 @@ do_client_processing (ACE_LSOCK_Stream &sc)
if (sc.send_handle (fd_write[0]) == -1 || sc.send_handle (fd_read[1]) == -1)
return -1;
- /* Close off the ends we aren't interested in. */
+ // Close off the ends we aren't interested in.
if (ACE_OS::close (fd_read[1]) || ACE_OS::close (fd_write[0]) == -1)
return -1;
- /* Do a silly dup just for fun... */
+ // Do a silly dup just for fun...
+
+ ACE_HANDLE fd1 = ACE_OS::open (file_name, O_RDONLY);
- if ((fd1 = ACE_OS::open (file_name, O_RDONLY)) == -1)
+ if (fd1 == ACE_INVALID_HANDLE)
return -1;
while ((n = ACE_OS::read (fd1, buf, sizeof buf)) > 0)
{
- if (ACE_OS::write (fd_write[1], buf, n) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "write"), -1);
- if ((n = ACE_OS::read (fd_read[0], buf, sizeof buf)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "read"), -1);
- if (ACE_OS::write (ACE_STDOUT, buf, n) == -1)
+ if (ACE_OS::write (fd_write[1],
+ buf,
+ n) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "write"),
+ -1);
+ if ((n = ACE_OS::read (fd_read[0],
+ buf,
+ sizeof buf)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "read"),
+ -1);
+ if (ACE_OS::write (ACE_STDOUT,
+ buf,
+ n) == -1)
return -1;
}
@@ -100,24 +114,32 @@ main (int argc, char *argv[])
ACE_LSOCK_Stream sc;
ACE_LSOCK_Connector con;
- if (con.connect (sc, ACE_UNIX_Addr (rendezvous)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "connect"), -1);
+ if (con.connect (sc,
+ ACE_UNIX_Addr (rendezvous)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "connect"),
+ -1);
if (do_client_processing (sc) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "do_client_processing"), -1);
-
-#if defined (SunOS4)
- ACE_OS::sleep (1);
-#endif /* SunOS4 */
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "do_client_processing"),
+ -1);
if (sc.close () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close"), -1);
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "close"),
+ -1);
+
return 0;
}
#else
int main (int, char *[])
{
- ACE_ERROR_RETURN ((LM_ERROR, "your platform must support sendmsg/recvmsg to run this test\n"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "your platform must support sendmsg/recvmsg to run this test\n"),
+ -1);
}
#endif /* ACE_HAS_MSG */
diff --git a/examples/Service_Configurator/IPC-tests/client/local_spipe_client_test.cpp b/examples/Service_Configurator/IPC-tests/client/local_spipe_client_test.cpp
index c2ced0e670f..c751e12ea22 100644
--- a/examples/Service_Configurator/IPC-tests/client/local_spipe_client_test.cpp
+++ b/examples/Service_Configurator/IPC-tests/client/local_spipe_client_test.cpp
@@ -16,16 +16,18 @@ static char *program_name;
// debug state on or off
static int debug = 0;
-char *rendezvous_spipe = "/tmp/foo_spipe";
+static const char *rendezvous_spipe = "/tmp/foo_spipe";
-/* Name of file to send. */
-static char *file_name = "./local_data";
+// Name of file to send.
+static const char *file_name = "./local_data";
static void
print_usage_and_die (void)
{
- ACE_ERROR ((LM_ERROR, "usage: %s [-d] [-r rendezvous_spipe]\n%a",
- program_name, -1));
+ ACE_ERROR ((LM_ERROR,
+ "usage: %s [-d] [-r rendezvous_spipe]\n%a",
+ program_name,
+ -1));
}
static void
@@ -48,7 +50,8 @@ parse_arguments (int argc, char *argv[])
break;
}
if (debug)
- ACE_DEBUG ((LM_DEBUG, "rendezvous_spipe = %s\n",
+ ACE_DEBUG ((LM_DEBUG,
+ "rendezvous_spipe = %s\n",
rendezvous_spipe));
}
@@ -60,23 +63,32 @@ main(int argc, char *argv[])
ACE_SPIPE_Stream spipe;
ACE_SPIPE_Connector con;
- if (con.connect (spipe, ACE_SPIPE_Addr (rendezvous_spipe)) == -1)
+ if (con.connect (spipe,
+ ACE_SPIPE_Addr (rendezvous_spipe)) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open %s for requesting a new communication channel"
- " in local_spipe_client_test.\n", rendezvous_spipe), -1);
+ " in local_spipe_client_test.\n",
+ rendezvous_spipe),
+ -1);
ACE_Mem_Map mmap (file_name);
void *cp;
if (mmap (cp) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "mmap"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "mmap"),
+ -1);
- /* Next, send the file's contents. */
+ // Next, send the file's contents.
ACE_Str_Buf msg (cp, int (mmap.size ()));
if (spipe.send ((ACE_Str_Buf *) 0, &msg) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "send"),
+ -1);
return 0;
}
#else
@@ -84,6 +96,8 @@ main(int argc, char *argv[])
int
main (int, char *[])
{
- ACE_ERROR_RETURN ((LM_ERROR, "This feature is not supported\n"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "This feature is not supported\n"),
+ -1);
}
#endif /* ACE_HAS_STREAM_PIPES */
diff --git a/examples/Service_Configurator/IPC-tests/client/local_stream_client_test.cpp b/examples/Service_Configurator/IPC-tests/client/local_stream_client_test.cpp
index 80d4915741b..0c28532906f 100644
--- a/examples/Service_Configurator/IPC-tests/client/local_stream_client_test.cpp
+++ b/examples/Service_Configurator/IPC-tests/client/local_stream_client_test.cpp
@@ -9,20 +9,22 @@
ACE_RCSID(client, local_stream_client_test, "$Id$")
#if defined (ACE_HAS_MSG) && !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)
-/* Name of the program. */
+// Name of the program.
static char *program_name;
-/* Name of rendezvous point. */
-static char *rendezvous = "/tmp/foo_stream";
+// Name of rendezvous point.
+static const char *rendezvous = "/tmp/foo_stream";
-/* Name of file to send. */
-static char *file_name = "local_data";
+// Name of file to send.
+static const char *file_name = "local_data";
static void
print_usage_and_die (void)
{
- ACE_ERROR ((LM_ERROR, "usage: %s [-r rendezvous] [-f file]%a\n",
- program_name, -1));
+ ACE_ERROR ((LM_ERROR,
+ "usage: %s [-r rendezvous] [-f file]%a\n",
+ program_name,
+ -1));
}
void
@@ -58,30 +60,50 @@ main (int argc, char *argv[])
ACE_LSOCK_Stream sc;
ACE_LSOCK_Connector con;
- if (con.connect (sc, ACE_UNIX_Addr (rendezvous)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "connect"), -1);
+ if (con.connect (sc,
+ ACE_UNIX_Addr (rendezvous)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "connect"),
+ -1);
- if ((fd = ACE_OS::open (file_name, O_RDONLY)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
+ if ((fd = ACE_OS::open (file_name,
+ O_RDONLY)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "open"),
+ -1);
- /* Send the open file descriptor to the server! */
+ // Send the open file descriptor to the server!
if (sc.send_handle (fd) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send_handle"), -1);
-
- if ((n = sc.recv_n (buf, sizeof buf)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "recv"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "send_handle"),
+ -1);
+
+ if ((n = sc.recv_n (buf,
+ sizeof buf)) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "recv"),
+ -1);
else
ACE_OS::write (ACE_STDOUT, buf, n);
if (ACE_OS::close (fd) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "close"),
+ -1);
return 0;
}
#else
int main (int, char *[])
{
- ACE_ERROR_RETURN ((LM_ERROR, "your platform must support sendmsg/recvmsg to run this test\n"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "your platform must support sendmsg/recvmsg to run this test\n"),
+ -1);
}
#endif /* ACE_HAS_MSG */
diff --git a/examples/Service_Configurator/Misc/main.cpp b/examples/Service_Configurator/Misc/main.cpp
index 5025bc21271..2b54045056b 100644
--- a/examples/Service_Configurator/Misc/main.cpp
+++ b/examples/Service_Configurator/Misc/main.cpp
@@ -31,7 +31,7 @@ ACE_STATIC_SVC_REQUIRE (Timer_Service_1)
int
main (int, ASYS_TCHAR *argv[])
{
- ASYS_TCHAR *l_argv[9];
+ LPCTSTR l_argv[9];
// Manufacture a "fake" svc.conf entry to demonstrate the -S option
// that allows us to pass these entries via the "command-line"
@@ -47,7 +47,9 @@ main (int, ASYS_TCHAR *argv[])
l_argv[7] = ASYS_TEXT ("-fsvc.conf");
l_argv[8] = 0;
- if (ACE_Service_Config::open (8, l_argv, ACE_DEFAULT_LOGGER_KEY, 0) == -1 && errno != ENOENT)
+ if (ACE_Service_Config::open (8,
+ (ASYS_TCHAR *[]) l_argv,
+ ACE_DEFAULT_LOGGER_KEY, 0) == -1 && errno != ENOENT)
ACE_ERROR_RETURN ((LM_ERROR,
ASYS_TEXT ("%p\n"),
ASYS_TEXT ("open")),
diff --git a/examples/Shared_Malloc/test_malloc.cpp b/examples/Shared_Malloc/test_malloc.cpp
index cc200d6f2f7..29fbf609cc9 100644
--- a/examples/Shared_Malloc/test_malloc.cpp
+++ b/examples/Shared_Malloc/test_malloc.cpp
@@ -116,13 +116,14 @@ spawn (void)
ACE_OS::sprintf (msg_size,
"%d",
Options::instance ()->max_msg_size ());
- char* cp = 0;
+ const char *cp = 0;
+
if (Options::instance ()->debug ())
cp = "-d";
else
cp = "";
- char *argv[] =
+ const char *argv[] =
{
(char *) Options::instance ()->slave_name (),
"-p",
diff --git a/examples/Shared_Malloc/test_persistence.cpp b/examples/Shared_Malloc/test_persistence.cpp
index f9176a18a59..19117721f89 100644
--- a/examples/Shared_Malloc/test_persistence.cpp
+++ b/examples/Shared_Malloc/test_persistence.cpp
@@ -14,7 +14,7 @@ typedef ACE_Malloc_Iterator <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> MALLOC_ITERAT
static MALLOC *shmem_manager = 0;
// Backing store name.
-static char *backing_store = ACE_DEFAULT_BACKING_STORE;
+static const char *backing_store = ACE_DEFAULT_BACKING_STORE;
class Employee
{
diff --git a/examples/System_V_IPC/SV_Message_Queues/test.h b/examples/System_V_IPC/SV_Message_Queues/test.h
index e88e567fa40..b3da2877bc7 100644
--- a/examples/System_V_IPC/SV_Message_Queues/test.h
+++ b/examples/System_V_IPC/SV_Message_Queues/test.h
@@ -16,7 +16,9 @@
class Message_Data
{
public:
- Message_Data (long p = -1, const char user[] = "", char text[] = ""): pid_ (p)
+ Message_Data (long p = -1,
+ const char user[] = "",
+ const char text[] = ""): pid_ (p)
{
::strncpy (this->username_, user, 9);
::strncpy (this->mtext_, text, MSGSZ);
@@ -47,8 +49,8 @@ class Message_Block : public ACE_SV_Message, public Message_Data
public:
Message_Block (long t,
long p = 0,
- char login[] = "",
- char message[] = "")
+ const char login[] = "",
+ const char message[] = "")
: ACE_SV_Message (t),
Message_Data (p, login, message)
{}
diff --git a/performance-tests/Misc/childbirth_time.cpp b/performance-tests/Misc/childbirth_time.cpp
index d0bd956a03c..69a93da21b7 100644
--- a/performance-tests/Misc/childbirth_time.cpp
+++ b/performance-tests/Misc/childbirth_time.cpp
@@ -339,7 +339,7 @@ main (int argc, char* argv[])
int c;
size_t iteration = 10;
Profiler profiler = 0;
- char *profile_name = 0 ;
+ const char *profile_name = 0 ;
while ((c=get_opt ()) != -1)
{