summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-10-25 18:03:36 +0000
committeriliyan <iliyan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-10-25 18:03:36 +0000
commitcf662a37817a285b5a8c29669aeb545c537417e3 (patch)
treeaee8116ddfca088dfb1c48f31009d2d53fdddaca
parent28b7e2df7485b5b63428e0b3774e3a1ef1cea83d (diff)
downloadATCD-cf662a37817a285b5a8c29669aeb545c537417e3.tar.gz
ChangeLogTag: Wed Oct 25 18:01:05 UTC 2006 Iliyan Jeliazkov <iliyan@ociweb.com>
-rw-r--r--ACEXML/ChangeLog476
-rw-r--r--ACEXML/common/HttpCharStream.cpp40
-rw-r--r--ACEXML/common/Mem_Map_Stream.cpp5
-rw-r--r--ACEXML/common/SAXExceptions.cpp29
-rw-r--r--ACEXML/common/SAXExceptions.h8
-rw-r--r--ACEXML/common/codecs.mpb2
-rw-r--r--ChangeLog488
-rw-r--r--ace/ACE.cpp12
-rw-r--r--ace/Array_Base.cpp74
-rw-r--r--ace/Array_Base.h87
-rw-r--r--ace/Array_Base.inl71
-rw-r--r--ace/Array_Map.h33
-rw-r--r--ace/CDR_Stream.cpp45
-rw-r--r--ace/CDR_Stream.inl73
-rw-r--r--ace/Configuration.cpp21
-rw-r--r--ace/Configuration_Import_Export.cpp18
-rw-r--r--ace/Default_Constants.h2
-rw-r--r--ace/Dev_Poll_Reactor.cpp7
-rw-r--r--ace/Hash_Map_Manager_T.h95
-rw-r--r--ace/Hash_Map_Manager_T.inl186
-rw-r--r--ace/INET_Addr.cpp30
-rw-r--r--ace/INET_Addr.inl4
-rw-r--r--ace/Lib_Find.cpp18
-rw-r--r--ace/Numeric_Limits.h9
-rw-r--r--ace/OS_NS_Thread.inl8
-rw-r--r--ace/OS_NS_arpa_inet.inl10
-rw-r--r--ace/OS_NS_dirent.cpp2
-rw-r--r--ace/OS_NS_fcntl.cpp22
-rw-r--r--ace/OS_NS_netdb.inl12
-rw-r--r--ace/OS_NS_stdio.cpp19
-rw-r--r--ace/OS_NS_stdio.inl8
-rw-r--r--ace/OS_NS_stdlib.inl18
-rw-r--r--ace/OS_NS_sys_select.inl18
-rw-r--r--ace/OS_NS_sys_socket.inl130
-rw-r--r--ace/OS_NS_unistd.inl6
-rw-r--r--ace/OS_TLI.h6
-rw-r--r--ace/OS_TLI.inl4
-rw-r--r--ace/Reactor.h3
-rw-r--r--ace/SOCK_Dgram.cpp10
-rw-r--r--ace/Select_Reactor_Base.cpp406
-rw-r--r--ace/Select_Reactor_Base.h148
-rw-r--r--ace/Select_Reactor_Base.inl78
-rw-r--r--ace/Select_Reactor_T.cpp22
-rw-r--r--ace/Service_Config.cpp75
-rw-r--r--ace/Service_Config.h13
-rw-r--r--ace/Service_Repository.cpp10
-rw-r--r--ace/Sock_Connect.cpp153
-rw-r--r--ace/Sock_Connect.h16
-rw-r--r--ace/Svc_Conf.y71
-rw-r--r--ace/Svc_Conf_y.cpp61
-rw-r--r--ace/System_Time.cpp24
-rw-r--r--ace/System_Time.h24
-rw-r--r--ace/TTY_IO.cpp8
-rw-r--r--ace/Thread_Manager.cpp2
-rw-r--r--ace/Time_Value.h2
-rw-r--r--ace/Truncate.h97
-rw-r--r--ace/UUID.cpp12
-rw-r--r--ace/UUID.h4
-rw-r--r--ace/Unbounded_Queue.cpp6
-rw-r--r--ace/WFMO_Reactor.cpp5
-rw-r--r--ace/ace_for_tao.mpc5
-rw-r--r--ace/ace_wchar.inl2
-rw-r--r--ace/config-aix-4.x.h4
-rw-r--r--ace/config-lite.h60
-rw-r--r--ace/config-rtems.h35
-rw-r--r--ace/os_include/netinet/os_in.h29
-rw-r--r--ace/os_include/os_netdb.h42
-rw-r--r--ace/os_include/sys/os_socket.h64
-rw-r--r--apps/gperf/ChangeLog70
-rw-r--r--apps/gperf/src/Key_List.cpp17
-rw-r--r--examples/Service_Configurator/IPC-tests/server/Handle_Timeout.inl6
-rw-r--r--examples/Shared_Malloc/test_position_independent_malloc.cpp2
-rw-r--r--include/makeinclude/platform_irix6.x_sgic++.GNU7
-rw-r--r--tests/Map_Manager_Test.cpp2
-rw-r--r--tests/Priority_Buffer_Test.cpp12
-rw-r--r--tests/Thread_Manager_Test.cpp51
76 files changed, 2655 insertions, 1099 deletions
diff --git a/ACEXML/ChangeLog b/ACEXML/ChangeLog
index 2bce4374135..0832298a45a 100644
--- a/ACEXML/ChangeLog
+++ b/ACEXML/ChangeLog
@@ -1,6 +1,52 @@
+Tue Oct 24 18:00:15 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * common/common.mpc:
+ * parser/parser/parser.mpc:
+
+ Re-disabled ACEXML when ace_for_tao is enabled. ACEXML needs
+ the ACE_Configuration and memory map classes that are not found
+ in the ace_for_tao subset.
+
+Mon Oct 24 02:26:32 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * common/common.mpc:
+ * parser/parser/parser.mpc:
+
+ No longer any need to explicitly disable ACEXML in the
+ ace_for_tao configuration.
+
+ * common/HttpCharStream.cpp:
+
+ Fixed Coverity OVERRUN_STATIC and FORWARD_NULL errors.
+
+ Improved const-correctness.
+
+ * common/codecs.mpb:
+
+ Disable ACEXML codecs support if ace_for_tao is enabled.
+
+ * common/Mem_Map_Stream.cpp:
+
+ Fixed Coverity NEGATIVE_RETURNS error.
+
+ * common/SAXExceptions.cpp (_downcast):
+
+ Removed redundant type checking code.
+
+ (~ACEXML_SAXNotSupportedException):
+ (~ACEXML_SAXNotRecognizedException):
+
+ Addressed Coverity USE_AFTER_FREE errors.
+
+ (exception_name_):
+ * common/SAXExceptions.h (exception_name_):
+
+ Declare this static constant as an array rather than a pointer.
+ Allows the compiler to perform additional optimizations.
+
Tue Jun 20 08:23:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
- * ACEXML/parser/parser/Parser.cpp:
+ * parser/parser/Parser.cpp:
64bit fix
Thu Mar 30 13:14:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
@@ -10,19 +56,21 @@ Thu Mar 30 13:14:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
Tue Mar 14 20:58:12 UTC 2006 jiang,shanshan <shanshan.jiang@vanderbilt.edu>
- * ACEXML/common/FileCharStream.cpp
- * ACEXML/common/HttpCharStream.cpp
- * ACEXML/common/Transcode.cpp
- * ACEXML/common/XML_Macros.h
- * ACEXML/parser/parser/Parser.cpp
- * ACEXML/parser/parser/Parser.i
- Updated these files to solve the warnings when setting up "VC level 4 warnings"
- on Windows. These warnings include "unreachable code", "assignment within
- conditional expression", "conversion from some type to another type, possible
- loss of data", "local variable may be used without having been initialized" and
- so on.
- Thanks to Lukas Gruetzmacher <gruetzmacher at ais-dresden dot de> for
- motivating the fix to these "VC level 4 warnings".
+ * common/FileCharStream.cpp
+ * common/HttpCharStream.cpp
+ * common/Transcode.cpp
+ * common/XML_Macros.h
+ * parser/parser/Parser.cpp
+ * parser/parser/Parser.i
+
+ Updated these files to solve the warnings when setting up "VC
+ level 4 warnings" on Windows. These warnings include
+ "unreachable code", "assignment within conditional expression",
+ "conversion from some type to another type, possible loss of
+ data", "local variable may be used without having been
+ initialized" and so on. Thanks to Lukas Gruetzmacher
+ <gruetzmacher at ais-dresden dot de> for motivating the fix to
+ these "VC level 4 warnings".
Fri Feb 10 23:45:14 UTC 2006 Steve Huston <shuston@riverace.com>
@@ -291,10 +339,10 @@ Thu Dec 18 13:13:57 2003 Krishnakumar B <kitty@nospam.invalid.domain>
Sat Jul 19 18:38:50 UTC 2003 Don Hinton <dhinton@dresystems.com>
- * ACEXML/apps/svcconf/Svcconf.h:
- * ACEXML/common/*.h:
- * ACEXML/parser/*.h:
- * ACEXML/parser/parser/*.h:
+ * apps/svcconf/Svcconf.h:
+ * common/*.h:
+ * parser/*.h:
+ * parser/parser/*.h:
Added "/**/" between the #include and filename for pre.h and
post.h so Doxygen won't include them in the file reference tree
graphs.
@@ -459,128 +507,128 @@ Thu May 29 23:00:24 2003 Krishnakumar B <kitty@spam.invalid.domain>
Thu May 29 22:03:40 2003 Krishnakumar B <kitty@spam.invalid.domain>
- * ACEXML/ACEXML.mwc:
- * ACEXML/ChangeLog:
- * ACEXML/apps/svcconf/ACEXML_XML_Svc_Conf_Parser.dsp:
- * ACEXML/apps/svcconf/Makefile.ACEXML_XML_Svc_Conf_Parser:
- * ACEXML/apps/svcconf/Makefile.ACEXML_XML_Svc_Conf_Parser.bor:
- * ACEXML/common/ACEXML.dsp:
- * ACEXML/common/Makefile.ACEXML:
- * ACEXML/common/Makefile.ACEXML.bor:
- * ACEXML/examples/SAXPrint/Makefile.SAXPrint:
- * ACEXML/examples/SAXPrint/Makefile.SAXPrint.bor:
- * ACEXML/examples/svcconf/Makefile:
- * ACEXML/examples/svcconf/Makefile.Svcconf:
- * ACEXML/examples/svcconf/Makefile.Svcconf.bor:
- * ACEXML/examples/svcconf/Svcconf.mpc:
- * ACEXML/parser/parser/ACEXML_Parser.dsp:
- * ACEXML/parser/parser/Makefile.ACEXML_Parser:
- * ACEXML/parser/parser/Makefile.ACEXML_Parser.bor:
- * ACEXML/parser/parser/Makefile.Parser:
- * ACEXML/tests/Makefile.ContentHandler_Test.bor:
- * ACEXML/tests/Makefile.HttpCharStream_Test:
- * ACEXML/tests/Makefile.HttpCharStream_Test.bor:
- * ACEXML/tests/Makefile.NamespaceSupport_Test:
- * ACEXML/tests/Makefile.NamespaceSupport_Test.bor:
- * ACEXML/tests/Makefile.Transcoder_Test:
- * ACEXML/tests/Makefile.Transcoder_Test.bor:
+ * ACEXML.mwc:
+ * ChangeLog:
+ * apps/svcconf/ACEXML_XML_Svc_Conf_Parser.dsp:
+ * apps/svcconf/Makefile.ACEXML_XML_Svc_Conf_Parser:
+ * apps/svcconf/Makefile.ACEXML_XML_Svc_Conf_Parser.bor:
+ * common/ACEXML.dsp:
+ * common/Makefile.ACEXML:
+ * common/Makefile.ACEXML.bor:
+ * examples/SAXPrint/Makefile.SAXPrint:
+ * examples/SAXPrint/Makefile.SAXPrint.bor:
+ * examples/svcconf/Makefile:
+ * examples/svcconf/Makefile.Svcconf:
+ * examples/svcconf/Makefile.Svcconf.bor:
+ * examples/svcconf/Svcconf.mpc:
+ * parser/parser/ACEXML_Parser.dsp:
+ * parser/parser/Makefile.ACEXML_Parser:
+ * parser/parser/Makefile.ACEXML_Parser.bor:
+ * parser/parser/Makefile.Parser:
+ * tests/Makefile.ContentHandler_Test.bor:
+ * tests/Makefile.HttpCharStream_Test:
+ * tests/Makefile.HttpCharStream_Test.bor:
+ * tests/Makefile.NamespaceSupport_Test:
+ * tests/Makefile.NamespaceSupport_Test.bor:
+ * tests/Makefile.Transcoder_Test:
+ * tests/Makefile.Transcoder_Test.bor:
New files to build ACEXML generated using MPC.
- * ACEXML/apps/svcconf/svcconf.dtd:
+ * apps/svcconf/svcconf.dtd:
Moved the DTD from a hidden location to a prominent one.
- * ACEXML/examples/SAXPrint/namespaces.xml:
+ * examples/SAXPrint/namespaces.xml:
New file to test namespace support.
- * ACEXML/common/ZipCharStream.cpp:
- * ACEXML/common/ZipCharStream.h:
+ * common/ZipCharStream.cpp:
+ * common/ZipCharStream.h:
New files to support reading files from within a ZIP archive as
a stream.
- * ACEXML/parser/parser/ParserContext.cpp:
- * ACEXML/parser/parser/ParserContext.h:
- * ACEXML/parser/parser/ParserContext.inl:
+ * parser/parser/ParserContext.cpp:
+ * parser/parser/ParserContext.h:
+ * parser/parser/ParserContext.inl:
New files to support a per stream context encountered when
parsing references.
- * ACEXML/parser/parser/ParserInternals.cpp:
- * ACEXML/parser/parser/ParserInternals.h:
+ * parser/parser/ParserInternals.cpp:
+ * parser/parser/ParserInternals.h:
Move some common functions from Parser.cpp to these files.
- * ACEXML/ACEXML.dsw:
- * ACEXML/Makefile:
- * ACEXML/Makefile.bor:
- * ACEXML/apps/svcconf/Makefile:
- * ACEXML/apps/svcconf/Makefile.bor:
- * ACEXML/common/Makefile:
- * ACEXML/common/Makefile.bor:
- * ACEXML/examples/SAXPrint/Makefile:
- * ACEXML/examples/SAXPrint/Makefile.bor:
- * ACEXML/examples/SAXPrint/SAXPrint.dsp:
- * ACEXML/examples/SAXPrint/SAXPrint.mpc:
- * ACEXML/examples/svcconf/Makefile.bor:
- * ACEXML/examples/svcconf/Svcconf.dsp:
- * ACEXML/parser/parser/Makefile:
- * ACEXML/parser/parser/Makefile.bor:
- * ACEXML/tests/ContentHandler_Test.cpp:
- * ACEXML/tests/ContentHandler_Test.dsp:
- * ACEXML/tests/HttpCharStream_Test.cpp:
- * ACEXML/tests/HttpCharStream_Test.dsp:
- * ACEXML/tests/Makefile:
- * ACEXML/tests/Makefile.bor:
- * ACEXML/tests/NamespaceSupport_Test.dsp:
- * ACEXML/tests/Transcoder_Test.dsp:
+ * ACEXML.dsw:
+ * Makefile:
+ * Makefile.bor:
+ * apps/svcconf/Makefile:
+ * apps/svcconf/Makefile.bor:
+ * common/Makefile:
+ * common/Makefile.bor:
+ * examples/SAXPrint/Makefile:
+ * examples/SAXPrint/Makefile.bor:
+ * examples/SAXPrint/SAXPrint.dsp:
+ * examples/SAXPrint/SAXPrint.mpc:
+ * examples/svcconf/Makefile.bor:
+ * examples/svcconf/Svcconf.dsp:
+ * parser/parser/Makefile:
+ * parser/parser/Makefile.bor:
+ * tests/ContentHandler_Test.cpp:
+ * tests/ContentHandler_Test.dsp:
+ * tests/HttpCharStream_Test.cpp:
+ * tests/HttpCharStream_Test.dsp:
+ * tests/Makefile:
+ * tests/Makefile.bor:
+ * tests/NamespaceSupport_Test.dsp:
+ * tests/Transcoder_Test.dsp:
Build related files changed with the introduction of MPC to
build ACEXML.
- * ACEXML/examples/SAXPrint/ns.svc.conf.xml:
- * ACEXML/examples/SAXPrint/svc.conf.xml:
+ * examples/SAXPrint/ns.svc.conf.xml:
+ * examples/SAXPrint/svc.conf.xml:
New files to test specific features of the parser.
- * ACEXML/apps/svcconf/Svcconf.cpp:
- * ACEXML/common/Attributes.h:
- * ACEXML/common/Attributes_Def_Builder.h:
- * ACEXML/common/CharStream.h:
- * ACEXML/common/DefaultHandler.cpp:
- * ACEXML/common/Encoding.cpp:
- * ACEXML/common/Encoding.h:
- * ACEXML/common/Exception.cpp:
- * ACEXML/common/FileCharStream.cpp:
- * ACEXML/common/FileCharStream.h:
- * ACEXML/common/HttpCharStream.cpp:
- * ACEXML/common/HttpCharStream.h:
- * ACEXML/common/InputSource.cpp:
- * ACEXML/common/InputSource.h:
- * ACEXML/common/LocatorImpl.cpp:
- * ACEXML/common/LocatorImpl.h:
- * ACEXML/common/Mem_Map_Stream.cpp:
- * ACEXML/common/NamespaceSupport.cpp:
- * ACEXML/common/NamespaceSupport.h:
- * ACEXML/common/SAXExceptions.cpp:
- * ACEXML/common/StrCharStream.cpp:
- * ACEXML/common/StrCharStream.h:
- * ACEXML/common/StreamFactory.cpp:
- * ACEXML/common/Transcode.cpp:
- * ACEXML/common/Transcode.h:
- * ACEXML/common/Transcode.i:
- * ACEXML/examples/SAXPrint/Print_Handler.cpp:
- * ACEXML/examples/SAXPrint/SAXPrint_Handler.cpp:
- * ACEXML/examples/SAXPrint/main.cpp:
- * ACEXML/examples/svcconf/main.cpp:
- * ACEXML/parser/parser/Parser.cpp:
- * ACEXML/parser/parser/Parser.h:
- * ACEXML/parser/parser/Parser.i:
- * ACEXML/parser/parser/Entity_Manager.cpp:
- * ACEXML/parser/parser/Entity_Manager.h:
- * ACEXML/parser/parser/Entity_Manager.i:
+ * apps/svcconf/Svcconf.cpp:
+ * common/Attributes.h:
+ * common/Attributes_Def_Builder.h:
+ * common/CharStream.h:
+ * common/DefaultHandler.cpp:
+ * common/Encoding.cpp:
+ * common/Encoding.h:
+ * common/Exception.cpp:
+ * common/FileCharStream.cpp:
+ * common/FileCharStream.h:
+ * common/HttpCharStream.cpp:
+ * common/HttpCharStream.h:
+ * common/InputSource.cpp:
+ * common/InputSource.h:
+ * common/LocatorImpl.cpp:
+ * common/LocatorImpl.h:
+ * common/Mem_Map_Stream.cpp:
+ * common/NamespaceSupport.cpp:
+ * common/NamespaceSupport.h:
+ * common/SAXExceptions.cpp:
+ * common/StrCharStream.cpp:
+ * common/StrCharStream.h:
+ * common/StreamFactory.cpp:
+ * common/Transcode.cpp:
+ * common/Transcode.h:
+ * common/Transcode.i:
+ * examples/SAXPrint/Print_Handler.cpp:
+ * examples/SAXPrint/SAXPrint_Handler.cpp:
+ * examples/SAXPrint/main.cpp:
+ * examples/svcconf/main.cpp:
+ * parser/parser/Parser.cpp:
+ * parser/parser/Parser.h:
+ * parser/parser/Parser.i:
+ * parser/parser/Entity_Manager.cpp:
+ * parser/parser/Entity_Manager.h:
+ * parser/parser/Entity_Manager.i:
Merge from the Validator branch. It is not close to conformance
related to Validation but is quite stable as a parser which
@@ -709,99 +757,99 @@ Tue Nov 19 15:02:06 2002 Krishnakumar B <kitty@cs.wustl.edu>
Mon Nov 18 22:29:39 2002 Krishnakumar B <kitty@cs.wustl.edu>
- * ACEXML/Makefile:
+ * Makefile:
Deleted this file in the previous check-in. Re-add it.
Mon Nov 18 22:19:47 2002 Krishnakumar B <kitty@cs.wustl.edu>
- * ACEXML/common/common.mpc:
- * ACEXML/parser/parser/parser.mpc:
- * ACEXML/parser/debug_validator/validator.mpc:
- * ACEXML/apps/svcconf/svcconf.mpc:
- * ACEXML/examples/svcconf/Svcconf.mpc:
- * ACEXML/examples/SAXPrint/saxprint.mpc:
- * ACEXML/tests/tests.mpc:
- * ACEXML/ACEXML.mwc:
+ * common/common.mpc:
+ * parser/parser/parser.mpc:
+ * parser/debug_validator/validator.mpc:
+ * apps/svcconf/svcconf.mpc:
+ * examples/svcconf/Svcconf.mpc:
+ * examples/SAXPrint/saxprint.mpc:
+ * tests/tests.mpc:
+ * ACEXML.mwc:
New MPC files and Workspace file.
- * ACEXML/common/Makefile.XML_Common:
- * ACEXML/apps/svcconf/Makefile.XML_Svc_Conf_Parser:
- * ACEXML/parser/parser/Makefile.Parser:
- * ACEXML/parser/debug_validator/Makefile.Validator:
- * ACEXML/examples/SAXPrint/Makefile.SAXPrint:
- * ACEXML/examples/svcconf/Makefile.Svcconf:
- * ACEXML/tests/Makefile.HttpCharStream_Test:
- * ACEXML/tests/Makefile.NamespaceSupport_Test:
- * ACEXML/tests/Makefile.Transcoder_Test:
+ * common/Makefile.XML_Common:
+ * apps/svcconf/Makefile.XML_Svc_Conf_Parser:
+ * parser/parser/Makefile.Parser:
+ * parser/debug_validator/Makefile.Validator:
+ * examples/SAXPrint/Makefile.SAXPrint:
+ * examples/svcconf/Makefile.Svcconf:
+ * tests/Makefile.HttpCharStream_Test:
+ * tests/Makefile.NamespaceSupport_Test:
+ * tests/Makefile.Transcoder_Test:
New Makefiles generated by MPC.
- * ACEXML/common/Makefile:
- * ACEXML/parser/parser/Makefile:
- * ACEXML/parser/Makefile:
- * ACEXML/examples/Makefile:
- * ACEXML/apps/Makefile:
- * ACEXML/apps/svcconf/Makefile:
- * ACEXML/examples/SAXPrint/Makefile:
- * ACEXML/tests/Makefile:
+ * common/Makefile:
+ * parser/parser/Makefile:
+ * parser/Makefile:
+ * examples/Makefile:
+ * apps/Makefile:
+ * apps/svcconf/Makefile:
+ * examples/SAXPrint/Makefile:
+ * tests/Makefile:
Removed old Makefiles.
- * ACEXML/parser/parser/Parser.cpp:
- * ACEXML/common/StreamFactory.cpp:
- * ACEXML/common/ZipCharStream.cpp:
- * ACEXML/common/ZipCharStream.h:
+ * parser/parser/Parser.cpp:
+ * common/StreamFactory.cpp:
+ * common/ZipCharStream.cpp:
+ * common/ZipCharStream.h:
Fixed compilation errors.
Mon Nov 18 20:30:30 2002 Krishnakumar B <kitty@cs.wustl.edu>
- * ACEXML/common/CharStream.h:
- * ACEXML/common/Encoding.cpp:
- * ACEXML/common/FileCharStream.cpp:
- * ACEXML/common/FileCharStream.h:
- * ACEXML/common/StrCharStream.cpp:
- * ACEXML/common/StrCharStream.h:
- * ACEXML/common/HttpCharStream.cpp:
- * ACEXML/common/HttpCharStream.h:
+ * common/CharStream.h:
+ * common/Encoding.cpp:
+ * common/FileCharStream.cpp:
+ * common/FileCharStream.h:
+ * common/StrCharStream.cpp:
+ * common/StrCharStream.h:
+ * common/HttpCharStream.cpp:
+ * common/HttpCharStream.h:
Fixed a number of minor typos and debugging statements.
- * ACEXML/common/LocatorImpl.cpp: Check for a valid string before
+ * common/LocatorImpl.cpp: Check for a valid string before
assigning it to the new Locator.
- * ACEXML/common/NamespaceSupport.cpp:
+ * common/NamespaceSupport.cpp:
Make sure that we don't have a null prefix before trying to
dereference the prefix.
- * ACEXML/common/ZipCharStream.cpp:
- * ACEXML/common/ZipCharStream.h:
+ * common/ZipCharStream.cpp:
+ * common/ZipCharStream.h:
New stream which reads files from a ZIP archive.
- * ACEXML/common/StreamFactory.cpp:
+ * common/StreamFactory.cpp:
Modified to accomodate ZipCharStream.
- * ACEXML/examples/SAXPrint/Print_Handler.cpp:
- * ACEXML/examples/SAXPrint/SAXPrint_Handler.cpp:
- * ACEXML/examples/SAXPrint/main.cpp:
+ * examples/SAXPrint/Print_Handler.cpp:
+ * examples/SAXPrint/SAXPrint_Handler.cpp:
+ * examples/SAXPrint/main.cpp:
Commented out a lot of unnecessary debug statements.
- * ACEXML/parser/parser/Parser.cpp:
- * ACEXML/parser/parser/Parser.h:
+ * parser/parser/Parser.cpp:
+ * parser/parser/Parser.h:
Lots of bugfixes. Finally we parse the XML version of XHTML
specification without dumping core.
Sat Nov 16 21:18:55 2002 Krishnakumar B <kitty@cs.wustl.edu>
- * ACEXML/parser/parser/Parser.cpp:
- * ACEXML/parser/parser/Parser.h:
+ * parser/parser/Parser.cpp:
+ * parser/parser/Parser.h:
More bugs fixed. Add support for parsing PE references within
attribute list declarations and clean up the same. Add support
@@ -809,96 +857,96 @@ Sat Nov 16 21:18:55 2002 Krishnakumar B <kitty@cs.wustl.edu>
Tue Nov 12 19:48:34 2002 Krishnakumar B <kitty@cs.wustl.edu>
- * ACEXML/parser/parser/ParserContext.cpp:
- * ACEXML/parser/parser/ParserContext.h:
- * ACEXML/parser/parser/ParserContext.inl:
+ * parser/parser/ParserContext.cpp:
+ * parser/parser/ParserContext.h:
+ * parser/parser/ParserContext.inl:
New files which hold the ParserContext needed to handle the
switching of input streams on the fly.
- * ACEXML/parser/parser/ParserInternals.cpp:
- * ACEXML/parser/parser/ParserInternals.h:
+ * parser/parser/ParserInternals.cpp:
+ * parser/parser/ParserInternals.h:
Moved some generic code from Parser.cpp to here.
- * ACEXML/apps/svcconf/Makefile:
- * ACEXML/common/Makefile:
- * ACEXML/parser/parser/Makefile:
+ * apps/svcconf/Makefile:
+ * common/Makefile:
+ * parser/parser/Makefile:
Updated dependencies.
- * ACEXML/common/Attributes_Def_Builder.h:
+ * common/Attributes_Def_Builder.h:
No need to typedef in C++.
- * ACEXML/common/DefaultHandler.cpp:
+ * common/DefaultHandler.cpp:
Minor typos.
- * ACEXML/common/Encoding.cpp:
+ * common/Encoding.cpp:
If auto-detection of encoding fails, assume that it is UTF-8.
- * ACEXML/common/Exception.cpp:
+ * common/Exception.cpp:
Change the error message from ACE_DEBUG to ACE_ERROR.
- * ACEXML/common/FileCharStream.cpp: Handle BOM of UTF-8 in
+ * common/FileCharStream.cpp: Handle BOM of UTF-8 in
addition to UTF-16. Cleanup unnecessary parens.
- * ACEXML/common/HttpCharStream.cpp:
- * ACEXML/common/HttpCharStream.h:
+ * common/HttpCharStream.cpp:
+ * common/HttpCharStream.h:
Add support for auto-detection of encoding.
- * ACEXML/common/InputSource.cpp:
- * ACEXML/common/InputSource.h:
+ * common/InputSource.cpp:
+ * common/InputSource.h:
Fixes for use with ACEXML_Parser_Context.
- * ACEXML/common/LocatorImpl.cpp:
- * ACEXML/common/LocatorImpl.h:
+ * common/LocatorImpl.cpp:
+ * common/LocatorImpl.h:
Fixed bug in copy constructor which resulted in locator
information not getting set properly.
- * ACEXML/common/NamespaceSupport.cpp:
- * ACEXML/common/NamespaceSupport.h:
+ * common/NamespaceSupport.cpp:
+ * common/NamespaceSupport.h:
Implement reset() method.
- * ACEXML/common/SAXExceptions.cpp:
+ * common/SAXExceptions.cpp:
Change the error message from ACE_DEBUG to ACE_ERROR.
- * ACEXML/common/StrCharStream.cpp:
+ * common/StrCharStream.cpp:
Handle copying of bytes according to sizeof (ACE_WCHAR).
- * ACEXML/common/StreamFactory.cpp: Create the appropriate stream
+ * common/StreamFactory.cpp: Create the appropriate stream
given an URI. We don't try to normalize the URI here. It is done
in the Parser.
- * ACEXML/common/Transcode.cpp:
- * ACEXML/common/Transcode.i:
+ * common/Transcode.cpp:
+ * common/Transcode.i:
Moved some very big functions from .i to .cpp.
- * ACEXML/examples/SAXPrint/SAXPrint_Handler.cpp:
- * ACEXML/examples/SAXPrint/main.cpp:
+ * examples/SAXPrint/SAXPrint_Handler.cpp:
+ * examples/SAXPrint/main.cpp:
Updates to reflect the new calling convention in the Parser.
- * ACEXML/parser/parser/Entity_Manager.cpp:
- * ACEXML/parser/parser/Entity_Manager.h:
- * ACEXML/parser/parser/Entity_Manager.i:
+ * parser/parser/Entity_Manager.cpp:
+ * parser/parser/Entity_Manager.h:
+ * parser/parser/Entity_Manager.i:
Implemented support for resolving SYSTEM and PUBLIC ids from
the Entity_Manager.
- * ACEXML/parser/parser/Parser.cpp:
- * ACEXML/parser/parser/Parser.h:
- * ACEXML/parser/parser/Parser.i:
+ * parser/parser/Parser.cpp:
+ * parser/parser/Parser.h:
+ * parser/parser/Parser.i:
Implemented support for external parameter and entity
references. Rewrote a lot of the basic parsing functionality to
@@ -908,19 +956,19 @@ Tue Nov 12 19:48:34 2002 Krishnakumar B <kitty@cs.wustl.edu>
Fri Oct 25 15:44:04 2002 Krishnakumar B <kitty@cs.wustl.edu>
- * ACEXML/parser/parser/Parser.i: Handle end-of-line as required by
+ * parser/parser/Parser.i: Handle end-of-line as required by
the spec. Specifically any sequence of 0x0D or 0x0D 0x0A should
be normalized to a 0x0A before passing to the XML processor.
- * ACEXML/parser/parser/Parser.cpp: Remove checks for 0x0D as it is
+ * parser/parser/Parser.cpp: Remove checks for 0x0D as it is
handled tranparently now.
Thu Oct 24 21:06:44 2002 Krishnakumar B <kitty@cs.wustl.edu>
- * ACEXML/common/NamespaceSupport.cpp: Define strings normally and
+ * common/NamespaceSupport.cpp: Define strings normally and
not as an array.
- * ACEXML/common/Attributes_Def_Builder.h: No need to typedef in C++.
+ * common/Attributes_Def_Builder.h: No need to typedef in C++.
Thu Oct 24 01:52:46 2002 Krishnakumar B <kitty@cs.wustl.edu>
@@ -929,41 +977,41 @@ Thu Oct 24 01:52:46 2002 Krishnakumar B <kitty@cs.wustl.edu>
Wed Oct 23 22:24:59 2002 Krishnakumar B <kitty@cs.wustl.edu>
- * ACEXML/parser/parser/Parser.cpp: Fixed a stupid thinko in array
+ * parser/parser/Parser.cpp: Fixed a stupid thinko in array
initialization.
Wed Oct 23 17:27:14 2002 Krishnakumar B <kitty@cs.wustl.edu>
- * ACEXML/common/Encoding.cpp:
- * ACEXML/common/Encoding.h:
+ * common/Encoding.cpp:
+ * common/Encoding.h:
Use UTF-16 instead of UTF-16LE/UTF-16BE as the specification
doesn't require mentioning the endianness of the input.
- * ACEXML/common/Transcode.h: Fixed some minor typos.
+ * common/Transcode.h: Fixed some minor typos.
- * ACEXML/examples/SAXPrint/namespaces.xml: New file which tests
+ * examples/SAXPrint/namespaces.xml: New file which tests
out the namespaces feature much better.
- * ACEXML/apps/svcconf/Makefile:
- * ACEXML/parser/parser/Makefile:
+ * apps/svcconf/Makefile:
+ * parser/parser/Makefile:
Updated dependencies.
- * ACEXML/parser/parser/ParserErrors.h: New file which contains the
+ * parser/parser/ParserErrors.h: New file which contains the
error codes of all the error spit out by the parser.
- * ACEXML/examples/SAXPrint/Print_Handler.cpp:
- * ACEXML/examples/SAXPrint/SAXPrint_Handler.cpp:
+ * examples/SAXPrint/Print_Handler.cpp:
+ * examples/SAXPrint/SAXPrint_Handler.cpp:
Make sure that the characters() function describes the arguments
as start and length instead of start and end.
- * ACEXML/parser/parser/Parser.dsp: Added ParserErrors.h to the
+ * parser/parser/Parser.dsp: Added ParserErrors.h to the
project file.
- * ACEXML/parser/parser/Parser.cpp:
- * ACEXML/parser/parser/Parser.h:
+ * parser/parser/Parser.cpp:
+ * parser/parser/Parser.h:
Use minor codes when reporting error in the parser. This cleans
up a lot of repeated error messages and indenting so that we
diff --git a/ACEXML/common/HttpCharStream.cpp b/ACEXML/common/HttpCharStream.cpp
index b6f5e6aa423..ffb9cee422d 100644
--- a/ACEXML/common/HttpCharStream.cpp
+++ b/ACEXML/common/HttpCharStream.cpp
@@ -119,13 +119,17 @@ ACEXML_HttpCharStream::get_url (size_t& len)
int header_state = HDST_LINE1_PROTOCOL;
int status = 0;
size_t b = 0;
- char* buf = 0;
+ char const * buf = 0;
size_t buflen = BUFSIZ;
for (;;)
{
- if ((buf = const_cast<char*> (this->stream_->recv (buflen))) == 0)
- if (buflen <= 0)
+ buf = this->stream_->recv (buflen);
+
+ if (buf == 0)
+ if (buflen == 0)
break;
+ else
+ continue;
for (b = 0; b < buflen; ++b)
{
@@ -224,12 +228,12 @@ ACEXML_HttpCharStream::get_url (size_t& len)
++b;
// Store the address of the beginning of data. We will use it to seek to
// beginning of the data in the URL.
- char* data_beg = buf + b;
+ char const * const data_beg = buf + b;
buflen = BUFSIZ;
// Get all of the data. Since this is backed by file store, we won't lose
// any of the data.
- while (( buf = const_cast<char*> (this->stream_->recv (buflen))) != 0)
+ while ((buf = this->stream_->recv (buflen)) != 0)
;
// Length of data in the URL.
@@ -318,33 +322,41 @@ ACEXML_HttpCharStream::determine_encoding (void)
if (this->stream_ == 0)
return -1;
- char input[4] = {0, 0, 0, 0};
- int i = 0;
- for (; i < 4 && input[i] != (char)-1; ++i)
- input[i] = static_cast<char> (this->stream_->peek_char(i));
- if (i < 4)
+ char input[] = {0, 0, 0, 0};
+ size_t const len = sizeof (input) / sizeof (input[0]);
+
+ size_t i = 0;
+ for (; i < len && input[i] != static_cast<char> (EOF); ++i)
+ input[i] = this->stream_->peek_char (i);
+
+ if (i < len)
return -1;
- const ACEXML_Char* temp = ACEXML_Encoding::get_encoding (input);
+
+ ACEXML_Char const * const temp = ACEXML_Encoding::get_encoding (input);
+
if (!temp)
return -1;
else
{
if (this->encoding_)
delete [] this->encoding_;
+
this->encoding_ = ACE::strnew (temp);
// ACE_DEBUG ((LM_DEBUG, "URI's encoding is %s\n", this->encoding_));
}
+
// Move over the byte-order-mark if present.
- for (int j = 0; j < 3; ++j)
+ for (size_t j = 0; j < len; ++j)
{
- if (input[i] == '\xFF' || input[i] == '\xFE' || input[i] == '\xEF' ||
- input[i] == '\xBB' || input[i] == '\xBF')
+ if (input[j] == '\xFF' || input[j] == '\xFE' || input[j] == '\xEF' ||
+ input[j] == '\xBB' || input[j] == '\xBF')
{
this->stream_->get_char();
continue;
}
break;
}
+
return 0;
}
diff --git a/ACEXML/common/Mem_Map_Stream.cpp b/ACEXML/common/Mem_Map_Stream.cpp
index 306641cb177..4f19d81809a 100644
--- a/ACEXML/common/Mem_Map_Stream.cpp
+++ b/ACEXML/common/Mem_Map_Stream.cpp
@@ -198,13 +198,14 @@ ACEXML_Mem_Map_Stream::grow_file_and_remap (void)
while (1)
{
n = this->svc_handler_->peer ().recv (buf, sizeof buf, 0, &tv);
- if (n == -1)
+ if (n < 0)
{
if (errno != EWOULDBLOCK)
{
ACE_ERROR ((LM_ERROR, "%p\n", "recv"));
- return -1;
}
+
+ return -1;
}
bytes += n;
if (n == 0 && !bytes)
diff --git a/ACEXML/common/SAXExceptions.cpp b/ACEXML/common/SAXExceptions.cpp
index 89e0cb99ed3..acf9199789a 100644
--- a/ACEXML/common/SAXExceptions.cpp
+++ b/ACEXML/common/SAXExceptions.cpp
@@ -6,13 +6,13 @@
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
-const ACEXML_Char *ACEXML_SAXException::exception_name_ = ACE_TEXT ("ACEXML_SAXException");
+const ACEXML_Char * ACEXML_SAXException::exception_name_ = ACE_TEXT ("ACEXML_SAXException");
-const ACEXML_Char *ACEXML_SAXNotSupportedException::exception_name_ = ACE_TEXT ("ACEXML_SAXNotSupportedException");
+const ACEXML_Char ACEXML_SAXNotSupportedException::exception_name_[] = ACE_TEXT ("ACEXML_SAXNotSupportedException");
-const ACEXML_Char *ACEXML_SAXNotRecognizedException::exception_name_ = ACE_TEXT ("ACEXML_SAXNotRecognizedException");
+const ACEXML_Char ACEXML_SAXNotRecognizedException::exception_name_[] = ACE_TEXT ("ACEXML_SAXNotRecognizedException");
-const ACEXML_Char *ACEXML_SAXParseException::exception_name_ = ACE_TEXT ("ACEXML_SAXParseException");
+const ACEXML_Char ACEXML_SAXParseException::exception_name_[] = ACE_TEXT ("ACEXML_SAXParseException");
#if !defined (__ACEXML_INLINE__)
# include "ACEXML/common/SAXExceptions.inl"
@@ -46,22 +46,16 @@ ACEXML_SAXException::operator= (const ACEXML_SAXException& src)
return *this;
}
-
ACEXML_SAXException*
ACEXML_SAXException::_downcast (ACEXML_Exception* ex)
{
- if (ex->is_a (ACE_TEXT ("ACEXML_SAXException")))
- return dynamic_cast<ACEXML_SAXException*> (ex);
- return 0;
+ return dynamic_cast<ACEXML_SAXException*> (ex);
}
ACEXML_SAXException::~ACEXML_SAXException (void)
{
- delete[] this->message_;
}
-
-
ACEXML_Exception *
ACEXML_SAXException::duplicate (void) const
{
@@ -105,9 +99,7 @@ ACEXML_SAXNotSupportedException::operator= (const
ACEXML_SAXNotSupportedException*
ACEXML_SAXNotSupportedException::_downcast (ACEXML_Exception* ex)
{
- if (ex->is_a (ACE_TEXT ("ACEXML_SAXNotSupportedException")))
- return dynamic_cast<ACEXML_SAXNotSupportedException*> (ex);
- return 0;
+ return dynamic_cast<ACEXML_SAXNotSupportedException*> (ex);
}
ACEXML_SAXNotSupportedException::ACEXML_SAXNotSupportedException (const ACEXML_Char* msg)
@@ -169,14 +161,11 @@ ACEXML_SAXNotRecognizedException::operator= (const ACEXML_SAXNotRecognizedExcept
ACEXML_SAXNotRecognizedException*
ACEXML_SAXNotRecognizedException::_downcast (ACEXML_Exception* ex)
{
- if (ex->is_a (ACE_TEXT ("ACEXML_SAXNotRecognizedException")))
- return dynamic_cast<ACEXML_SAXNotRecognizedException*> (ex);
- return 0;
+ return dynamic_cast<ACEXML_SAXNotRecognizedException*> (ex);
}
ACEXML_SAXNotRecognizedException::~ACEXML_SAXNotRecognizedException (void)
{
- delete[] this->message_;
}
ACEXML_Exception *
@@ -227,9 +216,7 @@ ACEXML_SAXParseException::operator= (const ACEXML_SAXParseException &ex)
ACEXML_SAXParseException*
ACEXML_SAXParseException::_downcast (ACEXML_Exception* ex)
{
- if (ex->is_a (ACE_TEXT ("ACEXML_SAXParseException")))
- return dynamic_cast<ACEXML_SAXParseException*> (ex);
- return 0;
+ return dynamic_cast<ACEXML_SAXParseException*> (ex);
}
ACEXML_SAXParseException::~ACEXML_SAXParseException (void)
diff --git a/ACEXML/common/SAXExceptions.h b/ACEXML/common/SAXExceptions.h
index 5740c0b7760..24bab396440 100644
--- a/ACEXML/common/SAXExceptions.h
+++ b/ACEXML/common/SAXExceptions.h
@@ -66,7 +66,7 @@ public:
virtual void print (void);
protected:
- static const ACEXML_Char *exception_name_;
+ static const ACEXML_Char * exception_name_;
/// A message providing more information about the exception being thrown.
ACEXML_Char *message_;
@@ -111,7 +111,7 @@ public:
virtual void print (void);
protected:
- static const ACEXML_Char *exception_name_;
+ static const ACEXML_Char exception_name_[];
};
/**
@@ -153,7 +153,7 @@ public:
virtual void print (void);
protected:
- static const ACEXML_Char *exception_name_;
+ static const ACEXML_Char exception_name_[];
};
/**
@@ -196,7 +196,7 @@ public:
virtual void print (void);
protected:
- static const ACEXML_Char *exception_name_;
+ static const ACEXML_Char exception_name_[];
};
#if defined (__ACEXML_INLINE__)
diff --git a/ACEXML/common/codecs.mpb b/ACEXML/common/codecs.mpb
index 134e0815539..aea3ee9b7e0 100644
--- a/ACEXML/common/codecs.mpb
+++ b/ACEXML/common/codecs.mpb
@@ -1,7 +1,7 @@
// -*- MPC -*-
// $Id$
-feature(ace_codecs) {
+feature(ace_codecs, !ace_for_tao) {
Source_Files {
XML_Codecs.cpp
}
diff --git a/ChangeLog b/ChangeLog
index a5eca1f4e2d..eb8191b3fc9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,481 @@
+Wed Oct 25 09:47:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/SOCK_Dgram.cpp:
+ Fixed compile error in non win32 part
+
+Wed Oct 25 09:24:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/ace_for_tao.mpc:
+ Added Rtems_init.c, for rtems without network support we
+ also use the ace_for_tao base project
+
+Wed Oct 25 08:38:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/config-rtems.h:
+ * ace/OS_NS_netdb.inl:
+ Added ACE_LACKS_GETHOSTBYADDR_R
+
+Wed Oct 25 08:11:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/config-rtems.h:
+ * ace/OS_NS_sys_socket.inl:
+ Added ACE_LACKS_GETSOCKOPT, ACE_LACKS_RECV, ACE_LACKS_SEND,
+ and ACE_LACKS_SENDTO
+
+Wed Oct 25 08:04:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * tests/Priority_Buffer_Test.cpp:
+ Fixed compile problem with gcc 2.96
+
+Wed Oct 25 07:58:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/config-rtems.h:
+ * ace/OS_NS_sys_socket.inl:
+ Added ACE_LACKS_ACCEPT, ACE_LACKS_CONNECT, ACE_LACKS_GETPEERNAME,
+ ACE_LACKS_GETSOCKNAME
+
+Wed Oct 25 06:30:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/TTY_IO.cpp:
+ Fixed compile error on Vxworks
+
+Tue Oct 24 23:53:08 UTC 2006 Steve Huston <shuston@riverace.com>
+
+ * ace/config-aix-4.x.h: Changed ACE_HAS_PTHREAD_CONTINUE to
+ ACE_HAS_PTHREAD_CONTINUE_NP and ACE_HAS_PTHREAD_SUSPEND to
+ ACE_HAS_PTHREAD_SUSPEND_NP. The non-_NP varieties return ENOTSUP;
+ the _NP varieties are the only documented APIs through AIX 5.3.
+ Thanks to Guy Peleg for raising this issue.
+
+ * tests/Thread_Manager_Test.cpp: Altered the suspend/resume tests to
+ only allow ENOTSUP as a legit result if the config.h file does not
+ include ACE_HAS_... settings that indicate it should work.
+
+Tue Oct 24 23:59:10 UTC 2006 Ossama othman <ossama_othman at symantec dot com>
+
+ * examples/Service_Configurator/IPC-tests/server/Handle_Timeout.inl
+ (init):
+ * examples/Shared_Malloc/test_position_independent_malloc.cpp
+ (parse_args):
+
+ Use intptr_t instead of int when casting to void*. Addresses
+ "sizes do not match" warnings in 64-bit Intel compiler builds.
+
+Tue Oct 24 23:49:25 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/Hash_Map_Manager_T.inl (ACE_Hash_Map_Iterator_Base_Ex):
+
+ Commented out use of ACE_TRACE macro. The regular expression in
+ the bin/fuzz.pl script used to detect ACE_TRACE mismatch
+ incorrectly identifies a mismatch the ACE_TRACE question. Once
+ the fuzz script is fixed, the ACE_TRACE can be uncommented.
+
+Tue Oct 24 22:20:38 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/Truncate.h:
+
+ Rename truncate to trunc. Yet another attempt at fixing Borland
+ compiler brain damage.
+
+Tue Oct 24 22:01:41 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/OS_NS_stdlib.inl (atop):
+
+ Use intptr_t type to fix 64-bit conversion to void* warnings.
+
+ * ace/Select_Reactor_Base.h (max_handlep1):
+ * ace/Select_Reactor_Base.inl (max_handlep1):
+
+ Changed return type to be ACE_HANDLE on UNIX platforms instead
+ of size_t. Addresses "loss of significant bits" warnings in
+ 64-bit Intel compiler builds.
+
+ * ace/Select_Reactor_Base.cpp (dump):
+
+ Corrected format specifiers for Windows configuration.
+
+ * ace/Select_Reactor_T.cpp (work_pending):
+ (wait_for_multiple_events):
+
+ Removed unnecessary casts and corrected type of "width" variable
+ that is passed to select().
+
+ * tests/Map_Manager_Test.cpp (test_cache_map_manager):
+
+ Fixed "might be used uninitialized" warning.
+
+Tue Oct 24 17:46:40 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/Truncate.h (Truncator):
+
+ Export the Borland-specific specializations from the DLL. This
+ should address the "undefined symbol" link-time problem.
+
+ * bin/MakeProjectCreator/config/acexml.mpb:
+
+ Re-disabled ACEXML when ace_for_tao is enabled. ACEXML needs
+ the ACE_Configuration and memory map classes that are not found
+ in the ace_for_tao subset.
+
+Tue Oct 24 14:44:09 UTC 2006 Olli Savia <ops@iki.fi>
+
+ * ace/TTY_IO.cpp:
+
+ Changed the default constructor to always initialise member
+ variables regardless of ACE_HAS_TERMIOS or ACE_HAS_TERMIO setting.
+
+Tue Oct 24 14:16:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/ACE.cpp:
+ Use some bools instead of int
+
+ * ace/INET_Addr.cpp (set_port_number):
+ Added check for ACE_LACKS_HTONS
+
+ * ace/INET_Addr.inl (get_port_number):
+ Added check for ACE_LACKS_NTOHS
+
+Tue Oct 24 13:54:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/os_include/netinet/os_in.h:
+ * ace/config-rtems.h:
+ Added ACE_LACKS_IP_MREQ
+
+ * ace/INET_Addr.cpp (get_port_number_from_name):
+ Added ACE_LACKS_HTONS check
+
+Tue Oct 24 13:27:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/Reactor.h:
+ Added an include of Time_Value.h, this is included implicitly
+ but this implicit include is not there when using FOCUS with
+ tp-reactor specialization
+
+Tue Oct 24 13:09:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/Sock_Connect.cpp:
+ * ace/config-rtems.h:
+ Added ACE_LACKS_GET_BCAST_ADDR
+
+Tue Oct 24 13:00:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/os_include/os_socket.h:
+ * ace/config-rtems.h:
+ Added ACE_LACKS_SOCKADDR
+
+Tue Oct 24 12:54:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/os_include/os_netdb.h:
+ * ace/config-rtems.h:
+ Added ACE_LACKS_HOSTENT
+
+Tue Oct 24 12:09:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/OS_NS_arpa_inet.inl:
+ * ace/config-rtems.h:
+ Added ACE_LACKS_INET_ADDR and ACE_LACKS_INET_NTOA
+
+Tue Oct 24 12:00:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/os_include/sys/os_socket.h:
+ Define MSG_OOB when it is not defined
+
+Tue Oct 24 11:17:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/OS_NS_sys_socket.inl:
+ * ace/config-rtems.h:
+ Added ACE_LACKS_SOCKET, ACE_LACKS_SHUTDOWN and ACE_LACKS_SETSOCKOPT
+
+Tue Oct 24 11:08:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/OS_NS_sys_select.inl:
+ * ace/config-rtems.h:
+ Added ACE_LACKS_SELECT
+
+Tue Oct 24 10:58:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ * ace/os_include/netinet/os_in.h:
+ * ace/config-rtems.h:
+ Added ACE_LACKS_IN_ADDR and ACE_LACKS_SOCKADDR_IN
+
+Tue Oct 24 06:31:05 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/Numeric_Limits.h (ACE_Numeric_Limits):
+
+ Added missing "char" specialization for the
+ ACE_LACKS_NUMERIC_LIMITS case. The "signed char" and
+ "unsigned char" specializations are not always suitable.
+
+Tue Oct 24 04:04:26 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/Hash_Map_Manager_T.h (lock_):
+
+ Placed "mutable" keyword to beginning of declaration. It is a
+ storage class specifier, not a CV qualifier, and belongs at the
+ beginning. Addresses g++ warnings.
+
+ * ace/Sock_Connect.cpp (get_fqdn):
+
+ Addressed "might be used uninitialized warnings.
+
+Mon Oct 23 02:28:42 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/Array_Base.cpp:
+ * ace/Array_Base.h:
+ * ace/Array_Base.inl:
+
+ Added STL-style traits, iterators and swap() method.
+
+ (operator=):
+
+ Improved exception-safety.
+
+ * ace/Array_Map.h:
+ * ace/config-lite.h:
+
+ Moved reverse_iterator declarations to a new
+ ACE_DECLARE_STL_REVERSE_ITERATORS so that other ACE containers
+ may use them in a way that minimizes platform-specific
+ declaration duplication.
+
+ * ace/CDR_Stream.cpp (read_boolean_array):
+
+ Addressed a Coverity CHECKED_RETURN error. There's no need to
+ check the return value of read_boolean() in this case.
+ Explicitly cast the return value to "void".
+
+ Addressed Coverity DEADCODE error. No need to check for zero
+ "cont" pointer since the ACE_NEW_RETURN() call that initializes
+ it will return immediately. "cont" cannot be zero if the latter
+ call succeeds.
+
+ * ace/CDR_Stream.inl (operator>>):
+
+ Explicitly check return value of input stream read operations.
+ Addressed a Coverity CHECKED_RETURN errors.
+
+ * ace/Configuration.cpp (new_section):
+
+ Fixed Coverity USE_AFTER_FREE error. Memory was being accessed
+ after it was freed.
+
+ * ace/Configuration_Import_Export.cpp:
+
+ Addressed Coverity RESOURCE_LEAK errors.
+
+ * ace/Default_Constants.h (ACE_DEFAULT_CLOSE_ALL_HANDLES):
+
+ This symbol represents a boolean value. s/1/true.
+
+ * ace/Dev_Poll_Reactor.cpp (bind):
+ * ace/WFMO_Reactor.cpp (bind_i):
+
+ Disallow binding of a nil event handler pointer to the
+ repository. It is deferenced later on this method.
+
+ * ace/Hash_Map_Manager_T.h:
+ * ace/Hash_Map_Manager_T.inl:
+
+ Added STL-style traits and iterator accessors.
+
+ (find):
+
+ New method that returns an iterator as an "out" parameter. An
+ iterator return value could not be used due a conflict with an
+ existing find() method.
+
+ (unbind):
+
+ New method that unbinds the value pointed to by the given
+ iterator.
+
+ (ACE_Hash_Map_Iterator_Base_Ex, ACE_Hash_Map_Iterator_Ex):
+
+ New constructors that position the iterator at the given
+ ACE_Hash_Map_Entry.
+
+ * ace/Lib_Find.cpp (ldfind):
+
+ Place parentheses around ternary operator "?:" conditional to
+ address an operator precedence problem. In this case, an
+ expression such as "a + b ? 0 : 1" was used, which is equivalent
+ to "(a + b) ? 0 : 1" instead of the desired "a + (b ? 0 : 1)".
+
+ Changed local variable name from "got_suffix" to "has_suffix" to
+ clarify how the variable is being used.
+
+ * ace/OS_NS_Thread.inl (rw_unlock):
+
+ Fixed potential deadlock in case where reference count is one.
+ Addresses a Coverity DEADLOCK error.
+
+ * ace/OS_NS_dirent.cpp (scandir_emulation):
+
+ Fixed potential dereferencing of zero pointer reported by the
+ Coverity FORWARD_NULL checker.
+
+ * ace/OS_NS_fcntl.cpp (open):
+
+ Return if SetFilePointer() call fails. Addresses Coverity
+ CHECKED_RETURN error.
+
+ Added support for large files SetFilePointer() calls. Thanks to
+ Russell Mora for this fix.
+
+ * ace/OS_NS_stdio.cpp (fopen):
+
+ Fixed potential crash if null mode string is passed to this
+ method.
+
+ * ace/OS_NS_stdio.inl (fdopen):
+ * ace/OS_NS_unistd.inl (isatty):
+
+ No need to check for ACE_LACKS_INTPTR_T. Just use intptr_t in
+ all cases. ACE now supplies this typedef if the platform
+ doesn't.
+
+ * ace/OS_TLI.h (t_bind):
+ * ace/OS_TLI.inl (t_bind):
+
+ Work around HP aCC 3.63 namespace scoping problem using typedef
+ hack in use for other structures.
+
+ * ace/Select_Reactor_Base.cpp:
+ * ace/Select_Reactor_Base.h:
+ * ace/Select_Reactor_Base.inl:
+
+ Changed underlying event handler container from a simple array
+ to an ACE_Hash_Map_Manager<> on Windows, and to an
+ ACE_Array_Base<> on UNIX-like platforms.
+
+ Use of an ACE_Hash_Map_Manager<> on Windows allows for faster
+ event handler searches.
+
+ Use of an ACE_Array_Base<> on UNIX-like platforms allows us to
+ leverage advantages using a container (improved
+ exception-safety, container interface, etc), while still
+ retaining the direct file descriptor to event handler mapping at
+ essentially no cost to footprint relative to the previous
+ implementation.
+
+ (bind):
+
+ Disallow binding of a nil event handler pointer to the
+ repository. It is deferenced later on this method. Addresses a
+ potential crash.
+
+ * ace/Service_Config.cpp (current):
+
+ Simplified these methods.
+
+ Removed global lock that was held when accessing TSS. Only
+ initialization of global implementation needs to synchronized
+ with that lock.
+
+ Removed redundant accesses to TSS.
+
+ * ace/Service_Config.h:
+
+ Removed stray semi-colon.
+
+ (impl_):
+
+ This method no longer needs to return the pointer by reference.
+
+ * ace/Service_Repository.cpp:
+
+ Changed loop index type so that it matches repository size type
+ (an unsigned integer), and updated loop decrement to take into
+ account the index type is now unsigned.
+
+ * ace/Sock_Connect.h (ipv4_enabled):
+ * ace/Sock_Connect.cpp (ipv4_enabled):
+
+ New run-time check for existence IPv4 stack. Some hosts only
+ contain IPv6 stacks.
+
+ From Sriram Chandramouli <sriram_chandramouli at symantec dot com>
+ (get_fqdn):
+
+ New method that retrieves fully qualified domain. getaddrinfo()
+ doesn't always provide the desired results.
+
+ * ace/Svc_Conf.y (ace_get_module):
+ * ace/Svc_Conf_y.cpp (ace_get_module):
+
+ Simplified explicit casts.
+
+ Prevent dereferencing of potentially null pointer.
+
+ * ace/System_Time.cpp:
+ * ace/System_Time.h:
+
+ No need to include "ace/Malloc_T.h", "ace/MMAP_Memory_Pool.h"
+ and "ace/Null_Mutex.h". Forward declarations are sufficient.
+
+ Use time_t type instead of ACE_UINT32 when returning times, such
+ as those returned from ACE_OS::time(). Addresses lack of
+ precision issues.
+
+ * ace/Thread_Manager.cpp (wait):
+
+ Addressed a Coverity CHECKED_RETURN error. There's no need to
+ check the return value of ACE_Thread::join() in this case.
+ Explicitly cast the return value to "void".
+
+ * ace/Time_Value.h (ACE_ONE_SECOND_IN_USECONDS):
+
+ Made this constant type-safe. It is now of type suseconds_t,
+ instead of a preprocessor symbol definition.
+
+ * ace/UUID.cpp (lock):
+
+ Addressed USE_AFTER_FREE Coverity error. Do not return a
+ pointer to the previous lock. It may have been destroyed.
+
+ * ace/UUID.h (lock):
+
+ Changed return type from "ACE_SYNCH_MUTEX*" to "void". The
+ interface/implementation does not provide a means to safely
+ return the previous lock instance.
+
+ * ace/ace_wchar.inl (convert):
+
+ Corrected calculation of wide string length.
+
+ * bin/MakeProjectCreator/config/acexml.mpb:
+
+ No longer any need to explicitly disable ACEXML in the
+ ace_for_tao configuration.
+
+ * include/makeinclude/platform_irix6.x_sgic++.GNU:
+
+ SGI 7.3.x compiler doesn't have the 3506 error code. Do not
+ attempt to supress it.
+
+Mon Oct 23 22:24:01 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/Unbounded_Queue.cpp (set):
+
+ Explicitly initialize dummy value. Addresses "use of
+ uninitialized variable" g++ 4.1 warning when the variable is a
+ POD type.
+
+ * ace/ace_for_tao.mpc:
+
+ Removed unnecessary semaphore related files.
+
+ Added missing ace/Truncate.h header.
+
+Mon Oct 23 21:44:32 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * ace/Truncate.h (Truncator):
+
+ Borland doesn't appear to be able to grok the use of the
+ function call operator in the ACE_Utils::Truncate<> function
+ template. Replaced the Truncator<>::operator() function call
+ operator with a static Truncator<>::truncate() method instead.
+
Mon Oct 23 13:29:15 UTC 2006 Olli Savia <ops@iki.fi>
* ACE-INSTALL.html:
@@ -265,11 +743,21 @@ Thu Oct 19 11:48:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
Thu Oct 19 08:27:12 UTC 2006 Martin Corino <mcorino@remedy.nl>
<<<<<<< .working
+<<<<<<< .working
+<<<<<<< .working
* include/makeinclude/platform_openvms.GNU:
Small change to create hardlinks for produced executables.
=======
* include/makeinclude/platform_openvms.GNU:
Small change to create hardlinks for produced executables.
+>>>>>>> .merge-right.r75022
+=======
+ * include/makeinclude/platform_openvms.GNU:
+ Small change to create hardlinks for produced executables.
+>>>>>>> .merge-right.r74993
+=======
+ * include/makeinclude/platform_openvms.GNU:
+ Small change to create hardlinks for produced executables.
>>>>>>> .merge-right.r74951
Wed Oct 18 16:19:38 UTC 2006 Shanshan Jiang <shanshan.jiang@vanderbilt.edu>
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index ae6b1fb8031..771cac93886 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -2603,8 +2603,8 @@ ACE::handle_timed_complete (ACE_HANDLE h,
ex_handles.set_bit (h);
#endif /* ACE_WIN32 */
- int need_to_check = 0;
- int known_failure = 0;
+ bool need_to_check = false;
+ bool known_failure = false;
#if defined (ACE_WIN32)
int n = ACE_OS::select (0, // Ignored on Windows: int (h) + 1,
@@ -2649,8 +2649,8 @@ ACE::handle_timed_complete (ACE_HANDLE h,
// what getsockopt says about the error.
if (ex_handles.is_set (h))
{
- need_to_check = 1;
- known_failure = 1;
+ need_to_check = true;
+ known_failure = true;
}
#elif defined (ACE_VXWORKS)
ACE_UNUSED_ARG (is_tli);
@@ -2658,7 +2658,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
// Force the check on VxWorks. The read handle for "h" is not set,
// so "need_to_check" is false at this point. The write handle is
// set, for what it's worth.
- need_to_check = 1;
+ need_to_check = true;
#else
if (is_tli)
@@ -2672,7 +2672,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
#if defined(AIX)
// AIX is broken... both success and failed connect will set the
// write handle only, so always check.
- need_to_check = 1;
+ need_to_check = true;
#else
# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
need_to_check = (fds.revents & POLLIN);
diff --git a/ace/Array_Base.cpp b/ace/Array_Base.cpp
index ece933009d6..4e3253483bf 100644
--- a/ace/Array_Base.cpp
+++ b/ace/Array_Base.cpp
@@ -16,11 +16,13 @@
#include "ace/Malloc_Base.h"
#include "ace/os_include/os_errno.h"
+#include <algorithm>
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Dynamically initialize an array.
template <class T>
-ACE_Array_Base<T>::ACE_Array_Base (size_t size,
+ACE_Array_Base<T>::ACE_Array_Base (typename ACE_Array_Base<T>::size_type size,
ACE_Allocator *alloc)
: max_size_ (size),
cur_size_ (size),
@@ -33,7 +35,7 @@ ACE_Array_Base<T>::ACE_Array_Base (size_t size,
{
ACE_ALLOCATOR (this->array_,
(T *) this->allocator_->malloc (size * sizeof (T)));
- for (size_t i = 0; i < size; ++i)
+ for (size_type i = 0; i < size; ++i)
new (&array_[i]) T;
}
else
@@ -41,7 +43,7 @@ ACE_Array_Base<T>::ACE_Array_Base (size_t size,
}
template <class T>
-ACE_Array_Base<T>::ACE_Array_Base (size_t size,
+ACE_Array_Base<T>::ACE_Array_Base (typename ACE_Array_Base<T>::size_type size,
const T &default_value,
ACE_Allocator *alloc)
: max_size_ (size),
@@ -55,7 +57,7 @@ ACE_Array_Base<T>::ACE_Array_Base (size_t size,
{
ACE_ALLOCATOR (this->array_,
(T *) this->allocator_->malloc (size * sizeof (T)));
- for (size_t i = 0; i < size; ++i)
+ for (size_type i = 0; i < size; ++i)
new (&array_[i]) T (default_value);
}
else
@@ -75,7 +77,7 @@ ACE_Array_Base<T>::ACE_Array_Base (const ACE_Array_Base<T> &s)
ACE_ALLOCATOR (this->array_,
(T *) this->allocator_->malloc (s.size () * sizeof (T)));
- for (size_t i = 0; i < this->size (); i++)
+ for (size_type i = 0; i < this->size (); ++i)
new (&this->array_[i]) T (s.array_[i]);
}
@@ -90,32 +92,47 @@ ACE_Array_Base<T>::operator= (const ACE_Array_Base<T> &s)
{
if (this->max_size_ < s.size ())
{
- ACE_DES_ARRAY_FREE (this->array_,
- this->max_size_,
- this->allocator_->free,
- T);
- ACE_ALLOCATOR (this->array_,
- (T *) this->allocator_->malloc (s.size () * sizeof (T)));
- this->max_size_ = s.size ();
+ // Need to reallocate memory.
+
+ // Strongly exception-safe assignment.
+ //
+ // Note that we're swapping the allocators here, too.
+ // Should we? Probably. "*this" should be a duplicate of
+ // the "right hand side".
+ ACE_Array_Base<T> tmp (s);
+ this->swap (tmp);
}
else
{
+ // Underlying array is large enough. No need to reallocate
+ // memory.
+ //
+ // "*this" still owns the memory for the underlying array.
+ // Do not swap out the allocator.
+ //
+ // @@ Why don't we just drop the explicit destructor and
+ // placement operator new() calls with a straight
+ // element-by-element assignment? Is the existing
+ // approach more efficient?
+ // -Ossama
+
ACE_DES_ARRAY_NOFREE (this->array_,
s.size (),
T);
- }
- this->cur_size_ = s.size ();
+ this->cur_size_ = s.size ();
- for (size_t i = 0; i < this->size (); i++)
- new (&this->array_[i]) T (s.array_[i]);
+ for (size_type i = 0; i < this->size (); ++i)
+ new (&this->array_[i]) T (s.array_[i]);
+ }
}
}
// Set an item in the array at location slot.
template <class T> int
-ACE_Array_Base<T>::set (const T &new_item, size_t slot)
+ACE_Array_Base<T>::set (const T &new_item,
+ typename ACE_Array_Base<T>::size_type slot)
{
if (this->in_range (slot))
{
@@ -129,7 +146,8 @@ ACE_Array_Base<T>::set (const T &new_item, size_t slot)
// Get an item in the array at location slot.
template <class T> int
-ACE_Array_Base<T>::get (T &item, size_t slot) const
+ACE_Array_Base<T>::get (T &item,
+ typename ACE_Array_Base<T>::size_type slot) const
{
if (this->in_range (slot))
{
@@ -143,7 +161,7 @@ ACE_Array_Base<T>::get (T &item, size_t slot) const
}
template<class T> int
-ACE_Array_Base<T>::max_size (size_t new_size)
+ACE_Array_Base<T>::max_size (typename ACE_Array_Base<T>::size_type new_size)
{
if (new_size > this->max_size_)
{
@@ -152,12 +170,12 @@ ACE_Array_Base<T>::max_size (size_t new_size)
ACE_ALLOCATOR_RETURN (tmp,
(T *) this->allocator_->malloc (new_size * sizeof (T)),
-1);
- for (size_t i = 0; i < this->cur_size_; ++i)
+ for (size_type i = 0; i < this->cur_size_; ++i)
new (&tmp[i]) T (this->array_[i]);
// Initialize the new portion of the array that exceeds the
// previously allocated section.
- for (size_t j = this->cur_size_; j < new_size; j++)
+ for (size_type j = this->cur_size_; j < new_size; ++j)
new (&tmp[j]) T;
ACE_DES_ARRAY_FREE (this->array_,
@@ -173,15 +191,25 @@ ACE_Array_Base<T>::max_size (size_t new_size)
}
template<class T> int
-ACE_Array_Base<T>::size (size_t new_size)
+ACE_Array_Base<T>::size (typename ACE_Array_Base<T>::size_type new_size)
{
- int r = this->max_size (new_size);
+ int const r = this->max_size (new_size);
if (r != 0)
return r;
this->cur_size_ = new_size;
return 0;
}
+template<class T>
+void
+ACE_Array_Base<T>::swap (ACE_Array_Base<T> & rhs)
+{
+ std::swap (this->max_size_ , rhs.max_size_);
+ std::swap (this->cur_size_ , rhs.cur_size_);
+ std::swap (this->array_ , rhs.array_);
+ std::swap (this->allocator_, rhs.allocator_);
+}
+
// ****************************************************************
template <class T> int
diff --git a/ace/Array_Base.h b/ace/Array_Base.h
index 18542bf211e..6108e1be201 100644
--- a/ace/Array_Base.h
+++ b/ace/Array_Base.h
@@ -1,3 +1,5 @@
+// -*- C++ -*-
+
//=============================================================================
/**
* @file Array_Base.h
@@ -21,6 +23,7 @@
#include "ace/Global_Macros.h"
#include "ace/Malloc_Base.h"
+#include <iterator> /* For reverse_iterator adapters */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -41,27 +44,40 @@ class ACE_Array_Base
{
public:
- // Define a "trait"
+ // Old/ACE-style traits.
typedef T TYPE;
typedef ACE_Array_Iterator<T> ITERATOR;
+ // STL-style typedefs/traits.
+ typedef T value_type;
+ typedef value_type * iterator;
+ typedef value_type const * const_iterator;
+ typedef value_type & reference;
+ typedef value_type const & const_reference;
+ typedef value_type * pointer;
+ typedef value_type const * const_pointer;
+ typedef ptrdiff_t difference_type;
+ typedef ACE_Allocator::size_type size_type;
+
+ ACE_DECLARE_STL_REVERSE_ITERATORS
+
// = Initialization and termination methods.
/// Dynamically create an uninitialized array.
- ACE_Array_Base (size_t size = 0,
- ACE_Allocator *the_allocator = 0);
+ ACE_Array_Base (size_type size = 0,
+ ACE_Allocator * the_allocator = 0);
/// Dynamically initialize the entire array to the <default_value>.
- ACE_Array_Base (size_t size,
- const T &default_value,
- ACE_Allocator *the_allocator = 0);
+ ACE_Array_Base (size_type size,
+ T const & default_value,
+ ACE_Allocator * the_allocator = 0);
/**
* The copy constructor performs initialization by making an exact
* copy of the contents of parameter <s>, i.e., *this == s will
* return true.
*/
- ACE_Array_Base (const ACE_Array_Base<T> &s);
+ ACE_Array_Base (ACE_Array_Base<T> const & s);
/**
* Assignment operator performs an assignment by making an exact
@@ -71,7 +87,7 @@ public:
* <max_size_> is < <s.max_size_> we must delete the <array_>,
* reallocate a new <array_>, and then copy the contents of <s>.
*/
- void operator= (const ACE_Array_Base<T> &s);
+ void operator= (ACE_Array_Base<T> const & s);
/// Clean up the array (e.g., delete dynamically allocated memory).
~ACE_Array_Base (void);
@@ -80,15 +96,15 @@ public:
/// Set item in the array at location <slot>. Doesn't
/// perform range checking.
- T &operator [] (size_t slot);
+ T & operator[] (size_type slot);
/// Get item in the array at location <slot>. Doesn't
/// perform range checking.
- const T &operator [] (size_t slot) const;
+ T const & operator[] (size_type slot) const;
/// Set an item in the array at location <slot>. Returns
/// -1 if <slot> is not in range, else returns 0.
- int set (const T &new_item, size_t slot);
+ int set (T const & new_item, size_type slot);
/**
* Get an item in the array at location <slot>. Returns -1 if
@@ -96,20 +112,20 @@ public:
* copies the item. If you want to avoid the copy, you can use
* the const operator [], but then you'll be responsible for range checking.
*/
- int get (T &item, size_t slot) const;
+ int get (T & item, size_type slot) const;
/// Returns the <cur_size_> of the array.
- size_t size (void) const;
+ size_type size (void) const;
/**
* Changes the size of the array to match <new_size>.
* It copies the old contents into the new array.
* Return -1 on failure.
*/
- int size (size_t new_size);
+ int size (size_type new_size);
/// Returns the <max_size_> of the array.
- size_t max_size (void) const;
+ size_type max_size (void) const;
/**
* Changes the size of the array to match <new_size>.
@@ -117,16 +133,45 @@ public:
* Return -1 on failure.
* It does not affect new_size
*/
- int max_size (size_t new_size);
+ int max_size (size_type new_size);
+
+ /**
+ * @name Forward Iterator Accessors
+ *
+ * Forward iterator accessors.
+ */
+ //@{
+ iterator begin (void);
+ iterator end (void);
+ const_iterator begin (void) const;
+ const_iterator end (void) const;
+ //@}
+
+ /**
+ * @name Reverse Iterator Accessors
+ *
+ * Reverse iterator accessors.
+ */
+ //@{
+ reverse_iterator rbegin (void);
+ reverse_iterator rend (void);
+ const_reverse_iterator rbegin (void) const;
+ const_reverse_iterator rend (void) const;
+ //@}
+
+ /// Swap the contents of this array with the given @a array in
+ /// an exception-safe manner.
+ void swap (ACE_Array_Base<T> & array);
protected:
+
/// Returns 1 if <slot> is within range, i.e., 0 >= <slot> <
/// <cur_size_>, else returns 0.
- int in_range (size_t slot) const;
+ bool in_range (size_type slot) const;
/// Maximum size of the array, i.e., the total number of <T> elements
/// in <array_>.
- size_t max_size_;
+ size_type max_size_;
/**
* Current size of the array. This starts out being == to
@@ -135,13 +180,13 @@ protected:
* keeping track of both sizes is to avoid reallocating memory if we
* don't have to.
*/
- size_t cur_size_;
+ size_type cur_size_;
/// Pointer to the array's storage buffer.
- T *array_;
+ value_type * array_;
/// Allocation strategy of the ACE_Array_Base.
- ACE_Allocator *allocator_;
+ ACE_Allocator * allocator_;
friend class ACE_Array_Iterator<T>;
};
diff --git a/ace/Array_Base.inl b/ace/Array_Base.inl
index 3afc27e69b8..849bcc18de2 100644
--- a/ace/Array_Base.inl
+++ b/ace/Array_Base.inl
@@ -2,10 +2,9 @@
//
// $Id$
-// Clean up the array (e.g., delete dynamically allocated memory).
-
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+// Clean up the array (e.g., delete dynamically allocated memory).
template <class T> ACE_INLINE
ACE_Array_Base<T>::~ACE_Array_Base (void)
{
@@ -15,32 +14,88 @@ ACE_Array_Base<T>::~ACE_Array_Base (void)
T);
}
-template <class T> ACE_INLINE size_t
+template <class T>
+ACE_INLINE typename ACE_Array_Base<T>::iterator
+ACE_Array_Base<T>::begin (void)
+{
+ return this->array_;
+}
+
+template <class T>
+ACE_INLINE typename ACE_Array_Base<T>::iterator
+ACE_Array_Base<T>::end (void)
+{
+ return this->array_ + this->cur_size_;
+}
+
+template <class T>
+ACE_INLINE typename ACE_Array_Base<T>::const_iterator
+ACE_Array_Base<T>::begin (void) const
+{
+ return this->array_;
+}
+
+template <class T>
+ACE_INLINE typename ACE_Array_Base<T>::const_iterator
+ACE_Array_Base<T>::end (void) const
+{
+ return this->array_ + this->cur_size_;
+}
+
+template <class T>
+ACE_INLINE typename ACE_Array_Base<T>::reverse_iterator
+ACE_Array_Base<T>::rbegin (void)
+{
+ return reverse_iterator (this->end ());
+}
+
+template <class T>
+ACE_INLINE typename ACE_Array_Base<T>::reverse_iterator
+ACE_Array_Base<T>::rend (void)
+{
+ return reverse_iterator (this->begin ());
+}
+
+template <class T>
+ACE_INLINE typename ACE_Array_Base<T>::const_reverse_iterator
+ACE_Array_Base<T>::rbegin (void) const
+{
+ return const_reverse_iterator (this->end ());
+}
+
+template <class T>
+ACE_INLINE typename ACE_Array_Base<T>::const_reverse_iterator
+ACE_Array_Base<T>::rend (void) const
+{
+ return const_reverse_iterator (this->begin ());
+}
+
+template <class T> ACE_INLINE typename ACE_Array_Base<T>::size_type
ACE_Array_Base<T>::size (void) const
{
return this->cur_size_;
}
-template <class T> ACE_INLINE size_t
+template <class T> ACE_INLINE typename ACE_Array_Base<T>::size_type
ACE_Array_Base<T>::max_size (void) const
{
return this->max_size_;
}
-template <class T> ACE_INLINE int
-ACE_Array_Base<T>::in_range (size_t index) const
+template <class T> ACE_INLINE bool
+ACE_Array_Base<T>::in_range (typename ACE_Array_Base<T>::size_type index) const
{
return index < this->cur_size_;
}
template <class T> ACE_INLINE T &
-ACE_Array_Base<T>::operator[] (size_t index)
+ACE_Array_Base<T>::operator[] (typename ACE_Array_Base<T>::size_type index)
{
return this->array_[index];
}
template <class T> ACE_INLINE const T &
-ACE_Array_Base<T>::operator[] (size_t index) const
+ACE_Array_Base<T>::operator[] (typename ACE_Array_Base<T>::size_type index) const
{
return this->array_[index];
}
diff --git a/ace/Array_Map.h b/ace/Array_Map.h
index 743d6b06ff3..4af28e1565e 100644
--- a/ace/Array_Map.h
+++ b/ace/Array_Map.h
@@ -102,32 +102,7 @@ public:
typedef ptrdiff_t difference_type;
typedef size_t size_type;
-#if ((defined (_MSC_VER) && !defined (_CPPLIB_VER)))
- // the latest Platform SDK's doesn't define a standard's compliant
- // reverse_iterator,
- // It seems when there is no _CPPLIB_VER defined, then we can assume
- // also that the SDK is old.
- typedef std::reverse_iterator<iterator, value_type> reverse_iterator;
- typedef std::reverse_iterator<const_iterator,
- value_type const> const_reverse_iterator;
-#elif defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x580 \
- && defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
- typedef std::reverse_iterator<iterator,
- std::input_iterator_tag,
- value_type,
- reference,
- pointer,
- difference_type> reverse_iterator;
- typedef std::reverse_iterator<const_iterator,
- std::input_iterator_tag,
- value_type const,
- const_reference,
- const_pointer,
- difference_type> const_reverse_iterator;
-#else
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-#endif /* _MSC_VER */
+ ACE_DECLARE_STL_REVERSE_ITERATORS
/// Default Constructor.
/**
@@ -182,14 +157,14 @@ public:
size_type max_size (void) const;
/// Return @c true if the map is empty, else @c false.
- bool is_empty (void) const;
+ bool is_empty (void) const; // ACE style
- /**
+ /**
* Return @c true if the map is empty, else @c false. We recommend
* using @c is_empty() instead since it's more consistent with the
* ACE container naming conventions.
*/
- bool empty (void) const;
+ bool empty (void) const; // STL style
/// Swap the contents of this map with the given @a map in an
/// exception-safe manner.
diff --git a/ace/CDR_Stream.cpp b/ace/CDR_Stream.cpp
index 783730763af..516e4fd2c63 100644
--- a/ace/CDR_Stream.cpp
+++ b/ace/CDR_Stream.cpp
@@ -392,30 +392,23 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb)
this->good_bit_ = false;
ACE_NEW_RETURN (cont,
ACE_Message_Block (i->data_block ()->duplicate ()),
- 0);
+ false);
this->good_bit_ = true;
- if (cont != 0)
- {
- if (this->current_->cont () != 0)
- ACE_Message_Block::release (this->current_->cont ());
- cont->rd_ptr (i->rd_ptr ());
- cont->wr_ptr (i->wr_ptr ());
-
- this->current_->cont (cont);
- this->current_ = cont;
- this->current_is_writable_ = false;
+ if (this->current_->cont () != 0)
+ ACE_Message_Block::release (this->current_->cont ());
+ cont->rd_ptr (i->rd_ptr ());
+ cont->wr_ptr (i->wr_ptr ());
+
+ this->current_->cont (cont);
+ this->current_ = cont;
+ this->current_is_writable_ = false;
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
- this->current_alignment_ =
- (this->current_alignment_ + cont->length ()) % ACE_CDR::MAX_ALIGNMENT;
+ this->current_alignment_ =
+ (this->current_alignment_ + cont->length ()) % ACE_CDR::MAX_ALIGNMENT;
#endif /* ACE_LACKS_CDR_ALIGNMENT */
- }
- else
- {
- this->good_bit_ = false;
- return false;
- }
}
+
return true;
}
@@ -671,15 +664,15 @@ ACE_OutputCDR::write_boolean_array (const ACE_CDR::Boolean* x,
{
// It is hard to optimize this, the spec requires that on the wire
// booleans be represented as a byte with value 0 or 1, but in
- // memoery it is possible (though very unlikely) that a boolean has
+ // memory it is possible (though very unlikely) that a boolean has
// a non-zero value (different from 1).
// We resort to a simple loop.
- const ACE_CDR::Boolean* end = x + length;
+ ACE_CDR::Boolean const * const end = x + length;
- for (const ACE_CDR::Boolean* i = x;
+ for (ACE_CDR::Boolean const * i = x;
i != end && this->good_bit ();
++i)
- this->write_boolean (*i);
+ (void) this->write_boolean (*i);
return this->good_bit ();
}
@@ -862,7 +855,7 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs,
this->start_.wr_ptr (newpos + size);
ACE_CDR::Octet byte_order = 0;
- this->read_octet (byte_order);
+ (void) this->read_octet (byte_order);
this->do_byte_swap_ = (byte_order != ACE_CDR_BYTE_ORDER);
}
else
@@ -1324,11 +1317,11 @@ ACE_InputCDR::read_boolean_array (ACE_CDR::Boolean *x,
// It is hard to optimize this, the spec requires that on the wire
// booleans be represented as a byte with value 0 or 1, but in
- // memoery it is possible (though very unlikely) that a boolean has
+ // memory it is possible (though very unlikely) that a boolean has
// a non-zero value (different from 1).
// We resort to a simple loop.
for (ACE_CDR::ULong i = 0; i != length && this->good_bit_; ++i)
- this->read_boolean (x[i]);
+ (void) this->read_boolean (x[i]);
return this->good_bit_;
}
diff --git a/ace/CDR_Stream.inl b/ace/CDR_Stream.inl
index 9ac90d4ff8f..f2d6724ce7b 100644
--- a/ace/CDR_Stream.inl
+++ b/ace/CDR_Stream.inl
@@ -614,7 +614,7 @@ ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_boolean (ACE_CDR::Boolean& x)
{
ACE_CDR::Octet tmp = 0;
- this->read_octet (tmp);
+ (void) this->read_octet (tmp);
x = tmp ? true : false;
return (ACE_CDR::Boolean) this->good_bit_;
}
@@ -946,8 +946,7 @@ ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_boolean (void)
{
ACE_CDR::Octet tmp;
- this->read_octet (tmp);
- return (ACE_CDR::Boolean) this->good_bit_;
+ return this->read_octet (tmp) && this->good_bit_;
}
ACE_INLINE ACE_CDR::Boolean
@@ -1182,7 +1181,7 @@ operator<< (ACE_OutputCDR &os, const ACE_CDR::WChar *x)
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_boolean x)
{
- os.write_boolean (x.val_);
+ (void) os.write_boolean (x.val_);
return (ACE_CDR::Boolean) os.good_bit ();
}
@@ -1229,7 +1228,7 @@ operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wstring x)
if (x.val_ != 0)
{
- len = static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x.val_));
+ len = static_cast<ACE_CDR::ULong> (ACE_OS::strlen (x.val_));
}
os.write_wstring (len, x.val_);
@@ -1242,136 +1241,120 @@ operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wstring x)
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::Char &x)
{
- is.read_char (x);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_char (x) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::Short &x)
{
- is.read_short (x);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_short (x) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::UShort &x)
{
- is.read_ushort (x);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_ushort (x) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>>(ACE_InputCDR &is, ACE_CDR::Long &x)
{
- is.read_long (x);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_long (x) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::ULong &x)
{
- is.read_ulong (x);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_ulong (x) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR& is, ACE_CDR::LongLong &x)
{
- is.read_longlong (x);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_longlong (x) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR& is, ACE_CDR::ULongLong &x)
{
- is.read_ulonglong (x);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_ulonglong (x) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR& is, ACE_CDR::LongDouble &x)
{
- is.read_longdouble (x);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_longdouble (x) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::Float &x)
{
- is.read_float (x);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_float (x) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::Double &x)
{
- is.read_double (x);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_double (x) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::Char *&x)
{
- is.read_string (x);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_string (x) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::WChar *&x)
{
- is.read_wstring (x);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_wstring (x) && is.good_bit ();
}
// The following use the helper classes
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_boolean x)
{
- is.read_boolean (x.ref_);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_boolean (x.ref_);
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_char x)
{
- is.read_char (x.ref_);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_char (x.ref_) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wchar x)
{
- is.read_wchar (x.ref_);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_wchar (x.ref_) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_octet x)
{
- is.read_octet (x.ref_);
- return (ACE_CDR::Boolean) is.good_bit ();
+ return is.read_octet (x.ref_) && is.good_bit ();
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_string x)
{
- is.read_string (const_cast<char *&> (x.val_));
// check if the bounds are satisfied
return
- (ACE_CDR::Boolean) (is.good_bit ()
- && (!x.bound_
- || ACE_OS::strlen (x.val_) <= x.bound_));
+ (is.read_string (const_cast<char *&> (x.val_))
+ && is.good_bit ()
+ && (!x.bound_
+ || ACE_OS::strlen (x.val_) <= x.bound_));
}
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_wstring x)
{
- is.read_wstring (const_cast<ACE_CDR::WChar *&> (x.val_));
// check if the bounds are satisfied
return
- (ACE_CDR::Boolean) (is.good_bit ()
- && (!x.bound_
- || ACE_OS::strlen (x.val_) <= x.bound_));
+ (is.read_wstring (const_cast<ACE_CDR::WChar *&> (x.val_))
+ && is.good_bit ()
+ && (!x.bound_
+ || ACE_OS::strlen (x.val_) <= x.bound_));
}
// ***************************************************************************
diff --git a/ace/Configuration.cpp b/ace/Configuration.cpp
index 07e1eb0a12b..3201b66bd4a 100644
--- a/ace/Configuration.cpp
+++ b/ace/Configuration.cpp
@@ -1513,23 +1513,18 @@ ACE_Configuration_Heap::new_section (const ACE_TString& section,
// entry with the same name.
return_value = this->index_->bind (name, entry, this->allocator_);
- if (return_value == 1)
+ if (return_value == 1 /* Entry already existed so bind failed. */
+ || return_value == -1 /* Unable to bind for other reasons. */)
{
- // Entry already existed so bind failed. Free our dynamically
- // allocated memory.
- this->allocator_->free ((void *) ptr);
+ // Free our dynamically allocated memory.
+ this->allocator_->free (static_cast<void *> (ptr));
return return_value;
}
- if (return_value == -1)
- // Free our dynamically allocated memory.
- this->allocator_->free ((void *) ptr);
- else
- // If bind () succeed, it will automatically sync
- // up the map manager entry. However, we must sync up our
- // name/value memory.
- this->allocator_->sync (ptr, section_len);
-
+ // If bind () succeed, it will automatically sync
+ // up the map manager entry. However, we must sync up our
+ // name/value memory.
+ this->allocator_->sync (ptr, section_len);
}
// set the result
diff --git a/ace/Configuration_Import_Export.cpp b/ace/Configuration_Import_Export.cpp
index d3599af834f..7c5ee7fb03c 100644
--- a/ace/Configuration_Import_Export.cpp
+++ b/ace/Configuration_Import_Export.cpp
@@ -1,6 +1,7 @@
// $Id$
#include "ace/Configuration_Import_Export.h"
+#include "ace/OS_Errno.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_ctype.h"
#include "ace/OS_NS_string.h"
@@ -42,7 +43,13 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename)
u_int buffer_size = 4096;
u_int read_pos = 0;
ACE_TCHAR *buffer;
- ACE_NEW_RETURN (buffer, ACE_TCHAR[buffer_size], -1);
+ ACE_NEW_NORETURN (buffer, ACE_TCHAR[buffer_size]);
+ if (!buffer)
+ {
+ ACE_Errno_Guard guard (errno);
+ (void) ACE_OS::fclose (in);
+ return -1;
+ }
ACE_Configuration_Section_Key section;
ACE_TCHAR *end = 0;
@@ -55,7 +62,14 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename)
{
// allocate a new buffer - double size the previous one
ACE_TCHAR *temp_buffer;
- ACE_NEW_RETURN (temp_buffer, ACE_TCHAR[buffer_size * 2], -1);
+ ACE_NEW_NORETURN (temp_buffer, ACE_TCHAR[buffer_size * 2]);
+ if (!temp_buffer)
+ {
+ ACE_Errno_Guard guard (errno);
+ delete [] buffer;
+ (void) ACE_OS::fclose (in);
+ return -1;
+ }
// copy the beginnning of the line
ACE_OS::memcpy (temp_buffer, buffer, buffer_size);
diff --git a/ace/Default_Constants.h b/ace/Default_Constants.h
index fc4fa801f89..15aeb799399 100644
--- a/ace/Default_Constants.h
+++ b/ace/Default_Constants.h
@@ -30,7 +30,7 @@
// the ACE tests and applications. You can change these values by
// defining the macros in your config.h file.
# if !defined (ACE_DEFAULT_CLOSE_ALL_HANDLES)
-# define ACE_DEFAULT_CLOSE_ALL_HANDLES 1
+# define ACE_DEFAULT_CLOSE_ALL_HANDLES true
# endif /* ACE_DEFAULT_CLOSE_ALL_HANDLES */
// The maximum length for a fully qualified Internet name.
diff --git a/ace/Dev_Poll_Reactor.cpp b/ace/Dev_Poll_Reactor.cpp
index d676a3c5df7..57e1367f016 100644
--- a/ace/Dev_Poll_Reactor.cpp
+++ b/ace/Dev_Poll_Reactor.cpp
@@ -694,6 +694,9 @@ ACE_Dev_Poll_Reactor_Handler_Repository::bind (
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::bind");
+ if (event_handler == 0)
+ return -1;
+
if (handle == ACE_INVALID_HANDLE)
handle = event_handler->get_handle ();
@@ -709,7 +712,7 @@ ACE_Dev_Poll_Reactor_Handler_Repository::bind (
int
ACE_Dev_Poll_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
- bool decr_refcnt)
+ bool decr_refcnt)
{
ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::unbind");
@@ -1187,7 +1190,7 @@ ACE_Dev_Poll_Reactor::handle_events_i (ACE_Time_Value *max_wait_time,
{
result = this->work_pending_i (max_wait_time);
if (result == -1)
- ACE_ERROR((LM_ERROR, "%t: %p\n", "work_pending_i"));
+ ACE_ERROR((LM_ERROR, "%t: %p\n", "work_pending_i"));
}
while (result == -1 && this->restart_ != 0 && errno == EINTR);
diff --git a/ace/Hash_Map_Manager_T.h b/ace/Hash_Map_Manager_T.h
index 7178754a8ba..4d6e6e4d9e6 100644
--- a/ace/Hash_Map_Manager_T.h
+++ b/ace/Hash_Map_Manager_T.h
@@ -149,6 +149,17 @@ public:
typedef ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
reverse_iterator;
+ // = STL-style typedefs/traits.
+ typedef EXT_ID key_type;
+ typedef INT_ID data_type;
+ typedef ACE_Hash_Map_Entry<EXT_ID, INT_ID> value_type;
+ typedef value_type & reference;
+ typedef value_type const & const_reference;
+ typedef value_type * pointer;
+ typedef value_type const * const_pointer;
+// typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+
// = Initialization and termination methods.
/**
@@ -322,6 +333,13 @@ public:
int find (const EXT_ID &ext_id,
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) const;
+ /// Locate <ext_id> and pass out an iterator that points to its
+ /// corresponding value.
+ /**
+ * @param pos @a pos will be set to @c end() if not found.
+ */
+ void find (EXT_ID const & ext_id, iterator & pos) const;
+
/**
* Unbind (remove) the <ext_id> from the map. Don't return the
* <int_id> to the caller (this is useful for collections where the
@@ -335,10 +353,26 @@ public:
int unbind (const EXT_ID &ext_id,
INT_ID &int_id);
- /// Remove entry from map. Return 0 if the unbind was successfully,
- /// and returns -1 if failures occur.
+ /// Remove entry from map.
+ /**
+ * This unbind operation is fast relative to those that accept an
+ * external ID parameter since no map lookup is performed.
+ *
+ * @return 0 if the unbind was successful, and -1 if failures
+ * occur.
+ */
int unbind (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry);
+ /// Remove entry from map pointed to by @c iterator @a pos.
+ /**
+ * This unbind operation is fast relative to those that accept an
+ * external ID parameter since no map lookup is performed.
+ *
+ * @return 0 if the unbind was successful, and -1 if failures
+ * occur.
+ */
+ int unbind (iterator pos);
+
/// Returns the current number of ACE_Hash_Map_Entry objects in the
/// hash table.
size_t current_size (void) const;
@@ -363,12 +397,16 @@ public:
// = STL styled iterator factory functions.
/// Return forward iterator.
- ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> begin (void);
- ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> end (void);
+ iterator begin (void);
+ iterator end (void);
+ const_iterator begin (void) const;
+ const_iterator end (void) const;
/// Return reverse iterator.
- ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> rbegin (void);
- ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> rend (void);
+ reverse_iterator rbegin (void);
+ reverse_iterator rend (void);
+// const_reverse_iterator rbegin (void) const;
+// const_reverse_iterator rend (void) const;
protected:
// = The following methods do the actual work.
@@ -484,7 +522,7 @@ protected:
/// Synchronization variable for the MT_SAFE
/// @c ACE_Hash_Map_Manager_Ex.
- ACE_LOCK lock_;
+ mutable ACE_LOCK lock_;
/// Function object used for hashing keys.
HASH_KEY hash_key_;
@@ -538,10 +576,32 @@ class ACE_Hash_Map_Iterator_Base_Ex
{
public:
// = Initialization method.
- /// Contructor. If head != 0, the iterator constructed is positioned
- /// at the head of the map, it is positioned at the end otherwise.
- ACE_Hash_Map_Iterator_Base_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
- int head);
+ /// Contructor.
+ /**
+ * If @a head != @c false, the iterator constructed is positioned
+ * at the head of the map. It is positioned at the end otherwise.
+ * @par
+ */
+ ACE_Hash_Map_Iterator_Base_Ex (
+ ACE_Hash_Map_Manager_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK> &mm,
+ bool head);
+
+ /// Contructor.
+ /**
+ * This constructor positions the iterator to the given @a entry.
+ */
+ ACE_Hash_Map_Iterator_Base_Ex (
+ ACE_Hash_Map_Manager_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK> & mm,
+ ACE_Hash_Map_Entry<EXT_ID, INT_ID> * entry,
+ size_t index);
// = ITERATION methods.
@@ -679,6 +739,19 @@ public:
ACE_Hash_Map_Iterator_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
int tail = 0);
+ /// Contructor.
+ /**
+ * This constructor positions the iterator to the given @a entry.
+ */
+ ACE_Hash_Map_Iterator_Ex (
+ ACE_Hash_Map_Manager_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK> & mm,
+ ACE_Hash_Map_Entry<EXT_ID, INT_ID> * entry,
+ size_t index);
+
// = Iteration methods.
/// Move forward by one element in the set. Returns 0 when all the
/// items in the set have been seen, else 1.
diff --git a/ace/Hash_Map_Manager_T.inl b/ace/Hash_Map_Manager_T.inl
index e3e14a4a490..dbb68c7781a 100644
--- a/ace/Hash_Map_Manager_T.inl
+++ b/ace/Hash_Map_Manager_T.inl
@@ -163,6 +163,26 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbin
return this->unbind_i (ext_id, int_id);
}
+template <class EXT_ID,
+ class INT_ID,
+ class HASH_KEY,
+ class COMPARE_KEYS,
+ class ACE_LOCK>
+ACE_INLINE int
+ACE_Hash_Map_Manager_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK>::unbind (
+ typename ACE_Hash_Map_Manager_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK>::iterator pos)
+{
+ return this->unbind (&(*pos));
+}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::unbind (const EXT_ID &ext_id)
{
@@ -212,7 +232,7 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find
const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
(this);
- ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1);
+ ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
return nc_this->find_i (ext_id, int_id);
}
@@ -224,7 +244,7 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find
const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
(this);
- ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1);
+ ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
return nc_this->find_i (ext_id);
}
@@ -245,7 +265,7 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::find
const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
(this);
- ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, nc_this->lock_, -1);
+ ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
return nc_this->find_i (ext_id, entry);
}
@@ -353,33 +373,61 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rebin
}
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
-ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
+typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::iterator
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::begin (void)
{
- return ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this);
+ return iterator (*this);
}
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
-ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
+typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::iterator
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::end (void)
{
- return ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1);
+ return iterator (*this, 1);
}
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
-ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
+typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::const_iterator
+ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::begin (void) const
+{
+ return const_iterator (*this);
+}
+
+template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
+typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::const_iterator
+ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::end (void) const
+{
+ return const_iterator (*this, 1);
+}
+
+template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
+typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_iterator
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rbegin (void)
{
- return ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this);
+ return reverse_iterator (*this);
}
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
-ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>
+typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::reverse_iterator
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rend (void)
{
- return ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> (*this, 1);
+ return reverse_iterator (*this, 1);
}
+// template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
+// typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::const_reverse_iterator
+// ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rbegin (void) const
+// {
+// return const_reverse_iterator (*this);
+// }
+
+// template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
+// typename ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::const_reverse_iterator
+// ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::rend (void) const
+// {
+// return const_reverse_iterator (*this, 1);
+// }
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Entry<EXT_ID, INT_ID> *
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::table (void)
@@ -394,20 +442,94 @@ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::cur_s
return this->cur_size_;
}
-template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
-ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Base_Ex (ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> &mm,
- int head)
+template <class EXT_ID,
+ class INT_ID,
+ class HASH_KEY,
+ class COMPARE_KEYS,
+ class ACE_LOCK>
+ACE_INLINE void
+ACE_Hash_Map_Manager_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK>::find (
+ EXT_ID const &ext_id,
+ typename ACE_Hash_Map_Manager_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK>::iterator & pos) const
+{
+ ENTRY * entry = 0;
+ size_t index = 0;
+
+ ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *nc_this =
+ const_cast <ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK> *>
+ (this);
+
+ ACE_READ_GUARD (ACE_LOCK, ace_mon, this->lock_);
+
+ if (nc_this->shared_find (ext_id, entry, index) != -1)
+ pos = iterator (*nc_this, entry, index);
+ else
+ pos = nc_this->end ();
+}
+
+// ---------------------------------------------------------------------
+
+template <class EXT_ID,
+ class INT_ID,
+ class HASH_KEY,
+ class COMPARE_KEYS,
+ class ACE_LOCK>
+ACE_INLINE
+ACE_Hash_Map_Iterator_Base_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK>::ACE_Hash_Map_Iterator_Base_Ex (
+ ACE_Hash_Map_Manager_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK> &mm,
+ bool head)
: map_man_ (&mm),
- index_ (head != 0 ? -1 : (ssize_t) mm.total_size_),
+ index_ (head ? -1 : (ssize_t) mm.total_size_),
next_ (0)
{
- ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Base_Ex");
+// ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Iterator_Base_Ex");
if (mm.table_ != 0)
- this->next_ = &mm.table_[head != 0 ? 0 : mm.total_size_ - 1];
+ this->next_ = &mm.table_[head ? 0 : mm.total_size_ - 1];
+}
+
+template <class EXT_ID,
+ class INT_ID,
+ class HASH_KEY,
+ class COMPARE_KEYS,
+ class ACE_LOCK>
+ACE_INLINE
+ACE_Hash_Map_Iterator_Base_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK>::ACE_Hash_Map_Iterator_Base_Ex (
+ ACE_Hash_Map_Manager_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK> & mm,
+ ACE_Hash_Map_Entry<EXT_ID, INT_ID> * entry,
+ size_t index)
+ : map_man_ (&mm)
+ , index_ (static_cast<ssize_t> (index))
+ , next_ (entry)
+{
}
-template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
+template <class EXT_ID,
+ class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *&entry) const
{
ACE_TRACE ("ACE_Hash_Map_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::next");
@@ -613,6 +735,34 @@ ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_
this->forward_i ();
}
+template <class EXT_ID,
+ class INT_ID,
+ class HASH_KEY,
+ class COMPARE_KEYS,
+ class ACE_LOCK>
+ACE_INLINE
+ACE_Hash_Map_Iterator_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK>::ACE_Hash_Map_Iterator_Ex (
+ ACE_Hash_Map_Manager_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK> & mm,
+ ACE_Hash_Map_Entry<EXT_ID, INT_ID> * entry,
+ size_t index)
+ : ACE_Hash_Map_Iterator_Base_Ex<EXT_ID,
+ INT_ID,
+ HASH_KEY,
+ COMPARE_KEYS,
+ ACE_LOCK> (mm,
+ entry,
+ index)
+{
+}
+
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
ACE_Hash_Map_Iterator_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::advance (void)
{
diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp
index b8c0da25092..46c43be7daf 100644
--- a/ace/INET_Addr.cpp
+++ b/ace/INET_Addr.cpp
@@ -317,9 +317,13 @@ ACE_INET_Addr::set (u_short port_number,
struct in_addr addrv4;
if (ACE_OS::inet_aton (host_name,
&addrv4) == 1)
+# if !defined (ACE_LACKS_NTOHL)
return this->set (port_number,
encode ? ntohl (addrv4.s_addr) : addrv4.s_addr,
encode);
+# else
+ return -1;
+# endif /* ACE_LACKS_NTOHL */
else
{
# if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME)
@@ -342,9 +346,13 @@ ACE_INET_Addr::set (u_short port_number,
(void) ACE_OS::memcpy ((void *) &addrv4.s_addr,
hp->h_addr,
hp->h_length);
+# if !defined (ACE_LACKS_NTOHL)
return this->set (port_number,
encode ? ntohl (addrv4.s_addr) : addrv4.s_addr,
encode);
+# else
+ return -1;
+# endif /* ACE_LACKS_NTOHL */
}
}
#endif /* ACE_HAS_IPV6 */
@@ -357,6 +365,7 @@ static int get_port_number_from_name (const char port_name[],
{
int port_number = 0;
+#if !defined (ACE_LACKS_HTONS)
// Maybe port_name is directly a port number?
char *endp = 0;
port_number = static_cast<int> (ACE_OS::strtol (port_name, &endp, 10));
@@ -370,6 +379,7 @@ static int get_port_number_from_name (const char port_name[],
n = htons (n);
return n;
}
+#endif
// We try to resolve port number from its name.
@@ -625,12 +635,18 @@ ACE_INET_Addr::ACE_INET_Addr (const char port_name[],
: ACE_Addr (this->determine_type(), sizeof (inet_addr_))
{
ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr");
+#if !defined (ACE_LACKS_HTONL)
this->reset ();
if (this->set (port_name,
htonl (inet_address),
protocol) == -1)
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("ACE_INET_Addr::ACE_INET_Addr")));
+#else
+ ACE_UNUSED_ARG (port_name);
+ ACE_UNUSED_ARG (inet_address);
+ ACE_UNUSED_ARG (protocol);
+#endif
}
#if defined (ACE_HAS_WCHAR)
@@ -730,8 +746,12 @@ ACE_INET_Addr::set_port_number (u_short port_number,
{
ACE_TRACE ("ACE_INET_Addr::set_port_number");
+#if !defined (ACE_LACKS_HTONS)
if (encode)
port_number = htons (port_number);
+#else
+ ACE_UNUSED_ARG (encode);
+#endif /* ACE_LACKS_HTONS */
#if defined (ACE_HAS_IPV6)
if (this->get_type () == AF_INET6)
@@ -844,7 +864,7 @@ int ACE_INET_Addr::set_address (const char *ip_addr,
if (this->get_type () == AF_INET && map == 0) {
this->base_set (AF_INET, sizeof (this->inet_addr_.in4_));
#ifdef ACE_HAS_SOCKADDR_IN_SIN_LEN
- this->inet_addr_.in4_.sin_len = sizeof (this->inet_addr_.in4_);
+ this->inet_addr_.in4_.sin_len = sizeof (this->inet_addr_.in4_);
#endif
this->inet_addr_.in4_.sin_family = AF_INET;
this->set_size (sizeof (this->inet_addr_.in4_));
@@ -858,7 +878,7 @@ int ACE_INET_Addr::set_address (const char *ip_addr,
// this->set_type (AF_INET);
this->base_set (AF_INET, sizeof (this->inet_addr_.in4_));
#ifdef ACE_HAS_SOCKADDR_IN_SIN_LEN
- this->inet_addr_.in4_.sin_len = sizeof (this->inet_addr_.in4_);
+ this->inet_addr_.in4_.sin_len = sizeof (this->inet_addr_.in4_);
#endif
this->inet_addr_.in4_.sin_family = AF_INET;
this->set_size (sizeof (this->inet_addr_.in4_));
@@ -871,7 +891,7 @@ int ACE_INET_Addr::set_address (const char *ip_addr,
{
this->base_set (AF_INET6, sizeof (this->inet_addr_.in6_));
#ifdef ACE_HAS_SOCKADDR_IN6_SIN6_LEN
- this->inet_addr_.in6_.sin6_len = sizeof (this->inet_addr_.in6_);
+ this->inet_addr_.in6_.sin6_len = sizeof (this->inet_addr_.in6_);
#endif
this->inet_addr_.in6_.sin6_family = AF_INET6;
this->set_size (sizeof (this->inet_addr_.in6_));
@@ -1083,7 +1103,11 @@ ACE_INET_Addr::get_ip_address (void) const
return 0;
}
#endif /* ACE_HAS_IPV6 */
+#if !defined (ACE_LACKS_NTOHL)
return ntohl (ACE_UINT32 (this->inet_addr_.in4_.sin_addr.s_addr));
+#else
+ return 0;
+#endif /* ACE_LACKS_NTOHL */
}
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/INET_Addr.inl b/ace/INET_Addr.inl
index 583f3a8747e..d87974675d8 100644
--- a/ace/INET_Addr.inl
+++ b/ace/INET_Addr.inl
@@ -88,7 +88,9 @@ ACE_INLINE u_short
ACE_INET_Addr::get_port_number (void) const
{
ACE_TRACE ("ACE_INET_Addr::get_port_number");
-#if defined (ACE_HAS_IPV6)
+#if defined (ACE_LACKS_NTOHS)
+ ACE_NOTSUP_RETURN (0);
+#elif defined (ACE_HAS_IPV6)
if (this->get_type () == PF_INET)
return ntohs (this->inet_addr_.in4_.sin_port);
else
diff --git a/ace/Lib_Find.cpp b/ace/Lib_Find.cpp
index 9a1f286b731..3f6e5c5a237 100644
--- a/ace/Lib_Find.cpp
+++ b/ace/Lib_Find.cpp
@@ -248,7 +248,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
ACE_OS::strcpy (searchpathname, tempcopy);
}
- int got_suffix = 0;
+ bool has_suffix = false;
// Check to see if this has an appropriate DLL suffix for the OS
// platform.
@@ -259,7 +259,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
if (s != 0)
{
// If we have a dot, we have a suffix
- got_suffix = 1;
+ has_suffix = true;
// Check whether this matches the appropriate platform-specific
// suffix.
@@ -281,8 +281,8 @@ ACE::ldfind (const ACE_TCHAR* filename,
// Make sure we've got enough space in searchfilename.
if (ACE_OS::strlen (searchfilename)
+ ACE_OS::strlen (ACE_DLL_PREFIX)
- + got_suffix ? 0 : ACE_OS::strlen (dll_suffix) >= (sizeof searchfilename /
- sizeof (ACE_TCHAR)))
+ + (has_suffix ? 0 : ACE_OS::strlen (dll_suffix))
+ >= (sizeof searchfilename / sizeof (ACE_TCHAR)))
{
errno = ENOMEM;
return -1;
@@ -290,7 +290,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK)
size_t len_searchfilename = ACE_OS::strlen (searchfilename);
- if (! got_suffix)
+ if (! has_suffix)
ACE_OS::strcpy (searchfilename + len_searchfilename,
decorator);
@@ -323,7 +323,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
ACE_LIB_TEXT ("%s%s%s"),
searchpathname,
searchfilename,
- got_suffix ? ACE_LIB_TEXT ("") : dll_suffix);
+ has_suffix ? ACE_LIB_TEXT ("") : dll_suffix);
if (ACE_OS::access (pathname, F_OK) == 0)
return 0;
@@ -333,7 +333,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
searchpathname,
ACE_DLL_PREFIX,
searchfilename,
- got_suffix ? ACE_LIB_TEXT ("") : dll_suffix);
+ has_suffix ? ACE_LIB_TEXT ("") : dll_suffix);
if (ACE_OS::access (pathname, F_OK) == 0)
return 0;
}
@@ -474,7 +474,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
path_entry,
ACE_DIRECTORY_SEPARATOR_CHAR,
searchfilename,
- got_suffix ? ACE_LIB_TEXT ("") : dll_suffix);
+ has_suffix ? ACE_LIB_TEXT ("") : dll_suffix);
if (ACE_OS::access (pathname, F_OK) == 0)
break;
@@ -486,7 +486,7 @@ ACE::ldfind (const ACE_TCHAR* filename,
ACE_DIRECTORY_SEPARATOR_CHAR,
ACE_DLL_PREFIX,
searchfilename,
- got_suffix ? ACE_LIB_TEXT ("") : dll_suffix);
+ has_suffix ? ACE_LIB_TEXT ("") : dll_suffix);
if (ACE_OS::access (pathname, F_OK) == 0)
break;
diff --git a/ace/Numeric_Limits.h b/ace/Numeric_Limits.h
index e85dd263db8..863c576059e 100644
--- a/ace/Numeric_Limits.h
+++ b/ace/Numeric_Limits.h
@@ -68,6 +68,15 @@ template <typename T> struct ACE_Numeric_Limits;
// ------------------------------------------
+// Special cases.
+template<>
+struct ACE_Export ACE_Numeric_Limits<char>
+{
+ static char min (void) { return CHAR_MIN; }
+ static char max (void) { return CHAR_MAX; }
+};
+
+// ------------------------------------------
// Signed integers.
template<>
diff --git a/ace/OS_NS_Thread.inl b/ace/OS_NS_Thread.inl
index f74ec06f627..d9372f5ddb0 100644
--- a/ace/OS_NS_Thread.inl
+++ b/ace/OS_NS_Thread.inl
@@ -1186,8 +1186,10 @@ ACE_OS::rw_unlock (ACE_rwlock_t *rw)
else if (rw->ref_count_ == -1) // Releasing a writer.
rw->ref_count_ = 0;
else
- return -1; // @@ ACE_ASSERT (!"count should not be 0!\n");
-
+ {
+ (void) ACE_OS::mutex_unlock (&rw->lock_);
+ return -1; // @@ ACE_ASSERT (!"count should not be 0!\n");
+ }
int result = 0;
ACE_Errno_Guard error (errno);
@@ -1210,7 +1212,7 @@ ACE_OS::rw_unlock (ACE_rwlock_t *rw)
error = errno;
}
- ACE_OS::mutex_unlock (&rw->lock_);
+ (void) ACE_OS::mutex_unlock (&rw->lock_);
return result;
# endif /* ! ace_lacks_rwlock_t */
#else
diff --git a/ace/OS_NS_arpa_inet.inl b/ace/OS_NS_arpa_inet.inl
index 63774a1a5ef..547d30cdaf1 100644
--- a/ace/OS_NS_arpa_inet.inl
+++ b/ace/OS_NS_arpa_inet.inl
@@ -11,7 +11,10 @@ ACE_INLINE unsigned long
ACE_OS::inet_addr (const char *name)
{
ACE_OS_TRACE ("ACE_OS::inet_addr");
-#if defined (ACE_HAS_NONCONST_GETBY)
+#if defined (ACE_LACKS_INET_ADDR)
+ ACE_UNUSED_ARG (name);
+ ACE_NOTSUP_RETURN (0);
+#elif defined (ACE_HAS_NONCONST_GETBY)
return ::inet_addr (const_cast <char*> (name));
#else
return ::inet_addr (name);
@@ -22,9 +25,14 @@ ACE_INLINE char *
ACE_OS::inet_ntoa (const struct in_addr addr)
{
ACE_OS_TRACE ("ACE_OS::inet_ntoa");
+#if defined (ACE_LACKS_INET_NTOA)
+ ACE_UNUSED_ARG (addr);
+ ACE_NOTSUP_RETURN (0);
+#else
ACE_OSCALL_RETURN (::inet_ntoa (addr),
char *,
0);
+#endif
}
ACE_INLINE const char *
diff --git a/ace/OS_NS_dirent.cpp b/ace/OS_NS_dirent.cpp
index 0d708ca9b74..0fa32cc497e 100644
--- a/ace/OS_NS_dirent.cpp
+++ b/ace/OS_NS_dirent.cpp
@@ -257,7 +257,7 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname,
if (fail)
{
ACE_OS::closedir (dirp);
- while (nfiles-- > 0)
+ while (vector && nfiles-- > 0)
{
#if defined (ACE_LACKS_STRUCT_DIR)
ACE_OS::free (vector[nfiles]->d_name);
diff --git a/ace/OS_NS_fcntl.cpp b/ace/OS_NS_fcntl.cpp
index 77cf0bd894b..d88bf071281 100644
--- a/ace/OS_NS_fcntl.cpp
+++ b/ace/OS_NS_fcntl.cpp
@@ -102,9 +102,16 @@ ACE_OS::open (const char *filename,
if (ACE_BIT_ENABLED (mode, _O_APPEND))
{
- if (h != ACE_INVALID_HANDLE)
+ LONG high_size = 0;
+ if (h != ACE_INVALID_HANDLE
+ && ::SetFilePointer (h,
+ 0,
+ &high_size,
+ FILE_END) == INVALID_SET_FILE_POINTER
+ && GetLastError () != NO_ERROR)
{
- ::SetFilePointer (h, 0, 0, FILE_END);
+ ACE_MT (ACE_OS::thread_mutex_unlock (ace_os_monitor_lock);)
+ ACE_FAIL_RETURN (ACE_INVALID_HANDLE);
}
ACE_MT (ACE_OS::thread_mutex_unlock (ace_os_monitor_lock);)
@@ -206,9 +213,16 @@ ACE_OS::open (const wchar_t *filename,
if (ACE_BIT_ENABLED (mode, _O_APPEND))
{
- if (h != ACE_INVALID_HANDLE)
+ LONG high_size = 0;
+ if (h != ACE_INVALID_HANDLE
+ && ::SetFilePointer (h,
+ 0,
+ &high_size,
+ FILE_END) == INVALID_SET_FILE_POINTER
+ && GetLastError () != NO_ERROR)
{
- ::SetFilePointer (h, 0, 0, FILE_END);
+ ACE_MT (ACE_OS::thread_mutex_unlock (ace_os_monitor_lock);)
+ ACE_FAIL_RETURN (ACE_INVALID_HANDLE);
}
ACE_MT (ACE_OS::thread_mutex_unlock (ace_os_monitor_lock);)
diff --git a/ace/OS_NS_netdb.inl b/ace/OS_NS_netdb.inl
index 74494b8a994..38a992b2d9f 100644
--- a/ace/OS_NS_netdb.inl
+++ b/ace/OS_NS_netdb.inl
@@ -87,7 +87,15 @@ ACE_OS::gethostbyaddr_r (const char *addr,
int *h_errnop)
{
ACE_OS_TRACE ("ACE_OS::gethostbyaddr_r");
-# if defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
+# if defined (ACE_LACKS_GETHOSTBYADDR_R)
+ ACE_UNUSED_ARG (addr);
+ ACE_UNUSED_ARG (length);
+ ACE_UNUSED_ARG (type);
+ ACE_UNUSED_ARG (result);
+ ACE_UNUSED_ARG (buffer);
+ ACE_UNUSED_ARG (h_errnop);
+ ACE_NOTSUP_RETURN (0);
+# elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
if (0 == addr || '\0' == addr[0])
return 0;
@@ -151,7 +159,7 @@ ACE_OS::gethostbyaddr_r (const char *addr,
type),
struct hostent *,
0);
-# endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */
+# endif /* ACE_LACKS_GETHOSTBYADDR_R */
}
#endif
diff --git a/ace/OS_NS_stdio.cpp b/ace/OS_NS_stdio.cpp
index bfcbad2d8e5..df92196644b 100644
--- a/ace/OS_NS_stdio.cpp
+++ b/ace/OS_NS_stdio.cpp
@@ -119,10 +119,17 @@ ACE_OS::fopen (const char *filename,
ACE_OS_TRACE ("ACE_OS::fopen");
int hmode = _O_TEXT;
- for (const ACE_TCHAR *mode_ptr = mode; *mode_ptr != 0; mode_ptr++)
+ // Let the chips fall where they may if the user passes in a NULL
+ // mode string. Convert to an empty mode string to prevent a
+ // crash.
+ ACE_TCHAR const empty_mode[] = ACE_TEXT ("");
+ if (!mode)
+ mode = empty_mode;
+
+ for (ACE_TCHAR const* mode_ptr = mode; *mode_ptr != 0; ++mode_ptr)
ACE_OS::fopen_mode_to_open_mode_converter (*mode_ptr, hmode);
- ACE_HANDLE handle = ACE_OS::open (filename, hmode);
+ ACE_HANDLE const handle = ACE_OS::open (filename, hmode);
if (handle != ACE_INVALID_HANDLE)
{
hmode &= _O_TEXT | _O_RDONLY | _O_APPEND;
@@ -132,13 +139,13 @@ ACE_OS::fopen (const char *filename,
if (fd != -1)
{
# if defined (__BORLANDC__) && !defined (ACE_USES_WCHAR)
- FILE *fp = ::_fdopen (fd, const_cast<ACE_TCHAR *> (mode));
+ FILE * const fp = ::_fdopen (fd, const_cast<ACE_TCHAR *> (mode));
# elif defined (__BORLANDC__) && defined (ACE_USES_WCHAR)
- FILE *fp = ::_wfdopen (fd, const_cast<ACE_TCHAR *> (mode));
+ FILE * const fp = ::_wfdopen (fd, const_cast<ACE_TCHAR *> (mode));
# elif defined (ACE_USES_WCHAR)
- FILE *fp = ::_wfdopen (fd, mode);
+ FILE * const fp = ::_wfdopen (fd, mode);
# else
- FILE *fp = ::fdopen (fd, mode);
+ FILE * const fp = ::fdopen (fd, mode);
# endif /* defined(__BORLANDC__) && !defined (ACE_USES_WCHAR)) */
if (fp != 0)
{
diff --git a/ace/OS_NS_stdio.inl b/ace/OS_NS_stdio.inl
index d0bd0dc642f..3a4beb62f65 100644
--- a/ace/OS_NS_stdio.inl
+++ b/ace/OS_NS_stdio.inl
@@ -524,13 +524,9 @@ ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode)
// kernel file handle -> FILE* conversion...
// Options: _O_APPEND, _O_RDONLY and _O_TEXT are lost
- FILE *file = 0;
+ FILE * file = 0;
-# if defined (ACE_LACKS_INTPTR_T)
- int crt_handle = ::_open_osfhandle (long (handle), 0);
-# else
- int crt_handle = ::_open_osfhandle (intptr_t (handle), 0);
-# endif
+ int const crt_handle = ::_open_osfhandle (intptr_t (handle), 0);
if (crt_handle != -1)
{
diff --git a/ace/OS_NS_stdlib.inl b/ace/OS_NS_stdlib.inl
index 3c18df931d0..990b1895ece 100644
--- a/ace/OS_NS_stdlib.inl
+++ b/ace/OS_NS_stdlib.inl
@@ -78,14 +78,11 @@ ACE_OS::atop (const char *s)
{
ACE_TRACE ("ACE_OS::atop");
#if defined (ACE_WIN64)
- __int64 ip = ::_atoi64 (s);
-#elif defined(ACE_WIN32)
- // Avoid warnings with /Wp64
- intptr_t ip = ::atoi (s);
+ intptr_t ip = ::_atoi64 (s);
#else
- int ip = ::atoi (s);
+ intptr_t ip = ::atoi (s);
#endif /* ACE_WIN64 */
- void *p = reinterpret_cast<void *> (ip);
+ void * p = reinterpret_cast<void *> (ip);
return p;
}
@@ -94,14 +91,11 @@ ACE_INLINE void *
ACE_OS::atop (const wchar_t *s)
{
# if defined (ACE_WIN64)
- __int64 ip = ::_wtoi64 (s);
-# elif defined(ACE_WIN32)
- // Avoid warnings with /Wp64
- intptr_t ip = ACE_OS::atoi (s);
+ intptr ip = ::_wtoi64 (s);
# else
- int ip = ACE_OS::atoi (s);
+ intptr_t ip = ACE_OS::atoi (s);
# endif /* ACE_WIN64 */
- void *p = reinterpret_cast<void *> (ip);
+ void * p = reinterpret_cast<void *> (ip);
return p;
}
#endif /* ACE_HAS_WCHAR */
diff --git a/ace/OS_NS_sys_select.inl b/ace/OS_NS_sys_select.inl
index 11d1fba8cae..25890b81696 100644
--- a/ace/OS_NS_sys_select.inl
+++ b/ace/OS_NS_sys_select.inl
@@ -31,7 +31,14 @@ ACE_OS::select (int width,
#else
const timeval *timep = (timeout == 0 ? (const timeval *)0 : *timeout);
#endif /* ACE_HAS_NONCONST_SELECT_TIMEVAL */
-#if defined(ACE_TANDEM_T1248_PTHREADS)
+#if defined (ACE_LACKS_SELECT)
+ ACE_UNUSED_ARG (width);
+ ACE_UNUSED_ARG (rfds);
+ ACE_UNUSED_ARG (wfds);
+ ACE_UNUSED_ARG (efds);
+ ACE_UNUSED_ARG (timeout);
+ ACE_NOTSUP_RETURN (-1);
+#elif defined(ACE_TANDEM_T1248_PTHREADS)
ACE_SOCKCALL_RETURN (::spt_select (width,
(ACE_FD_SET_TYPE *) rfds,
(ACE_FD_SET_TYPE *) wfds,
@@ -61,7 +68,14 @@ ACE_OS::select (int width,
# define ___ACE_TIMEOUT timep
const timeval *timep = timeout;
#endif /* ACE_HAS_NONCONST_SELECT_TIMEVAL */
-#if defined(ACE_TANDEM_T1248_PTHREADS)
+#if defined (ACE_LACKS_SELECT)
+ ACE_UNUSED_ARG (width);
+ ACE_UNUSED_ARG (rfds);
+ ACE_UNUSED_ARG (wfds);
+ ACE_UNUSED_ARG (efds);
+ ACE_UNUSED_ARG (timeout);
+ ACE_NOTSUP_RETURN (-1);
+#elif defined(ACE_TANDEM_T1248_PTHREADS)
ACE_SOCKCALL_RETURN (::spt_select (width,
(ACE_FD_SET_TYPE *) rfds,
(ACE_FD_SET_TYPE *) wfds,
diff --git a/ace/OS_NS_sys_socket.inl b/ace/OS_NS_sys_socket.inl
index 6adb9276068..14afb257b77 100644
--- a/ace/OS_NS_sys_socket.inl
+++ b/ace/OS_NS_sys_socket.inl
@@ -41,7 +41,12 @@ ACE_OS::accept (ACE_HANDLE handle,
// this function needs to be reviewed. On Win32, the regular macros
// can be used, as this is not an issue.
-#if defined (ACE_WIN32)
+#if defined (ACE_LACKS_ACCEPT)
+ ACE_UNUSED_ARG (handle);
+ ACE_UNUSED_ARG (addr);
+ ACE_UNUSED_ARG (addrlen);
+ ACE_NOTSUP_RETURN (ACE_INVALID_HANDLE);
+#elif defined (ACE_WIN32)
ACE_SOCKCALL_RETURN (::accept ((ACE_SOCKET) handle,
addr,
(ACE_SOCKET_LEN *) addrlen),
@@ -127,9 +132,16 @@ ACE_OS::connect (ACE_HANDLE handle,
int addrlen)
{
ACE_OS_TRACE ("ACE_OS::connect");
+#if defined (ACE_LACKS_CONNECT)
+ ACE_UNUSED_ARG (handle);
+ ACE_UNUSED_ARG (addr);
+ ACE_UNUSED_ARG (addrlen);
+ ACE_NOTSUP_RETURN (-1);
+#else
ACE_SOCKCALL_RETURN (::connect ((ACE_SOCKET) handle,
addr,
(ACE_SOCKET_LEN) addrlen), int, -1);
+#endif /* ACE_LACKS_CONNECT */
}
ACE_INLINE int
@@ -159,8 +171,13 @@ ACE_OS::getpeername (ACE_HANDLE handle, struct sockaddr *addr,
{
ACE_OS_TRACE ("ACE_OS::getpeername");
-#if defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) \
- && (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO == 1)
+#if defined (ACE_LACKS_GETPEERNAME)
+ ACE_UNUSED_ARG (handle);
+ ACE_UNUSED_ARG (addr);
+ ACE_UNUSED_ARG (addrlen);
+ ACE_NOTSUP_RETURN (-1);
+#elif defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) \
+ && (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO == 1)
int result;
ACE_SOCKCALL (::getpeername ((ACE_SOCKET) handle,
addr,
@@ -202,8 +219,13 @@ ACE_OS::getsockname (ACE_HANDLE handle,
int *addrlen)
{
ACE_OS_TRACE ("ACE_OS::getsockname");
-#if defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) \
- && (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO == 1)
+#if defined (ACE_LACKS_GETSOCKNAME)
+ ACE_UNUSED_ARG (handle);
+ ACE_UNUSED_ARG (addr);
+ ACE_UNUSED_ARG (addrlen);
+ ACE_NOTSUP_RETURN (-1);
+#elif defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) \
+ && (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO == 1)
int result;
ACE_SOCKCALL (::getsockname ((ACE_SOCKET) handle,
addr,
@@ -244,6 +266,14 @@ ACE_OS::getsockopt (ACE_HANDLE handle,
int *optlen)
{
ACE_OS_TRACE ("ACE_OS::getsockopt");
+#if defined (ACE_LACKS_GETSOCKOPT)
+ ACE_UNUSED_ARG (handle);
+ ACE_UNUSED_ARG (level);
+ ACE_UNUSED_ARG (optname);
+ ACE_UNUSED_ARG (optval);
+ ACE_UNUSED_ARG (optlen);
+ ACE_NOTSUP_RETURN (-1);
+#else
ACE_SOCKCALL_RETURN (::getsockopt ((ACE_SOCKET) handle,
level,
optname,
@@ -251,6 +281,7 @@ ACE_OS::getsockopt (ACE_HANDLE handle,
(ACE_SOCKET_LEN *) optlen),
int,
-1);
+#endif /* ACE_LACKS_GETSOCKOPT */
}
ACE_INLINE int
@@ -280,7 +311,13 @@ ACE_OS::recv (ACE_HANDLE handle, char *buf, size_t len, int flags)
// handled explicitly here. If the ACE_OSCALL macro ever changes,
// this function needs to be reviewed. On Win32, the regular macros
// can be used, as this is not an issue.
-#if defined (ACE_WIN32)
+#if defined (ACE_LACKS_RECV)
+ ACE_UNUSED_ARG (handle);
+ ACE_UNUSED_ARG (buf);
+ ACE_UNUSED_ARG (len);
+ ACE_UNUSED_ARG (flags);
+ ACE_NOTSUP_RETURN (-1);
+#elif defined (ACE_WIN32)
ACE_SOCKCALL_RETURN (::recv ((ACE_SOCKET) handle, buf,
static_cast<int> (len), flags), ssize_t, -1);
#else
@@ -304,7 +341,7 @@ ACE_OS::recv (ACE_HANDLE handle, char *buf, size_t len, int flags)
# endif /* EAGAIN != EWOULDBLOCK*/
return ace_result_;
-#endif /* defined (ACE_WIN32) */
+#endif /* ACE_LACKS_RECV */
}
ACE_INLINE ssize_t
@@ -316,14 +353,22 @@ ACE_OS::recvfrom (ACE_HANDLE handle,
int *addrlen)
{
ACE_OS_TRACE ("ACE_OS::recvfrom");
-#if defined (ACE_WIN32)
- int shortened_len = static_cast<int> (len);
- int result = ::recvfrom ((ACE_SOCKET) handle,
- buf,
- shortened_len,
- flags,
- addr,
- (ACE_SOCKET_LEN *) addrlen);
+#if defined (ACE_LACKS_RECVFROM)
+ ACE_UNUSED_ARG (handle);
+ ACE_UNUSED_ARG (buf);
+ ACE_UNUSED_ARG (len);
+ ACE_UNUSED_ARG (flags);
+ ACE_UNUSED_ARG (addr);
+ ACE_UNUSED_ARG (addrlen);
+ ACE_NOTSUP_RETURN (-1);
+#elif defined (ACE_WIN32)
+ int const shortened_len = static_cast<int> (len);
+ int const result = ::recvfrom ((ACE_SOCKET) handle,
+ buf,
+ shortened_len,
+ flags,
+ addr,
+ (ACE_SOCKET_LEN *) addrlen);
if (result == SOCKET_ERROR)
{
ACE_OS::set_errno_to_wsa_last_error ();
@@ -343,7 +388,7 @@ ACE_OS::recvfrom (ACE_HANDLE handle,
addr,
(ACE_SOCKET_LEN *) addrlen),
ssize_t, -1);
-#endif /* defined (ACE_WIN32) */
+#endif /* ACE_LACKS_RECVFROM */
}
ACE_INLINE ssize_t
@@ -499,7 +544,13 @@ ACE_OS::send (ACE_HANDLE handle, const char *buf, size_t len, int flags)
// handled explicitly here. If the ACE_OSCALL macro ever changes,
// this function needs to be reviewed. On Win32, the regular macros
// can be used, as this is not an issue.
-#if defined (ACE_WIN32)
+#if defined (ACE_LACKS_SEND)
+ ACE_UNUSED_ARG (handle);
+ ACE_UNUSED_ARG (buf);
+ ACE_UNUSED_ARG (len);
+ ACE_UNUSED_ARG (flags);
+ ACE_NOTSUP_RETURN (-1);
+#elif defined (ACE_WIN32)
ACE_SOCKCALL_RETURN (::send ((ACE_SOCKET) handle,
buf,
static_cast<int> (len),
@@ -578,7 +629,15 @@ ACE_OS::sendto (ACE_HANDLE handle,
int addrlen)
{
ACE_OS_TRACE ("ACE_OS::sendto");
-#if defined (ACE_VXWORKS)
+#if defined (ACE_LACKS_SENDTO)
+ ACE_UNUSED_ARG (handle);
+ ACE_UNUSED_ARG (buf);
+ ACE_UNUSED_ARG (len);
+ ACE_UNUSED_ARG (flags);
+ ACE_UNUSED_ARG (addr);
+ ACE_UNUSED_ARG (addrlen);
+ ACE_NOTSUP_RETURN (-1);
+#elif defined (ACE_VXWORKS)
ACE_SOCKCALL_RETURN (::sendto ((ACE_SOCKET) handle,
const_cast <char *> (buf),
len,
@@ -586,8 +645,7 @@ ACE_OS::sendto (ACE_HANDLE handle,
const_cast<struct sockaddr *> (addr),
addrlen),
ssize_t, -1);
-#else
-# if defined (ACE_WIN32)
+#elif defined (ACE_WIN32)
ACE_SOCKCALL_RETURN (::sendto ((ACE_SOCKET) handle,
buf,
static_cast<int> (len),
@@ -595,7 +653,7 @@ ACE_OS::sendto (ACE_HANDLE handle,
const_cast<struct sockaddr *> (addr),
addrlen),
ssize_t, -1);
-# else
+#else
ACE_SOCKCALL_RETURN (::sendto ((ACE_SOCKET) handle,
buf,
len,
@@ -603,8 +661,7 @@ ACE_OS::sendto (ACE_HANDLE handle,
const_cast<struct sockaddr *> (addr),
addrlen),
ssize_t, -1);
-# endif /* ACE_WIN32 */
-#endif /* ACE_VXWORKS */
+#endif /* ACE_LACKS_SENDTO */
}
ACE_INLINE ssize_t
@@ -758,8 +815,15 @@ ACE_OS::setsockopt (ACE_HANDLE handle,
int optlen)
{
ACE_OS_TRACE ("ACE_OS::setsockopt");
-
- #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && defined(SO_REUSEPORT)
+#if defined (ACE_LACKS_SETSOCKOPT)
+ ACE_UNUSED_ARG (handle);
+ ACE_UNUSED_ARG (level);
+ ACE_UNUSED_ARG (optname);
+ ACE_UNUSED_ARG (optval);
+ ACE_UNUSED_ARG (optlen);
+ ACE_NOTSUP_RETURN (-1);
+#else
+#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && defined(SO_REUSEPORT)
// To work around an inconsistency with Microsofts implementation of
// sockets, we will check for SO_REUSEADDR, and ignore it. Winsock
// always behaves as if SO_REUSEADDR=1. Some implementations have
@@ -778,7 +842,7 @@ ACE_OS::setsockopt (ACE_HANDLE handle,
optname = SO_REUSEADDR;
}
}
- #endif /*ACE_HAS_WINSOCK2*/
+#endif /*ACE_HAS_WINSOCK2*/
int result;
ACE_SOCKCALL (::setsockopt ((ACE_SOCKET) handle,
@@ -796,13 +860,20 @@ ACE_OS::setsockopt (ACE_HANDLE handle,
#endif /* WSAEOPNOTSUPP */
errno = ENOTSUP;
return result;
+#endif
}
ACE_INLINE int
ACE_OS::shutdown (ACE_HANDLE handle, int how)
{
ACE_OS_TRACE ("ACE_OS::shutdown");
+#if defined (ACE_LACKS_SHUTDOWN)
+ ACE_UNUSED_ARG (handle);
+ ACE_UNUSED_ARG (how);
+ ACE_NOTSUP_RETURN (-1);
+#else
ACE_SOCKCALL_RETURN (::shutdown ((ACE_SOCKET) handle, how), int, -1);
+#endif /* ACE_LACKS_SHUTDOWN */
}
ACE_INLINE ACE_HANDLE
@@ -811,11 +882,18 @@ ACE_OS::socket (int domain,
int proto)
{
ACE_OS_TRACE ("ACE_OS::socket");
+#if defined (ACE_LACKS_SOCKET)
+ ACE_UNUSED_ARG (domain);
+ ACE_UNUSED_ARG (type);
+ ACE_UNUSED_ARG (proto);
+ ACE_NOTSUP_RETURN (ACE_INVALID_HANDLE);
+#else
ACE_SOCKCALL_RETURN (::socket (domain,
type,
proto),
ACE_HANDLE,
ACE_INVALID_HANDLE);
+#endif /* ACE_LACKS_SOCKET */
}
ACE_INLINE ACE_HANDLE
diff --git a/ace/OS_NS_unistd.inl b/ace/OS_NS_unistd.inl
index 1d3932f6e28..c1cd0fba4ac 100644
--- a/ace/OS_NS_unistd.inl
+++ b/ace/OS_NS_unistd.inl
@@ -596,11 +596,7 @@ ACE_OS::isatty (ACE_HANDLE handle)
ACE_UNUSED_ARG (handle);
return 0;
#else
-# if defined (ACE_LACKS_INTPTR_T)
- int fd = ::_open_osfhandle (long (handle), 0);
-# else
- int fd = ::_open_osfhandle (intptr_t (handle), 0);
-# endif
+ int fd = ::_open_osfhandle (intptr_t (handle), 0);
int status = ::_isatty (fd);
::_close (fd);
return status;
diff --git a/ace/OS_TLI.h b/ace/OS_TLI.h
index e81b00d6074..4744c2b8536 100644
--- a/ace/OS_TLI.h
+++ b/ace/OS_TLI.h
@@ -162,8 +162,10 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Mon Jan 23 22:08:56 UTC 2006 Steve Huston <shuston@riverace.com>
#if defined (__HP_aCC) && (__HP_aCC <= 36500)
typedef extern "C" struct t_optmgmt ACE_TOPTMGMT;
+typedef extern "C" struct t_bind ACE_TBIND;
#else
typedef struct t_optmgmt ACE_TOPTMGMT;
+typedef struct t_bind ACE_TBIND;
#endif
/**
@@ -189,8 +191,8 @@ namespace ACE_OS
ACE_NAMESPACE_INLINE_FUNCTION
int t_bind (ACE_HANDLE fildes,
- struct t_bind *req,
- struct t_bind *ret);
+ ACE_TBIND *req,
+ ACE_TBIND *ret);
ACE_NAMESPACE_INLINE_FUNCTION
int t_close (ACE_HANDLE fildes);
diff --git a/ace/OS_TLI.inl b/ace/OS_TLI.inl
index 563ba8311db..4dffee0f96f 100644
--- a/ace/OS_TLI.inl
+++ b/ace/OS_TLI.inl
@@ -46,7 +46,7 @@ t_alloc (ACE_HANDLE handle, int struct_type, int fields)
}
ACE_INLINE int
-t_bind (ACE_HANDLE handle, struct t_bind *req, struct t_bind *ret)
+t_bind (ACE_HANDLE handle, ACE_TBIND *req, ACE_TBIND *ret)
{
#if defined (ACE_HAS_TLI)
ACE_OSCALL_RETURN (::t_bind (handle, req, ret), int, -1);
@@ -133,7 +133,7 @@ ACE_INLINE int
t_getname (ACE_HANDLE handle, struct netbuf *namep, int type)
{
#if defined (ACE_HAS_XTI)
- struct t_bind bound, peer;
+ ACE_TBIND bound, peer;
// Depending on which address the caller wants, fill caller's values
// into one of the t_bind netbufs. The other is set up to ignore that
// address.
diff --git a/ace/Reactor.h b/ace/Reactor.h
index 1875482644e..987b869160d 100644
--- a/ace/Reactor.h
+++ b/ace/Reactor.h
@@ -30,6 +30,9 @@
// Event_Handler.h contains the definition of ACE_Reactor_Mask
#include "ace/Event_Handler.h"
+// Get ACE_Time_Value in
+#include "ace/Time_Value.h"
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Reactor_Impl;
diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp
index dc0c925fe02..969ed591754 100644
--- a/ace/SOCK_Dgram.cpp
+++ b/ace/SOCK_Dgram.cpp
@@ -90,7 +90,7 @@ ACE_SOCK_Dgram::recv (iovec *io_vec,
if (ACE_OS::ioctl (this->get_handle (),
FIONREAD,
- &inlen) == -1)
+ &inlen) == -1)
return -1;
else if (inlen > 0)
{
@@ -589,6 +589,8 @@ ACE_SOCK_Dgram::set_nic (const ACE_TCHAR *net_if,
// Send interface option not supported - ignore it.
// (We may have been invoked by ::subscribe, so we have to allow
// a non-null interface parameter in this function.)
+ ACE_UNUSED_ARG (net_if);
+ ACE_UNUSED_ARG (addr_family);
ACE_DEBUG ((LM_DEBUG,
ACE_LIB_TEXT ("Send interface specification not ")
ACE_LIB_TEXT ("supported - IGNORED.\n")));
@@ -613,6 +615,8 @@ ACE_SOCK_Dgram::make_multicast_ifaddr (ip_mreq *ret_mreq,
return -1;
lmreq.imr_interface.s_addr =
ACE_HTONL (interface_addr.get_ip_address ());
+#elif defined (ACE_LACKS_IFREQ)
+ // Do nothing
#else
ifreq if_address;
@@ -623,8 +627,8 @@ ACE_SOCK_Dgram::make_multicast_ifaddr (ip_mreq *ret_mreq,
&if_address) == -1)
return -1;
- sockaddr_in *socket_address;
- socket_address = reinterpret_cast<sockaddr_in*> (&if_address.ifr_addr);
+ sockaddr_in *socket_address =
+ reinterpret_cast<sockaddr_in*> (&if_address.ifr_addr);
lmreq.imr_interface.s_addr = socket_address->sin_addr.s_addr;
#endif /* ACE_WIN32 || __INTERIX */
}
diff --git a/ace/Select_Reactor_Base.cpp b/ace/Select_Reactor_Base.cpp
index 471f20dbf55..8a49a13a6bf 100644
--- a/ace/Select_Reactor_Base.cpp
+++ b/ace/Select_Reactor_Base.cpp
@@ -14,6 +14,10 @@
#include "ace/Select_Reactor_Base.inl"
#endif /* __ACE_INLINE__ */
+#ifndef ACE_WIN32
+# include <algorithm>
+#endif /* !ACE_WIN32 */
+
ACE_RCSID (ace,
Select_Reactor_Base,
"$Id$")
@@ -21,17 +25,20 @@ ACE_RCSID (ace,
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-#if defined (ACE_WIN32)
-#define ACE_SELECT_REACTOR_HANDLE(H) (this->event_handlers_[(H)].handle_)
-#define ACE_SELECT_REACTOR_EVENT_HANDLER(THIS,H) ((THIS)->event_handlers_[(H)].event_handler_)
+template<typename iterator>
+inline ACE_Event_Handler *
+ACE_SELECT_REACTOR_EVENT_HANDLER (iterator i)
+{
+#ifdef ACE_WIN32
+ return (*i).item ();
#else
-#define ACE_SELECT_REACTOR_HANDLE(H) (H)
-#define ACE_SELECT_REACTOR_EVENT_HANDLER(THIS,H) ((THIS)->event_handlers_[(H)])
-#endif /* ACE_WIN32 */
+ return (*i);
+#endif /* ACE_WIN32 */
+}
// Performs sanity checking on the ACE_HANDLE.
-int
+bool
ACE_Select_Reactor_Handler_Repository::invalid_handle (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::invalid_handle");
@@ -40,19 +47,20 @@ ACE_Select_Reactor_Handler_Repository::invalid_handle (ACE_HANDLE handle)
// Win32 due to the way that they implement SOCKET HANDLEs.
if (handle == ACE_INVALID_HANDLE)
#else /* !ACE_WIN32 */
- if (handle < 0 || handle >= this->max_size_)
+ if (handle < 0
+ || static_cast<size_type> (handle) >= this->event_handlers_.size ())
#endif /* ACE_WIN32 */
- {
- errno = EINVAL;
- return 1;
- }
- else
- return 0;
+ {
+ errno = EINVAL;
+ return true;
+ }
+
+ return false;
}
// Performs sanity checking on the ACE_HANDLE.
-int
+bool
ACE_Select_Reactor_Handler_Repository::handle_in_range (ACE_HANDLE handle)
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::handle_in_range");
@@ -61,52 +69,37 @@ ACE_Select_Reactor_Handler_Repository::handle_in_range (ACE_HANDLE handle)
// Win32 due to the way that they implement SOCKET HANDLEs.
if (handle != ACE_INVALID_HANDLE)
#else /* !ACE_WIN32 */
- if (handle >= 0 && handle < this->max_handlep1_)
+ if (handle >= 0 && handle < this->max_handlep1_)
#endif /* ACE_WIN32 */
- return 1;
- else
- {
- errno = EINVAL;
- return 0;
- }
-}
+ {
+ return true;
+ }
-size_t
-ACE_Select_Reactor_Handler_Repository::max_handlep1 (void)
-{
- ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::max_handlep1");
+ // Don't bother setting errno. It isn't used in the select()-based
+ // reactors and incurs a TSS access.
+ // errno = EINVAL;
- return this->max_handlep1_;
+ return false;
}
int
ACE_Select_Reactor_Handler_Repository::open (size_t size)
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::open");
- this->max_size_ = size;
- this->max_handlep1_ = 0;
#if defined (ACE_WIN32)
- // Try to allocate the memory.
- ACE_NEW_RETURN (this->event_handlers_,
- ACE_Event_Tuple[size],
- -1);
-
- // Initialize the ACE_Event_Handler * to { ACE_INVALID_HANDLE, 0 }.
- for (size_t h = 0; h < size; ++h)
- {
- ACE_SELECT_REACTOR_HANDLE (h) = ACE_INVALID_HANDLE;
- ACE_SELECT_REACTOR_EVENT_HANDLER (this, h) = 0;
- }
+ if (this->event_handlers_.open (size) == -1)
+ return -1;
#else
- // Try to allocate the memory.
- ACE_NEW_RETURN (this->event_handlers_,
- ACE_Event_Handler *[size],
- -1);
-
- // Initialize the ACE_Event_Handler * to NULL.
- for (size_t h = 0; h < size; ++h)
- ACE_SELECT_REACTOR_EVENT_HANDLER (this, h) = 0;
+ if (this->event_handlers_.size (size) == -1)
+ return -1;
+
+ // Initialize the ACE_Event_Handler pointers to 0.
+ std::fill (this->event_handlers_.begin (),
+ this->event_handlers_.end (),
+ static_cast<ACE_Event_Handler *> (0));
+
+ this->max_handlep1_ = 0;
#endif /* ACE_WIN32 */
// Try to increase the number of handles if <size> is greater than
@@ -118,9 +111,10 @@ ACE_Select_Reactor_Handler_Repository::open (size_t size)
ACE_Select_Reactor_Handler_Repository::ACE_Select_Reactor_Handler_Repository (ACE_Select_Reactor_Impl &select_reactor)
: select_reactor_ (select_reactor),
- max_size_ (0),
+#ifndef ACE_WIN32
max_handlep1_ (0),
- event_handlers_ (0)
+#endif /* !ACE_WIN32 */
+ event_handlers_ ()
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::ACE_Select_Reactor_Handler_Repository");
}
@@ -129,11 +123,39 @@ int
ACE_Select_Reactor_Handler_Repository::unbind_all (void)
{
// Unbind all of the <handle, ACE_Event_Handler>s.
- for (int slot = 0;
- slot < this->max_handlep1_;
- ++slot)
- this->unbind (ACE_SELECT_REACTOR_HANDLE (slot),
- ACE_Event_Handler::ALL_EVENTS_MASK);
+#ifdef ACE_WIN32
+ map_type::iterator const end = this->event_handlers_.end ();
+ for (map_type::iterator pos = this->event_handlers_.begin ();
+ pos != end;
+ )
+ {
+ // Post-increment (*not* pre-increment) before unbind()ing since
+ // the current iterator will be invalidated during the unbind()
+ // operation.
+ map_type::iterator const the_pos (pos++);
+
+ ACE_HANDLE const handle = (*the_pos).key ();
+ (void) this->unbind (handle,
+ the_pos,
+ ACE_Event_Handler::ALL_EVENTS_MASK);
+ }
+#else
+ // We could use the "end()" iterator but leveraging max_handlep1_
+ // allows us to optimize away unnecessary accesses of nil event
+ // handler pointers.
+ map_type::iterator pos =
+ this->event_handlers_.begin (); // iterator == ACE_Event_Handler*
+
+ for (ACE_HANDLE handle = 0;
+ handle < this->max_handlep1_;
+ ++handle)
+ {
+ (void) this->unbind (handle,
+ pos,
+ ACE_Event_Handler::ALL_EVENTS_MASK);
+ ++pos;
+ }
+#endif /* ACE_WIN32 */
return 0;
}
@@ -143,63 +165,33 @@ ACE_Select_Reactor_Handler_Repository::close (void)
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::close");
- if (this->event_handlers_ != 0)
- {
- this->unbind_all ();
-
- delete [] this->event_handlers_;
- this->event_handlers_ = 0;
- }
- return 0;
+ return this->unbind_all ();
}
-// Return the <ACE_Event_Handler *> associated with the <handle>.
-
-ACE_Event_Handler *
-ACE_Select_Reactor_Handler_Repository::find (ACE_HANDLE handle,
- size_t *index_p)
+ACE_Select_Reactor_Handler_Repository::map_type::iterator
+ACE_Select_Reactor_Handler_Repository::find_eh (ACE_HANDLE handle)
{
- ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::find");
+ ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::find_eh");
- ACE_Event_Handler *eh = 0;
- ssize_t i;
+ map_type::iterator pos (this->event_handlers_.end ());
// Only bother to search for the <handle> if it's in range.
if (this->handle_in_range (handle))
{
#if defined (ACE_WIN32)
- i = 0;
-
- for (; i < this->max_handlep1_; ++i)
- if (ACE_SELECT_REACTOR_HANDLE (i) == handle)
- {
- eh = ACE_SELECT_REACTOR_EVENT_HANDLER (this, i);
- break;
- }
+ this->event_handlers_.find (handle, pos);
#else
- i = handle;
+ map_type::iterator const tmp = &this->event_handlers_[handle];
- eh = ACE_SELECT_REACTOR_EVENT_HANDLER (this, handle);
+ if (*tmp != 0)
+ pos = tmp;
#endif /* ACE_WIN32 */
}
- else
- // g++ can't figure out that <i> won't be used below if the handle
- // is out of range, so keep it happy by defining <i> here . . .
- i = 0;
-
- if (eh != 0)
- {
- if (index_p != 0)
- *index_p = i;
- }
- else
- errno = ENOENT;
- return eh;
+ return pos;
}
// Bind the <ACE_Event_Handler *> to the <ACE_HANDLE>.
-
int
ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle,
ACE_Event_Handler *event_handler,
@@ -207,6 +199,9 @@ ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle,
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::bind");
+ if (event_handler == 0)
+ return -1;
+
if (handle == ACE_INVALID_HANDLE)
handle = event_handler->get_handle ();
@@ -214,66 +209,39 @@ ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle,
return -1;
// Is this handle already in the Reactor?
- int existing_handle = 0;
+ bool existing_handle = false;
#if defined (ACE_WIN32)
- ssize_t assigned_slot = -1;
+ map_type::ENTRY * entry = 0;
- for (ssize_t i = 0; i < this->max_handlep1_; ++i)
+ int const result =
+ this->event_handlers_.bind (handle, event_handler, entry);
+
+ if (result == -1)
{
- // If handle is already registered.
- if (ACE_SELECT_REACTOR_HANDLE (i) == handle)
+ return -1;
+ }
+ else if (result == 1) // Entry already exists.
+ {
+ // Cannot use a different handler for an existing handle.
+ if (event_handler != entry->item ())
+ {
+ return -1;
+ }
+ else
{
- // Cannot use a different handler for an existing handle.
- if (ACE_SELECT_REACTOR_EVENT_HANDLER (this, i) !=
- event_handler)
- return -1;
-
- // Remember location.
- assigned_slot = i;
-
// Remember that this handle is already registered in the
// Reactor.
- existing_handle = 1;
-
- // We can stop looking now.
- break;
+ existing_handle = true;
}
- else
- // Here's the first free slot, so let's take it.
- if (ACE_SELECT_REACTOR_HANDLE (i) == ACE_INVALID_HANDLE &&
- assigned_slot == -1)
- {
- assigned_slot = i;
- }
- }
-
- if (assigned_slot > -1)
- // We found a spot.
- {
- ACE_SELECT_REACTOR_HANDLE (assigned_slot) = handle;
- ACE_SELECT_REACTOR_EVENT_HANDLER (this, assigned_slot) = event_handler;
- }
- else if (this->max_handlep1_ < this->max_size_)
- {
- // Insert at the end of the active portion.
- ACE_SELECT_REACTOR_HANDLE (this->max_handlep1_) = handle;
- ACE_SELECT_REACTOR_EVENT_HANDLER (this, this->max_handlep1_) = event_handler;
- ++this->max_handlep1_;
- }
- else
- {
- // No more room at the inn!
- errno = ENOMEM;
- return -1;
}
#else
// Check if this handle is already registered.
- ACE_Event_Handler *current_handler =
- ACE_SELECT_REACTOR_EVENT_HANDLER (this, handle);
+ ACE_Event_Handler * const current_handler =
+ this->event_handlers_[handle];
if (current_handler)
{
@@ -283,10 +251,10 @@ ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle,
// Remember that this handle is already registered in the
// Reactor.
- existing_handle = 1;
+ existing_handle = true;
}
- ACE_SELECT_REACTOR_EVENT_HANDLER (this, handle) = event_handler;
+ this->event_handlers_[handle] = event_handler;
if (this->max_handlep1_ < handle + 1)
this->max_handlep1_ = handle + 1;
@@ -323,13 +291,18 @@ ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle,
// Remove the binding of <ACE_HANDLE>.
int
-ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
- ACE_Reactor_Mask mask)
+ACE_Select_Reactor_Handler_Repository::unbind (
+ ACE_HANDLE handle,
+ map_type::iterator pos,
+ ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::unbind");
- size_t slot = 0;
- ACE_Event_Handler *event_handler = this->find (handle, &slot);
+ // Retrieve event handler before unbinding it from the map. The
+ // iterator pointing to it will no longer be valid once the handler
+ // is unbound.
+ ACE_Event_Handler * const event_handler =
+ ACE_SELECT_REACTOR_EVENT_HANDLER (pos);
if (event_handler == 0)
return -1;
@@ -354,64 +327,42 @@ ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
// If there are no longer any outstanding events on this <handle>
// then we can totally shut down the Event_Handler.
- int has_any_wait_mask =
+ bool const has_any_wait_mask =
(this->select_reactor_.wait_set_.rd_mask_.is_set (handle)
|| this->select_reactor_.wait_set_.wr_mask_.is_set (handle)
|| this->select_reactor_.wait_set_.ex_mask_.is_set (handle));
- int has_any_suspend_mask =
+ bool const has_any_suspend_mask =
(this->select_reactor_.suspend_set_.rd_mask_.is_set (handle)
|| this->select_reactor_.suspend_set_.wr_mask_.is_set (handle)
|| this->select_reactor_.suspend_set_.ex_mask_.is_set (handle));
- int complete_removal = 0;
+ bool complete_removal = false;
if (!has_any_wait_mask && !has_any_suspend_mask)
{
- // The handle has been completed removed.
- complete_removal = 1;
-
- ACE_SELECT_REACTOR_EVENT_HANDLER (this, slot) = 0;
-
#if defined (ACE_WIN32)
-
- ACE_SELECT_REACTOR_HANDLE (slot) = ACE_INVALID_HANDLE;
-
- if (this->max_handlep1_ == (int) slot + 1)
- {
- // We've deleted the last entry (i.e., i + 1 == the current
- // size of the array), so we need to figure out the last
- // valid place in the array that we should consider in
- // subsequent searches.
-
- int i;
-
- for (i = this->max_handlep1_ - 1;
- i >= 0 && ACE_SELECT_REACTOR_HANDLE (i) == ACE_INVALID_HANDLE;
- --i)
- continue;
-
- this->max_handlep1_ = i + 1;
- }
-
+ if (this->event_handlers_.unbind (pos) == -1)
+ return -1; // Should not happen!
#else
+ this->event_handlers_[handle] = 0;
if (this->max_handlep1_ == handle + 1)
{
// We've deleted the last entry, so we need to figure out
// the last valid place in the array that is worth looking
// at.
- ACE_HANDLE wait_rd_max =
+ ACE_HANDLE const wait_rd_max =
this->select_reactor_.wait_set_.rd_mask_.max_set ();
- ACE_HANDLE wait_wr_max =
+ ACE_HANDLE const wait_wr_max =
this->select_reactor_.wait_set_.wr_mask_.max_set ();
- ACE_HANDLE wait_ex_max =
+ ACE_HANDLE const wait_ex_max =
this->select_reactor_.wait_set_.ex_mask_.max_set ();
- ACE_HANDLE suspend_rd_max =
+ ACE_HANDLE const suspend_rd_max =
this->select_reactor_.suspend_set_.rd_mask_.max_set ();
- ACE_HANDLE suspend_wr_max =
+ ACE_HANDLE const suspend_wr_max =
this->select_reactor_.suspend_set_.wr_mask_.max_set ();
- ACE_HANDLE suspend_ex_max =
+ ACE_HANDLE const suspend_ex_max =
this->select_reactor_.suspend_set_.ex_mask_.max_set ();
// Compute the maximum of six values.
@@ -433,6 +384,8 @@ ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
#endif /* ACE_WIN32 */
+ // The handle has been completely removed.
+ complete_removal = true;
}
bool const requires_reference_counting =
@@ -442,63 +395,70 @@ ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
// Close down the <Event_Handler> unless we've been instructed not
// to.
if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::DONT_CALL) == 0)
- event_handler->handle_close (handle, mask);
+ (void) event_handler->handle_close (handle, mask);
// Call remove_reference() if the removal is complete and reference
// counting is needed.
if (complete_removal && requires_reference_counting)
{
- event_handler->remove_reference ();
+ (void) event_handler->remove_reference ();
}
return 0;
}
ACE_Select_Reactor_Handler_Repository_Iterator::ACE_Select_Reactor_Handler_Repository_Iterator
- (const ACE_Select_Reactor_Handler_Repository *s)
+ (ACE_Select_Reactor_Handler_Repository const * s)
: rep_ (s),
- current_ (-1)
+ current_ (s->event_handlers_.begin ())
{
- this->advance ();
}
// Pass back the <next_item> that hasn't been seen in the Set.
// Returns 0 when all items have been seen, else 1.
-int
-ACE_Select_Reactor_Handler_Repository_Iterator::next (ACE_Event_Handler *&next_item)
+bool
+ACE_Select_Reactor_Handler_Repository_Iterator::next (
+ ACE_Event_Handler *&next_item)
{
- int result = 1;
+ bool result = true;
- if (this->current_ >= this->rep_->max_handlep1_)
- result = 0;
+ if (this->done ())
+ result = false;
else
- next_item = ACE_SELECT_REACTOR_EVENT_HANDLER (this->rep_,
- this->current_);
- return result;
-}
+ next_item = ACE_SELECT_REACTOR_EVENT_HANDLER (this->current_);
-int
-ACE_Select_Reactor_Handler_Repository_Iterator::done (void) const
-{
- return this->current_ >= this->rep_->max_handlep1_;
+ return result;
}
// Move forward by one element in the set.
-int
+bool
ACE_Select_Reactor_Handler_Repository_Iterator::advance (void)
{
- if (this->current_ < this->rep_->max_handlep1_)
+#ifdef ACE_WIN32
+ // No need to explicitly limit search to "current" to
+ // max_handlep1_ range.
+ const_base_iterator const end = this->rep_->event_handlers_.end ();
+#else
+ // Don't use ACE_Array_Base::end() since it may be larger than
+ // event_handlers[max_handlep1_].
+ const_base_iterator const end =
+ &this->rep_->event_handlers_[this->rep_->max_handlep1 ()];
+#endif /* ACE_WIN32 */
+
+ if (this->current_ != end)
++this->current_;
- while (this->current_ < this->rep_->max_handlep1_)
- if (ACE_SELECT_REACTOR_EVENT_HANDLER (this->rep_, this->current_) != 0)
- return 1;
- else
- ++this->current_;
+#ifndef ACE_WIN32
+ // Advance to the next element containing a non-zero event handler.
+ // There's no need to do this for the Windows case since the hash
+ // map will only contain non-zero event handlers.
+ while (this->current_ != end && (*(this->current_) == 0))
+ ++this->current_;
+#endif /* !ACE_WIN32 */
- return this->current_ < this->rep_->max_handlep1_;
+ return this->current_ != end;
}
// Dump the state of an object.
@@ -511,7 +471,12 @@ ACE_Select_Reactor_Handler_Repository_Iterator::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("rep_ = %u"), this->rep_));
- ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("current_ = %d"), this->current_));
+# ifdef ACE_WIN32
+ ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("current_ = ")));
+ this->current_.dump ();
+# else
+ ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("current_ = %@"), this->current_));
+# endif /* ACE_WIN32 */
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}
@@ -522,10 +487,20 @@ ACE_Select_Reactor_Handler_Repository::dump (void) const
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::dump");
+# ifdef ACE_WIN32
+# define ACE_HANDLE_FORMAT_SPECIFIER ACE_LIB_TEXT("%@")
+# define ACE_MAX_HANDLEP1_FORMAT_SPECIFIER ACE_LIB_TEXT("%u")
+# else
+# define ACE_HANDLE_FORMAT_SPECIFIER ACE_LIB_TEXT("%d")
+# define ACE_MAX_HANDLEP1_FORMAT_SPECIFIER ACE_LIB_TEXT("%d")
+# endif /* ACE_WIN32 */
+
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACE_DEBUG ((LM_DEBUG,
- ACE_LIB_TEXT ("max_handlep1_ = %d, max_size_ = %d\n"),
- this->max_handlep1_, this->max_size_));
+ ACE_LIB_TEXT ("max_handlep1_ = ")
+ ACE_MAX_HANDLEP1_FORMAT_SPECIFIER
+ ACE_LIB_TEXT ("\n"),
+ this->max_handlep1 ()));
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("[")));
ACE_Event_Handler *event_handler = 0;
@@ -533,8 +508,13 @@ ACE_Select_Reactor_Handler_Repository::dump (void) const
for (ACE_Select_Reactor_Handler_Repository_Iterator iter (this);
iter.next (event_handler) != 0;
iter.advance ())
- ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" (event_handler = %x, event_handler->handle_ = %d)\n"),
- event_handler, event_handler->get_handle ()));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_LIB_TEXT (" (event_handler = %@,")
+ ACE_LIB_TEXT (" event_handler->handle_ = ")
+ ACE_HANDLE_FORMAT_SPECIFIER
+ ACE_LIB_TEXT ("\n"),
+ event_handler,
+ event_handler->get_handle ()));
ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" ]\n")));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
diff --git a/ace/Select_Reactor_Base.h b/ace/Select_Reactor_Base.h
index fdcd4eee991..9f49dbd0d00 100644
--- a/ace/Select_Reactor_Base.h
+++ b/ace/Select_Reactor_Base.h
@@ -30,6 +30,15 @@
# include "ace/Unbounded_Queue.h"
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
+#ifdef ACE_WIN32
+# include "ace/Null_Mutex.h"
+# include "ace/Hash_Map_Manager_T.h"
+# include "ace/Functor.h" /* For ACE_Hash<void *> */
+# include <functional> /* For std::equal_to<> */
+#else
+# include "ace/Array_Base.h"
+#endif /* ACE_WIN32 */
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Add useful typedefs to simplify the following code.
@@ -76,9 +85,10 @@ public:
* stored explicitly. This class provides a lightweight
* mechanism to do so.
*/
-class ACE_Export ACE_Event_Tuple
+class ACE_Event_Tuple
{
public:
+
/// Default constructor.
ACE_Event_Tuple (void);
@@ -86,20 +96,20 @@ public:
ACE_Event_Tuple (ACE_Event_Handler *eh,
ACE_HANDLE h);
- /// Destructor.
- ~ACE_Event_Tuple (void);
-
/// Equality operator.
bool operator== (const ACE_Event_Tuple &rhs) const;
/// Inequality operator.
bool operator!= (const ACE_Event_Tuple &rhs) const;
+public:
+
/// Handle.
ACE_HANDLE handle_;
/// ACE_Event_Handler associated with the ACE_HANDLE.
ACE_Event_Handler *event_handler_;
+
};
/**
@@ -277,13 +287,40 @@ class ACE_Export ACE_Select_Reactor_Handler_Repository
public:
friend class ACE_Select_Reactor_Handler_Repository_Iterator;
+ typedef ACE_HANDLE key_type;
+ typedef ACE_Event_Handler * value_type;
+
+ // = The mapping from <HANDLES> to <Event_Handlers>.
+#ifdef ACE_WIN32
+ /**
+ * The NT version implements this via a hash map
+ * @c ACE_Event_Handler*. Since NT implements @c ACE_HANDLE
+ * as a void * we can't directly index into this array. Therefore,
+ * we must explicitly map @c ACE_HANDLE to @c ACE_Event_Handler.
+ */
+ typedef ACE_Hash_Map_Manager_Ex<key_type,
+ value_type,
+ ACE_Hash<key_type>,
+ std::equal_to<key_type>,
+ ACE_Null_Mutex> map_type;
+
+ typedef map_type::size_type max_handlep1_type;
+#else
+ /**
+ * The UNIX version implements this via a dynamically allocated
+ * array of @c ACE_Event_Handler* that is indexed directly using
+ * the @c ACE_HANDLE value.
+ */
+ typedef ACE_Array_Base<value_type> map_type;
+ typedef ACE_HANDLE max_handlep1_type;
+#endif /* ACE_WIN32 */
+
+ typedef map_type::size_type size_type;
+
// = Initialization and termination methods.
/// Default "do-nothing" constructor.
ACE_Select_Reactor_Handler_Repository (ACE_Select_Reactor_Impl &);
- /// Destructor.
- ~ACE_Select_Reactor_Handler_Repository (void);
-
/// Initialize a repository of the appropriate <size>.
/**
* On Unix platforms, the size parameter should be as large as the
@@ -293,7 +330,7 @@ public:
* handler repository. Direct indexing is used for efficiency
* reasons.
*/
- int open (size_t size);
+ int open (size_type size);
/// Close down the repository.
int close (void);
@@ -301,11 +338,9 @@ public:
// = Search structure operations.
/**
- * Return the <ACE_Event_Handler *> associated with ACE_HANDLE.
- * If <index_p> is non-0, then return the index location of the
- * <handle>, if found.
+ * Return the @c ACE_Event_Handler* associated with @c ACE_HANDLE.
*/
- ACE_Event_Handler *find (ACE_HANDLE handle, size_t *index_p = 0);
+ ACE_Event_Handler * find (ACE_HANDLE handle);
/// Bind the ACE_Event_Handler * to the ACE_HANDLE with the
/// appropriate ACE_Reactor_Mask settings.
@@ -322,21 +357,21 @@ public:
// = Sanity checking.
- // Check the <handle> to make sure it's a valid ACE_HANDLE that
- // within the range of legal handles (i.e., >= 0 && < max_size_).
- int invalid_handle (ACE_HANDLE handle);
+ // Check the @a handle to make sure it's a valid @c ACE_HANDLE that
+ // is within the range of legal handles (i.e., >= 0 && < max_size_).
+ bool invalid_handle (ACE_HANDLE handle);
- // Check the <handle> to make sure it's a valid ACE_HANDLE that
+ // Check the @c handle to make sure it's a valid @c ACE_HANDLE that
// within the range of currently registered handles (i.e., >= 0 && <
- // max_handlep1_).
- int handle_in_range (ACE_HANDLE handle);
+ // @c max_handlep1_).
+ bool handle_in_range (ACE_HANDLE handle);
// = Accessors.
/// Returns the current table size.
- size_t size (void) const;
+ size_type size (void) const;
/// Maximum ACE_HANDLE value, plus 1.
- size_t max_handlep1 (void);
+ max_handlep1_type max_handlep1 (void) const;
/// Dump the state of an object.
void dump (void) const;
@@ -345,35 +380,31 @@ public:
ACE_ALLOC_HOOK_DECLARE;
private:
+
+ /// Remove the binding of @a handle corresponding to position @a pos
+ /// in accordance with the @a mask.
+ int unbind (ACE_HANDLE handle,
+ map_type::iterator pos,
+ ACE_Reactor_Mask mask);
+
+ /**
+ * @return @c iterator corresponding @c ACE_Event_Handler*
+ * associated with @c ACE_HANDLE.
+ */
+ map_type::iterator find_eh (ACE_HANDLE handle);
+
+private:
/// Reference to our <Select_Reactor>.
ACE_Select_Reactor_Impl &select_reactor_;
- /// Maximum number of handles.
- ssize_t max_size_;
-
+#ifndef ACE_WIN32
/// The highest currently active handle, plus 1 (ranges between 0 and
- /// <max_size_>.
- int max_handlep1_;
+ /// @c max_size_.
+ max_handlep1_type max_handlep1_;
+#endif /* !ACE_WIN32 */
-#if defined (ACE_WIN32)
- // = The mapping from <HANDLES> to <Event_Handlers>.
-
- /**
- * The NT version implements this via a dynamically allocated
- * array of <ACE_Event_Tuple *>. Since NT implements ACE_HANDLE
- * as a void * we can't directly index into this array. Therefore,
- * we just do a linear search (for now). Next, we'll modify
- * things to use hashing or something faster...
- */
- ACE_Event_Tuple *event_handlers_;
-#else
- /**
- * The UNIX version implements this via a dynamically allocated
- * array of <ACE_Event_Handler *> that is indexed directly using
- * the ACE_HANDLE value.
- */
- ACE_Event_Handler **event_handlers_;
-#endif /* ACE_WIN32 */
+ /// Underlying table of event handlers.
+ map_type event_handlers_;
};
/**
@@ -384,24 +415,26 @@ private:
class ACE_Export ACE_Select_Reactor_Handler_Repository_Iterator
{
public:
- // = Initialization method.
- ACE_Select_Reactor_Handler_Repository_Iterator (const ACE_Select_Reactor_Handler_Repository *s);
- /// dtor.
- ~ACE_Select_Reactor_Handler_Repository_Iterator (void);
+ typedef
+ ACE_Select_Reactor_Handler_Repository::map_type::const_iterator const_base_iterator;
+
+ // = Initialization method.
+ ACE_Select_Reactor_Handler_Repository_Iterator (
+ ACE_Select_Reactor_Handler_Repository const * s);
// = Iteration methods.
/// Pass back the <next_item> that hasn't been seen in the Set.
- /// Returns 0 when all items have been seen, else 1.
- int next (ACE_Event_Handler *&next_item);
+ /// Returns @c false when all items have been seen, else @c true.
+ bool next (ACE_Event_Handler* & next_item);
- /// Returns 1 when all items have been seen, else 0.
- int done (void) const;
+ /// Returns @c true when all items have been seen, else @c false.
+ bool done (void) const;
- /// Move forward by one element in the set. Returns 0 when all the
- /// items in the set have been seen, else 1.
- int advance (void);
+ /// Move forward by one element in the set. Returns @c false when
+ /// all the items in the set have been seen, else @c true.
+ bool advance (void);
/// Dump the state of an object.
void dump (void) const;
@@ -410,11 +443,12 @@ public:
ACE_ALLOC_HOOK_DECLARE;
private:
+
/// Reference to the Handler_Repository we are iterating over.
- const ACE_Select_Reactor_Handler_Repository *rep_;
+ ACE_Select_Reactor_Handler_Repository const * const rep_;
/// Pointer to the current iteration level.
- ssize_t current_;
+ const_base_iterator current_;
};
/**
diff --git a/ace/Select_Reactor_Base.inl b/ace/Select_Reactor_Base.inl
index 83c561b8e8d..5532b99c70f 100644
--- a/ace/Select_Reactor_Base.inl
+++ b/ace/Select_Reactor_Base.inl
@@ -6,39 +6,91 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-ACE_INLINE
-ACE_Event_Tuple::~ACE_Event_Tuple (void)
+ACE_INLINE ACE_Select_Reactor_Handler_Repository::size_type
+ACE_Select_Reactor_Handler_Repository::size (void) const
{
+#ifdef ACE_WIN32
+ return this->event_handlers_.total_size ();
+#else
+ return this->event_handlers_.size ();
+#endif /* ACE_WIN32 */
}
-ACE_INLINE
-ACE_Select_Reactor_Handler_Repository::~ACE_Select_Reactor_Handler_Repository (void)
+ACE_INLINE ACE_Select_Reactor_Handler_Repository::max_handlep1_type
+ACE_Select_Reactor_Handler_Repository::max_handlep1 (void) const
{
+#ifdef ACE_WIN32
+ return this->event_handlers_.current_size ();
+#else
+ return this->max_handlep1_;
+#endif /* ACE_WIN32 */
}
-ACE_INLINE
-ACE_Select_Reactor_Handler_Repository_Iterator::~ACE_Select_Reactor_Handler_Repository_Iterator (void)
+ACE_INLINE int
+ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
+ ACE_Reactor_Mask mask)
{
+ map_type::iterator const pos = this->find_eh (handle);
+
+ return (pos == this->event_handlers_.end ()
+ ? -1
+ : this->unbind (handle, pos, mask));
}
-ACE_INLINE size_t
-ACE_Select_Reactor_Handler_Repository::size (void) const
+ACE_INLINE ACE_Event_Handler *
+ACE_Select_Reactor_Handler_Repository::find (ACE_HANDLE handle)
{
- return this->max_size_;
+ ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::find");
+
+ ACE_Event_Handler * eh = 0;
+
+ map_type::iterator const pos = this->find_eh (handle);
+
+ if (pos != this->event_handlers_.end ())
+ {
+#ifdef ACE_WIN32
+ eh = (*pos).item ();
+#else
+ eh = *pos;
+#endif /* ACE_WIN32 */
+ }
+ // Don't bother setting errno. It isn't used in the select()-based
+ // reactors and incurs a TSS access.
+ // else
+ // {
+ // errno = ENOENT;
+ // }
+
+ return eh;
+}
+
+// ------------------------------------------------------------------
+
+ACE_INLINE bool
+ACE_Select_Reactor_Handler_Repository_Iterator::done (void) const
+{
+#ifdef ACE_WIN32
+ return this->current_ != this->rep_->event_handlers_.end ();
+#else
+ return this->current_ != (this->rep_->event_handlers_.begin ()
+ + this->rep_->max_handlep1 ());
+#endif /* ACE_WIN32 */
}
+// ------------------------------------------------------------------
+
ACE_INLINE
ACE_Event_Tuple::ACE_Event_Tuple (void)
-: handle_ (ACE_INVALID_HANDLE),
- event_handler_ (0)
+ : handle_ (ACE_INVALID_HANDLE),
+ event_handler_ (0)
{
}
ACE_INLINE
ACE_Event_Tuple::ACE_Event_Tuple (ACE_Event_Handler* eh,
ACE_HANDLE h)
-: handle_ (h),
- event_handler_ (eh)
+ : handle_ (h),
+ event_handler_ (eh)
{
}
diff --git a/ace/Select_Reactor_T.cpp b/ace/Select_Reactor_T.cpp
index c4602281d3a..f6fc77b5cb5 100644
--- a/ace/Select_Reactor_T.cpp
+++ b/ace/Select_Reactor_T.cpp
@@ -1044,14 +1044,21 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::work_pending
int const timers_pending =
(this_timeout != 0 && *this_timeout != mwt ? 1 : 0);
- u_long const width = (u_long) this->handler_rep_.max_handlep1 ();
+#ifdef ACE_WIN32
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles.
+ int const width = 0;
+#else
+ int const width =
+ this->handler_rep_.max_handlep1 ();
+#endif /* ACE_WIN32 */
ACE_Select_Reactor_Handle_Set fd_set;
fd_set.rd_mask_ = this->wait_set_.rd_mask_;
fd_set.wr_mask_ = this->wait_set_.wr_mask_;
fd_set.ex_mask_ = this->wait_set_.ex_mask_;
- int nfds = ACE_OS::select (int (width),
+ int nfds = ACE_OS::select (width,
fd_set.rd_mask_,
fd_set.wr_mask_,
fd_set.ex_mask_,
@@ -1070,7 +1077,6 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::wait_for_multiple_events
ACE_Time_Value *max_wait_time)
{
ACE_TRACE ("ACE_Select_Reactor_T::wait_for_multiple_events");
- u_long width = 0;
ACE_Time_Value timer_buf (0);
ACE_Time_Value *this_timeout;
@@ -1086,12 +1092,18 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::wait_for_multiple_events
this_timeout =
this->timer_queue_->calculate_timeout (max_wait_time,
&timer_buf);
- width = (u_long) this->handler_rep_.max_handlep1 ();
+#ifdef ACE_WIN32
+ // This arg is ignored on Windows and causes pointer
+ // truncation warnings on 64-bit compiles.
+ int const width = 0;
+#else
+ int const width = this->handler_rep_.max_handlep1 ();
+#endif /* ACE_WIN32 */
dispatch_set.rd_mask_ = this->wait_set_.rd_mask_;
dispatch_set.wr_mask_ = this->wait_set_.wr_mask_;
dispatch_set.ex_mask_ = this->wait_set_.ex_mask_;
- number_of_active_handles = ACE_OS::select (int (width),
+ number_of_active_handles = ACE_OS::select (width,
dispatch_set.rd_mask_,
dispatch_set.wr_mask_,
dispatch_set.ex_mask_,
diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp
index 85b1a267e8b..f1a8e8db124 100644
--- a/ace/Service_Config.cpp
+++ b/ace/Service_Config.cpp
@@ -313,7 +313,8 @@ ACE_Service_Config::instance (void)
/// Provides access to the static ptr, containing the TSS
/// accessor. Ensures the desired order of initialization, even when
/// other static initializers need the value.
-ACE_Service_Config::TSS_Service_Gestalt_Ptr *& ACE_Service_Config::impl_ (void)
+ACE_Service_Config::TSS_Service_Gestalt_Ptr *
+ACE_Service_Config::impl_ (void)
{
/// A "straight" static ptr does not work in static builds, because
/// some static initializer may call current() method and assign
@@ -323,7 +324,20 @@ ACE_Service_Config::TSS_Service_Gestalt_Ptr *& ACE_Service_Config::impl_ (void)
/// static guarantees that the first time the method is invoked, the
/// instance_ will be initialized before returning.
- static TSS_Service_Gestalt_Ptr *instance_ = 0;
+ static TSS_Service_Gestalt_Ptr * instance_ = 0;
+
+ if (instance_ == 0)
+ {
+ // TSS not initialized yet - first thread to hit this, so doing
+ // the double-checked locking thing
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
+ *ACE_Static_Object_Lock::instance (), 0));
+
+ if (instance_ == 0)
+ ACE_NEW_RETURN (instance_,
+ TSS_Service_Gestalt_Ptr,
+ 0);
+ }
return instance_;
}
@@ -336,62 +350,35 @@ ACE_Service_Config::TSS_Service_Gestalt_Ptr *& ACE_Service_Config::impl_ (void)
ACE_Service_Gestalt *
ACE_Service_Config::current (void)
{
+ TSS_Service_Gestalt_Ptr * const impl = ACE_Service_Config::impl_ ();
+ if (impl == 0)
+ return 0;
- if (ACE_Service_Config::impl_ () != 0)
- {
- // TSS already initialized, but a new thread may need its own
- // ptr to the process-wide gestalt.
- if (ACE_TSS_GET (ACE_Service_Config::impl_ (), TSS_Resources)->ptr_ == 0)
- return current_i (global ());
-
- return ACE_TSS_GET (ACE_Service_Config::impl_ (), TSS_Resources)->ptr_;
- }
- else
- {
- // TSS not initialized yet - first thread to hit this, so doing
- // the double-checked locking thing
- ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
- *ACE_Static_Object_Lock::instance (), 0));
-
- if (ACE_Service_Config::impl_ () != 0)
- {
- // Another thread snuck in and initialized the TSS, but we
- // still need ow own ptr to the process-wide gestalt.
- if (ACE_TSS_GET (ACE_Service_Config::impl_ (), TSS_Resources)->ptr_ == 0)
- return current_i (global ());
+ ACE_Service_Gestalt* & gestalt =
+ ACE_TSS_GET (impl, TSS_Resources)->ptr_;
- return ACE_TSS_GET (ACE_Service_Config::impl_ (), TSS_Resources)->ptr_;
- }
+ if (gestalt == 0)
+ gestalt = ACE_Service_Config::global ();
- return current_i (global ());
- }
+ return gestalt;
}
/// A mutator to set the "current" (TSS) gestalt instance.
ACE_Service_Gestalt*
ACE_Service_Config::current (ACE_Service_Gestalt *newcurrent)
{
- ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
- *ACE_Static_Object_Lock::instance (), 0));
+ TSS_Service_Gestalt_Ptr * const impl = ACE_Service_Config::impl_ ();
+ if (impl == 0)
+ return 0;
- return current_i (newcurrent);
-}
+ ACE_Service_Gestalt* & gestalt =
+ ACE_TSS_GET (impl, TSS_Resources)->ptr_;
-/// A private, non-locking mutator to set the "current" (TSS) gestalt instance.
-/// Make sure to call with the proper locks held!
-ACE_Service_Gestalt*
-ACE_Service_Config::current_i (ACE_Service_Gestalt *newcurrent)
-{
- if (ACE_Service_Config::impl_ () == 0)
- {
- ACE_NEW_RETURN (ACE_Service_Config::impl_ (), TSS_Service_Gestalt_Ptr, 0);
- }
+ gestalt = newcurrent;
- ACE_TSS_GET (ACE_Service_Config::impl_ (), TSS_Resources)->ptr_ = newcurrent;
- return newcurrent;
+ return gestalt;
}
-
// This method has changed to return the gestalt instead of the
// container, underlying the service repository and defined
// ACE_Service_Gestalt::insert (ACE_Static_Svc_Descriptor*). This way
diff --git a/ace/Service_Config.h b/ace/Service_Config.h
index abbf37ab13a..fbe63edc87e 100644
--- a/ace/Service_Config.h
+++ b/ace/Service_Config.h
@@ -182,7 +182,6 @@ public:
/// memory.
virtual ~ACE_Service_Config (void);
-
protected:
/**
@@ -210,19 +209,13 @@ protected:
*/
virtual int parse_args_i (int argc, ACE_TCHAR *argv[]);
-
-
/// = Static interfaces
private:
- /// A private, non-locking mutator to set the "current" (TSS) gestalt instance.
- /// Make sure to call with the proper locks held!
- static ACE_Service_Gestalt* current_i (ACE_Service_Gestalt *newcurrent);
-
/// A Wrapper for the TSS-stored pointer.
struct TSS_Resources {
- TSS_Resources (void) : ptr_ (0) {};
+ TSS_Resources (void) : ptr_ (0) {}
ACE_Service_Gestalt *ptr_;
};
@@ -234,7 +227,7 @@ private:
/// Provides access to the static ptr, containing the TSS
/// accessor. Ensures the desired order of initialization, even when
/// other static initializers need the value.
- static TSS_Service_Gestalt_Ptr * & impl_ (void);
+ static TSS_Service_Gestalt_Ptr * impl_ (void);
protected:
@@ -244,7 +237,6 @@ protected:
/// global from the point of view of the static initializers in DLLs.
static ACE_Service_Gestalt* current (ACE_Service_Gestalt*);
-
public:
/// If not yet initialized, creates a process-wide instance
@@ -254,7 +246,6 @@ public:
/// different times, dependent on the context.
static ACE_Service_Gestalt* global (void);
-
/// Accessor for the "current" service repository through a pointer
/// held in TSS.
static ACE_Service_Gestalt* current (void);
diff --git a/ace/Service_Repository.cpp b/ace/Service_Repository.cpp
index 9367cdcc296..c3b63ac5a97 100644
--- a/ace/Service_Repository.cpp
+++ b/ace/Service_Repository.cpp
@@ -149,7 +149,10 @@ ACE_Service_Repository::fini (void)
// remove services, so typically they are deleted in reverse
// order.
- for (int i = this->current_size_ - 1; i >= 0; i--)
+ // Do not be tempted to use the prefix decrement operator. We
+ // need to use the postfix decrement operator in this case since
+ // the index is unsigned.
+ for (size_t i = this->current_size_; i-- != 0; )
{
ACE_Service_Type *s =
const_cast<ACE_Service_Type *> (this->service_vector_[i]);
@@ -197,7 +200,10 @@ ACE_Service_Repository::close (void)
this->current_size_));
#endif
- for (int i = this->current_size_ - 1; i >= 0; i--)
+ // Do not be tempted to use the prefix decrement operator. We
+ // need to use the postfix decrement operator in this case since
+ // the index is unsigned.
+ for (size_t i = this->current_size_; i-- != 0; )
{
#ifndef ACE_NLOGGING
diff --git a/ace/Sock_Connect.cpp b/ace/Sock_Connect.cpp
index 04725652697..d85a9825f93 100644
--- a/ace/Sock_Connect.cpp
+++ b/ace/Sock_Connect.cpp
@@ -60,8 +60,12 @@ namespace
// private:
// Used internally so not exported.
- /// Does this box have ipv6 turned on?
+ // Does this box have ipv4 turned on?
+ int ace_ipv4_enabled = -1;
+
+ // Does this box have ipv6 turned on?
int ace_ipv6_enabled = -1;
+
}
#endif /* ACE_HAS_IPV6 */
@@ -356,7 +360,13 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
{
ACE_TRACE ("ACE::get_bcast_addr");
-#if !defined(ACE_WIN32) && !defined(__INTERIX)
+#if defined (ACE_LACKS_GET_BCAST_ADDR)
+ ACE_UNUSED_ARG (bcast_addr);
+ ACE_UNUSED_ARG (host_name);
+ ACE_UNUSED_ARG (host_addr);
+ ACE_UNUSED_ARG (handle);
+ ACE_NOTSUP_RETURN (-1);
+#elif !defined(ACE_WIN32) && !defined(__INTERIX)
ACE_HANDLE s = handle;
if (s == ACE_INVALID_HANDLE)
@@ -528,6 +538,111 @@ ACE::get_bcast_addr (ACE_UINT32 &bcast_addr,
#endif /* !ACE_WIN32 && !__INTERIX */
}
+int
+ACE::get_fqdn (ACE_INET_Addr const & addr,
+ char hostname[],
+ size_t len)
+{
+ int h_error; // Not the same as errno!
+ hostent hentry;
+ ACE_HOSTENT_DATA buf;
+
+ char * ip_addr = 0;
+ int ip_addr_size = 0;
+ if (addr.get_type () == AF_INET)
+ {
+ sockaddr_in * const sock_addr =
+ reinterpret_cast<sockaddr_in *> (addr.get_addr ());
+ ip_addr_size = sizeof sock_addr->sin_addr;
+ ip_addr = (char*) &sock_addr->sin_addr;
+ }
+#ifdef ACE_HAS_IPV6
+ else
+ {
+ sockaddr_in6 * sock_addr =
+ reinterpret_cast<sockaddr_in6 *> (addr.get_addr ());
+
+ ip_addr_size = sizeof sock_addr->sin6_addr;
+ ip_addr = (char*) &sock_addr->sin6_addr;
+ }
+#endif /* ACE_HAS_IPV6 */
+
+ // get the host entry for the address in question
+ hostent * const hp = ACE_OS::gethostbyaddr_r (ip_addr,
+ ip_addr_size,
+ addr.get_type (),
+ &hentry,
+ buf,
+ &h_error);
+
+ // if it's not found in the host file or the DNS datase, there is nothing
+ // much we can do. embed the IP address
+ if (hp == 0 || hp->h_name == 0)
+ return -1;
+
+ if (ACE::debug())
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) - ACE::get_fqdn, ")
+ ACE_TEXT ("canonical host name is %s\n"),
+ ACE_TEXT_CHAR_TO_TCHAR (hp->h_name)));
+
+ // check if the canonical name is the FQDN
+ if (!ACE_OS::strchr(hp->h_name, '.'))
+ {
+ // list of address
+ char** p;
+ // list of aliases
+ char** q;
+
+ // for every address and for every alias within the address, check and
+ // see if we can locate a FQDN
+ for (p = hp->h_addr_list; *p != 0; ++p)
+ {
+ for (q = hp->h_aliases; *q != 0; ++q)
+ {
+ if (ACE_OS::strchr(*q, '.'))
+ {
+ // we got an FQDN from an alias. use this
+ if (ACE_OS::strlen (*q) >= len)
+ // the hostname is too huge to fit into a
+ // buffer of size MAXHOSTNAMELEN
+ // should we check other aliases as well
+ // before bailing out prematurely?
+ // for right now, let's do it. this (short name)
+ // is atleast better than embedding the IP
+ // address in the profile
+ continue;
+
+ if (ACE::debug ())
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) - ACE::get_fqdn, ")
+ ACE_TEXT ("found fqdn within alias as %s\n"),
+ ACE_TEXT_CHAR_TO_TCHAR(*q)));
+ ACE_OS::strcpy (hostname, *q);
+
+ return 0;
+ }
+ }
+ }
+ }
+
+ // The canonical name may be an FQDN when we reach here.
+ // Alternatively, the canonical name (a non FQDN) may be the best
+ // we can do.
+ if (ACE_OS::strlen (hp->h_name) >= len)
+ {
+ // The hostname is too large to fit into a buffer of size
+ // MAXHOSTNAMELEN.
+ return -2;
+ }
+ else
+ {
+ ACE_OS::strcpy (hostname, hp->h_name);
+ }
+
+ return 0;
+}
+
// return an array of all configured IP interfaces on this host, count
// rc = 0 on success (count == number of interfaces else -1 caller is
// responsible for calling delete [] on parray
@@ -1479,6 +1594,40 @@ ACE::get_handle (void)
return handle;
}
+bool
+ACE::ipv4_enabled (void)
+{
+#if defined (ACE_HAS_IPV6)
+ if (ace_ipv4_enabled == -1)
+ {
+ // Perform Double-Checked Locking Optimization.
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
+ *ACE_Static_Object_Lock::instance (), false));
+
+ if (ace_ipv4_enabled == -1)
+ {
+ // Determine if the kernel has IPv6 support by attempting to
+ // create a PF_INET socket and see if it fails.
+ ACE_HANDLE const s = ACE_OS::socket (PF_INET, SOCK_DGRAM, 0);
+ if (s == ACE_INVALID_HANDLE)
+ {
+ ace_ipv4_enabled = 0;
+ }
+ else
+ {
+ ace_ipv4_enabled = 1;
+ ACE_OS::closesocket (s);
+ }
+ }
+ }
+
+ return static_cast<bool> (ace_ipv4_enabled);
+#else
+ // Assume it's always enabled since ACE requires some version of
+ // TCP/IP to exist.
+ return true;
+#endif /* ACE_HAS_IPV6*/
+}
int
ACE::ipv6_enabled (void)
diff --git a/ace/Sock_Connect.h b/ace/Sock_Connect.h
index 2df0ec90d21..62aed239861 100644
--- a/ace/Sock_Connect.h
+++ b/ace/Sock_Connect.h
@@ -53,6 +53,11 @@ namespace ACE
ACE_UINT32 host_addr = 0,
ACE_HANDLE handle = ACE_INVALID_HANDLE);
+ /// Get fully qualified host/domain name.
+ extern ACE_Export int get_fqdn (ACE_INET_Addr const & addr,
+ char hostname[],
+ size_t len);
+
/**
* Return count and array of all configured IP interfaces on this
* host, rc = 0 on success (count == number of interfaces else -1).
@@ -73,6 +78,17 @@ namespace ACE
/// made. Caller must close the handle.
extern ACE_Export ACE_HANDLE get_handle (void);
+ /// Returns @c true if IPv4 is enabled on the current host; @c false
+ /// if not.
+ /**
+ * This is an execution-time check. If ACE has not been compiled
+ * with @c ACE_HAS_IPV6, it always returns @c true. This function
+ * tries to create a @c PF_INET socket, returning @c true if it
+ * succeeds, and @c false if it fails. Caches the result so it only
+ gets checked once.
+ */
+ extern ACE_Export bool ipv4_enabled (void);
+
/**
* Returns 1 if IPv6 is enabled on the current host; 0 if not.
* This is an execution-time check. If ACE has not been compiled
diff --git a/ace/Svc_Conf.y b/ace/Svc_Conf.y
index a3b5b7f7080..b3ba6ca31ca 100644
--- a/ace/Svc_Conf.y
+++ b/ace/Svc_Conf.y
@@ -22,13 +22,13 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Prototypes.
-static ACE_Module_Type *ace_get_module (const ACE_Service_Type *sr,
- const ACE_Service_Type *sv,
- int & ace_yyerrno);
+static ACE_Module_Type *ace_get_module (ACE_Service_Type const * sr,
+ ACE_Service_Type const * sv,
+ int & ace_yyerrno);
-static ACE_Module_Type *ace_get_module (const ACE_Service_Type *sr,
- const ACE_TCHAR *svc_name,
- int & ace_yyerrno);
+static ACE_Module_Type *ace_get_module (ACE_Service_Type const * sr,
+ ACE_TCHAR const * svc_name,
+ int & ace_yyerrno);
#define YYDEBUG_LEXER_TEXT (yytext[yyleng] = '\0', yytext)
@@ -183,7 +183,9 @@ module
ACE_Stream_Type *st =
dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (module->record (ACE_SVC_CONF_PARAM->config)->type ()));
- if (mt->init (args.argc (), args.argv ()) == -1
+ if (!st
+ || !mt
+ || mt->init (args.argc (), args.argv ()) == -1
|| st->push (mt) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -235,7 +237,7 @@ module
ACE_Stream_Type *st =
dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (stream->record (ACE_SVC_CONF_PARAM->config)->type ()));
- if (mt != 0 && st->remove (mt) == -1)
+ if (!st || (mt != 0 && st->remove (mt) == -1))
{
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("cannot remove Module_Type %s from STREAM_Type %s\n"),
@@ -336,54 +338,61 @@ yyerror (int yyerrno, int yylineno, const char *s)
// record.
static ACE_Module_Type *
-ace_get_module (const ACE_Service_Type *sr,
- const ACE_TCHAR *svc_name,
+ace_get_module (ACE_Service_Type const * sr,
+ ACE_TCHAR const * svc_name,
int & yyerrno)
{
- const ACE_Service_Type_Impl *type = sr->type ();
- ACE_Stream_Type *st = sr == 0
- ? 0
- : dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (type));
- ACE_Module_Type *mt = st == 0 ? 0 : st->find (svc_name);
+ ACE_Service_Type_Impl const * const type = sr->type ();
+ ACE_Stream_Type const * const st =
+ (sr == 0
+ ? 0
+ : dynamic_cast<ACE_Stream_Type const *> (type));
+ ACE_Module_Type const * const mt = (st == 0 ? 0 : st->find (svc_name));
if (sr == 0 || st == 0 || mt == 0)
{
ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("cannot locate Module_Type %s in STREAM_Type %s\n"),
+ ACE_LIB_TEXT ("cannot locate Module_Type %s ")
+ ACE_LIB_TEXT ("in STREAM_Type %s\n"),
svc_name,
- sr->name ()));
- yyerrno++;
+ (sr ? sr->name () : ACE_LIB_TEXT ("(nil)"))));
+ ++yyerrno;
}
- return mt;
+ return const_cast<ACE_Module_Type *> (mt);
}
static ACE_Module_Type *
-ace_get_module (const ACE_Service_Type *sr,
- const ACE_Service_Type *sv,
+ace_get_module (ACE_Service_Type const * sr,
+ ACE_Service_Type const * sv,
int & yyerrno)
{
- const ACE_Service_Type_Impl *type = sr->type ();
- ACE_Stream_Type *st = sr == 0 ? 0 : (ACE_Stream_Type *) type;
+ ACE_Stream_Type const * const st =
+ (sr == 0
+ ? 0
+ : static_cast<ACE_Stream_Type const *> (sr->type ()));
+
+ ACE_Module_Type const * const mt =
+ static_cast <ACE_Module_Type const *> (sv->type ());
- type = sv->type ();
- ACE_Module_Type *mt = (ACE_Module_Type *) type;
- const ACE_TCHAR *module_type_name = sr->name ();
+ ACE_TCHAR const * const module_type_name =
+ (mt ? mt->name () : ACE_LIB_TEXT ("(nil)"));
if (sr == 0 || st == 0 || mt == 0)
{
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("cannot locate Module_Type %s or STREAM_Type %s\n"),
module_type_name,
- sr->name ()));
- yyerrno++;
+ (sr ? sr->name () : ACE_LIB_TEXT ("(nil)"))));
+ ++yyerrno;
}
// Make sure that the Module has the same name as the
// Module_Type object from the svc.conf file.
- ACE_Module<ACE_SYNCH> *mp = (ACE_Module<ACE_SYNCH> *) mt->object ();
+ ACE_Module<ACE_SYNCH> * const mp =
+ static_cast<ACE_Module<ACE_SYNCH> *> (mt ? mt->object () : 0);
- if (ACE_OS::strcmp (mp->name (), module_type_name) != 0)
+ if (mp && ACE_OS::strcmp (mp->name (), module_type_name) != 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_LIB_TEXT ("warning: assigning Module_Type name %s to Module %s since names differ\n"),
@@ -392,7 +401,7 @@ ace_get_module (const ACE_Service_Type *sr,
mp->name (module_type_name);
}
- return mt;
+ return const_cast<ACE_Module_Type *> (mt);
}
#if defined (DEBUGGING)
diff --git a/ace/Svc_Conf_y.cpp b/ace/Svc_Conf_y.cpp
index 360cbecaed2..7b339a129ea 100644
--- a/ace/Svc_Conf_y.cpp
+++ b/ace/Svc_Conf_y.cpp
@@ -1255,7 +1255,9 @@ ace_yyreduce:
ACE_Stream_Type *st =
dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (module->record (ACE_SVC_CONF_PARAM->config)->type ()));
- if (mt->init (args.argc (), args.argv ()) == -1
+ if (!st
+ || !mt
+ || mt->init (args.argc (), args.argv ()) == -1
|| st->push (mt) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -1319,7 +1321,7 @@ ace_yyreduce:
ACE_Stream_Type *st =
dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (stream->record (ACE_SVC_CONF_PARAM->config)->type ()));
- if (mt != 0 && st->remove (mt) == -1)
+ if (!st || (mt != 0 && st->remove (mt) == -1))
{
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("cannot remove Module_Type %s from STREAM_Type %s\n"),
@@ -1544,7 +1546,7 @@ ace_yyerrlab:
`---------------------------------------------------*/
ace_yyerrorlab:
-#if defined (__GNUC__) || defined (ACE_WIN32)
+#if defined (__GNUC__) || defined (ACE_WIN32) || defined (__HP_aCC) || defined (__DECCXX)
/* Pacify GCC when the user code never invokes ACE_YYERROR and the label
ace_yyerrorlab therefore never appears in user code. */
if (0)
@@ -1659,54 +1661,61 @@ ace_yyerror (int ace_yyerrno, int ace_yylineno, const char *s)
// record.
static ACE_Module_Type *
-ace_get_module (const ACE_Service_Type *sr,
- const ACE_TCHAR *svc_name,
+ace_get_module (ACE_Service_Type const * sr,
+ ACE_TCHAR const * svc_name,
int & ace_yyerrno)
{
- const ACE_Service_Type_Impl *type = sr->type ();
- ACE_Stream_Type *st = sr == 0
- ? 0
- : dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (type));
- ACE_Module_Type *mt = st == 0 ? 0 : st->find (svc_name);
+ ACE_Service_Type_Impl const * const type = sr->type ();
+ ACE_Stream_Type const * const st =
+ (sr == 0
+ ? 0
+ : dynamic_cast<ACE_Stream_Type const *> (type));
+ ACE_Module_Type const * const mt = (st == 0 ? 0 : st->find (svc_name));
if (sr == 0 || st == 0 || mt == 0)
{
ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("cannot locate Module_Type %s in STREAM_Type %s\n"),
+ ACE_LIB_TEXT ("cannot locate Module_Type %s ")
+ ACE_LIB_TEXT ("in STREAM_Type %s\n"),
svc_name,
- sr->name ()));
- ace_yyerrno++;
+ (sr ? sr->name () : ACE_LIB_TEXT ("(nil)"))));
+ ++ace_yyerrno;
}
- return mt;
+ return const_cast<ACE_Module_Type *> (mt);
}
static ACE_Module_Type *
-ace_get_module (const ACE_Service_Type *sr,
- const ACE_Service_Type *sv,
+ace_get_module (ACE_Service_Type const * sr,
+ ACE_Service_Type const * sv,
int & ace_yyerrno)
{
- const ACE_Service_Type_Impl *type = sr->type ();
- ACE_Stream_Type *st = sr == 0 ? 0 : (ACE_Stream_Type *) type;
+ ACE_Stream_Type const * const st =
+ (sr == 0
+ ? 0
+ : static_cast<ACE_Stream_Type const *> (sr->type ()));
- type = sv->type ();
- ACE_Module_Type *mt = (ACE_Module_Type *) type;
- const ACE_TCHAR *module_type_name = sr->name ();
+ ACE_Module_Type const * const mt =
+ static_cast <ACE_Module_Type const *> (sv->type ());
+
+ ACE_TCHAR const * const module_type_name =
+ (mt ? mt->name () : ACE_LIB_TEXT ("(nil)"));
if (sr == 0 || st == 0 || mt == 0)
{
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("cannot locate Module_Type %s or STREAM_Type %s\n"),
module_type_name,
- sr->name ()));
- ace_yyerrno++;
+ (sr ? sr->name () : ACE_LIB_TEXT ("(nil)"))));
+ ++ace_yyerrno;
}
// Make sure that the Module has the same name as the
// Module_Type object from the svc.conf file.
- ACE_Module<ACE_SYNCH> *mp = (ACE_Module<ACE_SYNCH> *) mt->object ();
+ ACE_Module<ACE_SYNCH> * const mp =
+ static_cast<ACE_Module<ACE_SYNCH> *> (mt ? mt->object () : 0);
- if (ACE_OS::strcmp (mp->name (), module_type_name) != 0)
+ if (mp && ACE_OS::strcmp (mp->name (), module_type_name) != 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_LIB_TEXT ("warning: assigning Module_Type name %s to Module %s since names differ\n"),
@@ -1715,7 +1724,7 @@ ace_get_module (const ACE_Service_Type *sr,
mp->name (module_type_name);
}
- return mt;
+ return const_cast<ACE_Module_Type *> (mt);
}
#if defined (DEBUGGING)
diff --git a/ace/System_Time.cpp b/ace/System_Time.cpp
index 9aa77c4ddf1..ae5a9f905ab 100644
--- a/ace/System_Time.cpp
+++ b/ace/System_Time.cpp
@@ -1,16 +1,20 @@
// $Id$
#include "ace/System_Time.h"
+#include "ace/MMAP_Memory_Pool.h"
+#include "ace/Malloc_T.h"
+#include "ace/Null_Mutex.h"
+#include "ace/Time_Value.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_time.h"
-#include "ace/Time_Value.h"
ACE_RCSID(ace, System_Time, "$Id$")
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_System_Time::ACE_System_Time (const ACE_TCHAR *poolname)
- : delta_time_ (0)
+ : shmem_ (0)
+ , delta_time_ (0)
{
ACE_TRACE ("ACE_System_Time::ACE_System_Time");
@@ -56,7 +60,7 @@ ACE_System_Time::~ACE_System_Time (void)
// Get the local system time.
int
-ACE_System_Time::get_local_system_time (ACE_UINT32 &time_out)
+ACE_System_Time::get_local_system_time (time_t & time_out)
{
ACE_TRACE ("ACE_System_Time::get_local_system_time");
time_out = ACE_OS::time (0);
@@ -74,7 +78,7 @@ ACE_System_Time::get_local_system_time (ACE_Time_Value &time_out)
// Get the system time of the central time server.
int
-ACE_System_Time::get_master_system_time (ACE_UINT32 &time_out)
+ACE_System_Time::get_master_system_time (time_t &time_out)
{
ACE_TRACE ("ACE_System_Time::get_master_system_time");
@@ -82,7 +86,7 @@ ACE_System_Time::get_master_system_time (ACE_UINT32 &time_out)
{
// Try to find it
void * temp;
- if (this->shmem_->find (ACE_DEFAULT_TIME_SERVER_STR, temp) == -1)
+ if (this->shmem_->find (ACE_DEFAULT_TIME_SERVER_STR, temp) == -1)
{
// No time entry in shared memory (meaning no Clerk exists)
// so return the local time of the host.
@@ -90,20 +94,20 @@ ACE_System_Time::get_master_system_time (ACE_UINT32 &time_out)
}
else
// Extract the delta time.
- this->delta_time_ = (long *) temp;
+ this->delta_time_ = static_cast<long *> (temp);
}
- ACE_UINT32 local_time;
+ time_t local_time;
// If delta_time is positive, it means that the system clock is
// ahead of our local clock so add delta to the local time to get an
// approximation of the system time. Else if delta time is negative,
// it means that our local clock is ahead of the system clock, so
// return the last local time stored (to avoid time conflicts).
- if (*this->delta_time_ >=0 )
+ if (*this->delta_time_ >= 0 )
{
this->get_local_system_time (local_time);
- time_out = local_time + (ACE_UINT32) *this->delta_time_;
+ time_out = local_time + static_cast<ACE_UINT32> (*this->delta_time_);
}
else
// Return the last local time. Note that this is stored as the
@@ -116,7 +120,7 @@ int
ACE_System_Time::get_master_system_time (ACE_Time_Value &time_out)
{
ACE_TRACE ("ACE_System_Time::get_master_system_time");
- ACE_UINT32 to;
+ time_t to;
if (this->get_master_system_time (to) == -1)
return -1;
time_out.sec (to);
diff --git a/ace/System_Time.h b/ace/System_Time.h
index ae818eaf60c..bf58d4d5640 100644
--- a/ace/System_Time.h
+++ b/ace/System_Time.h
@@ -7,7 +7,8 @@
* $Id$
*
* @author Prashant Jain
- * @author Tim H. Harrison and Douglas C. Schmidt
+ * @author Tim H. Harrison
+ * @author Douglas C. Schmidt
*/
//=============================================================================
@@ -21,12 +22,19 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "ace/MMAP_Memory_Pool.h"
-#include "ace/Malloc_T.h"
-#include "ace/Null_Mutex.h"
+#include "ace/Global_Macros.h"
+#include "ace/os_include/os_time.h" /* For time_t. */
+#include "ace/os_include/os_limits.h" /* For MAXPATHLEN. */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+template<ACE_MEM_POOL_1, class ACE_LOCK> class ACE_Malloc;
+template<class MALLOC> class ACE_Allocator_Adapter;
+
+class ACE_Null_Mutex;
+class ACE_Time_Value;
+class ACE_MMAP_Memory_Pool;
+
/**
* @class ACE_System_Time
*
@@ -54,14 +62,14 @@ public:
/// Get the local system time, i.e., the value returned by
/// ACE_OS::time().
- static int get_local_system_time (ACE_UINT32 &time_out);
+ static int get_local_system_time (time_t & time_out);
/// Get the local system time, i.e., the value returned by
/// ACE_OS::time().
static int get_local_system_time (ACE_Time_Value &time_out);
/// Get the system time of the central time server.
- int get_master_system_time (ACE_UINT32 &time_out);
+ int get_master_system_time (time_t & time_out);
/// Get the system time of the central time server.
int get_master_system_time (ACE_Time_Value &time_out);
@@ -75,13 +83,13 @@ private:
typedef ACE_Allocator_Adapter<MALLOC> ALLOCATOR;
/// Our allocator (used for obtaining system time from shared memory).
- ALLOCATOR *shmem_;
+ ALLOCATOR * shmem_;
/// The name of the pool used by the allocator.
ACE_TCHAR poolname_[MAXPATHLEN + 1];
/// Pointer to delta time kept in shared memory.
- long *delta_time_;
+ long * delta_time_;
};
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ace/TTY_IO.cpp b/ace/TTY_IO.cpp
index 4d6175362eb..f1110393576 100644
--- a/ace/TTY_IO.cpp
+++ b/ace/TTY_IO.cpp
@@ -15,24 +15,23 @@ ACE_RCSID (ace,
TTY_IO,
"$Id$")
-#if defined (ACE_HAS_TERMIOS) || defined (ACE_HAS_TERMIO) || defined (ACE_WIN32)
namespace
{
+ const char ACE_TTY_IO_NONE[] = "none";
+#if defined (ACE_HAS_TERMIOS) || defined (ACE_HAS_TERMIO) || defined (ACE_WIN32)
const char ACE_TTY_IO_ODD[] = "odd";
const char ACE_TTY_IO_EVEN[] = "even";
- const char ACE_TTY_IO_NONE[] = "none";
+#endif
#if defined (ACE_WIN32)
const char ACE_TTY_IO_MARK[] = "mark";
const char ACE_TTY_IO_SPACE[] = "space";
#endif /* ACE_WIN32 */
}
-#endif
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_TTY_IO::Serial_Params::Serial_Params (void)
{
-#if defined (ACE_HAS_TERMIOS) || defined (ACE_HAS_TERMIO) || defined (ACE_WIN32)
baudrate = 9600;
xonlim = 0;
xofflim = 0;
@@ -50,7 +49,6 @@ ACE_TTY_IO::Serial_Params::Serial_Params (void)
dtrdisable = false;
databits = 8;
stopbits = 1;
-#endif
}
// Interface for reading/writing serial device parameters
diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp
index 4daf221f8d9..0c5d1ca6ff7 100644
--- a/ace/Thread_Manager.cpp
+++ b/ace/Thread_Manager.cpp
@@ -1816,7 +1816,7 @@ ACE_Thread_Manager::wait (const ACE_Time_Value *timeout,
if (ACE_BIT_DISABLED (item->flags_, THR_DETACHED | THR_DAEMON)
|| ACE_BIT_ENABLED (item->flags_, THR_JOINABLE))
// Detached handles shouldn't reached here.
- ACE_Thread::join (item->thr_handle_);
+ (void) ACE_Thread::join (item->thr_handle_);
# if defined (ACE_HAS_PTHREADS_DRAFT4) && defined (ACE_LACKS_SETDETACH)
// Must explicitly detach threads. Threads without
diff --git a/ace/Time_Value.h b/ace/Time_Value.h
index f76c4880c2e..51746d067eb 100644
--- a/ace/Time_Value.h
+++ b/ace/Time_Value.h
@@ -26,7 +26,7 @@
// Define some helpful constants.
// Not type-safe, and signed. For backward compatibility.
#define ACE_ONE_SECOND_IN_MSECS 1000L
-#define ACE_ONE_SECOND_IN_USECS 1000000L
+suseconds_t const ACE_ONE_SECOND_IN_USECS = 1000000;
#define ACE_ONE_SECOND_IN_NSECS 1000000000L
// needed for ACE_UINT64
diff --git a/ace/Truncate.h b/ace/Truncate.h
index 1c21f613667..a45af94a21a 100644
--- a/ace/Truncate.h
+++ b/ace/Truncate.h
@@ -496,7 +496,7 @@ namespace ACE_Utils
template<typename T>
struct Truncator<T, T>
{
- T operator() (T val)
+ static T trunc (T val)
{
return val;
}
@@ -507,9 +507,21 @@ namespace ACE_Utils
//----------------------------------------------------------
template<>
- struct Truncator<ACE_INT32, ACE_INT8>
+ struct ACE_Export Truncator<ACE_INT32, ACE_INT8>
+ {
+ static ACE_INT8 trunc (ACE_INT32 val)
+ {
+ return
+ (val > ACE_Numeric_Limits<ACE_INT8>::max ()
+ ? ACE_Numeric_Limits<ACE_INT8>::max ()
+ : static_cast<ACE_INT8> (val));
+ }
+ };
+
+ template<>
+ struct ACE_Export Truncator<ACE_UINT32, ACE_UINT8>
{
- ACE_INT8 operator() (ACE_INT32 val)
+ static ACE_UINT8 truncate (ACE_UINT32 val)
{
return
(val > ACE_Numeric_Limits<ACE_INT8>::max ()
@@ -519,9 +531,9 @@ namespace ACE_Utils
};
template<>
- struct Truncator<ACE_UINT32, ACE_UINT8>
+ struct ACE_Export Truncator<ACE_UINT32, ACE_UINT8>
{
- ACE_UINT8 operator() (ACE_UINT32 val)
+ static ACE_UINT8 trunc (ACE_UINT32 val)
{
return
(val > static_cast<ACE_UINT32> (ACE_Numeric_Limits<ACE_UINT8>::max ())
@@ -531,9 +543,9 @@ namespace ACE_Utils
};
template<>
- struct Truncator<ACE_INT32, ACE_UINT8>
+ struct ACE_Export Truncator<ACE_INT32, ACE_UINT8>
{
- ACE_UINT8 operator() (ACE_INT32 val)
+ static ACE_UINT8 trunc (ACE_INT32 val)
{
return
(val > static_cast<ACE_INT32> (ACE_Numeric_Limits<ACE_UINT8>::max ())
@@ -543,9 +555,9 @@ namespace ACE_Utils
};
template<>
- struct Truncator<ACE_UINT32, ACE_INT8>
+ struct ACE_Export Truncator<ACE_UINT32, ACE_INT8>
{
- ACE_INT8 operator() (ACE_UINT32 val)
+ static ACE_INT8 trunc (ACE_UINT32 val)
{
return
(val > static_cast<ACE_UINT32> (ACE_Numeric_Limits<ACE_INT8>::max ())
@@ -555,9 +567,9 @@ namespace ACE_Utils
};
template<>
- struct Truncator<ACE_INT64, ACE_INT32>
+ struct ACE_Export Truncator<ACE_INT64, ACE_INT32>
{
- ACE_INT32 operator() (ACE_INT64 val)
+ static ACE_INT32 trunc (ACE_INT64 val)
{
return
(val > ACE_Numeric_Limits<ACE_INT32>::max ()
@@ -567,9 +579,9 @@ namespace ACE_Utils
};
template<>
- struct Truncator<ACE_INT64, ACE_UINT32>
+ struct ACE_Export Truncator<ACE_INT64, ACE_UINT32>
{
- ACE_UINT32 operator() (ACE_INT64 val)
+ static ACE_UINT32 trunc (ACE_INT64 val)
{
return
(val > static_cast<ACE_INT64> (ACE_Numeric_Limits<ACE_UINT32>::max ())
@@ -579,11 +591,10 @@ namespace ACE_Utils
};
template<>
- struct Truncator<ACE_UINT64, ACE_UINT32>
+ struct ACE_Export Truncator<ACE_UINT64, ACE_UINT32>
{
- ACE_UINT32 operator() (ACE_UINT64 val)
+ static ACE_UINT32 trunc (ACE_UINT64 val)
{
- return
(val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_UINT32>::max ())
? ACE_Numeric_Limits<ACE_UINT32>::max ()
: static_cast<ACE_UINT32> (val));
@@ -591,9 +602,9 @@ namespace ACE_Utils
};
template<>
- struct Truncator<ACE_UINT64, ACE_INT32>
+ struct ACE_Export Truncator<ACE_UINT64, ACE_INT32>
{
- ACE_INT32 operator() (ACE_UINT64 val)
+ static ACE_INT32 trunc (ACE_UINT64 val)
{
return
(val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_INT32>::max ())
@@ -607,18 +618,18 @@ namespace ACE_Utils
//----------------------------------------------------------
template<>
- struct Truncator<ACE_INT32, ACE_UINT32>
+ struct ACE_Export Truncator<ACE_INT32, ACE_UINT32>
{
- ACE_UINT32 operator() (ACE_INT32 val)
+ static ACE_UINT32 trunc (ACE_INT32 val)
{
return static_cast<ACE_UINT32> (val);
}
};
template<>
- struct Truncator<ACE_UINT32, ACE_INT32>
+ struct ACE_Export Truncator<ACE_UINT32, ACE_INT32>
{
- ACE_INT32 operator() (ACE_UINT32 val)
+ static ACE_INT32 trunc (ACE_UINT32 val)
{
return
(val > static_cast<ACE_UINT32> (ACE_Numeric_Limits<ACE_INT32>::max ())
@@ -628,18 +639,18 @@ namespace ACE_Utils
};
template<>
- struct Truncator<ACE_INT64, ACE_UINT64>
+ struct ACE_Export Truncator<ACE_INT64, ACE_UINT64>
{
- ACE_UINT64 operator() (ACE_INT64 val)
+ static ACE_UINT64 trunc (ACE_INT64 val)
{
return static_cast<ACE_UINT64> (val);
}
};
template<>
- struct Truncator<ACE_UINT64, ACE_INT64>
+ struct ACE_Export Truncator<ACE_UINT64, ACE_INT64>
{
- ACE_INT64 operator() (ACE_UINT64 val)
+ static ACE_INT64 trunc (ACE_UINT64 val)
{
return
(val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_INT64>::max ())
@@ -653,72 +664,72 @@ namespace ACE_Utils
//----------------------------------------------------------
template<>
- struct Truncator<ACE_INT8, ACE_INT32>
+ struct ACE_Export Truncator<ACE_INT8, ACE_INT32>
{
- ACE_INT32 operator() (ACE_INT8 val)
+ static ACE_INT32 trunc (ACE_INT8 val)
{
return static_cast<ACE_INT32> (val);
}
};
template<>
- struct Truncator<ACE_UINT8, ACE_UINT32>
+ struct ACE_Export Truncator<ACE_UINT8, ACE_UINT32>
{
- ACE_UINT32 operator() (ACE_UINT8 val)
+ static ACE_UINT32 trunc (ACE_UINT8 val)
{
return static_cast<ACE_UINT32> (val);
}
};
template<>
- struct Truncator<ACE_UINT8, ACE_INT32>
+ struct ACE_Export Truncator<ACE_UINT8, ACE_INT32>
{
- ACE_INT32 operator() (ACE_UINT8 val)
+ static ACE_INT32 trunc (ACE_UINT8 val)
{
return static_cast<ACE_INT32> (val);
}
};
template<>
- struct Truncator<ACE_INT8, ACE_UINT32>
+ struct ACE_Export Truncator<ACE_INT8, ACE_UINT32>
{
- ACE_UINT32 operator() (ACE_INT8 val)
+ static ACE_UINT32 trunc (ACE_INT8 val)
{
return static_cast<ACE_UINT32> (val);
}
};
template<>
- struct Truncator<ACE_INT32, ACE_INT64>
+ struct ACE_Export Truncator<ACE_INT32, ACE_INT64>
{
- ACE_INT64 operator() (ACE_INT32 val)
+ static ACE_INT64 trunc (ACE_INT32 val)
{
return static_cast<ACE_INT64> (val);
}
};
template<>
- struct Truncator<ACE_INT32, ACE_UINT64>
+ struct ACE_Export Truncator<ACE_INT32, ACE_UINT64>
{
- ACE_UINT64 operator() (ACE_INT32 val)
+ static ACE_UINT64 trunc (ACE_INT32 val)
{
return static_cast<ACE_UINT64> (val);
}
};
template<>
- struct Truncator<ACE_UINT32, ACE_UINT64>
+ struct ACE_Export Truncator<ACE_UINT32, ACE_UINT64>
{
- ACE_UINT64 operator() (ACE_UINT32 val)
+ static ACE_UINT64 trunc (ACE_UINT32 val)
{
return static_cast<ACE_UINT64> (val);
}
};
template<>
- struct Truncator<ACE_UINT32, ACE_INT64>
+ struct ACE_Export Truncator<ACE_UINT32, ACE_INT64>
{
- ACE_INT64 operator() (ACE_UINT32 val)
+ static ACE_INT64 trunc (ACE_UINT32 val)
{
return static_cast<ACE_INT64> (val);
}
@@ -728,7 +739,7 @@ namespace ACE_Utils
template<typename TO, typename FROM>
inline TO Truncate (FROM val)
{
- return Truncator<FROM, TO>() (val);
+ return Truncator<FROM, TO>::trunc (val);
}
#endif /* !__BORLANDC__ || __BORLANDC__ > 0x582 */
diff --git a/ace/UUID.cpp b/ace/UUID.cpp
index 9ea7f9961a3..65eac030b59 100644
--- a/ace/UUID.cpp
+++ b/ace/UUID.cpp
@@ -475,17 +475,15 @@ namespace ACE_Utils
return this->lock_;
}
- ACE_SYNCH_MUTEX*
+ void
UUID_Generator::lock (ACE_SYNCH_MUTEX* lock,
- bool release_lock_)
+ bool release_lock)
{
- if (destroy_lock_)
- delete lock_;
+ if (this->destroy_lock_)
+ delete this->lock_;
- ACE_SYNCH_MUTEX* prev_lock = this->lock_;
this->lock_ = lock;
- this->destroy_lock_ = release_lock_;
- return prev_lock;
+ this->destroy_lock_ = release_lock;
}
}
diff --git a/ace/UUID.h b/ace/UUID.h
index f56812915ef..f94ffeafc71 100644
--- a/ace/UUID.h
+++ b/ace/UUID.h
@@ -188,8 +188,8 @@ namespace ACE_Utils
ACE_SYNCH_MUTEX* lock (void);
/// Set a new locking strategy and return the old one.
- ACE_SYNCH_MUTEX* lock (ACE_SYNCH_MUTEX*lock,
- bool release_lock);
+ void lock (ACE_SYNCH_MUTEX* lock,
+ bool release_lock);
private:
diff --git a/ace/Unbounded_Queue.cpp b/ace/Unbounded_Queue.cpp
index f7a11c2de9d..f88a45ee493 100644
--- a/ace/Unbounded_Queue.cpp
+++ b/ace/Unbounded_Queue.cpp
@@ -272,7 +272,7 @@ ACE_Unbounded_Queue<T>::set (const T &item,
for (i = 0;
i < slot && i < this->cur_size_;
- i++)
+ ++i)
curr = curr->next_;
if (i < this->cur_size_)
@@ -297,10 +297,10 @@ ACE_Unbounded_Queue<T>::set (const T &item,
}
else
{
- T dummy;
+ T const dummy = T ();
// We need to expand the list by multiple (dummy) items.
- for (; i < slot; i++)
+ for (; i < slot; ++i)
{
// This head points to the existing dummy node, which is
// about to be overwritten when we add the new dummy
diff --git a/ace/WFMO_Reactor.cpp b/ace/WFMO_Reactor.cpp
index c0deb2b65c2..768f66744f4 100644
--- a/ace/WFMO_Reactor.cpp
+++ b/ace/WFMO_Reactor.cpp
@@ -631,6 +631,9 @@ ACE_WFMO_Reactor_Handler_Repository::bind_i (int io_entry,
ACE_HANDLE event_handle,
int delete_event)
{
+ if (event_handler == 0)
+ return -1;
+
// Make sure that the <handle> is valid
if (event_handle == ACE_INVALID_HANDLE)
event_handle = event_handler->get_handle ();
@@ -1189,7 +1192,7 @@ ACE_WFMO_Reactor::open (size_t size,
this->atomic_wait_array_[0] = this->lock_.lock ().proc_mutex_;
this->atomic_wait_array_[1] = this->ok_to_wait_.handle ();
- // Prevent memory leaks when the ACE_WFMO_Reactor is reopened.
+ // Prevent memory leaks when the ACE_WFMO_Reactor is reopened.
if (this->delete_handler_rep_)
{
if (this->handler_rep_.changes_required ())
diff --git a/ace/ace_for_tao.mpc b/ace/ace_for_tao.mpc
index 7856c9158d3..cd28be5635b 100644
--- a/ace/ace_for_tao.mpc
+++ b/ace/ace_for_tao.mpc
@@ -139,6 +139,7 @@ project(ACE_FOR_TAO) : acedefaults, core, svcconf, versioned_namespace, pkgconfi
Read_Buffer.cpp
Recursive_Thread_Mutex.cpp
Refcountable.cpp
+ Rtems_init.c
RW_Mutex.cpp
RW_Thread_Mutex.cpp
Sched_Params.cpp
@@ -190,13 +191,10 @@ project(ACE_FOR_TAO) : acedefaults, core, svcconf, versioned_namespace, pkgconfi
// ACE_Token implementation uses semaphores on Windows and VxWorks.
conditional(vc6,vc71,vc8,nmake,bmake,borland) {
- ACE_crc32.cpp // Required by SV_Semaphore_Simple
NT_Service.cpp // Required by ace_for_tao sponsors
Semaphore.cpp
Process_Mutex.cpp
WFMO_Reactor.cpp
- SV_Semaphore_Simple.cpp
- SV_Semaphore_Complex.cpp
}
}
@@ -341,6 +339,7 @@ project(ACE_FOR_TAO) : acedefaults, core, svcconf, versioned_namespace, pkgconfi
Synch_Traits.h
TSS_T.h
Timer_Queuefwd.h
+ Truncate.h
Value_Ptr.h
Version.h
ace_wchar.h
diff --git a/ace/ace_wchar.inl b/ace/ace_wchar.inl
index e99549e3f04..7dabcc92bca 100644
--- a/ace/ace_wchar.inl
+++ b/ace/ace_wchar.inl
@@ -44,7 +44,7 @@ ACE_Wide_To_Ascii::convert (const wchar_t *wstr)
0);
# elif defined (ACE_LACKS_WCSLEN)
const wchar_t * wtemp = wstr;
- while (wtemp != 0)
+ while ((*wtemp) != 0) // Hopefully the string is null terminated!
++wtemp;
int const len = wtemp - wstr + 1;
diff --git a/ace/config-aix-4.x.h b/ace/config-aix-4.x.h
index 8b6d031aadd..d434ad61003 100644
--- a/ace/config-aix-4.x.h
+++ b/ace/config-aix-4.x.h
@@ -314,8 +314,8 @@
# if (ACE_AIX_VERS >= 403)
# define ACE_HAS_PTHREADS_STD
# define ACE_HAS_PTHREADS_UNIX98_EXT
-# define ACE_HAS_PTHREAD_CONTINUE
-# define ACE_HAS_PTHREAD_SUSPEND
+# define ACE_HAS_PTHREAD_CONTINUE_NP
+# define ACE_HAS_PTHREAD_SUSPEND_NP
# define ACE_HAS_RECURSIVE_MUTEXES
# else
# define ACE_HAS_PTHREADS_DRAFT7
diff --git a/ace/config-lite.h b/ace/config-lite.h
index cd121771c86..e36f2c525a5 100644
--- a/ace/config-lite.h
+++ b/ace/config-lite.h
@@ -99,6 +99,66 @@ typedef ACE_OS_Thread_Descriptor *(*ACE_THR_DESC_LOG_MSG_HOOK) (void);
ACE_END_VERSIONED_NAMESPACE_DECL
+/**
+ * @deprecated ACE_DECLARE_STL_REVERSE_ITERATORS is a crutch to be
+ * used until all C++ compiler supported by ACE support
+ * the standard reverse_iterator adapters.
+ * @internal ACE_DECLARE_STL_REVERSE_ITERATORS is not meant for use
+ * outside of ACE.
+ */
+// STL reverse_iterator declaration generator
+// Make sure you include <iterator> in the file you're using this
+// generator, and that the following traits are available:
+//
+// iterator
+// const_iterator
+// value_type
+// reference
+// pointer
+// const_reference
+// const_pointer
+// difference_type
+//
+// Once all C++ compilers support the standard reverse_iterator
+// adapters, we can drop this generator macro or at least drop the
+// MSVC++ or Sun Studio preprocessor conditional blocks.
+#if defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x580
+ // We need to ensure that this is included in order to test
+ // _RWSTD_NO_CLASS_PARTIAL_SPEC below
+# include <Cstd/stdcomp.h>
+#endif /* __SUNPRO_CC <= 0x580 */
+#if defined (_MSC_VER) && !defined (_CPPLIB_VER)
+ // MSVC++ 6 and the latest platform SDKs don't define a standard
+ // compliant reverse_iterator adapter.
+ //
+ // It seems when there is no _CPPLIB_VER defined we can also assume
+ // that the SDK is old.
+# define ACE_DECLARE_STL_REVERSE_ITERATORS \
+ typedef std::reverse_iterator<iterator, value_type> reverse_iterator; \
+ typedef std::reverse_iterator<const_iterator, \
+ value_type const> const_reverse_iterator;
+#elif defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x580 \
+ && defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
+# define ACE_DECLARE_STL_REVERSE_ITERATORS \
+ typedef std::reverse_iterator<iterator, \
+ std::input_iterator_tag, \
+ value_type, \
+ reference, \
+ pointer, \
+ difference_type> reverse_iterator; \
+ typedef std::reverse_iterator<const_iterator, \
+ std::input_iterator_tag, \
+ value_type const, \
+ const_reference, \
+ const_pointer, \
+ difference_type> const_reverse_iterator;
+#else
+# define ACE_DECLARE_STL_REVERSE_ITERATORS \
+ typedef std::reverse_iterator<iterator> reverse_iterator; \
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+#endif /* _MSC_VER && !_CPPLIB_VER */
+
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_LITE_H */
diff --git a/ace/config-rtems.h b/ace/config-rtems.h
index 5c8addd675f..98c1dab9e1e 100644
--- a/ace/config-rtems.h
+++ b/ace/config-rtems.h
@@ -159,7 +159,15 @@
// Missing types
# define ACE_LACKS_IOVEC
+# define ACE_LACKS_IN_ADDR
# define ACE_LACKS_SOCKADDR_IN
+# define ACE_LACKS_HOSTENT
+# define ACE_LACKS_SOCKADDR
+# define ACE_LACKS_IP_MREQ
+# define ACE_LACKS_PROTOENT
+# define ACE_LACKS_SERVENT
+# define ACE_LACKS_IFREQ
+# define ACE_LACKS_INTPTR_T
// Missing methods
# define ACE_LACKS_GETHOSTBYADDR
@@ -169,6 +177,33 @@
# define ACE_LACKS_BIND
# define ACE_LACKS_NTOHL
# define ACE_LACKS_HTONL
+# define ACE_LACKS_HTONS
+# define ACE_LACKS_NTOHS
+# define ACE_LACKS_SELECT
+# define ACE_LACKS_SOCKET
+# define ACE_LACKS_SHUTDOWN
+# define ACE_LACKS_SETSOCKOPT
+# define ACE_LACKS_INET_ATON
+# define ACE_LACKS_INET_ADDR
+# define ACE_LACKS_INET_NTOA
+# define ACE_LACKS_GET_BCAST_ADDR
+# define ACE_LACKS_GETSERVBYNAME
+# define ACE_LACKS_ACCEPT
+# define ACE_LACKS_CONNECT
+# define ACE_LACKS_GETPEERNAME
+# define ACE_LACKS_GETSOCKNAME
+# define ACE_LACKS_GETSOCKOPT
+# define ACE_LACKS_RECV
+# define ACE_LACKS_SEND
+# define ACE_LACKS_SENDTO
+# define ACE_LACKS_RECVFROM
+# define ACE_LACKS_RECVMSG
+# define ACE_LACKS_SENDMSG
+# define ACE_LACKS_GETHOSTBYADDR_R
+# define ACE_LACKS_GETPROTOBYNAME
+# define ACE_LACKS_GETPROTOBYNUMBER
+# define ACE_LACKS_GETSERVBYNAME
+# undef ACE_HAS_MSG
// Missing OS features
# define ACE_LACKS_UNIX_SYSLOG
diff --git a/ace/os_include/netinet/os_in.h b/ace/os_include/netinet/os_in.h
index 63cf9c582f1..9b43db20e0a 100644
--- a/ace/os_include/netinet/os_in.h
+++ b/ace/os_include/netinet/os_in.h
@@ -68,6 +68,31 @@ extern "C"
};
# endif /* ! ACE_HAS_IP_MULTICAST && ACE_LACKS_IP_ADD_MEMBERSHIP */
+# if defined (ACE_LACKS_IN_ADDR)
+ struct in_addr
+ {
+ u_long s_addr;
+ };
+# endif /* ACE_LACKS_IN_ADDR */
+
+# if defined (ACE_LACKS_SOCKADDR_IN)
+ struct sockaddr_in
+ {
+ short sin_family; // e.g. AF_INET
+ unsigned short sin_port; // e.g. htons(3490)
+ struct in_addr sin_addr; // see struct in_addr, below
+ char sin_zero[8]; // zero this if you want to
+ };
+# endif /* ACE_LACKS_SOCKADDR_IN */
+
+# if defined (ACE_LACKS_IP_MREQ)
+ struct ip_mreq
+ {
+ struct in_addr imr_multiaddr; /* IP multicast address of group */
+ struct in_addr imr_interface; /* local IP address of interface */
+ };
+# endif /* ACE_LACKS_IP_MREQ */
+
#if !defined (IPPORT_RESERVED)
# define IPPORT_RESERVED 1024
#endif /* !IPPORT_RESERVED */
@@ -132,6 +157,10 @@ extern "C"
# define IP_MAX_MEMBERSHIPS 0
# endif /* IP_MAX_MEMBERSHIP */
+# if !defined (IPPROTO_IP)
+# define IPPROTO_IP 0
+# endif /* IPPROTO_IP */
+
# if !defined (INADDR_ANY)
# define INADDR_ANY (u_long)0x00000000
# endif /* INADDR_ANY */
diff --git a/ace/os_include/os_netdb.h b/ace/os_include/os_netdb.h
index 6b543023ed4..879aecd1c69 100644
--- a/ace/os_include/os_netdb.h
+++ b/ace/os_include/os_netdb.h
@@ -49,6 +49,48 @@ extern "C"
{
#endif /* __cplusplus */
+<<<<<<< .working
+#if defined (ACE_LACKS_HOSTENT)
+struct hostent {
+ char *h_name; /* official name of host */
+ char **h_aliases; /* alias list */
+ int h_addrtype; /* host address type */
+ int h_length; /* length of address */
+ char **h_addr_list; /* list of addresses from name server */
+#define h_addr h_addr_list[0] /* address, for backward compatibility */
+};
+#endif /* ACE_LACKS_HOSTENT */
+
+=======
+#if defined (ACE_LACKS_HOSTENT)
+struct hostent {
+ char *h_name; /* official name of host */
+ char **h_aliases; /* alias list */
+ int h_addrtype; /* host address type */
+ int h_length; /* length of address */
+ char **h_addr_list; /* list of addresses from name server */
+#define h_addr h_addr_list[0] /* address, for backward compatibility */
+};
+#endif /* ACE_LACKS_HOSTENT */
+
+#if defined (ACE_LACKS_PROTOENT)
+struct protoent {
+ char *p_name; /* official protocol name */
+ char **p_aliases; /* alias list */
+ int p_proto; /* protocol # */
+};
+#endif /* ACE_LACKS_PROTOENT */
+
+#if defined (ACE_LACKS_SERVENT)
+struct servent {
+ char *s_name; /* official service name */
+ char **s_aliases; /* alias list */
+ int s_port; /* port # */
+ char *s_proto; /* protocol to use */
+};
+#endif /* ACE_LACKS_SERVENT */
+
+>>>>>>> .merge-right.r75022
#if defined (ACE_HAS_STRUCT_NETDB_DATA)
typedef char ACE_HOSTENT_DATA[sizeof(struct hostent_data)];
typedef char ACE_SERVENT_DATA[sizeof(struct servent_data)];
diff --git a/ace/os_include/sys/os_socket.h b/ace/os_include/sys/os_socket.h
index ffb4f3174c0..1013a847d8f 100644
--- a/ace/os_include/sys/os_socket.h
+++ b/ace/os_include/sys/os_socket.h
@@ -62,6 +62,14 @@ extern "C"
# endif /* ! msg_accrightslen */
#endif /* ACE_HAS_MSG && ACE_LACKS_MSG_ACCRIGHTS */
+# if defined (ACE_LACKS_SOCKADDR)
+ struct sockaddr {
+ u_char sa_len; /* total length */
+ u_char sa_family; /* address family */
+ char sa_data[14]; /* actually longer; address value */
+ };
+# endif /* ACE_LACKS_SOCKADDR */
+
#if defined (ACE_WIN32)
struct msghdr
{
@@ -107,6 +115,30 @@ extern "C"
# define AF_UNSPEC 0
#endif /* AF_UNSPEC */
+#if !defined (AF_LOCAL)
+# define AF_LOCAL 1
+#endif /* AF_LOCAL */
+
+#if !defined (AF_INET)
+# define AF_INET 2
+#endif /* AF_INET */
+
+#if !defined (PF_INET)
+# define PF_INET AF_INET
+#endif /* PF_INET */
+
+#if !defined (PF_LOCAL)
+# define PF_LOCAL AF_LOCAL
+#endif /* PF_LOCAL */
+
+#if !defined (PF_UNIX)
+# define PF_UNIX PF_LOCAL
+#endif /* PF_UNIX */
+
+#if !defined (AF_MAX)
+# define AF_MAX 29
+#endif /* AF_MAX */
+
#if !defined (PF_UNSPEC)
# define PF_UNSPEC 0
#endif /* PF_UNSPEC */
@@ -118,6 +150,38 @@ extern "C"
#define AF_DEV (AF_MAX + 3)
#define AF_UPIPE (AF_SPIPE)
+#if !defined (MSG_OOB)
+# define MSG_OOB 0x1
+#endif /* MSG_OOB */
+
+#if !defined (MSG_PEEK)
+# define MSG_PEEK 0x2
+#endif /* MSG_PEEK */
+
+#if !defined (SOCK_STREAM)
+# define SOCK_STREAM 1
+#endif /* SOCK_STREAM */
+
+#if !defined (SOCK_DGRAM)
+# define SOCK_DGRAM 2
+#endif /* SOCK_DGRAM */
+
+#if !defined (SOL_SOCKET)
+# define SOL_SOCKET 0xffff
+#endif /* SOL_SOCKET */
+
+#if !defined (SO_REUSEADDR)
+# define SO_REUSEADDR 0x0004
+#endif /* SO_REUSEADDR */
+
+#if !defined (SO_SNDBUF)
+# define SO_SNDBUF 0x1001
+#endif /* SO_SNDBUF */
+
+#if !defined (SO_RCVBUF)
+# define SO_RCVBUF 0x1002
+#endif /* SO_RCVBUF */
+
#if defined (ACE_HAS_IPV6)
# if defined (ACE_USES_IPV4_IPV6_MIGRATION)
# define ACE_ADDRESS_FAMILY_INET AF_UNSPEC
diff --git a/apps/gperf/ChangeLog b/apps/gperf/ChangeLog
index d98c69958d5..3820534f358 100644
--- a/apps/gperf/ChangeLog
+++ b/apps/gperf/ChangeLog
@@ -1,3 +1,9 @@
+Mon Oct 24 02:36:08 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
+
+ * apps/gperf/src/Key_List.cpp:
+
+ Addressed Coverity RESOURCE_LEAK errors.
+
Thu Sep 21 11:54:54 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu>
* src/Key_List.cpp (output_hash_function): Fixed a bug where the
@@ -16,7 +22,7 @@ Tue Mar 14 21:08:12 UTC 2006 jiang,shanshan <shanshan.jiang@vanderbilt.edu>
conditional expression", "conversion from some type to another type, possible
loss of data", "local variable may be used without having been initialized" and
so on.
- Thanks to Lukas Gruetzmacher <gruetzmacher at ais-dresden dot de> for
+ Thanks to Lukas Gruetzmacher <gruetzmacher at ais-dresden dot de> for
motivating the fix to these "VC level 4 warnings".
Wed Jan 4 22:55:24 UTC 2006 J.T. Conklin <jtc@acorntoolworks.com>
@@ -49,11 +55,11 @@ Sat Apr 30 10:56:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
Fri Apr 29 09:08:39 2005 Douglas C. Schmidt <schmidt@cs.wustl.edu>
- * src/Key_List.cpp (output_binary_search_function): Added a
+ * src/Key_List.cpp (output_binary_search_function): Added a
- do {/* null */} while (&base == 0);
+ do {/* null */} while (&base == 0);
- to silence warnings on some compilers. Thanks to Frank Pilhofer
+ to silence warnings on some compilers. Thanks to Frank Pilhofer
<fp@mc.com>.
Fri Aug 5 15:30:00 UTC 2004 Simon Massey <simon.massey@prismtechnologies.com>
@@ -66,16 +72,16 @@ Fri Aug 5 15:30:00 UTC 2004 Simon Massey <simon.massey@prismtechnologies.com>
Fri Apr 23 21:18:17 2004 Ossama Othman <ossama@dre.vanderbilt.edu>
- * src/Options.h (operator !=):
- * src/Options.cpp (operator !=):
+ * src/Options.h (operator !=):
+ * src/Options.cpp (operator !=):
- Changed return type to bool, as is the norm in modern C++.
+ Changed return type to bool, as is the norm in modern C++.
Tue Jan 20 17:13:29 2004 Steve Huston <shuston@riverace.com>
- * version.texi: Something in the autoconf build thought it wise to
- update the date in this file. It matches the last modification
- date of gperf.texi.
+ * version.texi: Something in the autoconf build thought it wise to
+ update the date in this file. It matches the last modification
+ date of gperf.texi.
Thu Jun 19 14:52:05 UTC 2003 Don Hinton <dhinton@dresystems.com>
@@ -88,48 +94,48 @@ Thu Jun 19 14:52:05 UTC 2003 Don Hinton <dhinton@dresystems.com>
Tue Jun 17 11:38:36 2003 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
- * src/Key_List.cpp (output_lookup_array):
- * src/Gen_Perf.cpp (run):
- * src/Key_List.cpp (already_determined):
- * src/List_Node.cpp (List_Node): Added casts to prevent GCC 3.3
- from complaining about stupid stuff... Thanks to Bala for
+ * src/Key_List.cpp (output_lookup_array):
+ * src/Gen_Perf.cpp (run):
+ * src/Key_List.cpp (already_determined):
+ * src/List_Node.cpp (List_Node): Added casts to prevent GCC 3.3
+ from complaining about stupid stuff... Thanks to Bala for
reporting this.
Sun Jul 28 17:04:54 2002 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu>
- * src/gperf.cpp (main): Only generate the timestamps if the
- DEBUGGING option ('-d') is enabled. Thanks to Kier Schmitt
+ * src/gperf.cpp (main): Only generate the timestamps if the
+ DEBUGGING option ('-d') is enabled. Thanks to Kier Schmitt
<SchmittKC@kpt.nuwc.navy.mil> for this suggestion.
Tue Feb 26 23:15:47 2002 Ossama Othman <ossama@uci.edu>
- * gperf.texi:
+ * gperf.texi:
- Added missing "@dircategory" entry. It is required for proper
- installation when using `install-info'.
+ Added missing "@dircategory" entry. It is required for proper
+ installation when using `install-info'.
- Use "@direntry" instead of "{START,END}-INFO-DIR-ENTRY"
- directly.
+ Use "@direntry" instead of "{START,END}-INFO-DIR-ENTRY"
+ directly.
- * gperf.info:
+ * gperf.info:
- Regenerated this file.
+ Regenerated this file.
Mon Jan 14 14:43:53 2002 Carlos O'Ryan <coryan@uci.edu>
- * tests/Makefile:
- Re-generate dependencies.
+ * tests/Makefile:
+ Re-generate dependencies.
Mon Dec 24 12:47:27 2001 Carlos O'Ryan <coryan@uci.edu>
- * src/Options.cpp:
- Add temporary fix until something better shows up, at least it
- compiles this way!
+ * src/Options.cpp:
+ Add temporary fix until something better shows up, at least it
+ compiles this way!
Sat Sep 22 09:06:10 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
- * src/Makefile: Removed the rules.lib.GNU file since it didn't
- seem to be needed and was causing problems for MinGW. Thanks to
+ * src/Makefile: Removed the rules.lib.GNU file since it didn't
+ seem to be needed and was causing problems for MinGW. Thanks to
Jeff McNiel <JMcNiel@datacrit.com> for reporting this.
Wed Sep 19 02:29:37 2001 Carlos O'Ryan <coryan@uci.edu>
@@ -2105,7 +2111,7 @@ Thu Jan 5 22:46:34 1989 Doug Schmidt (schmidt at siam.ics.uci.edu)
* Added a check in Key_List::Output for the special case where
the keys used are 1,$. It is possible to generate more
efficient C code in this case.
-
+
Local Variables:
mode: change-log
add-log-time-format: (lambda () (progn (setq tz (getenv "TZ")) (set-time-zone-rule "UTC") (setq time (format-time-string "%a %b %e %H:%M:%S %Z %Y" (current-time))) (set-time-zone-rule tz) time))
diff --git a/apps/gperf/src/Key_List.cpp b/apps/gperf/src/Key_List.cpp
index 474d0889f97..cd627124648 100644
--- a/apps/gperf/src/Key_List.cpp
+++ b/apps/gperf/src/Key_List.cpp
@@ -27,8 +27,9 @@ ACE_RCSID(src, Key_List, "$Id$")
#if defined (ACE_HAS_GPERF)
-#include "ace/Read_Buffer.h"
#include "Hash_Table.h"
+#include "ace/Read_Buffer.h"
+#include "ace/Auto_Ptr.h"
#include "ace/OS_Memory.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_string.h"
@@ -543,7 +544,9 @@ Key_List::output_switch (int use_keyword_table)
output_keyword_table ();
}
- char *comp_buffer;
+ ACE_Auto_Basic_Array_Ptr<char> safe_comp_buffer;
+ char * comp_buffer;
+
List_Node *curr = head;
int pointer_and_type_enabled = option[POINTER] && option[TYPE];
int total_switches = option.total_switches ();
@@ -553,8 +556,14 @@ Key_List::output_switch (int use_keyword_table)
{
// Keep track of the longest string we'll need!
const char *s = "charmap[*str] == *resword->%s && !strncasecmp (str + 1, resword->%s + 1, len - 1)";
- comp_buffer =
- new char [ACE_OS::strlen (s) + 2 * ACE_OS::strlen (option.key_name ()) + 1];
+
+ char * const tmp =
+ new char[ACE_OS::strlen (s)
+ + 2 * ACE_OS::strlen (option.key_name ()) + 1];
+ ACE_AUTO_PTR_RESET (safe_comp_buffer, tmp, char);
+
+ comp_buffer = safe_comp_buffer.get ();
+
if (option[COMP])
sprintf (comp_buffer, "%s == *resword->%s && !%s (str + 1, resword->%s + 1, len - 1)",
option[STRCASECMP] ? "charmap[*str]" : "*str", option.key_name (),
diff --git a/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.inl b/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.inl
index 346a22e773c..a5f1421b8b9 100644
--- a/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.inl
+++ b/examples/Service_Configurator/IPC-tests/server/Handle_Timeout.inl
@@ -31,7 +31,7 @@ Handle_Timeout::init (int argc, ACE_TCHAR *argv[])
ACE_Time_Value delta (10);
ACE_Time_Value interval (1);
ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("a:d:i:"), 0);
- int arg = 0;
+ intptr_t arg = 0;
for (int c; (c = get_opt ()) != -1; )
switch (c)
@@ -51,8 +51,8 @@ Handle_Timeout::init (int argc, ACE_TCHAR *argv[])
if (ACE_Reactor::instance ()->schedule_timer (this,
reinterpret_cast<void *> (arg),
- delta,
- interval) == -1)
+ delta,
+ interval) == -1)
return -1;
else
return 0;
diff --git a/examples/Shared_Malloc/test_position_independent_malloc.cpp b/examples/Shared_Malloc/test_position_independent_malloc.cpp
index b4c66e54957..3da3436377e 100644
--- a/examples/Shared_Malloc/test_position_independent_malloc.cpp
+++ b/examples/Shared_Malloc/test_position_independent_malloc.cpp
@@ -129,7 +129,7 @@ parse_args (int argc, ACE_TCHAR *argv[])
{
case 'a':
// Override the default base address.
- base_addr = reinterpret_cast<void *> (ACE_OS::atoi (get_opt.opt_arg ()));
+ base_addr = reinterpret_cast<void *> (static_cast<intptr_t> (ACE_OS::atoi (get_opt.opt_arg ())));
break;
case 'T':
#if defined (ACE_HAS_TRACE)
diff --git a/include/makeinclude/platform_irix6.x_sgic++.GNU b/include/makeinclude/platform_irix6.x_sgic++.GNU
index 933f43db38d..3767ea57646 100644
--- a/include/makeinclude/platform_irix6.x_sgic++.GNU
+++ b/include/makeinclude/platform_irix6.x_sgic++.GNU
@@ -65,7 +65,12 @@ endif # templates != implicit
# Suppress warnings about "class has no copy assignment operator"
# Suppress warnings about "Access control" on inherited classes
# Suppress warnings about "last argument" of varargs function is unnamed
-CCFLAGS += -diag_suppress 3284,1253,3439,1234,3506
+ifeq (7.3,$(findstring 7.3,$(CXX_VERSION)))
+ # 7.3.x doesn't have the 3506 error code
+ CCFLAGS += -diag_suppress 3284,1253,3439,1234
+else
+ CCFLAGS += -diag_suppress 3284,1253,3439,1234,3506
+endif
LDFLAGS += -Wl,-woff,15
LDFLAGS += -Wl,-woff,84
diff --git a/tests/Map_Manager_Test.cpp b/tests/Map_Manager_Test.cpp
index 2f90f2bb16b..c220e285a06 100644
--- a/tests/Map_Manager_Test.cpp
+++ b/tests/Map_Manager_Test.cpp
@@ -86,7 +86,7 @@ test_cache_map_manager (size_t table_size,
CACHE_MAP_MANAGER map (null_caching_strategy,
table_size);
TYPE i;
- TYPE j;
+ TYPE j = TYPE ();
ssize_t k;
for (i = 0; i < iterations; i++)
diff --git a/tests/Priority_Buffer_Test.cpp b/tests/Priority_Buffer_Test.cpp
index dbb9b27046c..074ffce90e7 100644
--- a/tests/Priority_Buffer_Test.cpp
+++ b/tests/Priority_Buffer_Test.cpp
@@ -31,7 +31,7 @@ ACE_RCSID(tests, Priority_Buffer_Test, "$Id$")
static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz";
// Global message count.
-static int count = 0;
+static int message_count = 0;
// Make the queue be capable of being *very* large.
static const long max_queue = LONG_MAX;
@@ -88,7 +88,7 @@ consumer (void *args)
break;
}
- ACE_ASSERT (local_count == count);
+ ACE_ASSERT (local_count == message_count);
return 0;
}
@@ -104,11 +104,11 @@ producer (void *args)
ACE_Message_Queue<ACE_MT_SYNCH> *msg_queue =
reinterpret_cast<ACE_Message_Queue<ACE_MT_SYNCH> *> (args);
- ACE_Message_Block *mb;
+ ACE_Message_Block *mb = 0;
for (const char *c = ACE_ALPHABET; *c != '\0'; c++)
{
- count++;
+ ++message_count;
// Allocate a new message
@@ -118,7 +118,7 @@ producer (void *args)
*mb->wr_ptr () = *c;
// Set the priority.
- mb->msg_priority (count);
+ mb->msg_priority (message_count);
mb->wr_ptr (1);
// Enqueue in priority order.
@@ -139,7 +139,7 @@ producer (void *args)
ACE_TEXT ("(%t) %p\n"),
ACE_TEXT ("put_next")));
- count++;
+ ++message_count;
// Now read all the items out in priority order (i.e., ordered by
// the size of the lines!).
diff --git a/tests/Thread_Manager_Test.cpp b/tests/Thread_Manager_Test.cpp
index 2d9467b5124..aa3e008e622 100644
--- a/tests/Thread_Manager_Test.cpp
+++ b/tests/Thread_Manager_Test.cpp
@@ -124,8 +124,8 @@ worker (int iterations)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) has been cancelled ")
- ACE_TEXT ("before iteration %d!\n"),
- i));
+ ACE_TEXT ("before iteration %d!\n"),
+ i));
break;
}
}
@@ -341,11 +341,24 @@ run_main (int, ACE_TCHAR *[])
if (thr_mgr->suspend_grp (grp_id) == -1)
{
// Pthreads w/o UNIX 98 extensions doesn't support suspend/resume,
- // so it's allowed to ENOTSUP; anything else is a hard fail.
- ACE_ASSERT (errno == ENOTSUP);
- ACE_DEBUG((LM_DEBUG,
- ACE_TEXT (" OK: suspend_grp isn't supported with ")
- ACE_TEXT ("Pthreads\n")));
+ // so it's allowed to ENOTSUP as long as the config indicates this.
+ if (errno == ENOTSUP)
+ {
+#if defined (ACE_HAS_PTHREADS) && (defined (ACE_HAS_PTHREAD_SUSPEND) || \
+ defined (ACE_HAS_PTHREAD_SUSPEND_NP))
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("suspend_grp: ENOTSUP but config ")
+ ACE_TEXT ("says it should work.\n")));
+#else
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT (" OK: suspend_grp isn't supported with ")
+ ACE_TEXT ("Pthreads\n")));
+#endif /* ACE_HAS_PTHREADS && should be able to suspend */
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("suspend_grp")));
+ }
}
// Wait for 1 more second and then resume every thread in the
@@ -357,10 +370,26 @@ run_main (int, ACE_TCHAR *[])
if (thr_mgr->resume_grp (grp_id) == -1)
{
- ACE_ASSERT (errno == ENOTSUP);
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT (" OK: resume_grp isn't supported with ")
- ACE_TEXT ("Pthreads\n")));
+ // Pthreads w/o UNIX 98 extensions doesn't support suspend/resume,
+ // so it's allowed to ENOTSUP as long as the config indicates this.
+ if (errno == ENOTSUP)
+ {
+#if defined (ACE_HAS_PTHREADS) && (defined (ACE_HAS_PTHREAD_CONTINUE) || \
+ defined (ACE_HAS_PTHREAD_CONTINUE_NP) || \
+ defined (ACE_HAS_PTHREAD_RESUME_NP))
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("resume_grp: ENOTSUP but config ")
+ ACE_TEXT ("says it should work.\n")));
+#else
+ ACE_DEBUG((LM_DEBUG,
+ ACE_TEXT (" OK: resume_grp isn't supported with ")
+ ACE_TEXT ("Pthreads\n")));
+#endif /* ACE_HAS_PTHREADS && should be able to continue/resume */
+ }
+ else
+ {
+ ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("resume_grp")));
+ }
}
// Wait for 1 more second and then send a SIGINT to every thread in