diff --git a/bindings/python/src/alert.cpp b/bindings/python/src/alert.cpp index 3e05d49fe..e182536d1 100644 --- a/bindings/python/src/alert.cpp +++ b/bindings/python/src/alert.cpp @@ -346,7 +346,7 @@ void bind_alert() ; class_, noncopyable>( - "read_piece_alert", 0, no_init) + "read_piece_alert", nullptr, no_init) .add_property("buffer", get_buffer) .def_readonly("piece", &read_piece_alert::piece) .def_readonly("size", &read_piece_alert::size) diff --git a/bindings/python/src/converters.cpp b/bindings/python/src/converters.cpp index 668b363f9..8fd0c4a0b 100644 --- a/bindings/python/src/converters.cpp +++ b/bindings/python/src/converters.cpp @@ -33,15 +33,15 @@ struct tuple_to_endpoint static void* convertible(PyObject* x) { - if (!PyTuple_Check(x)) return NULL; - if (PyTuple_Size(x) != 2) return NULL; + if (!PyTuple_Check(x)) return nullptr; + if (PyTuple_Size(x) != 2) return nullptr; extract ip(object(borrowed(PyTuple_GetItem(x, 0)))); - if (!ip.check()) return NULL; + if (!ip.check()) return nullptr; extract port(object(borrowed(PyTuple_GetItem(x, 1)))); - if (!port.check()) return NULL; + if (!port.check()) return nullptr; lt::error_code ec; lt::address::from_string(ip, ec); - if (ec) return NULL; + if (ec) return nullptr; return x; } @@ -78,7 +78,7 @@ struct tuple_to_pair static void* convertible(PyObject* x) { - return (PyTuple_Check(x) && PyTuple_Size(x) == 2) ? x: NULL; + return (PyTuple_Check(x) && PyTuple_Size(x) == 2) ? x: nullptr; } static void construct(PyObject* x, converter::rvalue_from_python_stage1_data* data) @@ -121,7 +121,7 @@ struct list_to_vector static void* convertible(PyObject* x) { - return PyList_Check(x) ? x: 0; + return PyList_Check(x) ? x: nullptr; } static void construct(PyObject* x, converter::rvalue_from_python_stage1_data* data) diff --git a/bindings/python/src/create_torrent.cpp b/bindings/python/src/create_torrent.cpp index 0c58a94e9..9380977af 100644 --- a/bindings/python/src/create_torrent.cpp +++ b/bindings/python/src/create_torrent.cpp @@ -76,7 +76,7 @@ namespace FileIter(file_storage const& fs, int i) : m_fs(&fs), m_i(i) {} FileIter(FileIter const& fi) : m_fs(fi.m_fs), m_i(fi.m_i) {} - FileIter() : m_fs(NULL), m_i(0) {} + FileIter() : m_fs(nullptr), m_i(0) {} libtorrent::file_entry operator*() const { return m_fs->at(m_i); } diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index 5a6063ffa..e355f0ace 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -794,7 +794,7 @@ void bind_session() #ifndef TORRENT_NO_DEPRECATE .def( "listen_on", &listen_on - , (arg("min"), "max", arg("interface") = (char const*)0, arg("flags") = 0) + , (arg("min"), "max", arg("interface") = (char const*)nullptr, arg("flags") = 0) ) #ifndef TORRENT_DISABLE_DHT .def("start_dht", allow_threads(start_dht0)) diff --git a/bindings/python/src/string.cpp b/bindings/python/src/string.cpp index 6784f801c..03406b3da 100644 --- a/bindings/python/src/string.cpp +++ b/bindings/python/src/string.cpp @@ -21,7 +21,7 @@ struct unicode_from_python #if PY_VERSION_HEX >= 0x03020000 return PyBytes_Check(x) ? x : PyUnicode_Check(x) ? x : 0; #else - return PyString_Check(x) ? x : PyUnicode_Check(x) ? x : 0; + return PyString_Check(x) ? x : PyUnicode_Check(x) ? x : nullptr; #endif } @@ -33,7 +33,7 @@ struct unicode_from_python if (PyUnicode_Check(x)) { PyObject* utf8 = PyUnicode_AsUTF8String(x); - if (utf8 == NULL) + if (utf8 == nullptr) { new (storage) std::string(); } diff --git a/bindings/python/src/utility.cpp b/bindings/python/src/utility.cpp index 1820af2c1..600f4726f 100644 --- a/bindings/python/src/utility.cpp +++ b/bindings/python/src/utility.cpp @@ -42,7 +42,7 @@ struct bytes_from_python #if PY_MAJOR_VERSION >= 3 return PyBytes_Check(x) ? x : NULL; #else - return PyString_Check(x) ? x : NULL; + return PyString_Check(x) ? x : nullptr; #endif }