Replaced literal zeros with NULL in headers.

This is for better code readability and to possibly silence compiler
warnings.
This commit is contained in:
Andrey Semashev 2022-07-17 01:59:00 +03:00
parent 561b964c2e
commit 014216f3e5
5 changed files with 60 additions and 58 deletions

View File

@ -139,12 +139,12 @@ public:
// for VC++, GCC, and probably other compilers, that =default is not used with noexcept
// functions. GCC is not even consistent for the same release on different platforms.
BOOST_CONSTEXPR file_status(const file_status& rhs) BOOST_NOEXCEPT :
BOOST_CONSTEXPR file_status(file_status const& rhs) BOOST_NOEXCEPT :
m_value(rhs.m_value),
m_perms(rhs.m_perms)
{
}
BOOST_CXX14_CONSTEXPR file_status& operator=(const file_status& rhs) BOOST_NOEXCEPT
BOOST_CXX14_CONSTEXPR file_status& operator=(file_status const& rhs) BOOST_NOEXCEPT
{
m_value = rhs.m_value;
m_perms = rhs.m_perms;

View File

@ -15,6 +15,7 @@
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/path.hpp>
#include <cstddef>
#include <iosfwd>
#include <fstream>
@ -71,7 +72,7 @@ public:
public:
basic_filebuf< charT, traits >* open(path const& p, std::ios_base::openmode mode)
{
return std::basic_filebuf< charT, traits >::open(BOOST_FILESYSTEM_C_STR(p), mode) ? this : 0;
return std::basic_filebuf< charT, traits >::open(BOOST_FILESYSTEM_C_STR(p), mode) ? this : NULL;
}
};

View File

@ -30,8 +30,9 @@
#include <boost/core/scoped_enum.hpp>
#include <boost/system/error_code.hpp>
#include <boost/cstdint.hpp>
#include <string>
#include <cstddef>
#include <ctime>
#include <string>
#include <boost/filesystem/detail/header.hpp> // must be the last #include
@ -89,78 +90,78 @@ BOOST_SCOPED_ENUM_DECLARE_END(copy_option)
namespace detail {
BOOST_FILESYSTEM_DECL
path absolute(path const& p, path const& base, system::error_code* ec = 0);
path absolute(path const& p, path const& base, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
file_status status(path const& p, system::error_code* ec = 0);
file_status status(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
file_status symlink_status(path const& p, system::error_code* ec = 0);
file_status symlink_status(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
bool is_empty(path const& p, system::error_code* ec = 0);
bool is_empty(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
path initial_path(system::error_code* ec = 0);
path initial_path(system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
path canonical(path const& p, path const& base, system::error_code* ec = 0);
path canonical(path const& p, path const& base, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
void copy(path const& from, path const& to, unsigned int options, system::error_code* ec = 0);
void copy(path const& from, path const& to, unsigned int options, system::error_code* ec = NULL);
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
BOOST_FILESYSTEM_DECL
void copy_directory(path const& from, path const& to, system::error_code* ec = 0);
void copy_directory(path const& from, path const& to, system::error_code* ec = NULL);
#endif
BOOST_FILESYSTEM_DECL
bool copy_file(path const& from, path const& to, // See ticket #2925
unsigned int options, system::error_code* ec = 0); // see copy_options for options
bool copy_file(path const& from, path const& to, // See ticket #2925
unsigned int options, system::error_code* ec = NULL); // see copy_options for options
BOOST_FILESYSTEM_DECL
void copy_symlink(path const& existing_symlink, path const& new_symlink, system::error_code* ec = 0);
void copy_symlink(path const& existing_symlink, path const& new_symlink, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
bool create_directories(path const& p, system::error_code* ec = 0);
bool create_directories(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
bool create_directory(path const& p, const path* existing, system::error_code* ec = 0);
bool create_directory(path const& p, const path* existing, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
void create_directory_symlink(path const& to, path const& from, system::error_code* ec = 0);
void create_directory_symlink(path const& to, path const& from, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
void create_hard_link(path const& to, path const& from, system::error_code* ec = 0);
void create_hard_link(path const& to, path const& from, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
void create_symlink(path const& to, path const& from, system::error_code* ec = 0);
void create_symlink(path const& to, path const& from, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
path current_path(system::error_code* ec = 0);
path current_path(system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
void current_path(path const& p, system::error_code* ec = 0);
void current_path(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
bool equivalent(path const& p1, path const& p2, system::error_code* ec = 0);
bool equivalent(path const& p1, path const& p2, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
boost::uintmax_t file_size(path const& p, system::error_code* ec = 0);
boost::uintmax_t file_size(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
boost::uintmax_t hard_link_count(path const& p, system::error_code* ec = 0);
boost::uintmax_t hard_link_count(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
std::time_t creation_time(path const& p, system::error_code* ec = 0);
std::time_t creation_time(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
std::time_t last_write_time(path const& p, system::error_code* ec = 0);
std::time_t last_write_time(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
void last_write_time(path const& p, const std::time_t new_time, system::error_code* ec = 0);
void last_write_time(path const& p, const std::time_t new_time, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
void permissions(path const& p, perms prms, system::error_code* ec = 0);
void permissions(path const& p, perms prms, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
path read_symlink(path const& p, system::error_code* ec = 0);
path read_symlink(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
path relative(path const& p, path const& base, system::error_code* ec = 0);
path relative(path const& p, path const& base, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
bool remove(path const& p, system::error_code* ec = 0);
bool remove(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
boost::uintmax_t remove_all(path const& p, system::error_code* ec = 0);
boost::uintmax_t remove_all(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
void rename(path const& old_p, path const& new_p, system::error_code* ec = 0);
void rename(path const& old_p, path const& new_p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
void resize_file(path const& p, uintmax_t size, system::error_code* ec = 0);
void resize_file(path const& p, uintmax_t size, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
space_info space(path const& p, system::error_code* ec = 0);
space_info space(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
path system_complete(path const& p, system::error_code* ec = 0);
path system_complete(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
path temp_directory_path(system::error_code* ec = 0);
path temp_directory_path(system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
path unique_path(path const& p, system::error_code* ec = 0);
path unique_path(path const& p, system::error_code* ec = NULL);
BOOST_FILESYSTEM_DECL
path weakly_canonical(path const& p, path const& base, system::error_code* ec = 0);
path weakly_canonical(path const& p, path const& base, system::error_code* ec = NULL);
} // namespace detail
@ -447,12 +448,12 @@ inline bool create_directories(path const& p, system::error_code& ec) BOOST_NOEX
inline bool create_directory(path const& p)
{
return detail::create_directory(p, 0);
return detail::create_directory(p, NULL);
}
inline bool create_directory(path const& p, system::error_code& ec) BOOST_NOEXCEPT
{
return detail::create_directory(p, 0, &ec);
return detail::create_directory(p, NULL, &ec);
}
inline bool create_directory(path const& p, path const& existing)

View File

@ -209,7 +209,7 @@ public:
template< class Source >
path(Source const& source, typename boost::enable_if_c<
path_traits::is_pathable< typename boost::decay< Source >::type >::value && !path_detail::is_native_pathable< Source >::value
>::type* = 0)
>::type* = NULL)
{
path_traits::dispatch(source, m_pathname);
}
@ -274,7 +274,7 @@ public:
template< class Source >
path(Source const& source, codecvt_type const& cvt, typename boost::enable_if_c<
path_traits::is_pathable< typename boost::decay< Source >::type >::value && !path_detail::is_native_pathable< Source >::value
>::type* = 0)
>::type* = NULL)
{
path_traits::dispatch(source, m_pathname, cvt);
}
@ -282,7 +282,7 @@ public:
path(const value_type* begin, const value_type* end) : m_pathname(begin, end) {}
template< class InputIterator >
path(InputIterator begin, InputIterator end, typename boost::disable_if< path_detail::is_native_char_ptr< InputIterator > >::type* = 0)
path(InputIterator begin, InputIterator end, typename boost::disable_if< path_detail::is_native_char_ptr< InputIterator > >::type* = NULL)
{
if (begin != end)
{
@ -295,7 +295,7 @@ public:
path(const value_type* begin, const value_type* end, codecvt_type const&) : m_pathname(begin, end) {}
template< class InputIterator >
path(InputIterator begin, InputIterator end, codecvt_type const& cvt, typename boost::disable_if< path_detail::is_native_char_ptr< InputIterator > >::type* = 0)
path(InputIterator begin, InputIterator end, codecvt_type const& cvt, typename boost::disable_if< path_detail::is_native_char_ptr< InputIterator > >::type* = NULL)
{
if (begin != end)
{
@ -1183,7 +1183,7 @@ template< typename T >
inline typename boost::enable_if< boost::is_same< T, path >, std::size_t >::type hash_value(T const& p) BOOST_NOEXCEPT
{
#ifdef BOOST_WINDOWS_API
std::size_t seed = 0;
std::size_t seed = 0u;
for (typename T::value_type const* it = p.c_str(); *it; ++it)
hash_combine(seed, *it == L'/' ? L'\\' : *it);
return seed;
@ -1359,14 +1359,14 @@ inline std::wstring path::generic_string< std::wstring >(codecvt_type const& cvt
namespace path_traits { // without codecvt
inline void convert(const char* from,
const char* from_end, // 0 for null terminated MBCS
const char* from_end, // NULL for null terminated MBCS
std::wstring& to)
{
convert(from, from_end, to, path::codecvt());
}
inline void convert(const wchar_t* from,
const wchar_t* from_end, // 0 for null terminated MBCS
const wchar_t* from_end, // NULL for null terminated MBCS
std::string& to)
{
convert(from, from_end, to, path::codecvt());
@ -1375,13 +1375,13 @@ inline void convert(const wchar_t* from,
inline void convert(const char* from, std::wstring& to)
{
BOOST_ASSERT(!!from);
convert(from, 0, to, path::codecvt());
convert(from, NULL, to, path::codecvt());
}
inline void convert(const wchar_t* from, std::string& to)
{
BOOST_ASSERT(!!from);
convert(from, 0, to, path::codecvt());
convert(from, NULL, to, path::codecvt());
}
} // namespace path_traits

View File

@ -147,40 +147,40 @@ inline bool empty(T (&x)[N])
// value types differ ---------------------------------------------------------------//
//
// A from_end argument of 0 is less efficient than a known end, so use only if needed
// A from_end argument of NULL is less efficient than a known end, so use only if needed
// with codecvt
BOOST_FILESYSTEM_DECL
void convert(const char* from,
const char* from_end, // 0 for null terminated MBCS
const char* from_end, // NULL for null terminated MBCS
std::wstring& to, codecvt_type const& cvt);
BOOST_FILESYSTEM_DECL
void convert(const wchar_t* from,
const wchar_t* from_end, // 0 for null terminated MBCS
const wchar_t* from_end, // NULL for null terminated MBCS
std::string& to, codecvt_type const& cvt);
inline void convert(const char* from, std::wstring& to, codecvt_type const& cvt)
{
BOOST_ASSERT(from);
convert(from, 0, to, cvt);
convert(from, NULL, to, cvt);
}
inline void convert(const wchar_t* from, std::string& to, codecvt_type const& cvt)
{
BOOST_ASSERT(from);
convert(from, 0, to, cvt);
convert(from, NULL, to, cvt);
}
// without codecvt
inline void convert(const char* from,
const char* from_end, // 0 for null terminated MBCS
const char* from_end, // NULL for null terminated MBCS
std::wstring& to);
inline void convert(const wchar_t* from,
const wchar_t* from_end, // 0 for null terminated MBCS
const wchar_t* from_end, // NULL for null terminated MBCS
std::string& to);
inline void convert(const char* from, std::wstring& to);