Boost C++ Libraries: Ticket #5128: Implicit constant overflow in non_blocking_io::name() https://svn.boost.org/trac10/ticket/5128 <p> non_blocking_io::name() returns FIONBIO as an int, without explicit cast. </p> <p> On Mac OS X (10.6.6), the FIONBIO macro evaluates to ((<span class="underline">uint32_t)0x80000000 | ((sizeof(int) &amp; 0x1fff) &lt;&lt; 16) | ((('f')) &lt;&lt; 8) | ((126))) </span></p> <p> While this is a perfectly valid 32-bit number (0x8004667e), the implicit cast to int generates an 'Overflow in implicit constant conversion' warning, which makes the build fail if '-Werror' is specified. </p> <p> A simple solution would be to modify non_blocking_io::name() to </p> <p> return (int)FIONBIO; </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5128 Trac 1.4.3 chris_kohlhoff Wed, 23 Feb 2011 01:06:36 GMT <link>https://svn.boost.org/trac10/ticket/5128#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5128#comment:1</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/69194" title="Changes for asio version 1.5.0: * Added support for timeouts on ...">[69194]</a>) Changes for asio version 1.5.0: </p> <ul><li>Added support for timeouts on socket iostreams, such as ip::tcp::iostream. A timeout is set by calling expires_at() or expires_from_now() to establish a deadline. Any socket operations which occur past the deadline will put the iostream into a bad state. </li></ul><ul><li>Added a new error() member function to socket iostreams, for retrieving the error code from the most recent system call. </li></ul><ul><li>Added a new basic_deadline_timer::cancel_one() function. This function lets you cancel a single waiting handler on a timer. Handlers are cancelled in FIFO order. </li></ul><ul><li>Added a new transfer_exactly() completion condition. This can be used to send or receive a specified number of bytes even if the total size of the buffer (or buffer sequence) is larger. </li></ul><ul><li>Added new free functions connect() and async_connect(). These operations try each endpoint in a list until the socket is successfully connected. </li></ul><ul><li>Extended the buffer_size() function so that it works for buffer sequences in addition to individual buffers. </li></ul><ul><li>Added a new buffer_copy() function that can be used to copy the raw bytes between individual buffers and buffer sequences. </li></ul><ul><li>Added new non-throwing overloads of read(), read_at(), write() and write_at() that do not require a completion condition. </li></ul><ul><li>Added friendlier compiler errors for when a completion handler does not meet the necessary type requirements. When C++0x is available (currently supported for g++ 4.5 or later, and MSVC 10), static_assert is also used to generate an informative error message. Checking may be disabled by defining BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS. </li></ul><ul><li>Made the is_loopback(), is_unspecified() and is_multicast() functions consistently available across the ip::address, ip::address_v4 and ip::address_v6 classes. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3939" title="#3939: Feature Requests: Determination on wither ip::address is a multicast address (closed: fixed)">#3939</a>. </li></ul><ul><li>Added new non_blocking() functions for managing the non-blocking behaviour of a socket or descriptor. The io_control() commands named non_blocking_io are now deprecated in favour of these new functions. </li></ul><ul><li>Added new native_non_blocking() functions for managing the non-blocking mode of the underlying socket or descriptor. These functions are intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The functions have no effect on the behaviour of the synchronous operations of the socket or descriptor. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3307" title="#3307: Bugs: Stream descriptor blocking state set on close (closed: fixed)">#3307</a>. </li></ul><ul><li>Added the io_control() member function for socket acceptors. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3297" title="#3297: Bugs: io_control not exposed on tcp::connector in asio (closed: fixed)">#3297</a>. </li></ul><ul><li>For consistency with the C++0x standard library, deprecated the native_type typedefs in favour of native_handle_type, and the native() member functions in favour of native_handle(). </li></ul><ul><li>Added a release() member function to posix descriptors. This function releases ownership of the underlying native descriptor to the caller. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3900" title="#3900: Feature Requests: Request for support of &#34;release&#34; member function or assign without ... (closed: fixed)">#3900</a>. </li></ul><ul><li>Added support for sequenced packet sockets (SOCK_SEQPACKET). </li></ul><ul><li>Added a new io_service::stopped() function that can be used to determine whether the io_service has stopped (i.e. a reset() call is needed prior to any further calls to run(), run_one(), poll() or poll_one()). </li></ul><ul><li>Reduced the copying of handler function objects. </li></ul><ul><li>Added support for C++0x move construction to further reduce copying of handler objects. Move support is enabled when compiling in -std=c++0x mode on g++ 4.5 or higher, or when using MSVC10. </li></ul><ul><li>Removed the dependency on OS-provided macros for the well-known IPv4 and IPv6 addresses. This should eliminate the annoying "missing braces around initializer" warnings. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3741" title="#3741: Bugs: asio::ip::address_v6.hpp: Missing braces around anonymous union (closed: fixed)">#3741</a>. </li></ul><ul><li>Reduced the size of ip::basic_endpoint&lt;&gt; objects (such as ip::tcp::endpoint and ip::udp::endpoint). </li></ul><ul><li>Changed the reactor backends to assume that any descriptors or sockets added using assign() may have been dup()-ed, and so require explicit deregistration from the reactor. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4971" title="#4971: Bugs: stream_descriptor not remove descriptor from epoll_reactor (closed: fixed)">#4971</a>. </li></ul><ul><li>Changed the SSL error category to return error strings from the OpenSSL library. </li></ul><ul><li>Changed the separate compilation support such that, to use Asio's SSL capabilities, you should also include 'asio/ssl/impl/src.hpp in one source file in your program. </li></ul><ul><li>Removed the deprecated member functions named io_service(). The get_io_service() member functions should be used instead. </li></ul><ul><li>Removed the deprecated typedefs resolver_query and resolver_iterator from the ip::tcp, ip::udp and ip::icmp classes. </li></ul><ul><li>Fixed a compile error on some versions of g++ due to anonymous enums. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4883" title="#4883: Patches: epoll_reactor.hpp doesn`t compile with some versions of gcc (closed: fixed)">#4883</a>. </li></ul><ul><li>Added an explicit cast to the FIONBIO constant to int to suppress a compiler warning on some platforms. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5128" title="#5128: Bugs: Implicit constant overflow in non_blocking_io::name() (closed: fixed)">#5128</a>. </li></ul><ul><li>Fixed warnings reported by g++'s -Wshadow compiler option. Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3905" title="#3905: Bugs: asio boost headers fail with g++-4.3.2 and -Wshadow -Werror (closed: fixed)">#3905</a>. </li></ul> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Mon, 06 Jun 2011 02:00:25 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5128#comment:2 https://svn.boost.org/trac10/ticket/5128#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed on trunk as of <a class="changeset" href="https://svn.boost.org/trac10/changeset/72428" title="Merge asio from trunk.">[72428]</a>. </p> Ticket