Skip to content

Commit 014216f

Browse files
committed
Replaced literal zeros with NULL in headers.
This is for better code readability and to possibly silence compiler warnings.
1 parent 561b964 commit 014216f

File tree

5 files changed

+60
-58
lines changed

5 files changed

+60
-58
lines changed

include/boost/filesystem/file_status.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ class file_status
139139
// for VC++, GCC, and probably other compilers, that =default is not used with noexcept
140140
// functions. GCC is not even consistent for the same release on different platforms.
141141

142-
BOOST_CONSTEXPR file_status(const file_status& rhs) BOOST_NOEXCEPT :
142+
BOOST_CONSTEXPR file_status(file_status const& rhs) BOOST_NOEXCEPT :
143143
m_value(rhs.m_value),
144144
m_perms(rhs.m_perms)
145145
{
146146
}
147-
BOOST_CXX14_CONSTEXPR file_status& operator=(const file_status& rhs) BOOST_NOEXCEPT
147+
BOOST_CXX14_CONSTEXPR file_status& operator=(file_status const& rhs) BOOST_NOEXCEPT
148148
{
149149
m_value = rhs.m_value;
150150
m_perms = rhs.m_perms;

include/boost/filesystem/fstream.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <boost/filesystem/config.hpp>
1717
#include <boost/filesystem/path.hpp>
18+
#include <cstddef>
1819
#include <iosfwd>
1920
#include <fstream>
2021

@@ -71,7 +72,7 @@ class basic_filebuf :
7172
public:
7273
basic_filebuf< charT, traits >* open(path const& p, std::ios_base::openmode mode)
7374
{
74-
return std::basic_filebuf< charT, traits >::open(BOOST_FILESYSTEM_C_STR(p), mode) ? this : 0;
75+
return std::basic_filebuf< charT, traits >::open(BOOST_FILESYSTEM_C_STR(p), mode) ? this : NULL;
7576
}
7677
};
7778

include/boost/filesystem/operations.hpp

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@
3030
#include <boost/core/scoped_enum.hpp>
3131
#include <boost/system/error_code.hpp>
3232
#include <boost/cstdint.hpp>
33-
#include <string>
33+
#include <cstddef>
3434
#include <ctime>
35+
#include <string>
3536

3637
#include <boost/filesystem/detail/header.hpp> // must be the last #include
3738

@@ -89,78 +90,78 @@ BOOST_SCOPED_ENUM_DECLARE_END(copy_option)
8990
namespace detail {
9091

9192
BOOST_FILESYSTEM_DECL
92-
path absolute(path const& p, path const& base, system::error_code* ec = 0);
93+
path absolute(path const& p, path const& base, system::error_code* ec = NULL);
9394
BOOST_FILESYSTEM_DECL
94-
file_status status(path const& p, system::error_code* ec = 0);
95+
file_status status(path const& p, system::error_code* ec = NULL);
9596
BOOST_FILESYSTEM_DECL
96-
file_status symlink_status(path const& p, system::error_code* ec = 0);
97+
file_status symlink_status(path const& p, system::error_code* ec = NULL);
9798
BOOST_FILESYSTEM_DECL
98-
bool is_empty(path const& p, system::error_code* ec = 0);
99+
bool is_empty(path const& p, system::error_code* ec = NULL);
99100
BOOST_FILESYSTEM_DECL
100-
path initial_path(system::error_code* ec = 0);
101+
path initial_path(system::error_code* ec = NULL);
101102
BOOST_FILESYSTEM_DECL
102-
path canonical(path const& p, path const& base, system::error_code* ec = 0);
103+
path canonical(path const& p, path const& base, system::error_code* ec = NULL);
103104
BOOST_FILESYSTEM_DECL
104-
void copy(path const& from, path const& to, unsigned int options, system::error_code* ec = 0);
105+
void copy(path const& from, path const& to, unsigned int options, system::error_code* ec = NULL);
105106
#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
106107
BOOST_FILESYSTEM_DECL
107-
void copy_directory(path const& from, path const& to, system::error_code* ec = 0);
108+
void copy_directory(path const& from, path const& to, system::error_code* ec = NULL);
108109
#endif
109110
BOOST_FILESYSTEM_DECL
110-
bool copy_file(path const& from, path const& to, // See ticket #2925
111-
unsigned int options, system::error_code* ec = 0); // see copy_options for options
111+
bool copy_file(path const& from, path const& to, // See ticket #2925
112+
unsigned int options, system::error_code* ec = NULL); // see copy_options for options
112113
BOOST_FILESYSTEM_DECL
113-
void copy_symlink(path const& existing_symlink, path const& new_symlink, system::error_code* ec = 0);
114+
void copy_symlink(path const& existing_symlink, path const& new_symlink, system::error_code* ec = NULL);
114115
BOOST_FILESYSTEM_DECL
115-
bool create_directories(path const& p, system::error_code* ec = 0);
116+
bool create_directories(path const& p, system::error_code* ec = NULL);
116117
BOOST_FILESYSTEM_DECL
117-
bool create_directory(path const& p, const path* existing, system::error_code* ec = 0);
118+
bool create_directory(path const& p, const path* existing, system::error_code* ec = NULL);
118119
BOOST_FILESYSTEM_DECL
119-
void create_directory_symlink(path const& to, path const& from, system::error_code* ec = 0);
120+
void create_directory_symlink(path const& to, path const& from, system::error_code* ec = NULL);
120121
BOOST_FILESYSTEM_DECL
121-
void create_hard_link(path const& to, path const& from, system::error_code* ec = 0);
122+
void create_hard_link(path const& to, path const& from, system::error_code* ec = NULL);
122123
BOOST_FILESYSTEM_DECL
123-
void create_symlink(path const& to, path const& from, system::error_code* ec = 0);
124+
void create_symlink(path const& to, path const& from, system::error_code* ec = NULL);
124125
BOOST_FILESYSTEM_DECL
125-
path current_path(system::error_code* ec = 0);
126+
path current_path(system::error_code* ec = NULL);
126127
BOOST_FILESYSTEM_DECL
127-
void current_path(path const& p, system::error_code* ec = 0);
128+
void current_path(path const& p, system::error_code* ec = NULL);
128129
BOOST_FILESYSTEM_DECL
129-
bool equivalent(path const& p1, path const& p2, system::error_code* ec = 0);
130+
bool equivalent(path const& p1, path const& p2, system::error_code* ec = NULL);
130131
BOOST_FILESYSTEM_DECL
131-
boost::uintmax_t file_size(path const& p, system::error_code* ec = 0);
132+
boost::uintmax_t file_size(path const& p, system::error_code* ec = NULL);
132133
BOOST_FILESYSTEM_DECL
133-
boost::uintmax_t hard_link_count(path const& p, system::error_code* ec = 0);
134+
boost::uintmax_t hard_link_count(path const& p, system::error_code* ec = NULL);
134135
BOOST_FILESYSTEM_DECL
135-
std::time_t creation_time(path const& p, system::error_code* ec = 0);
136+
std::time_t creation_time(path const& p, system::error_code* ec = NULL);
136137
BOOST_FILESYSTEM_DECL
137-
std::time_t last_write_time(path const& p, system::error_code* ec = 0);
138+
std::time_t last_write_time(path const& p, system::error_code* ec = NULL);
138139
BOOST_FILESYSTEM_DECL
139-
void last_write_time(path const& p, const std::time_t new_time, system::error_code* ec = 0);
140+
void last_write_time(path const& p, const std::time_t new_time, system::error_code* ec = NULL);
140141
BOOST_FILESYSTEM_DECL
141-
void permissions(path const& p, perms prms, system::error_code* ec = 0);
142+
void permissions(path const& p, perms prms, system::error_code* ec = NULL);
142143
BOOST_FILESYSTEM_DECL
143-
path read_symlink(path const& p, system::error_code* ec = 0);
144+
path read_symlink(path const& p, system::error_code* ec = NULL);
144145
BOOST_FILESYSTEM_DECL
145-
path relative(path const& p, path const& base, system::error_code* ec = 0);
146+
path relative(path const& p, path const& base, system::error_code* ec = NULL);
146147
BOOST_FILESYSTEM_DECL
147-
bool remove(path const& p, system::error_code* ec = 0);
148+
bool remove(path const& p, system::error_code* ec = NULL);
148149
BOOST_FILESYSTEM_DECL
149-
boost::uintmax_t remove_all(path const& p, system::error_code* ec = 0);
150+
boost::uintmax_t remove_all(path const& p, system::error_code* ec = NULL);
150151
BOOST_FILESYSTEM_DECL
151-
void rename(path const& old_p, path const& new_p, system::error_code* ec = 0);
152+
void rename(path const& old_p, path const& new_p, system::error_code* ec = NULL);
152153
BOOST_FILESYSTEM_DECL
153-
void resize_file(path const& p, uintmax_t size, system::error_code* ec = 0);
154+
void resize_file(path const& p, uintmax_t size, system::error_code* ec = NULL);
154155
BOOST_FILESYSTEM_DECL
155-
space_info space(path const& p, system::error_code* ec = 0);
156+
space_info space(path const& p, system::error_code* ec = NULL);
156157
BOOST_FILESYSTEM_DECL
157-
path system_complete(path const& p, system::error_code* ec = 0);
158+
path system_complete(path const& p, system::error_code* ec = NULL);
158159
BOOST_FILESYSTEM_DECL
159-
path temp_directory_path(system::error_code* ec = 0);
160+
path temp_directory_path(system::error_code* ec = NULL);
160161
BOOST_FILESYSTEM_DECL
161-
path unique_path(path const& p, system::error_code* ec = 0);
162+
path unique_path(path const& p, system::error_code* ec = NULL);
162163
BOOST_FILESYSTEM_DECL
163-
path weakly_canonical(path const& p, path const& base, system::error_code* ec = 0);
164+
path weakly_canonical(path const& p, path const& base, system::error_code* ec = NULL);
164165

165166
} // namespace detail
166167

@@ -447,12 +448,12 @@ inline bool create_directories(path const& p, system::error_code& ec) BOOST_NOEX
447448

448449
inline bool create_directory(path const& p)
449450
{
450-
return detail::create_directory(p, 0);
451+
return detail::create_directory(p, NULL);
451452
}
452453

453454
inline bool create_directory(path const& p, system::error_code& ec) BOOST_NOEXCEPT
454455
{
455-
return detail::create_directory(p, 0, &ec);
456+
return detail::create_directory(p, NULL, &ec);
456457
}
457458

458459
inline bool create_directory(path const& p, path const& existing)

include/boost/filesystem/path.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class path :
209209
template< class Source >
210210
path(Source const& source, typename boost::enable_if_c<
211211
path_traits::is_pathable< typename boost::decay< Source >::type >::value && !path_detail::is_native_pathable< Source >::value
212-
>::type* = 0)
212+
>::type* = NULL)
213213
{
214214
path_traits::dispatch(source, m_pathname);
215215
}
@@ -274,15 +274,15 @@ class path :
274274
template< class Source >
275275
path(Source const& source, codecvt_type const& cvt, typename boost::enable_if_c<
276276
path_traits::is_pathable< typename boost::decay< Source >::type >::value && !path_detail::is_native_pathable< Source >::value
277-
>::type* = 0)
277+
>::type* = NULL)
278278
{
279279
path_traits::dispatch(source, m_pathname, cvt);
280280
}
281281

282282
path(const value_type* begin, const value_type* end) : m_pathname(begin, end) {}
283283

284284
template< class InputIterator >
285-
path(InputIterator begin, InputIterator end, typename boost::disable_if< path_detail::is_native_char_ptr< InputIterator > >::type* = 0)
285+
path(InputIterator begin, InputIterator end, typename boost::disable_if< path_detail::is_native_char_ptr< InputIterator > >::type* = NULL)
286286
{
287287
if (begin != end)
288288
{
@@ -295,7 +295,7 @@ class path :
295295
path(const value_type* begin, const value_type* end, codecvt_type const&) : m_pathname(begin, end) {}
296296

297297
template< class InputIterator >
298-
path(InputIterator begin, InputIterator end, codecvt_type const& cvt, typename boost::disable_if< path_detail::is_native_char_ptr< InputIterator > >::type* = 0)
298+
path(InputIterator begin, InputIterator end, codecvt_type const& cvt, typename boost::disable_if< path_detail::is_native_char_ptr< InputIterator > >::type* = NULL)
299299
{
300300
if (begin != end)
301301
{
@@ -1183,7 +1183,7 @@ template< typename T >
11831183
inline typename boost::enable_if< boost::is_same< T, path >, std::size_t >::type hash_value(T const& p) BOOST_NOEXCEPT
11841184
{
11851185
#ifdef BOOST_WINDOWS_API
1186-
std::size_t seed = 0;
1186+
std::size_t seed = 0u;
11871187
for (typename T::value_type const* it = p.c_str(); *it; ++it)
11881188
hash_combine(seed, *it == L'/' ? L'\\' : *it);
11891189
return seed;
@@ -1359,14 +1359,14 @@ inline std::wstring path::generic_string< std::wstring >(codecvt_type const& cvt
13591359
namespace path_traits { // without codecvt
13601360

13611361
inline void convert(const char* from,
1362-
const char* from_end, // 0 for null terminated MBCS
1362+
const char* from_end, // NULL for null terminated MBCS
13631363
std::wstring& to)
13641364
{
13651365
convert(from, from_end, to, path::codecvt());
13661366
}
13671367

13681368
inline void convert(const wchar_t* from,
1369-
const wchar_t* from_end, // 0 for null terminated MBCS
1369+
const wchar_t* from_end, // NULL for null terminated MBCS
13701370
std::string& to)
13711371
{
13721372
convert(from, from_end, to, path::codecvt());
@@ -1375,13 +1375,13 @@ inline void convert(const wchar_t* from,
13751375
inline void convert(const char* from, std::wstring& to)
13761376
{
13771377
BOOST_ASSERT(!!from);
1378-
convert(from, 0, to, path::codecvt());
1378+
convert(from, NULL, to, path::codecvt());
13791379
}
13801380

13811381
inline void convert(const wchar_t* from, std::string& to)
13821382
{
13831383
BOOST_ASSERT(!!from);
1384-
convert(from, 0, to, path::codecvt());
1384+
convert(from, NULL, to, path::codecvt());
13851385
}
13861386

13871387
} // namespace path_traits

include/boost/filesystem/path_traits.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,40 +147,40 @@ inline bool empty(T (&x)[N])
147147

148148
// value types differ ---------------------------------------------------------------//
149149
//
150-
// A from_end argument of 0 is less efficient than a known end, so use only if needed
150+
// A from_end argument of NULL is less efficient than a known end, so use only if needed
151151

152152
// with codecvt
153153

154154
BOOST_FILESYSTEM_DECL
155155
void convert(const char* from,
156-
const char* from_end, // 0 for null terminated MBCS
156+
const char* from_end, // NULL for null terminated MBCS
157157
std::wstring& to, codecvt_type const& cvt);
158158

159159
BOOST_FILESYSTEM_DECL
160160
void convert(const wchar_t* from,
161-
const wchar_t* from_end, // 0 for null terminated MBCS
161+
const wchar_t* from_end, // NULL for null terminated MBCS
162162
std::string& to, codecvt_type const& cvt);
163163

164164
inline void convert(const char* from, std::wstring& to, codecvt_type const& cvt)
165165
{
166166
BOOST_ASSERT(from);
167-
convert(from, 0, to, cvt);
167+
convert(from, NULL, to, cvt);
168168
}
169169

170170
inline void convert(const wchar_t* from, std::string& to, codecvt_type const& cvt)
171171
{
172172
BOOST_ASSERT(from);
173-
convert(from, 0, to, cvt);
173+
convert(from, NULL, to, cvt);
174174
}
175175

176176
// without codecvt
177177

178178
inline void convert(const char* from,
179-
const char* from_end, // 0 for null terminated MBCS
179+
const char* from_end, // NULL for null terminated MBCS
180180
std::wstring& to);
181181

182182
inline void convert(const wchar_t* from,
183-
const wchar_t* from_end, // 0 for null terminated MBCS
183+
const wchar_t* from_end, // NULL for null terminated MBCS
184184
std::string& to);
185185

186186
inline void convert(const char* from, std::wstring& to);

0 commit comments

Comments
 (0)