Use generic_cateogry for errno

This commit is contained in:
Vinnie Falco
2017-06-17 08:35:09 -07:00
parent cdff15e021
commit a26017d695
4 changed files with 20 additions and 8 deletions

View File

@ -1,6 +1,7 @@
Version 61:
* Remove Spirit dependency
* Use generic_cateogry for errno
--------------------------------------------------------------------------------

View File

@ -196,6 +196,7 @@
<member><link linkend="beast.ref.beast__buffer_cat">buffer_cat</link></member>
<member><link linkend="beast.ref.beast__buffer_prefix">buffer_prefix</link></member>
<member><link linkend="beast.ref.beast__buffers">buffers</link></member>
<member><link linkend="beast.ref.beast__generic_category">generic_category</link></member>
<member><link linkend="beast.ref.beast__iequals">iequals</link></member>
<member><link linkend="beast.ref.beast__ostream">ostream</link></member>
<member><link linkend="beast.ref.beast__read_size">read_size</link></member>

View File

@ -180,8 +180,8 @@ init(beast::error_code& ec)
if(! file_)
{
// Convert the old-school `errno` into
// an error code using the system category.
ec = beast::error_code{errno, beast::system_category()};
// an error code using the generic category.
ec = beast::error_code{errno, beast::generic_category()};
return;
}
@ -219,8 +219,9 @@ get(beast::error_code& ec) ->
// Handle any errors
if(ferror(file_))
{
// Convert old-school `errno` to error_code
ec = beast::error_code(errno, beast::system_category());
// Convert the old-school `errno` into
// an error code using the generic category.
ec = beast::error_code{errno, beast::generic_category()};
return boost::none;
}
@ -350,8 +351,8 @@ init(boost::optional<std::uint64_t> const& content_length, beast::error_code& ec
if(! file_)
{
// Convert the old-school `errno` into
// an error code using the system category.
ec = beast::error_code{errno, beast::system_category()};
// an error code using the generic category.
ec = beast::error_code{errno, beast::generic_category()};
return;
}
@ -379,8 +380,9 @@ put(ConstBufferSequence const& buffers, beast::error_code& ec)
// Handle any errors
if(ferror(file_))
{
// Convert old-school `errno` to error_code
ec = beast::error_code(errno, beast::system_category());
// Convert the old-school `errno` into
// an error code using the generic category.
ec = beast::error_code{errno, beast::generic_category()};
return;
}
}

View File

@ -23,6 +23,14 @@ using system_error = boost::system::system_error;
/// The type of error category used by the library
using error_category = boost::system::error_category;
/// A function to return the generic error category used by the library
#if BEAST_DOXYGEN
error_category const&
generic_category();
#else
using boost::system::generic_category;
#endif
/// A function to return the system error category used by the library
#if BEAST_DOXYGEN
error_category const&