diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-06-07 04:13:44 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-06-07 04:13:44 +0000 |
commit | bd3a5e20e335a01ed66170dd2d1e67090a288839 (patch) | |
tree | 5859974b2c581e814c037d0022b9fa92a2f44729 | |
parent | 88130ddce8e30f654772c3a53c45ee065aaf4766 (diff) | |
download | ATCD-bd3a5e20e335a01ed66170dd2d1e67090a288839.tar.gz |
.
38 files changed, 607 insertions, 319 deletions
diff --git a/ACE-INSTALL.html b/ACE-INSTALL.html index ddbcacba382..63515630fb2 100644 --- a/ACE-INSTALL.html +++ b/ACE-INSTALL.html @@ -315,7 +315,7 @@ make: *** [libACE.so] Error 8 Arturo Montes <<A HREF="mailto:mitosys@colomsat.net.co">mitosys@colomsat.net.co</A>> maintains this code. In addition, he also maintains a version of <A - HREF="FSU-threads.ps.gz">FSU + HREF="FSU-threads.tar.gz">FSU pthreads</A>.<P> <LI><B>SGI IRIX 5.x and 6.x</B><P> diff --git a/ChangeLog-99b b/ChangeLog-99b index 3dac980db3f..fc0239c53a7 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -1,5 +1,13 @@ Sun Jun 6 22:02:43 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + * Fixed gazillions of incorrect usages of char * (which should + have been const char *) throughout ACE. + + * netsvcs/clients/Tokens: Fixed some const char * inconsistencies. + + * netsvcs/lib/Name_Handler.h: Fixed another inconsistent use of + char * that should have been const char *. + * ace/Service_Config.h: Fixed a const incorrectness in the ACE_Static_Svc_Descriptor. diff --git a/TAO/docs/configurations.html b/TAO/docs/configurations.html index 906c67cfb92..fda6c729f33 100644 --- a/TAO/docs/configurations.html +++ b/TAO/docs/configurations.html @@ -25,7 +25,7 @@ href="http://www.cs.wustl.edu/~schmidt/CACM-arch.ps.gz">concurrency model</a>. </p> <p> TAO configures itself using the <a -href="http://www.cs.wustl.edu/~schmidt/O-Service-Configurator.ps.gz">ACE +href="http://www.cs.wustl.edu/~schmidt/Svc-Conf.ps.gz">ACE Service Configurator</a> framework. Thus, options are specified in the familiar <tt>svc.conf</tt> file (if you want to use a different file name, use the <tt><a href="Options.html#svcfonf">-ORBsvcconf</a></tt> @@ -3666,7 +3666,7 @@ extern "C" int t_close(int fildes); int t_connect(int fildes, struct t_call *sndcall, struct t_call *rcvcall); - void t_error(char *errmsg); + void t_error(const char *errmsg); int t_free(char *ptr, int struct_type); int t_getinfo(int fildes, struct t_info *info); int t_getname (int fildes, struct netbuf *namep, int type); @@ -6544,7 +6544,7 @@ ACE_OS::t_connect(int fildes, } ACE_INLINE void -ACE_OS::t_error (char *errmsg) +ACE_OS::t_error (const char *errmsg) { ACE_TRACE ("ACE_OS::t_error"); #if defined (ACE_HAS_TLI) diff --git a/apps/Gateway/Peer/Options.h b/apps/Gateway/Peer/Options.h index dc3daf5ce4b..c0136ce78ae 100644 --- a/apps/Gateway/Peer/Options.h +++ b/apps/Gateway/Peer/Options.h @@ -117,7 +117,7 @@ private: // The connector port number, i.e., the one that we use to actively // establish connections with a gatewayd and create a Consumer. - char *connector_host_; + const char *connector_host_; // Our connector host, i.e., where the gatewayd process is running. long timeout_; diff --git a/apps/gperf/src/Gen_Perf.cpp b/apps/gperf/src/Gen_Perf.cpp index 584e1274954..b237d626fa5 100644 --- a/apps/gperf/src/Gen_Perf.cpp +++ b/apps/gperf/src/Gen_Perf.cpp @@ -30,7 +30,7 @@ ACE_RCSID(src, Gen_Perf, "$Id$") #include "Vectors.h" // Current release version. -extern char *version_string; +extern const char *version_string; // Reads input keys, possibly applies the reordering heuristic, sets // the maximum associated value size (rounded up to the nearest power diff --git a/apps/gperf/src/Options.cpp b/apps/gperf/src/Options.cpp index 0e5e2ad0b50..27c75b9f6be 100644 --- a/apps/gperf/src/Options.cpp +++ b/apps/gperf/src/Options.cpp @@ -36,7 +36,7 @@ ACE_RCSID(src, Options, "$Id$") Options option; // Current program version. -extern char *version_string; +extern const char *version_string; // Size to jump on a collision. static const int DEFAULT_JUMP_VALUE = 5; diff --git a/apps/gperf/src/Version.cpp b/apps/gperf/src/Version.cpp index 1ed8b33e1ac..d2967050e43 100644 --- a/apps/gperf/src/Version.cpp +++ b/apps/gperf/src/Version.cpp @@ -27,4 +27,4 @@ ACE_RCSID(src, Version, "$Id$") -char *version_string = "2.8 (ACE version)"; +const char *version_string = "2.8 (ACE version)"; diff --git a/docs/tutorials/guide-tutorials.html b/docs/tutorials/guide-tutorials.html index fdb3083cb66..184bbb27e3d 100644 --- a/docs/tutorials/guide-tutorials.html +++ b/docs/tutorials/guide-tutorials.html @@ -9,7 +9,7 @@ <H3>Online Examples from the ACE Programmers Guide</H3> The following page has links to the example code that is presented in -the <A HREF="http://www.cs.wustl.edu/~schmidt/ACE-tutorials.ps.gz">ACE +the <A HREF="http://www.cs.wustl.edu/~schmidt/ACE-tutorial.ps.gz">ACE programmers guide</a>. The guide was created at <A HREF="http://www.hns.com">Hughes Network Systems</A>. Questions regarding the guide should be sent to <A diff --git a/examples/ASX/UPIPE_Event_Server/Options.h b/examples/ASX/UPIPE_Event_Server/Options.h index e82729d965a..3badf1e9daf 100644 --- a/examples/ASX/UPIPE_Event_Server/Options.h +++ b/examples/ASX/UPIPE_Event_Server/Options.h @@ -47,17 +47,17 @@ public: void t_flags (long flag); long t_flags (void); - void supplier_port (char *port); - char *supplier_port (void); + void supplier_port (const char *port); + const char *supplier_port (void); - void consumer_port (char *port); - char *consumer_port (void); + void consumer_port (const char *port); + const char *consumer_port (void); - void supplier_file (char *file); - char *supplier_file (void); + void supplier_file (const char *file); + const char *supplier_file (void); - void consumer_file (char *file); - char *consumer_file (void); + void consumer_file (const char *file); + const char *consumer_file (void); int debug (void); int verbose (void); @@ -75,10 +75,10 @@ private: size_t iterations_; // Number of iterations to run the test program. int debugging_; // Extra debugging info. int verbosity_; // Extra verbose messages. - char *consumer_port_; // Port that the Consumer_Router is using. - char *supplier_port_; // Port that the Supplier_Router is using. - char *consumer_file_; // file that the Consumer_Router is using. - char *supplier_file_; // file that the Supplier_Router is using. + const char *consumer_port_; // Port that the Consumer_Router is using. + const char *supplier_port_; // Port that the Supplier_Router is using. + const char *consumer_file_; // file that the Consumer_Router is using. + const char *supplier_file_; // file that the Supplier_Router is using. }; extern Options options; diff --git a/examples/ASX/UPIPE_Event_Server/Options.i b/examples/ASX/UPIPE_Event_Server/Options.i index 4641b301473..2f9944ea4aa 100644 --- a/examples/ASX/UPIPE_Event_Server/Options.i +++ b/examples/ASX/UPIPE_Event_Server/Options.i @@ -4,48 +4,48 @@ // Option manager for ustreams. inline void -Options::supplier_port (char *port) +Options::supplier_port (const char *port) { this->supplier_port_ = port; } -inline char * +inline const char * Options::supplier_port (void) { return this->supplier_port_; } inline void -Options::supplier_file (char *file) +Options::supplier_file (const char *file) { this->supplier_file_ = file; } -inline char * +inline const char * Options::supplier_file (void) { return this->supplier_file_; } inline void -Options::consumer_file (char *file) +Options::consumer_file (const char *file) { this->consumer_file_ = file; } -inline char * +inline const char * Options::consumer_file (void) { return this->consumer_file_; } inline void -Options::consumer_port (char *port) +Options::consumer_port (const char *port) { this->consumer_port_ = port; } -inline char * +inline const char * Options::consumer_port (void) { return this->consumer_port_; diff --git a/examples/IPC_SAP/SPIPE_SAP/NPClient.cpp b/examples/IPC_SAP/SPIPE_SAP/NPClient.cpp index e0e76d4a4c9..036d30aeb20 100644 --- a/examples/IPC_SAP/SPIPE_SAP/NPClient.cpp +++ b/examples/IPC_SAP/SPIPE_SAP/NPClient.cpp @@ -19,10 +19,13 @@ main (int argc, char *argv[]) { int size = argc > 1 ? atoi (argv[1]) : DEFAULT_SIZE; int iterations = argc > 2 ? atoi (argv[2]) : DEFAULT_COUNT; - char *buf = new char[size]; + char *buf; - //char *pipe_name = ACE_DEFAULT_RENDEZVOUS; - char *pipe_name = "acepipe"; + ACE_NEW_RETURN (buf, + new char[size], + 1); + + const char *pipe_name = "acepipe"; char *rendezvous; rendezvous = MAKE_PIPE_NAME (pipe_name); @@ -30,18 +33,27 @@ main (int argc, char *argv[]) ACE_SPIPE_Connector con; int i; - if (con.connect (cli_stream, ACE_SPIPE_Addr (rendezvous)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", rendezvous), -1); + if (con.connect (cli_stream, + ACE_SPIPE_Addr (rendezvous)) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + rendezvous), + -1); ACE_OS::strcpy (buf, "hello"); size = ACE_OS::strlen (buf) + 1; for (i = 0; i < iterations; i++) if (cli_stream.send (buf, size) != size) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "putmsg"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "putmsg"), + -1); if (cli_stream.close () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close"), -1); - + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "close"), + -1); return 0; } diff --git a/examples/IPC_SAP/SPIPE_SAP/NPServer.cpp b/examples/IPC_SAP/SPIPE_SAP/NPServer.cpp index 5d860ffa226..b1decbc976f 100644 --- a/examples/IPC_SAP/SPIPE_SAP/NPServer.cpp +++ b/examples/IPC_SAP/SPIPE_SAP/NPServer.cpp @@ -15,40 +15,54 @@ int main (int /* argc */, char * /* argv */ []) { ACE_SPIPE_Acceptor acceptor; - ACE_SPIPE_Stream new_stream; + ACE_SPIPE_Stream new_stream; char buf[BUFSIZ]; int n; - // char *pipe_name = ACE_DEFAULT_RENDEZVOUS; - char *pipe_name = "acepipe"; + const char *pipe_name = "acepipe"; char *rendezvous; rendezvous = MAKE_PIPE_NAME (pipe_name); - /* Initialize named pipe listener */ + // Initialize named pipe listener. if (acceptor.open (ACE_SPIPE_Addr (rendezvous)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), 1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + + "open"), 1); for (;;) { - ACE_DEBUG ((LM_DEBUG, "waiting for connection\n")); + ACE_DEBUG ((LM_DEBUG, + "waiting for connection\n")); - /* Accept a client connection */ + // Accept a client connection. if (acceptor.accept (new_stream, 0) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "accept"), 1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "accept"), + 1); - ACE_DEBUG ((LM_DEBUG, "Accepted connection\n")); + ACE_DEBUG ((LM_DEBUG, + "Accepted connection\n")); while ((n = new_stream.recv (buf, sizeof buf)) > 0) { - ACE_OS::fprintf (stderr, "%s\n", buf); - ACE_OS::write (ACE_STDOUT, buf, n); + ACE_OS::fprintf (stderr, + "%s\n", + buf); + ACE_OS::write (ACE_STDOUT, + buf, + n); } + if (n == -1) { - ACE_DEBUG ((LM_DEBUG, "End of connection. Closing handle\n")); + ACE_DEBUG ((LM_DEBUG, + "End of connection. Closing handle\n")); new_stream.close (); } } + ACE_NOTREACHED(return 0); } diff --git a/examples/Log_Msg/test_log_msg.cpp b/examples/Log_Msg/test_log_msg.cpp index 815afa29cdf..09f0e913a63 100644 --- a/examples/Log_Msg/test_log_msg.cpp +++ b/examples/Log_Msg/test_log_msg.cpp @@ -13,11 +13,10 @@ // several use cases. // // = AUTHOR -// Douglas Schmidt +// Douglas Schmidt <schmidt@cs.wustl.edu> // // ============================================================================ - #include "ace/OS.h" #include "ace/streams.h" @@ -26,14 +25,16 @@ ACE_RCSID(Log_Msg, test_log_msg, "$Id$") static void cleanup (void) { - ACE_DEBUG ((LM_INFO, "leaving (%P)!\n")); + ACE_DEBUG ((LM_INFO, + "leaving (%P)!\n")); } static void cause_error (void) { errno = EWOULDBLOCK; - ACE_ERROR ((LM_DEBUG, "would block\n")); + ACE_ERROR ((LM_DEBUG, + "would block\n")); } int @@ -45,94 +46,143 @@ main (int argc, char *argv[]) if (argc > 1) { - if (ACE_LOG_MSG->open (argv[0], ACE_Log_Msg::OSTREAM) == -1) - ACE_ERROR ((LM_ERROR, "cannot open logger!!!\n")); + if (ACE_LOG_MSG->open (argv[0], + ACE_Log_Msg::OSTREAM) == -1) + ACE_ERROR ((LM_ERROR, + "cannot open logger!!!\n")); cause_error (); // Check to see what happened. if (ACE_LOG_MSG->op_status () == -1 && ACE_LOG_MSG->errnum () == EWOULDBLOCK) - ACE_DEBUG ((LM_DEBUG, "op_status and errnum work!\n")); + ACE_DEBUG ((LM_DEBUG, + "op_status and errnum work!\n")); else - ACE_ERROR ((LM_ERROR, "op_status and errnum failed!\n")); + ACE_ERROR ((LM_ERROR, + "op_status and errnum failed!\n")); } else { if (ACE_LOG_MSG->open (argv[0]) == -1) - ACE_ERROR ((LM_ERROR, "cannot open logger!!!\n")); + ACE_ERROR ((LM_ERROR, + "cannot open logger!!!\n")); cause_error (); // Check to see what happened. if (ACE_LOG_MSG->op_status () == -1 && ACE_LOG_MSG->errnum () == EWOULDBLOCK) - ACE_DEBUG ((LM_DEBUG, "op_status and errnum work!\n")); + ACE_DEBUG ((LM_DEBUG, + "op_status and errnum work!\n")); else - ACE_ERROR ((LM_ERROR, "op_status and errnum failed!\n")); + ACE_ERROR ((LM_ERROR, + "op_status and errnum failed!\n")); // Exercise many different combinations of STDERR and OSTREAM. - ACE_DEBUG ((LM_INFO, "%10f, %*s%s = %d\n", - 3.1416 * counter++, 8, "", "hello", 10000)); + ACE_DEBUG ((LM_INFO, + "%10f, %*s%s = %d\n", + 3.1416 * counter++, + 8, + "", + "hello", + 10000)); ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM); ACE_LOG_MSG->msg_ostream (&cout); - ACE_DEBUG ((LM_INFO, "%10f, %*s%s = %d\n", - 3.1416 * counter, 8, "", "world", 10000 * counter++)); + ACE_DEBUG ((LM_INFO, + "%10f, %*s%s = %d\n", + 3.1416 * counter, + 8, + "", + "world", + 10000 * counter++)); ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR); - ACE_DEBUG ((LM_INFO, "%10f, %*s%s = %d\n", - 3.1416 * counter, 8, "", "world", 10000 * counter++)); + ACE_DEBUG ((LM_INFO, + "%10f, %*s%s = %d\n", + 3.1416 * counter, + 8, + "", + "world", + 10000 * counter++)); ACE_LOG_MSG->msg_ostream (0); ACE_LOG_MSG->set_flags (ACE_Log_Msg::STDERR); - ACE_DEBUG ((LM_INFO, "%10f, %*s%s = %d\n", - 3.1416 * counter, 8, "", "world", 10000 * counter++)); + ACE_DEBUG ((LM_INFO, + "%10f, %*s%s = %d\n", + 3.1416 * counter, + 8, + "", + "world", + 10000 * counter++)); ACE_LOG_MSG->clr_flags (ACE_Log_Msg::OSTREAM); ACE_LOG_MSG->msg_ostream (&cerr); - ACE_DEBUG ((LM_INFO, "%10f, %*s%s = %d\n", - 3.1416 * counter, 8, "", "world", 10000 * counter++)); + ACE_DEBUG ((LM_INFO, + "%10f, %*s%s = %d\n", + 3.1416 * counter, + 8, + "", + "world", + 10000 * counter++)); static int array[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048}; // Print out the binary bytes of the array in hex form. - ACE_LOG_MSG->log_hexdump (LM_DEBUG, (char *) array, sizeof array); + ACE_LOG_MSG->log_hexdump (LM_DEBUG, + (char *) array, + sizeof array); // Disable the LM_DEBUG and LM_INFO messages. int priority_mask = ACE_LOG_MSG->priority_mask (); - ACE_CLR_BITS (priority_mask, LM_DEBUG | LM_INFO); + ACE_CLR_BITS (priority_mask, + LM_DEBUG | LM_INFO); ACE_LOG_MSG->priority_mask (priority_mask); - ACE_DEBUG ((LM_INFO, "This LM_INFO message should not print!\n")); - ACE_DEBUG ((LM_DEBUG, "This LM_DEBUG message should not print!\n")); + ACE_DEBUG ((LM_INFO, + "This LM_INFO message should not print!\n")); + ACE_DEBUG ((LM_DEBUG, + "This LM_DEBUG message should not print!\n")); - ACE_SET_BITS (priority_mask, LM_INFO); - ACE_LOG_MSG->priority_mask (priority_mask, ACE_Log_Msg::PROCESS); + ACE_SET_BITS (priority_mask, + LM_INFO); + ACE_LOG_MSG->priority_mask (priority_mask, + ACE_Log_Msg::PROCESS); - ACE_DEBUG ((LM_INFO, "This LM_INFO message should print!\n")); - ACE_DEBUG ((LM_DEBUG, "This LM_DEBUG message should not print!\n")); + ACE_DEBUG ((LM_INFO, + "This LM_INFO message should print!\n")); + ACE_DEBUG ((LM_DEBUG, + "This LM_DEBUG message should not print!\n")); ACE_CLR_BITS (priority_mask, LM_INFO); - ACE_LOG_MSG->priority_mask (priority_mask, ACE_Log_Msg::PROCESS); - - ACE_DEBUG ((LM_INFO, "This LM_INFO message should not print!\n")); - ACE_DEBUG ((LM_DEBUG, "This LM_DEBUG message should not print!\n")); + ACE_LOG_MSG->priority_mask (priority_mask, + ACE_Log_Msg::PROCESS); + + ACE_DEBUG ((LM_INFO, + "This LM_INFO message should not print!\n")); + ACE_DEBUG ((LM_DEBUG, + "This LM_DEBUG message should not print!\n")); - char *badname = "badname"; + const char badname[] = "badname"; char *l_argv[2]; l_argv[0] = badname; l_argv[1] = 0; - if (ACE_OS::execv (badname, l_argv) == -1) - ACE_ERROR ((LM_ERROR, "%n: (%x), %p%r%a\n", - 10000, badname, cleanup, 1)); + if (ACE_OS::execv (badname, + l_argv) == -1) + ACE_ERROR ((LM_ERROR, + "%n: (%x), %p%r%a\n", + 10000, + badname, + cleanup, + 1)); } return 0; } diff --git a/examples/Naming/test_multiple_contexts.cpp b/examples/Naming/test_multiple_contexts.cpp index 5bd6e2cc383..828cea2c030 100644 --- a/examples/Naming/test_multiple_contexts.cpp +++ b/examples/Naming/test_multiple_contexts.cpp @@ -6,44 +6,71 @@ ACE_RCSID(Naming, test_multiple_contexts, "$Id$") int main (int, char *[]) { - static u_long ACE_DEFAULT_BASE_ADDR_1 = (1 * 64 * 1024 * 1024); static u_long ACE_DEFAULT_BASE_ADDR_2 = (2 * 64 * 1024 * 1024); int i; - ACE_Naming_Context * ns_ptr = new ACE_Naming_Context (); - ACE_Name_Options *name_options = ns_ptr->name_options (); + ACE_Naming_Context *ns_ptr; + ACE_NEW_RETURN (ns_ptr, + ACE_Naming_Context, + 1); + ACE_Name_Options *name_options = + ns_ptr->name_options (); - ACE_Naming_Context * ns_ptr1 = new ACE_Naming_Context (); - ACE_Name_Options *name_options1 = ns_ptr1->name_options (); + ACE_Naming_Context *ns_ptr1; + ACE_NEW_RETURN (ns_ptr1, + ACE_Naming_Context, + 1); + ACE_Name_Options *name_options1 = + ns_ptr1->name_options (); char address_arg1[BUFSIZ]; char address_arg2[BUFSIZ]; - ACE_OS::sprintf (address_arg1, "-b%d", ACE_DEFAULT_BASE_ADDR_1); + ACE_OS::sprintf (address_arg1, + "-b%d", + ACE_DEFAULT_BASE_ADDR_1); + + const char *m_argv[] = + { + "MyName1", + "-cNODE_LOCAL", + address_arg1, + NULL + }; + int m_argc = + sizeof (m_argv) / sizeof (char *) -1; - char * m_argv[] = {"MyName1", - "-cNODE_LOCAL", - address_arg1, - NULL}; - int m_argc = sizeof (m_argv) / sizeof (char *) -1; + ACE_OS::sprintf (address_arg2, + "-b%d", + ACE_DEFAULT_BASE_ADDR_2); + const char *n_argv[] = + { + "MyName2", + "-cNODE_LOCAL", + address_arg2, + NULL + }; - ACE_OS::sprintf (address_arg2, "-b%d", ACE_DEFAULT_BASE_ADDR_2); - char * n_argv[] = {"MyName2", - "-cNODE_LOCAL", - address_arg2, - NULL}; - int n_argc = sizeof (n_argv) / sizeof (char *) -1; + int n_argc = + sizeof (n_argv) / sizeof (char *) -1; name_options->parse_args (m_argc, m_argv); i = ns_ptr->open (ACE_Naming_Context::NODE_LOCAL); - ACE_DEBUG ((LM_DEBUG, "(%P) opened with %d\n", i)); - if (i != 0) return -1; + + ACE_DEBUG ((LM_DEBUG, + "(%P) opened with %d\n", + i)); + + if (i != 0) + return -1; name_options1->parse_args (n_argc, n_argv); i = ns_ptr1->open (ACE_Naming_Context::NODE_LOCAL); - ACE_DEBUG ((LM_DEBUG, "(%P) 1 opened with %d\n", i)); - if (i != 0) return -1; + ACE_DEBUG ((LM_DEBUG, + "(%P) 1 opened with %d\n", i)); + if (i != 0) + return -1; return 0; } diff --git a/examples/Naming/test_non_existent.cpp b/examples/Naming/test_non_existent.cpp index 17c035237af..c2ffb5cd0b6 100644 --- a/examples/Naming/test_non_existent.cpp +++ b/examples/Naming/test_non_existent.cpp @@ -8,29 +8,44 @@ int main (int, char *[]) { int i; - ACE_Naming_Context * ns_ptr = new ACE_Naming_Context (); + ACE_Naming_Context *ns_ptr; + ACE_NEW_RETURN (ns_ptr, + ACE_Naming_Context, + 1); + ACE_Name_Options *name_options = ns_ptr->name_options (); + const char *m_argv[] = + { + "MyName", + "-cNODE_LOCAL" , #if defined (ACE_WIN32) - char * m_argv[] = {"MyName", - "-cNODE_LOCAL" , - "-lC:\\temp\\non_existent", - NULL}; + "-lC:\\temp\\non_existent", #else - char * m_argv[] = {"MyName", - "-cNODE_LOCAL" , - "-l/tmp/foobar.mine", - NULL}; -#endif - int m_argc = sizeof (m_argv) / sizeof (char *) -1; - - name_options->parse_args (m_argc,m_argv); - i = ns_ptr->open (ACE_Naming_Context::NODE_LOCAL); - ACE_DEBUG ((LM_DEBUG, "(%P) opened with %d\n", i)); - if (i != 0) return -1; + "-l/tmp/foobar.mine", +#endif /* ACE_WIN32 */ + NULL + }; - i = ns_ptr->bind ("Key_Value","Val_Value","-"); - ACE_DEBUG ((LM_DEBUG, "(%P) bound with %d\n", i)); + int m_argc = + sizeof (m_argv) / sizeof (char *) -1; + name_options->parse_args (m_argc, + m_argv); + + i = ns_ptr->open (ACE_Naming_Context::NODE_LOCAL); + ACE_DEBUG ((LM_DEBUG, + "(%P) opened with %d\n", + i)); + if (i != 0) + return -1; + + i = ns_ptr->bind ("Key_Value", + "Val_Value", + "-"); + + ACE_DEBUG ((LM_DEBUG, + "(%P) bound with %d\n", + i)); return 0; } diff --git a/examples/Naming/test_open.cpp b/examples/Naming/test_open.cpp index ca64a01ddda..adcc1fb0962 100644 --- a/examples/Naming/test_open.cpp +++ b/examples/Naming/test_open.cpp @@ -7,49 +7,69 @@ ACE_RCSID(Naming, test_open, "$Id$") int main (int argc, char **argv) { - char *host = argc > 1 ? argv[1] : "-hlocalhost"; - char *port = argc > 2 ? argv[2] : "-p20012"; + const char *host = argc > 1 ? argv[1] : "-hlocalhost"; + const char *port = argc > 2 ? argv[2] : "-p20012"; ACE_Naming_Context ns; ACE_Name_Options *name_options = ns.name_options (); - char * m_argv[] = { "MyName", - "-cNET_LOCAL", - host, - port, - NULL }; - int m_argc = sizeof ( m_argv ) / sizeof ( char * ) -1; - - name_options->parse_args( m_argc, m_argv ); - - int result = 0; - result = ns.open ( ACE_Naming_Context::NET_LOCAL ); - ACE_DEBUG ((LM_DEBUG, "ACE_Naming_Context::open returned %d\n", result)); + const char *m_argv[] = + { + "MyName", + "-cNET_LOCAL", + host, + port, + NULL + }; + int m_argc = + sizeof (m_argv) / sizeof (char *) -1; + + name_options->parse_args (m_argc, m_argv); + + int result = ns.open (ACE_Naming_Context::NET_LOCAL); + ACE_DEBUG ((LM_DEBUG, + "ACE_Naming_Context::open returned %d\n", + result)); if (result != 0) return result; else { - char Key[128]; - char Val[32]; - char Type[2]; + char key[128]; + char val[32]; + char type[2]; - Type[0] = '-'; - Type[1] = '\0'; + type[0] = '-'; + type[1] = '\0'; int i = 0; + for (int l = 1; l <= 1000 ; l++) { - ACE_OS::sprintf (Key, "K_%05d_%05d", ACE_OS::getpid(), l); - ACE_OS::sprintf (Val, "Val%05d", l); - i = ns.bind (Key, Val, Type); - cout << ACE_OS::getpid() << ": bind of " << Key << " :" << i << endl; - if (i != 0) { + ACE_OS::sprintf (key, + "K_%05d_%05d", + ACE_OS::getpid (), + l); + ACE_OS::sprintf (val, + "Val%05d", + l); + i = ns.bind (key, + val, + type); + ACE_DEBUG ((LM_DEBUG, + "%d: bind of %s: %d\n", + ACE_OS::getpid (), + key, + i)); + + if (i != 0) return -1; - } + } result = ns.close (); - ACE_DEBUG ((LM_DEBUG, "ACE_Naming_Context::close returned %d\n", result)); + ACE_DEBUG ((LM_DEBUG, + "ACE_Naming_Context::close returned %d\n", + result)); } return result; diff --git a/examples/Naming/test_writers.cpp b/examples/Naming/test_writers.cpp index bfd8eb85e8f..1a23d2e91f8 100644 --- a/examples/Naming/test_writers.cpp +++ b/examples/Naming/test_writers.cpp @@ -8,36 +8,63 @@ int main (int, char *[]) { int i; - ACE_Naming_Context * ns_ptr = new ACE_Naming_Context (); - ACE_Name_Options *name_options = ns_ptr->name_options (); + ACE_Naming_Context *ns_ptr; + ACE_NEW_RETURN (ns_ptr, + ACE_Naming_Context, + 1); + ACE_Name_Options *name_options = + ns_ptr->name_options (); - char * m_argv[] = {"MyName", - "-cNODE_LOCAL", - NULL}; + const char *m_argv[] = + { + "MyName", + "-cNODE_LOCAL", + NULL + }; int m_argc = sizeof (m_argv) / sizeof (char *) -1; name_options->parse_args (m_argc,m_argv); i = ns_ptr->open (ACE_Naming_Context::NODE_LOCAL); - ACE_DEBUG ((LM_DEBUG, "(%P) opened with %d\n", i)); - if (i != 0) return -1; - - char Key[128]; - char Val[32]; - char Type[2]; - - Type[0] = '-'; - Type[1] = '\0'; - - for (int l = 1; l <= 1000 ; l++) { - ACE_OS::sprintf (Key, "K_%05d_%05d", ACE_OS::getpid(), l); - ACE_OS::sprintf (Val, "Val%05d", l); - i = ns_ptr->bind (Key, Val, Type); - ACE_DEBUG ((LM_DEBUG, "(%P) bind of %s: %d\n", Key, i)); - if (i != 0) { - return -1; - } - } + ACE_DEBUG ((LM_DEBUG, + "(%P) opened with %d\n", + i)); + if (i != 0) + return -1; + else + { + char key[128]; + char val[32]; + char type[2]; + + type[0] = '-'; + type[1] = '\0'; + + int i = 0; + + for (int l = 1; l <= 1000 ; l++) + { + ACE_OS::sprintf (key, + "K_%05d_%05d", + ACE_OS::getpid (), + l); + ACE_OS::sprintf (val, + "Val%05d", + l); + i = ns.bind (key, + val, + type); + ACE_DEBUG ((LM_DEBUG, + "%d: bind of %s: %d\n", + ACE_OS::getpid (), + key, + i)); + + if (i != 0) + return -1; + + } + } return 0; } diff --git a/examples/Reactor/Misc/test_signals_2.cpp b/examples/Reactor/Misc/test_signals_2.cpp index f25c329bfe8..0378aea8b20 100644 --- a/examples/Reactor/Misc/test_signals_2.cpp +++ b/examples/Reactor/Misc/test_signals_2.cpp @@ -106,7 +106,7 @@ ACE_RCSID(Misc, test_signals_2, "$Id$") class Sig_Handler_1 : public ACE_Event_Handler { public: - Sig_Handler_1 (ACE_Reactor &reactor, char *msg) + Sig_Handler_1 (ACE_Reactor &reactor, const char *msg) : msg_ (msg), count_ (0), reactor_ (reactor) @@ -174,7 +174,7 @@ public: } protected: - char *msg_; + const char *msg_; int count_; int int_sigkey_; int quit_sigkey_; @@ -184,7 +184,7 @@ protected: class Sig_Handler_2 : public Sig_Handler_1 { public: - Sig_Handler_2 (ACE_Reactor &reactor, char *msg) + Sig_Handler_2 (ACE_Reactor &reactor, const char *msg) : Sig_Handler_1 (reactor, msg) { } diff --git a/netsvcs/clients/Naming/Client/Client_Test.cpp b/netsvcs/clients/Naming/Client/Client_Test.cpp index c7f14ea7afd..90a7b33d8bc 100644 --- a/netsvcs/clients/Naming/Client/Client_Test.cpp +++ b/netsvcs/clients/Naming/Client/Client_Test.cpp @@ -34,34 +34,38 @@ public: void list_options (void); // Print name options - int bind (char *key, char *value, char *type = ""); + int bind (const char *key, + const char *value, + const char *type = ""); // Bind a key to a value - int unbind (char *key); + int unbind (const char *key); // Unbind a name binding - int rebind (char *key, char *value, char *type = ""); + int rebind (const char *key, + const char *value, + const char *type = ""); // Rebind a name binding - int find (char *key); + int find (const char *key); // Find the value associated with a key - int list_names (char *pattern); + int list_names (const char *pattern); // Find all names that match pattern - int list_values (char *pattern); + int list_values (const char *pattern); // Find all values that match pattern - int list_types (char *pattern); + int list_types (const char *pattern); // Find all types that match pattern - int list_name_entries (char *pattern); + int list_name_entries (const char *pattern); // Find all names that match pattern - int list_value_entries (char *pattern); + int list_value_entries (const char *pattern); // Find all values that match pattern - int list_type_entries (char *pattern); + int list_type_entries (const char *pattern); // Find all types that match pattern private: @@ -77,9 +81,9 @@ private: int set_node_local (void); // Set options to use NODE_LOCAL naming context - int set_host (char *hostname, int port); - // Set options to use NET_LOCAL naming context - // specifying host name and port number + int set_host (const char *hostname, int port); + // Set options to use NET_LOCAL naming context specifying host name + // and port number int quit (void); // Gracefully exit @@ -386,7 +390,7 @@ Client_Test::set_node_local (void) } int -Client_Test::set_host (char* hostname, int port) +Client_Test::set_host (const char *hostname, int port) { // Close down original name space NAMING_CONTEXT ()->close (); @@ -407,7 +411,9 @@ Client_Test::quit (void) } int -Client_Test::bind (char* key, char* value, char* type) +Client_Test::bind (const char *key, + const char *value, + const char *type) { if (NAMING_CONTEXT ()->bind (key, value, type) != 0) ACE_ERROR_RETURN ((LM_ERROR, @@ -419,7 +425,7 @@ Client_Test::bind (char* key, char* value, char* type) } int -Client_Test::unbind (char* key) +Client_Test::unbind (const char *key) { if (NAMING_CONTEXT ()->unbind (key) != 0) ACE_ERROR_RETURN ((LM_ERROR, @@ -431,14 +437,16 @@ Client_Test::unbind (char* key) } int -Client_Test::rebind (char* key, char* value, char* type) +Client_Test::rebind (const char *key, + const char *value, + const char *type) { int result = NAMING_CONTEXT ()->rebind (key, value, type ); return result == 1 ? 0 : result; } int -Client_Test::list_names (char *pattern) +Client_Test::list_names (const char *pattern) { ACE_PWSTRING_SET set; @@ -462,7 +470,7 @@ Client_Test::list_names (char *pattern) } int -Client_Test::list_values (char *pattern) +Client_Test::list_values (const char *pattern) { ACE_PWSTRING_SET set; @@ -486,7 +494,7 @@ Client_Test::list_values (char *pattern) } int -Client_Test::list_types (char *pattern) +Client_Test::list_types (const char *pattern) { ACE_PWSTRING_SET set; @@ -510,7 +518,7 @@ Client_Test::list_types (char *pattern) } int -Client_Test::list_name_entries (char *pattern) +Client_Test::list_name_entries (const char *pattern) { ACE_BINDING_SET set; @@ -543,7 +551,7 @@ Client_Test::list_name_entries (char *pattern) } int -Client_Test::list_value_entries (char *pattern) +Client_Test::list_value_entries (const char *pattern) { ACE_BINDING_SET set; @@ -575,7 +583,7 @@ Client_Test::list_value_entries (char *pattern) } int -Client_Test::list_type_entries (char *pattern) +Client_Test::list_type_entries (const char *pattern) { ACE_BINDING_SET set; @@ -607,7 +615,7 @@ Client_Test::list_type_entries (char *pattern) } int -Client_Test::find (char *key) +Client_Test::find (const char *key) { char *value = 0; char *type = 0; diff --git a/netsvcs/clients/Naming/Client/main.cpp b/netsvcs/clients/Naming/Client/main.cpp index 7dedde59b5f..75918c46378 100644 --- a/netsvcs/clients/Naming/Client/main.cpp +++ b/netsvcs/clients/Naming/Client/main.cpp @@ -23,8 +23,9 @@ main (int argc, char *argv[]) else // Use static binding. { char *l_argv[3]; + char port[] = "-p 10011"; l_argv[0] = argv[0]; - l_argv[1] = "-p 10011"; + l_argv[1] = port; l_argv[2] = 0; ACE_Service_Object *so = ACE_SVC_INVOKE (ACE_Naming_Context); diff --git a/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp b/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp index c747f012011..fec5e9967f0 100644 --- a/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp +++ b/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp @@ -11,28 +11,35 @@ ACE_RCSID(Dump_Restore, Dump_Restore, "$Id$") Dump_Restore::Dump_Restore (int argc, char *argv[]) : infile_ (0) { - ACE_NEW (this->ns_context_, ACE_Naming_Context); + ACE_NEW (this->ns_context_, + ACE_Naming_Context); // Cache the name options this->name_options_ = this->ns_context_->name_options (); this->name_options_->parse_args (argc, argv); //determine name context - if (ACE_OS::strcmp (this->name_options_->nameserver_host (), "localhost") == 0) + if (ACE_OS::strcmp (this->name_options_->nameserver_host (), + "localhost") == 0) { if (ns_context_->open (ACE_Naming_Context::PROC_LOCAL) == -1) - ACE_ERROR ( (LM_ERROR, "%p\n", "ns_context_->open")); + ACE_ERROR ((LM_ERROR, + "%p\n", + "ns_context_->open")); } else { - // Don't really need to do this but it's a hack to fix - // the problme of Display () not printing the right hostname + // Don't really need to do this but it's a hack to fix the + // problme of Display () not printing the right hostname ACE_OS::strcpy (this->hostname_, this->name_options_->nameserver_host ()); - this->port_ = this->name_options_->nameserver_port (); + this->port_ = + this->name_options_->nameserver_port (); if (this->ns_context_->open (ACE_Naming_Context::NET_LOCAL) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "ns_context_->open")); + ACE_ERROR ((LM_ERROR, + "%p\n", + "ns_context_->open")); } this->display_menu (); @@ -40,7 +47,9 @@ Dump_Restore::Dump_Restore (int argc, char *argv[]) if (ACE_Event_Handler::register_stdin_handler (this, ACE_Reactor::instance (), ACE_Thread_Manager::instance ()) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "register_stdin_handler")); + ACE_ERROR ((LM_ERROR, + "%p\n", + "register_stdin_handler")); } Dump_Restore::~Dump_Restore (void) @@ -62,7 +71,8 @@ Dump_Restore::handle_input (ACE_HANDLE) if (::scanf ("%s", option) <= 0) { - ACE_DEBUG ((LM_ERROR, "try again\n")); + ACE_DEBUG ((LM_ERROR, + "try again\n")); return 0; } @@ -123,38 +133,60 @@ Dump_Restore::handle_input (ACE_HANDLE) void Dump_Restore::display_menu (void) { - ACE_DEBUG ((LM_DEBUG, "\n")); - ACE_DEBUG ((LM_DEBUG, "Name Service Main Menu\n")); - ACE_DEBUG ((LM_DEBUG, "----------------------\n")); + ACE_DEBUG ((LM_DEBUG, + "\n")); + ACE_DEBUG ((LM_DEBUG, + "Name Service Main Menu\n")); + ACE_DEBUG ((LM_DEBUG, + "----------------------\n")); // Check if using local name space or remote name space - if (ACE_OS::strcmp (this->name_options_->nameserver_host (), "localhost") == 0) + if (ACE_OS::strcmp (this->name_options_->nameserver_host (), + "localhost") == 0) { if (this->ns_scope_ == ACE_Naming_Context::PROC_LOCAL) - ACE_DEBUG ((LM_DEBUG, " *** Using Process Local Database ***\n\n")); + ACE_DEBUG ((LM_DEBUG, + " *** Using Process Local Database ***\n\n")); else - ACE_DEBUG ((LM_DEBUG, " *** Using Node Local Database ***\n\n")); + ACE_DEBUG ((LM_DEBUG, + " *** Using Node Local Database ***\n\n")); } else { - ACE_DEBUG ((LM_DEBUG, " Hostname: %s\n", this->hostname_)); - ACE_DEBUG ((LM_DEBUG, " Port Number: %d\n", this->port_)); + ACE_DEBUG ((LM_DEBUG, + " Hostname: %s\n", + this->hostname_)); + ACE_DEBUG ((LM_DEBUG, + " Port Number: %d\n", + this->port_)); } if (this->infile_) - ACE_DEBUG ((LM_DEBUG, "Input File: %s\n", this->filename_)); + ACE_DEBUG ((LM_DEBUG, + "Input File: %s\n", + this->filename_)); else - ACE_DEBUG ((LM_DEBUG, "** No Input File Specified **\n")); - - ACE_DEBUG ((LM_DEBUG, "<P> Use Process Local Database\n")); - ACE_DEBUG ((LM_DEBUG, "<N> Use Node Local Database\n")); - ACE_DEBUG ((LM_DEBUG, "<H> Set Remote Name server <host> and <port>\n")); - ACE_DEBUG ((LM_DEBUG, "<F> Set Input File <file name>\n")); - ACE_DEBUG ((LM_DEBUG, "<B> Bind\n")); - ACE_DEBUG ((LM_DEBUG, "<U> Unbind\n")); - ACE_DEBUG ((LM_DEBUG, "<R> Rebind\n")); - ACE_DEBUG ((LM_DEBUG, "<D> Dump <file name>\n")); - ACE_DEBUG ((LM_DEBUG, "<Q> or ^C (exit) \n")); + ACE_DEBUG ((LM_DEBUG, + "** No Input File Specified **\n")); + + ACE_DEBUG ((LM_DEBUG, + "<P> Use Process Local Database\n")); + ACE_DEBUG ((LM_DEBUG, + "<N> Use Node Local Database\n")); + ACE_DEBUG ((LM_DEBUG, + "<H> Set Remote Name server <host> and <port>\n")); + ACE_DEBUG ((LM_DEBUG, + "<F> Set Input File <file name>\n")); + ACE_DEBUG ((LM_DEBUG, + "<B> Bind\n")); + ACE_DEBUG ((LM_DEBUG, + "<U> Unbind\n")); + ACE_DEBUG ((LM_DEBUG, + "<R> Rebind\n")); + ACE_DEBUG ((LM_DEBUG, + "<D> Dump <file name>\n")); + ACE_DEBUG ((LM_DEBUG, + "<Q> or ^C (exit) \n")); } @@ -166,16 +198,22 @@ Dump_Restore::set_proc_local (void) this->name_options_->nameserver_port (0); // Set Naming Context scope - this->ns_scope_ = ACE_Naming_Context::PROC_LOCAL; + this->ns_scope_ = + ACE_Naming_Context::PROC_LOCAL; // Remove old naming context delete this->ns_context_; // Create new Naming Context - ACE_NEW_RETURN (this->ns_context_, ACE_Naming_Context, -1); + ACE_NEW_RETURN (this->ns_context_, + ACE_Naming_Context, + -1); if (this->ns_context_->open (ACE_Naming_Context::PROC_LOCAL) == -1) - ACE_ERROR_RETURN ( (LM_ERROR, "%p\n", "ns_context_->open"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "ns_context_->open"), + -1); return 0; } @@ -194,44 +232,56 @@ Dump_Restore::set_node_local (void) delete this->ns_context_; // Create new Naming Context - ACE_NEW_RETURN (this->ns_context_, ACE_Naming_Context, -1); + ACE_NEW_RETURN (this->ns_context_, + ACE_Naming_Context, + -1); if (ns_context_->open (ACE_Naming_Context::NODE_LOCAL) == -1) - ACE_ERROR_RETURN ( (LM_ERROR, "%p\n", "ns_context_->open"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "ns_context_->open"), + -1); return 0; } int -Dump_Restore::set_host (char* hostname, int port) +Dump_Restore::set_host (const char *hostname, + int port) { // Set Name Options this->name_options_->nameserver_host (hostname); this->name_options_->nameserver_port (port); - // don't really need to do this but it's a hack to fix - // the problme of Display () not printing the right hostname - ACE_OS::strcpy (this->hostname_, hostname); + // Don't really need to do this but it's a hack to fix the problme + // of Display () not printing the right hostname + ACE_OS::strcpy (this->hostname_, + hostname); this->port_ = port; - this->ns_scope_ = ACE_Naming_Context::NET_LOCAL; + this->ns_scope_ = + ACE_Naming_Context::NET_LOCAL; // remove old naming context delete this->ns_context_; // Create new Naming Context - ACE_NEW_RETURN (this->ns_context_, ACE_Naming_Context, -1); + ACE_NEW_RETURN (this->ns_context_, + ACE_Naming_Context, + -1); // assume net_local context if (ns_context_->open (ACE_Naming_Context::NET_LOCAL) == -1) - ACE_ERROR_RETURN ( (LM_ERROR, "%p\n", "ns_context_->open"), -1); - + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "ns_context_->open"), + -1); return 0; } int Dump_Restore::doit (Dump_Restore::Operation_Type op, - char *name, - char* value, - char* type) + const char *name, + const char *value, + const char *type) { int result = -1; @@ -269,17 +319,22 @@ Dump_Restore::populate (Dump_Restore::Operation_Type op) // reset file pointer ACE_OS::rewind (this->infile_); - ACE_Allocator *allocator = ACE_Allocator::instance (); - ACE_Read_Buffer read_buffer (this->infile_, 0, allocator); + ACE_Allocator *allocator = + ACE_Allocator::instance (); + ACE_Read_Buffer read_buffer (this->infile_, + 0, + allocator); - for (char *temp; (temp = read_buffer.read ('\n')) != 0; ) + for (char *temp; + (temp = read_buffer.read ('\n')) != 0; + ) { char *name = 0; - char *actual_name = 0; + const char *actual_name = 0; char *value = 0; - char *actual_value = 0; + const char *actual_value = 0; char *type = 0; - char *actual_type = 0; + const char *actual_type = 0; switch (state) { @@ -318,7 +373,10 @@ Dump_Restore::populate (Dump_Restore::Operation_Type op) state = NAME; break; default: - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "populate"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "populate"), + -1); /* NOTREACHED */ } } @@ -330,34 +388,53 @@ Dump_Restore::populate (Dump_Restore::Operation_Type op) } int -Dump_Restore::bind (char* key, char* value, char* type) +Dump_Restore::bind (const char *key, + const char *value, + const char *type) { - int result = ns_context_->bind (key, value, type); - + int result = ns_context_->bind (key, + value, + type); if (result == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ns_context_->bind"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "ns_context_->bind"), + -1); else if (result == 1) - ACE_ERROR_RETURN ((LM_ERROR, "%s%s%s\n", "key <", key, "> already bound"), 1); + ACE_ERROR_RETURN ((LM_ERROR, + "%s%s%s\n", + "key <", + key, + "> already bound"), + 1); return 0; } int -Dump_Restore::unbind (char* key) +Dump_Restore::unbind (const char *key) { int result = ns_context_->unbind (key); if (result == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ns_context_->unbind"), -1); - + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "ns_context_->unbind"), + -1); return 0; } int -Dump_Restore::rebind (char* key, char* value, char* type) +Dump_Restore::rebind (const char *key, + const char *value, + const char *type) { - if (ns_context_->rebind (key, value, type) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ns_context_->rebind"), -1); - + if (ns_context_->rebind (key, + value, + type) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "ns_context_->rebind"), + -1); return 0; } diff --git a/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.h b/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.h index c2702ba04c9..741d7ec2f3a 100644 --- a/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.h +++ b/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.h @@ -42,7 +42,8 @@ private: int set_node_local (void); // Set options to use NODE_LOCAL naming context. - int set_host (char* hostname, int port); + int set_host (const char *hostname, + int port); // Set options to use NET_LOCAL naming context specifying host name // and port number. @@ -52,12 +53,16 @@ private: int populate (Dump_Restore::Operation_Type op); int doit (Dump_Restore::Operation_Type op, - char *name, - char *value, - char *type = ""); - int bind (char* key, char* value, char* type = ""); - int unbind (char* key); - int rebind (char* key, char* value, char* type = ""); + const char *name, + const char *value, + const char *type = ""); + int bind (const char *key, + const char *value, + const char *type = ""); + int unbind (const char *key); + int rebind (const char *key, + const char *value, + const char *type = ""); char filename_[MAXPATHLEN + 1]; char dump_filename_[MAXPATHLEN + 1]; diff --git a/netsvcs/clients/Tokens/collection/collection.cpp b/netsvcs/clients/Tokens/collection/collection.cpp index 3dcd8fdf455..1e7ac2d8823 100644 --- a/netsvcs/clients/Tokens/collection/collection.cpp +++ b/netsvcs/clients/Tokens/collection/collection.cpp @@ -31,7 +31,7 @@ ACE_RCSID(collection, collection, "$Id$") #if defined (ACE_HAS_THREADS) -static char *server_host = ACE_DEFAULT_SERVER_HOST; +static const char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; // unused: static int threads = 2; static int iterations = 50; diff --git a/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp b/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp index 5fa6a0dde11..4a7b1bc5a39 100644 --- a/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp +++ b/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp @@ -53,7 +53,7 @@ public: static int ignore_deadlock = 0; static int remote_mutexes = 0; -static char *server_host = ACE_DEFAULT_SERVER_HOST; +static const char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; static int iterations = 100; static int rwlocks = 0; diff --git a/netsvcs/clients/Tokens/invariant/invariant.cpp b/netsvcs/clients/Tokens/invariant/invariant.cpp index f7d417a1094..b2b55df3605 100644 --- a/netsvcs/clients/Tokens/invariant/invariant.cpp +++ b/netsvcs/clients/Tokens/invariant/invariant.cpp @@ -27,8 +27,8 @@ ACE_RCSID(invariant, invariant, "$Id$") typedef ACE_Token_Invariant_Manager ACE_TOKEN_INVARIANTS; -static char * rwname = "reader/writer"; -static char * mutexname = "mutex"; +static const char *rwname = "reader/writer"; +static const char *mutexname = "mutex"; static void * run_reader_writer (void *) diff --git a/netsvcs/clients/Tokens/mutex/test_mutex.cpp b/netsvcs/clients/Tokens/mutex/test_mutex.cpp index d51b8c6dbf1..a6a29a9bed3 100644 --- a/netsvcs/clients/Tokens/mutex/test_mutex.cpp +++ b/netsvcs/clients/Tokens/mutex/test_mutex.cpp @@ -28,7 +28,7 @@ ACE_RCSID(mutex, test_mutex, "$Id$") static ACE_Token_Proxy *mutex; static int remote_mutexes = 0; -static char *server_host = ACE_DEFAULT_SERVER_HOST; +static const char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; static int iterations = 100; static int spawn_count = 2; diff --git a/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp b/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp index 6354f2fc6c9..37e9d0e3886 100644 --- a/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp +++ b/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp @@ -33,7 +33,7 @@ typedef ACE_Token_Invariant_Manager ACE_TOKEN_INVARIANTS; static ACE_Token_Proxy *global_rlock; static ACE_Token_Proxy *global_wlock; -static char *server_host = ACE_DEFAULT_SERVER_HOST; +static const char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; static int ignore_deadlock = 0; static int threads = 2; diff --git a/netsvcs/lib/Name_Handler.h b/netsvcs/lib/Name_Handler.h index 9b47952890a..600e66075c8 100644 --- a/netsvcs/lib/Name_Handler.h +++ b/netsvcs/lib/Name_Handler.h @@ -125,7 +125,7 @@ private: // A member function pointer that serves as a factory to create a // request that is passed back to the client. - char *description_; + const char *description_; // Name of the operation we're dispatching (used for debugging). }; diff --git a/netsvcs/servers/main.cpp b/netsvcs/servers/main.cpp index dd21ed1cf58..c0881b3b0aa 100644 --- a/netsvcs/servers/main.cpp +++ b/netsvcs/servers/main.cpp @@ -39,14 +39,15 @@ main (int argc, char *argv[]) 1); else // Use static linking. { - char *l_argv[3]; - // Calling ACE_SVC_INVOKE to create a new Service_Object. // Stash the newly created Service_Object into an // ACE_Service_Object_Ptr which is an <auto_ptr> specialized // for ACE_Service_Object. - l_argv[0] = "-p " ACE_DEFAULT_NAME_SERVER_PORT_STR; + char *l_argv[3]; + char name_port[] = "-p " ACE_DEFAULT_NAME_SERVER_PORT_STR; + + l_argv[0] = name_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_1 = ACE_SVC_INVOKE (ACE_Name_Acceptor); @@ -56,7 +57,8 @@ main (int argc, char *argv[]) "Name Service", 1)); - l_argv[0] = "-p " ACE_DEFAULT_TIME_SERVER_PORT_STR; + char time_port[] = "-p " ACE_DEFAULT_TIME_SERVER_PORT_STR; + l_argv[0] = time_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_2 = ACE_SVC_INVOKE (ACE_TS_Server_Acceptor); @@ -65,15 +67,20 @@ main (int argc, char *argv[]) "%p\n%a", "TS Server Acceptor", 1)); + char clerk_port[] = "-p 10011"; l_argv[0] = argv[0]; - l_argv[1] = "-p 10011"; + l_argv[1] = clerk_port; l_argv[2] = 0; ACE_Service_Object_Ptr sp_3 = ACE_SVC_INVOKE (ACE_TS_Clerk_Processor); if (sp_3->init (2, l_argv) == -1) - ACE_ERROR ((LM_ERROR, "%p\n%a", "TS Clerk Processor", 1)); + ACE_ERROR ((LM_ERROR, + "%p\n%a", + "TS Clerk Processor", + 1)); - l_argv[0] = "-p " ACE_DEFAULT_TOKEN_SERVER_PORT_STR; + char token_port[] = "-p " ACE_DEFAULT_TOKEN_SERVER_PORT_STR; + l_argv[0] = token_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_4 = ACE_SVC_INVOKE (ACE_Token_Acceptor); @@ -83,7 +90,8 @@ main (int argc, char *argv[]) "Token Service", 1)); - l_argv[0] = "-p " ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR; + char thr_logging_port[] = "-p " ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR; + l_argv[0] = thr_logging_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_5 = ACE_SVC_INVOKE (ACE_Thr_Server_Logging_Acceptor); @@ -93,7 +101,8 @@ main (int argc, char *argv[]) "Threaded Logging Server", 1)); - l_argv[0] = "-p " ACE_DEFAULT_LOGGING_SERVER_PORT_STR; + char logging_port[] = "-p " ACE_DEFAULT_LOGGING_SERVER_PORT_STR; + l_argv[0] = logging_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_6 = ACE_SVC_INVOKE (ACE_Server_Logging_Acceptor); @@ -102,7 +111,7 @@ main (int argc, char *argv[]) "%p\n%a", "Logging Server", 1)); - l_argv[0] = "-p " ACE_DEFAULT_LOGGING_SERVER_PORT_STR; + l_argv[0] = logging_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_7 = ACE_SVC_INVOKE (ACE_Client_Logging_Acceptor); diff --git a/tests/DLList_Test.cpp b/tests/DLList_Test.cpp index 9352e50b4a7..c5a484e918f 100644 --- a/tests/DLList_Test.cpp +++ b/tests/DLList_Test.cpp @@ -26,7 +26,7 @@ USELIB("..\ace\aced.lib"); //--------------------------------------------------------------------------- #endif /* defined(__BORLANDC__) && __BORLANDC__ >= 0x0530 */ -static ASYS_TCHAR * string_table[] = +static LPCTSTR string_table[] = { ASYS_TEXT ("hello"), ASYS_TEXT ("guten Tag"), diff --git a/tests/Hash_Map_Manager_Test.cpp b/tests/Hash_Map_Manager_Test.cpp index e172015f03d..3554abe784e 100644 --- a/tests/Hash_Map_Manager_Test.cpp +++ b/tests/Hash_Map_Manager_Test.cpp @@ -54,8 +54,8 @@ typedef ACE_Hash_Map_Reverse_Iterator_Ex<ASYS_TCHAR *, struct String_Table { - ASYS_TCHAR *key_; - ASYS_TCHAR *value_; + LPCTSTR key_; + LPCTSTR value_; }; static String_Table string_table[] = diff --git a/tests/Message_Block_Test.cpp b/tests/Message_Block_Test.cpp index 4ebc1724591..17b5505622f 100644 --- a/tests/Message_Block_Test.cpp +++ b/tests/Message_Block_Test.cpp @@ -264,7 +264,7 @@ ACE_Cached_Allocator<MEMORY_CHUNK, struct { ACE_Allocator *strategy_; - ASYS_TCHAR *name_; + LPCTSTR name_; ACE_Profile_Timer::ACE_Elapsed_Time et_; } alloc_struct[ACE_ALLOC_STRATEGY_NO] = { diff --git a/tests/Notify_Performance_Test.cpp b/tests/Notify_Performance_Test.cpp index 6083846ee76..403fed63084 100644 --- a/tests/Notify_Performance_Test.cpp +++ b/tests/Notify_Performance_Test.cpp @@ -9,14 +9,13 @@ // Notify_Performance_Test.cpp // // = DESCRIPTION -// // This test is used to time the notification mechanisms of the // ACE_Reactors. Both the WFMO_Reactor and Select_Reactor can be // tested. The notify() mechanism can also be tested with or // without data. // // = AUTHOR -// Irfan Pyarali +// Irfan Pyarali <irfan@cs.wustl.edu> // // ============================================================================ @@ -71,7 +70,8 @@ Handler::handle_exception (ACE_HANDLE handle) } // Execute the client tests. -void * + +static void * client (void *arg) { // Number of client (user) threads @@ -94,7 +94,8 @@ client (void *arg) } // Sets up the correct reactor (based on platform and options) -void + +static void create_reactor (void) { ACE_Reactor_Impl *impl = 0; @@ -114,10 +115,10 @@ create_reactor (void) ACE_Reactor::instance (reactor); } -void +static void print_results (ACE_Profile_Timer::ACE_Elapsed_Time &et) { - ASYS_TCHAR *reactor_type = 0; + LPCTSTR reactor_type = 0; if (opt_wfmo_reactor) reactor_type = ASYS_TEXT ("WFMO_Reactor"); else if (opt_select_reactor) @@ -125,16 +126,26 @@ print_results (ACE_Profile_Timer::ACE_Elapsed_Time &et) else reactor_type = ASYS_TEXT ("Platform's default Reactor"); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\nNotify_Performance Test statistics:\n\n"))); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\tReactor Type: %s\n"), reactor_type)); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\tWorker threads (calling notify()): %d\n"), opt_nthreads)); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\tIteration per thread: %d\n"), opt_nloops)); + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("\nNotify_Performance Test statistics:\n\n"))); + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("\tReactor Type: %s\n"), + reactor_type)); + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("\tWorker threads (calling notify()): %d\n"), + opt_nthreads)); + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("\tIteration per thread: %d\n"), + opt_nloops)); if (opt_pass_notify_data) - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\tData was passed in the notify() call\n"))); + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("\tData was passed in the notify() call\n"))); else - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\tNo data was passed in the notify() call\n"))); + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("\tNo data was passed in the notify() call\n"))); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\n\tTiming results notify() call:\n"))); + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("\n\tTiming results notify() call:\n"))); ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\t\treal time = %f secs \n\t\tuser time = %f secs \n\t\tsystem time = %f secs\n\n"), et.real_time, @@ -148,6 +159,7 @@ main (int argc, ASYS_TCHAR *argv[]) ACE_START_TEST (ASYS_TEXT ("Notify_Performance_Test")); ACE_Get_Opt getopt (argc, argv, ASYS_TEXT ("swdc:l:")); + for (int c; (c = getopt ()) != -1; ) switch (c) { @@ -209,7 +221,8 @@ main (int argc, ASYS_TCHAR *argv[]) // Print results print_results (et); - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) waiting for the worker threads...\n"))); + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("(%P|%t) waiting for the worker threads...\n"))); // Wait for all worker to get done. ACE_Thread_Manager::instance ()->wait (); diff --git a/tests/Process_Strategy_Test.cpp b/tests/Process_Strategy_Test.cpp index 11ec1c318c5..c60e343395c 100644 --- a/tests/Process_Strategy_Test.cpp +++ b/tests/Process_Strategy_Test.cpp @@ -475,7 +475,7 @@ client (void *arg) ACE_SOCK_Connector connector; char buf[BUFSIZ]; - char *command; + const char *command; size_t command_len; size_t i; diff --git a/tests/RB_Tree_Test.cpp b/tests/RB_Tree_Test.cpp index ef89caf7205..edb47bfbfbd 100644 --- a/tests/RB_Tree_Test.cpp +++ b/tests/RB_Tree_Test.cpp @@ -38,11 +38,15 @@ USELIB("..\ace\aced.lib"); // These arrays of numbers as ints and character strings // are used to instantiate key and item nodes in the tree. -static char *number_strings [] = {"10", "20", "30", "40", - "50", "60", "70", "80"}; +static const char *number_strings [] = +{ + "10", "20", "30", "40", "50", "60", "70", "80" +}; -static int number_integers [] = {10, 20, 30, 40, - 50, 60, 70, 80}; +static int number_integers [] = +{ + 10, 20, 30, 40, 50, 60, 70, 80 +}; // These arrays of ints are used to shuffle the order of insertion // of keys and items for the various trees. diff --git a/tests/test_config.h b/tests/test_config.h index 2c961ce5517..3effdb8f81d 100644 --- a/tests/test_config.h +++ b/tests/test_config.h @@ -246,7 +246,7 @@ ACE_Test_Output::set_output (const ASYS_TCHAR *filename, int append) { ASYS_TCHAR temp[MAXPATHLEN]; // Ignore the error value since the directory may already exist. - ASYS_TCHAR *test_dir; + LPCTSTR test_dir; #if !defined (ACE_HAS_WINCE) test_dir = ACE_OS::getenv ("ACE_TEST_DIR"); @@ -255,8 +255,6 @@ ACE_Test_Output::set_output (const ASYS_TCHAR *filename, int append) #endif /* ACE_HAS_WINCE */ test_dir = ASYS_TEXT (""); - - ACE_OS::sprintf (temp, ASYS_TEXT ("%s%s%s%s"), test_dir, @@ -268,8 +266,8 @@ ACE_Test_Output::set_output (const ASYS_TCHAR *filename, int append) // This is the only way I could figure out to avoid a console warning // about opening an existing file (w/o O_CREAT), or attempting to unlink // a non-existant one. - int fd; - if ((fd = ACE_OS::open (temp, O_WRONLY | O_CREAT, 0x644)) != ERROR) + int fd = ACE_OS::open (temp, O_WRONLY | O_CREAT, 0x644); + if (fd != ERROR) { ACE_OS::close (fd); ACE_OS::unlink (temp); |