diff options
author | Murray Cumming <murrayc@murrayc.com> | 2013-06-27 10:25:21 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2015-07-09 23:27:07 +0200 |
commit | 8de5b1c659df65d0cc381a32ef7a7cd84a8e1038 (patch) | |
tree | 9de835427f4a0e8144e46e7ca93b9e4f9760d3a3 | |
parent | e0a8d05f0457d157a392303ced2b4237b228901b (diff) | |
download | glibmm-8de5b1c659df65d0cc381a32ef7a7cd84a8e1038.tar.gz |
C++11: examples: Use nullptr.
-rw-r--r-- | examples/child_watch/main.cc | 2 | ||||
-rw-r--r-- | examples/iochannel_stream/fdstream.cc | 8 | ||||
-rw-r--r-- | examples/network/resolver.cc | 2 | ||||
-rw-r--r-- | examples/thread/dispatcher.cc | 4 | ||||
-rw-r--r-- | examples/thread/dispatcher2.cc | 10 |
5 files changed, 13 insertions, 13 deletions
diff --git a/examples/child_watch/main.cc b/examples/child_watch/main.cc index 3bbc368b..883577a2 100644 --- a/examples/child_watch/main.cc +++ b/examples/child_watch/main.cc @@ -40,7 +40,7 @@ void ChildWatch::run() { GPid pid = fork(); - if(pid==0) + if(!pid) { sleep(5); exit(0); diff --git a/examples/iochannel_stream/fdstream.cc b/examples/iochannel_stream/fdstream.cc index be97676f..90df473e 100644 --- a/examples/iochannel_stream/fdstream.cc +++ b/examples/iochannel_stream/fdstream.cc @@ -280,8 +280,8 @@ std::streamsize fdstreambuf::xsgetn(char* dest, std::streamsize num) } fdstream::fdstream(int fd, bool manage) -: std::istream(0), - std::ostream(0), +: std::istream(nullptr), + std::ostream(nullptr), buf(fd, manage) { std::istream::rdbuf(&buf); @@ -289,8 +289,8 @@ fdstream::fdstream(int fd, bool manage) } fdstream::fdstream() -: std::istream(0), - std::ostream(0) +: std::istream(nullptr), + std::ostream(nullptr) { std::istream::rdbuf(&buf); std::ostream::rdbuf(&buf); diff --git a/examples/network/resolver.cc b/examples/network/resolver.cc index 4fdf0cfa..dee1ebf5 100644 --- a/examples/network/resolver.cc +++ b/examples/network/resolver.cc @@ -405,7 +405,7 @@ do_connectable (const std::string& arg, gboolean synchronous) { host = arg.substr (0, pos); port_str = arg.substr(pos); - port = strtoul (port_str.c_str (), NULL, 10); + port = strtoul (port_str.c_str (), nullptr, 10); } else port = 0; diff --git a/examples/thread/dispatcher.cc b/examples/thread/dispatcher.cc index 21833e7f..1c1eb667 100644 --- a/examples/thread/dispatcher.cc +++ b/examples/thread/dispatcher.cc @@ -80,7 +80,7 @@ public: ThreadProgress::ThreadProgress(int id) : - thread_ (0), + thread_ (nullptr), id_ (id), progress_ (0) { @@ -91,7 +91,7 @@ ThreadProgress::ThreadProgress(int id) ThreadProgress::~ThreadProgress() { // It is an error if the thread is still running at this point. - g_return_if_fail(thread_ == 0); + g_return_if_fail(thread_ == nullptr); } int ThreadProgress::id() const diff --git a/examples/thread/dispatcher2.cc b/examples/thread/dispatcher2.cc index dd7d7de8..b9afebc1 100644 --- a/examples/thread/dispatcher2.cc +++ b/examples/thread/dispatcher2.cc @@ -77,7 +77,7 @@ ThreadTimer::ThreadTimer() // Create a new Glib::Dispatcher that is attached to the default main context, signal_increment_ (), // This pointer will be initialized later by the 2nd thread. - signal_finished_ptr_ (NULL) + signal_finished_ptr_ (nullptr) { // Connect the cross-thread signal. signal_increment_.connect(sigc::mem_fun(*this, &ThreadTimer::timer_increment)); @@ -99,7 +99,7 @@ void ThreadTimer::launch() sigc::mem_fun(*this, &ThreadTimer::thread_function)); // Wait for the 2nd thread's startup notification. - while(signal_finished_ptr_ == NULL) + while(!signal_finished_ptr_) startup_cond_.wait(startup_mutex_); } @@ -109,10 +109,10 @@ void ThreadTimer::signal_finished_emit() signal_finished_ptr_->emit(); // wait for the thread to join - if(thread_ != NULL) + if(thread_) thread_->join(); - signal_finished_ptr_ = NULL; + signal_finished_ptr_ = nullptr; } void ThreadTimer::print() const @@ -189,7 +189,7 @@ ThreadTimer::type_signal_end ThreadTimer::signal_end_; ThreadDispatcher::ThreadDispatcher() : - timer_ (NULL) + timer_ (nullptr) { std::cout << "Thread Dispatcher Example #2" << std::endl; |