X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=signalhandler.cpp;h=398114d5b96f610954f5c86f8d6b833407a9812b;hb=9daf2d80edb259028e26301d49d02752a115d6f6;hp=475f49b0638065065fca6b6645a34147bae015d6;hpb=8dbbc7f0b9ea59d0f0d62225772f8a56eee125f5;p=pulseview.git
diff --git a/signalhandler.cpp b/signalhandler.cpp
index 475f49b..398114d 100644
--- a/signalhandler.cpp
+++ b/signalhandler.cpp
@@ -14,11 +14,10 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see .
*/
-#include "signalhandler.h"
+#include "signalhandler.hpp"
#include
#include
@@ -33,7 +32,7 @@ int SignalHandler::sockets_[2];
bool SignalHandler::prepare_signals()
{
- if(socketpair(AF_UNIX, SOCK_STREAM, 0, sockets_) != 0)
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets_) != 0)
return false;
struct sigaction sig_action;
@@ -42,8 +41,8 @@ bool SignalHandler::prepare_signals()
sigemptyset(&sig_action.sa_mask);
sig_action.sa_flags = SA_RESTART;
- if(sigaction(SIGINT, &sig_action, 0) != 0 ||
- sigaction(SIGTERM, &sig_action, 0) != 0) {
+ if (sigaction(SIGINT, &sig_action, nullptr) != 0 ||
+ sigaction(SIGTERM, &sig_action, nullptr) != 0) {
close(sockets_[0]);
close(sockets_[1]);
return false;
@@ -53,7 +52,7 @@ bool SignalHandler::prepare_signals()
}
SignalHandler::SignalHandler(QObject* parent) : QObject(parent),
- socket_notifier_(0)
+ socket_notifier_(nullptr)
{
socket_notifier_ = new QSocketNotifier(sockets_[1],
QSocketNotifier::Read, this);
@@ -66,8 +65,7 @@ void SignalHandler::on_socket_notifier_activated()
socket_notifier_->setEnabled(false);
int sig_number;
- if(read(sockets_[1], &sig_number, sizeof(int)) !=
- sizeof(int)) {
+ if (read(sockets_[1], &sig_number, sizeof(int)) != sizeof(int)) {
qDebug() << "Failed to catch signal";
abort();
}
@@ -87,8 +85,7 @@ void SignalHandler::on_socket_notifier_activated()
void SignalHandler::handle_signals(int sig_number)
{
- if(write(sockets_[0], &sig_number, sizeof(int)) !=
- sizeof(int)) {
+ if (write(sockets_[0], &sig_number, sizeof(int)) != sizeof(int)) {
// Failed to handle signal
abort();
}