summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPovilas Kanapickas <povilas@radix.lt>2020-11-27 18:48:52 +0200
committerPovilas Kanapickas <povilas@radix.lt>2020-11-27 18:48:52 +0200
commit332892503a64e726878201e2cdd067ea893322aa (patch)
tree29c8fa588560ea73f3f202aeec742f70f3196ebb
parent866ee813335d73962e61005e191a17f7aa1299bf (diff)
Fix zero as null pointer constant warnings
-rw-r--r--examples/xorg-gtest-example.cpp2
-rw-r--r--include/xorg/gtest/evemu/xorg-gtest-device.h3
-rw-r--r--include/xorg/gtest/xorg-gtest-process.h2
-rw-r--r--src/device.cpp10
-rw-r--r--src/process.cpp14
-rw-r--r--src/test.cpp8
-rw-r--r--src/xorg-gtest_main.cpp6
-rw-r--r--src/xserver.cpp20
-rw-r--r--test/process-test.cpp58
-rw-r--r--test/xserver-test.cpp22
10 files changed, 73 insertions, 72 deletions
diff --git a/examples/xorg-gtest-example.cpp b/examples/xorg-gtest-example.cpp
index fa09e7f..b47c510 100644
--- a/examples/xorg-gtest-example.cpp
+++ b/examples/xorg-gtest-example.cpp
@@ -45,7 +45,7 @@ TEST(XServer, DisplayConnection) {
server.Start();
Display *dpy = XOpenDisplay(server.GetDisplayString().c_str());
- ASSERT_TRUE(dpy != NULL);
+ ASSERT_TRUE(dpy != nullptr);
/* calling Terminate isn't necessary as the destructor will do it for us,
but we do want the log file removed. That only works on terminated
diff --git a/include/xorg/gtest/evemu/xorg-gtest-device.h b/include/xorg/gtest/evemu/xorg-gtest-device.h
index e722058..62f6439 100644
--- a/include/xorg/gtest/evemu/xorg-gtest-device.h
+++ b/include/xorg/gtest/evemu/xorg-gtest-device.h
@@ -124,7 +124,8 @@ class Device {
*
* @return false if this device doesn't have this axis, or true on success
*/
- bool GetAbsData(int code, int *min, int *max, int *fuzz = NULL, int *flat = NULL, int *resolution = NULL);
+ bool GetAbsData(int code, int *min, int *max,
+ int *fuzz = nullptr, int *flat = nullptr, int *resolution = nullptr);
private:
diff --git a/include/xorg/gtest/xorg-gtest-process.h b/include/xorg/gtest/xorg-gtest-process.h
index 2c4c897..e3f56ba 100644
--- a/include/xorg/gtest/xorg-gtest-process.h
+++ b/include/xorg/gtest/xorg-gtest-process.h
@@ -104,7 +104,7 @@ class Process {
* environment variable exists and to false otherwise.
* @returns The value of the environment variable, or an empty string.
*/
- static std::string GetEnv(const std::string& name, bool* exists = NULL);
+ static std::string GetEnv(const std::string& name, bool* exists = nullptr);
/**
* Creates a child-process that is in a terminated state.
diff --git a/src/device.cpp b/src/device.cpp
index a57864d..0de0026 100644
--- a/src/device.cpp
+++ b/src/device.cpp
@@ -42,7 +42,7 @@
#define DEV_INPUT_DIR "/dev/input/"
struct xorg::testing::evemu::Device::Private {
- Private() : fd(-1), device(NULL), device_node() {}
+ Private() : fd(-1), device(nullptr), device_node() {}
int fd;
struct evemu_device* device;
@@ -89,7 +89,7 @@ static bool event_is_device(const std::string &path,
}
void xorg::testing::evemu::Device::GuessDeviceNode(time_t ctime) {
- struct dirent **event_devices = NULL;
+ struct dirent **event_devices = nullptr;
int n_event_devices;
n_event_devices = scandir(SYS_INPUT_DIR, &event_devices,
@@ -158,12 +158,12 @@ xorg::testing::evemu::Device::Device(const std::string& path)
: d_(new Private) {
static const char UINPUT_NODE[] = "/dev/uinput";
- d_->device = evemu_new(NULL);
+ d_->device = evemu_new(nullptr);
if (!d_->device)
throw std::runtime_error("Failed to create evemu record");
FILE* fp = fopen(path.c_str(), "r");
- if (fp == NULL) {
+ if (fp == nullptr) {
evemu_delete(d_->device);
throw std::runtime_error("Failed to open device file");
}
@@ -190,7 +190,7 @@ xorg::testing::evemu::Device::Device(const std::string& path)
throw std::runtime_error("Failed to open uinput node");
}
- d_->ctime = time(NULL);
+ d_->ctime = time(nullptr);
if (evemu_create(d_->device, d_->fd) < 0) {
close(d_->fd);
evemu_delete(d_->device);
diff --git a/src/process.cpp b/src/process.cpp
index dac820b..f94cb82 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -78,7 +78,7 @@ pid_t xorg::testing::Process::Fork() {
throw std::runtime_error("Failed to fork child process");
} else if (d_->pid == 0) { /* Child */
close(0);
- if (getenv("XORG_GTEST_CHILD_STDOUT") == NULL) {
+ if (getenv("XORG_GTEST_CHILD_STDOUT") == nullptr) {
close(1);
close(2);
}
@@ -107,7 +107,7 @@ void xorg::testing::Process::Start(const std::string &program, const std::vector
char *tok = strtok(valgrind, " ");
while(tok) {
args.push_back(strdup(tok));
- tok = strtok(NULL, " ");
+ tok = strtok(nullptr, " ");
}
}
@@ -115,7 +115,7 @@ void xorg::testing::Process::Start(const std::string &program, const std::vector
for (it = argv.begin(); it != argv.end(); it++)
args.push_back(strdup(it->c_str()));
- args.push_back(NULL);
+ args.push_back(nullptr);
execvp(args[0], &args[0]);
@@ -158,11 +158,11 @@ bool xorg::testing::Process::WaitForExit(unsigned int timeout) {
long tv_usecs = (timeout % 1000) * 1000000L;
struct timespec sig_timeout = { tv_secs, tv_usecs };
- if (sigtimedwait(&sig_mask, NULL, &sig_timeout) != SIGCHLD && errno != EAGAIN)
+ if (sigtimedwait(&sig_mask, nullptr, &sig_timeout) != SIGCHLD && errno != EAGAIN)
usleep(timeout * 1000);
if (!sigismember(&sig_mask, SIGCHLD)) {
- if (sigprocmask(SIG_UNBLOCK, &sig_mask, NULL) == -1)
+ if (sigprocmask(SIG_UNBLOCK, &sig_mask, nullptr) == -1)
std::cout << "WARNING: Failed to unblock SIGCHLD. Tests may behave funny.\n";
}
@@ -245,8 +245,8 @@ void xorg::testing::Process::SetEnv(const std::string& name,
std::string xorg::testing::Process::GetEnv(const std::string& name,
bool* exists) {
const char* var = getenv(name.c_str());
- if (exists != NULL)
- *exists = (var != NULL);
+ if (exists != nullptr)
+ *exists = (var != nullptr);
return std::string(var);
}
diff --git a/src/test.cpp b/src/test.cpp
index a484787..64cfbae 100644
--- a/src/test.cpp
+++ b/src/test.cpp
@@ -38,13 +38,13 @@ struct xorg::testing::Test::Private {
};
xorg::testing::Test::Test() : d_(new Private) {
- d_->display = NULL;
+ d_->display = nullptr;
}
xorg::testing::Test::~Test() {}
void xorg::testing::Test::SetUp() {
- const char *dpy = NULL;
+ const char *dpy = nullptr;
if (!d_->display_string.empty())
dpy = d_->display_string.c_str();
@@ -53,7 +53,7 @@ void xorg::testing::Test::SetUp() {
if (!d_->display) {
std::stringstream ss;
ss << "Failed to open connection to display";
- if (dpy != NULL) ss << " " << dpy;
+ if (dpy != nullptr) ss << " " << dpy;
ss << ".\nThis usually means that your X server did not start properly.\n";
ss << "Check the log file, or set XORG_GTEST_CHILD_STDOUT to see the server's\n"
"error messages when starting.";
@@ -64,7 +64,7 @@ void xorg::testing::Test::SetUp() {
void xorg::testing::Test::TearDown() {
if (d_->display)
XCloseDisplay(d_->display);
- d_->display = NULL;
+ d_->display = nullptr;
}
::Display* xorg::testing::Test::Display() const {
diff --git a/src/xorg-gtest_main.cpp b/src/xorg-gtest_main.cpp
index 54c80bb..459c003 100644
--- a/src/xorg-gtest_main.cpp
+++ b/src/xorg-gtest_main.cpp
@@ -50,12 +50,12 @@ const struct option longopts[] = {
{ "xorg-display", required_argument, &xorg_display_specified, true, },
{ "xorg-logfile", required_argument, &xorg_logfile_specified, true, },
{ "server", required_argument, &server_specified, true, },
- { NULL, 0, NULL, 0 }
+ { nullptr, 0, nullptr, 0 }
};
} // namespace
-xorg::testing::Environment* environment = NULL;
+xorg::testing::Environment* environment = nullptr;
static void signal_handler(int signum) {
if (environment)
@@ -99,7 +99,7 @@ static void setup_signal_handlers() {
action.sa_flags = SA_RESETHAND;
for (unsigned i = 0; i < sizeof(signals) / sizeof(signals[0]); ++i)
- if (sigaction(signals[i], &action, NULL))
+ if (sigaction(signals[i], &action, nullptr))
std::cerr << "Warning: Failed to set signal handler for signal "
<< signals[i] << "\n";
}
diff --git a/src/xserver.cpp b/src/xserver.cpp
index da48567..081e5f5 100644
--- a/src/xserver.cpp
+++ b/src/xserver.cpp
@@ -118,9 +118,9 @@ bool xorg::testing::XServer::WaitForEvent(::Display *display, time_t timeout)
int ret;
if (timeout)
- ret = select(display_fd + 1, &fds, NULL, NULL, &timeval);
+ ret = select(display_fd + 1, &fds, nullptr, nullptr, &timeval);
else
- ret = select(display_fd + 1, &fds, NULL, NULL, NULL);
+ ret = select(display_fd + 1, &fds, nullptr, nullptr, nullptr);
if (ret < 0)
throw std::runtime_error("Failed to select on X fd");
@@ -176,7 +176,7 @@ static XIEventMask* set_hierarchy_mask(::Display *display,
int nmasks;
bool mask_toggled = false;
bool new_mask_created = false;
- XIEventMask *all_devices_mask = NULL;
+ XIEventMask *all_devices_mask = nullptr;
masks = XIGetSelectedEvents(display, DefaultRootWindow(display), &nmasks);
@@ -215,7 +215,7 @@ static XIEventMask* set_hierarchy_mask(::Display *display,
}
XFree(masks);
- masks = NULL;
+ masks = nullptr;
if (new_mask_created || mask_toggled) {
XISelectEvents(display, DefaultRootWindow(display), new_masks, nmasks);
@@ -443,7 +443,7 @@ void xorg::testing::XServer::RegisterXIOErrorHandler()
{
XIOErrorHandler old_handler, def_handler;
- old_handler = XSetIOErrorHandler(NULL);
+ old_handler = XSetIOErrorHandler(nullptr);
def_handler = XSetIOErrorHandler(_x_io_error_handler);
if (old_handler != def_handler &&
@@ -456,7 +456,7 @@ void xorg::testing::XServer::RegisterXErrorHandler()
{
XErrorHandler old_handler, def_handler;
- old_handler = XSetErrorHandler(NULL);
+ old_handler = XSetErrorHandler(nullptr);
def_handler = XSetErrorHandler(_x_error_handler);
if (old_handler != def_handler &&
@@ -479,7 +479,7 @@ void xorg::testing::XServer::Start(const std::string &program) {
sigemptyset(&sig_mask);
sigaddset(&sig_mask, SIGUSR1);
sigaddset(&sig_mask, SIGCHLD);
- if (sigprocmask(SIG_BLOCK, &sig_mask, NULL)) {
+ if (sigprocmask(SIG_BLOCK, &sig_mask, nullptr)) {
err_msg.append("Failed to set signal mask: ");
err_msg.append(std::strerror(errno));
throw std::runtime_error(err_msg);
@@ -506,7 +506,7 @@ void xorg::testing::XServer::Start(const std::string &program) {
for VT switching */
sigemptyset(&sig_mask);
sigaddset(&sig_mask, SIGUSR1);
- if (sigprocmask(SIG_UNBLOCK, &sig_mask, NULL)) {
+ if (sigprocmask(SIG_UNBLOCK, &sig_mask, nullptr)) {
err_msg.append("Failed to unblock signal mask: ");
err_msg.append(std::strerror(errno));
throw std::runtime_error(err_msg);
@@ -531,7 +531,7 @@ void xorg::testing::XServer::Start(const std::string &program) {
raise(SIGSTOP);
/* wait for SIGUSR1 from XServer */
- int recv_sig = sigtimedwait(&sig_mask, NULL, &sig_timeout);
+ int recv_sig = sigtimedwait(&sig_mask, nullptr, &sig_timeout);
if (recv_sig == SIGCHLD) {
GetState();
} else if (recv_sig != SIGUSR1 && errno != EAGAIN) {
@@ -543,7 +543,7 @@ void xorg::testing::XServer::Start(const std::string &program) {
sigemptyset(&sig_mask);
sigaddset(&sig_mask, SIGCHLD);
sigaddset(&sig_mask, SIGUSR1);
- sigprocmask(SIG_UNBLOCK, &sig_mask, NULL);
+ sigprocmask(SIG_UNBLOCK, &sig_mask, nullptr);
/* Ignore SIGUSR1, it's triggered on server regeneration. Tests that need
* to handle SIGUSR1 will have to install their own signal handler anyways */
diff --git a/test/process-test.cpp b/test/process-test.cpp
index 0c788fa..e42d476 100644
--- a/test/process-test.cpp
+++ b/test/process-test.cpp
@@ -17,7 +17,7 @@ TEST(Process, StartWithNULLArg)
{
XORG_TESTCASE("invocation of 'ls' with no arguments");
Process p;
- p.Start("ls", NULL);
+ p.Start("ls", nullptr);
ASSERT_GT(p.Pid(), 0);
}
@@ -26,7 +26,7 @@ TEST(Process, StartWithNULLTerminatedArg)
XORG_TESTCASE("invocation of 'ls' with NULL-terminated argument list");
Process p;
- p.Start("ls", "-l", NULL);
+ p.Start("ls", "-l", nullptr);
ASSERT_GT(p.Pid(), 0);
}
@@ -38,7 +38,7 @@ TEST(Process, ExitCodeSuccess)
ASSERT_EQ(p.GetState(), Process::NONE);
/* Process:Start closes stdout, so we need something that doesn't print */
- p.Start("echo", "-n", NULL);
+ p.Start("echo", "-n", nullptr);
ASSERT_GT(p.Pid(), 0);
ASSERT_EQ(p.GetState(), Process::RUNNING);
@@ -58,7 +58,7 @@ TEST(Process, ExitCodeFailure)
/* Process:Start closes stdout, so ls should fail with status 2, if not,
* that file is unlikely to exists so we get status 1 */
- p.Start("ls", "asqwerq.aqerqw_rqwe", NULL);
+ p.Start("ls", "asqwerq.aqerqw_rqwe", nullptr);
ASSERT_GT(p.Pid(), 0);
ASSERT_EQ(p.GetState(), Process::RUNNING);
@@ -86,7 +86,7 @@ TEST(Process, ChildTearDown)
close(pipefd[0]);
Process p;
- p.Start("sleep", "1000", NULL); /* forks another child */
+ p.Start("sleep", "1000", nullptr); /* forks another child */
ASSERT_GT(p.Pid(), 0);
char *buffer;
@@ -125,10 +125,10 @@ TEST(Process, TerminationFailure)
sigaddset(&sig_mask, SIGUSR1);
Process p;
- p.Start(TEST_ROOT_DIR "process-test-helper", NULL);
+ p.Start(TEST_ROOT_DIR "process-test-helper", nullptr);
/* don't check error here, the helper may have sent the signal before we
get here */
- sigtimedwait(&sig_mask, NULL, &sig_timeout);
+ sigtimedwait(&sig_mask, nullptr, &sig_timeout);
ASSERT_GT(p.Pid(), 0);
kill(p.Pid(), SIGSTOP);
@@ -143,7 +143,7 @@ TEST(Process, KillExitStatus)
XORG_TESTCASE("a child process killed must have a state of\n"
"FINISHED_FAILURE");
Process p;
- p.Start(TEST_ROOT_DIR "process-test-helper", NULL);
+ p.Start(TEST_ROOT_DIR "process-test-helper", nullptr);
p.Kill(1000);
ASSERT_EQ(p.GetState(), Process::FINISHED_FAILURE);
}
@@ -157,9 +157,9 @@ TEST(Process, DoubleStart)
/* Process double-started must fail */
Process p;
- p.Start("echo", "-n", NULL);
+ p.Start("echo", "-n", nullptr);
try {
- p.Start("echo", "-n", NULL);;
+ p.Start("echo", "-n", nullptr);
FAIL() << "Expected exception";
} catch (std::runtime_error &e) {
}
@@ -175,53 +175,53 @@ TEST(Process, DoubleStart)
/* restart job after a failed one, must succeed */
try {
- p.Start("echo", "-n", NULL);
+ p.Start("echo", "-n", nullptr);
} catch (std::runtime_error &e) {
FAIL();
}
- ASSERT_EQ(sigtimedwait(&sig_mask, NULL, &sig_timeout), SIGCHLD);
+ ASSERT_EQ(sigtimedwait(&sig_mask, nullptr, &sig_timeout), SIGCHLD);
ASSERT_EQ(p.GetState(), Process::FINISHED_SUCCESS);
/* restart job after successful one, must succeed */
try {
- p.Start("echo", "-n", NULL);
+ p.Start("echo", "-n", nullptr);
} catch (std::runtime_error &e) {
FAIL();
}
- ASSERT_EQ(sigtimedwait(&sig_mask, NULL, &sig_timeout), SIGCHLD);
+ ASSERT_EQ(sigtimedwait(&sig_mask, nullptr, &sig_timeout), SIGCHLD);
ASSERT_EQ(p.GetState(), Process::FINISHED_SUCCESS);
/* job that must be killed, followed by job */
sigemptyset(&sig_mask);
sigaddset(&sig_mask, SIGUSR1);
- p.Start(TEST_ROOT_DIR "process-test-helper", NULL);
- sigtimedwait(&sig_mask, NULL, &sig_timeout);
+ p.Start(TEST_ROOT_DIR "process-test-helper", nullptr);
+ sigtimedwait(&sig_mask, nullptr, &sig_timeout);
ASSERT_EQ(p.GetState(), Process::RUNNING);
p.Kill(100);
ASSERT_EQ(p.GetState(), Process::FINISHED_FAILURE);
/* restart job after successful one, must succeed */
try {
- p.Start("echo", "-n", NULL);
+ p.Start("echo", "-n", nullptr);
} catch (std::runtime_error &e) {
FAIL();
}
sigemptyset(&sig_mask);
sigaddset(&sig_mask, SIGCHLD);
- ASSERT_EQ(sigtimedwait(&sig_mask, NULL, &sig_timeout), SIGCHLD);
+ ASSERT_EQ(sigtimedwait(&sig_mask, nullptr, &sig_timeout), SIGCHLD);
ASSERT_EQ(p.GetState(), Process::FINISHED_SUCCESS);
/* job that fails to terminate, starting another one must fail */
sigemptyset(&sig_mask);
sigaddset(&sig_mask, SIGUSR1);
- p.Start(TEST_ROOT_DIR "process-test-helper", NULL);
- sigtimedwait(&sig_mask, NULL, &sig_timeout);
+ p.Start(TEST_ROOT_DIR "process-test-helper", nullptr);
+ sigtimedwait(&sig_mask, nullptr, &sig_timeout);
ASSERT_EQ(p.GetState(), Process::RUNNING);
ASSERT_FALSE(p.Terminate(100));
try {
- p.Start("echo", "-n", NULL);
+ p.Start("echo", "-n", nullptr);
FAIL() << "exception expected";
} catch (std::runtime_error &e) {
}
@@ -239,7 +239,7 @@ TEST(Process, ForkedParentStart)
if (p.Fork() > 0) {
ASSERT_GT(p.Pid(), 0);
ASSERT_EQ(p.GetState(), Process::RUNNING);
- ASSERT_THROW({ p.Start("ls", NULL); }, std::runtime_error);
+ ASSERT_THROW({ p.Start("ls", nullptr); }, std::runtime_error);
}
}
@@ -249,7 +249,7 @@ TEST(Process, ForkedChildStart)
Process p;
if (p.Fork() == 0) {
ASSERT_EQ(p.GetState(), Process::RUNNING);
- p.Start("ls", NULL);
+ p.Start("ls", nullptr);
ASSERT_GT(p.Pid(), 0);
}
}
@@ -260,9 +260,9 @@ TEST(Process, ForkedChildDoubleStart)
Process p;
if (p.Fork() == 0) {
ASSERT_EQ(p.GetState(), Process::RUNNING);
- p.Start("ls", NULL);
+ p.Start("ls", nullptr);
ASSERT_THROW({
- p.Start("ls", NULL);
+ p.Start("ls", nullptr);
}, std::runtime_error);
}
}
@@ -278,7 +278,7 @@ public:
Process valgrind;
/* check if valgrind actually exists */
- valgrind.Start("valgrind", "--version", NULL);
+ valgrind.Start("valgrind", "--version", nullptr);
int status;
ASSERT_EQ(waitpid(valgrind.Pid(), &status, 0), valgrind.Pid());
ASSERT_TRUE(WIFEXITED(status));
@@ -295,7 +295,7 @@ TEST_P(ProcessValgrindWrapper, ValgrindWrapper)
/* now set the env and fire up valgrind */
setenv("XORG_GTEST_USE_VALGRIND", executable.c_str(), 1);
Process p;
- p.Start("ls", NULL);
+ p.Start("ls", nullptr);
unsetenv("XORG_GTEST_USE_VALGRIND");
/* Check /proc/<pid>/comm to make sure valgrind
@@ -331,14 +331,14 @@ TEST_P(ProcessValgrindArgsWrapper, ValgrindWrapperWithArgs)
char *tok = strtok(all_args, " ");
while(tok) {
valgrind_args.push_back(std::string(tok));
- tok = strtok(NULL, " ");
+ tok = strtok(nullptr, " ");
}
free(all_args);
/* now set the env and fire up valgrind */
setenv("XORG_GTEST_USE_VALGRIND", vargs.c_str(), 1);
Process p;
- p.Start(TEST_ROOT_DIR "process-test-helper", NULL);
+ p.Start(TEST_ROOT_DIR "process-test-helper", nullptr);
unsetenv("XORG_GTEST_USE_VALGRIND");
ASSERT_EQ(p.GetState(), Process::RUNNING);
diff --git a/test/xserver-test.cpp b/test/xserver-test.cpp
index 5e24ae7..a7f4759 100644
--- a/test/xserver-test.cpp
+++ b/test/xserver-test.cpp
@@ -70,7 +70,7 @@ TEST(XServer, WaitForSIGUSR1)
server.Start();
ASSERT_EQ(server.GetState(), Process::RUNNING);
Display *dpy = XOpenDisplay(server.GetDisplayString().c_str());
- ASSERT_TRUE(dpy != NULL);
+ ASSERT_TRUE(dpy != nullptr);
XCloseDisplay(dpy);
server.Terminate(500);
}
@@ -111,7 +111,7 @@ TEST(XServer, WaitForDeviceEventMask)
server.Start();
ASSERT_EQ(server.GetState(), Process::RUNNING);
::Display *dpy = XOpenDisplay(server.GetDisplayString().c_str());
- ASSERT_TRUE(dpy != NULL);
+ ASSERT_TRUE(dpy != nullptr);
int major = 2, minor = 0;
XIQueryVersion(dpy, &major, &minor);
@@ -174,7 +174,7 @@ TEST(XServer, WaitForExistingDevice)
server.Start();
ASSERT_EQ(server.GetState(), Process::RUNNING);
::Display *dpy = XOpenDisplay(server.GetDisplayString().c_str());
- ASSERT_TRUE(dpy != NULL);
+ ASSERT_TRUE(dpy != nullptr);
ASSERT_TRUE(XServer::WaitForDevice(dpy, "PIXART USB OPTICAL MOUSE", 1000));
}
@@ -190,7 +190,7 @@ TEST(XServer, WaitForNewDevice)
server.Start();
ASSERT_EQ(server.GetState(), Process::RUNNING);
::Display *dpy = XOpenDisplay(server.GetDisplayString().c_str());
- ASSERT_TRUE(dpy != NULL);
+ ASSERT_TRUE(dpy != nullptr);
xorg::testing::evemu::Device d(TEST_ROOT_DIR "PIXART-USB-OPTICAL-MOUSE.desc");
@@ -208,7 +208,7 @@ TEST(XServer, IOErrorException)
server.Start();
ASSERT_EQ(server.GetState(), Process::RUNNING);
::Display *dpy = XOpenDisplay(server.GetDisplayString().c_str());
- ASSERT_TRUE(dpy != NULL);
+ ASSERT_TRUE(dpy != nullptr);
close(ConnectionNumber(dpy));
XSync(dpy, False);
}, XIOError);
@@ -230,7 +230,7 @@ TEST(XServer, ErrorHandler)
server.Start();
ASSERT_EQ(server.GetState(), Process::RUNNING);
::Display *dpy = XOpenDisplay(server.GetDisplayString().c_str());
- ASSERT_TRUE(dpy != NULL);
+ ASSERT_TRUE(dpy != nullptr);
XColor color;
XQueryColor(dpy, 0, &color);
XSync(dpy, False);
@@ -273,7 +273,7 @@ TEST(XServer, NondefaultErrorHandler)
server.Start();
ASSERT_EQ(server.GetState(), Process::RUNNING);
::Display *dpy = XOpenDisplay(server.GetDisplayString().c_str());
- ASSERT_TRUE(dpy != NULL);
+ ASSERT_TRUE(dpy != nullptr);
XColor color;
XQueryColor(dpy, 0, &color);
XSync(dpy, False);
@@ -301,7 +301,7 @@ TEST(XServer, KeepAlive)
close(pipefd[0]);
ASSERT_EQ(setenv("XORG_GTEST_XSERVER_KEEPALIVE", "1", 1), 0);
- ASSERT_TRUE(getenv("XORG_GTEST_XSERVER_KEEPALIVE") != NULL);
+ ASSERT_TRUE(getenv("XORG_GTEST_XSERVER_KEEPALIVE") != nullptr);
XServer server;
server.SetOption("-logfile", LOGFILE_DIR "/Xorg-keepalive.log");
@@ -310,7 +310,7 @@ TEST(XServer, KeepAlive)
server.Start();
ASSERT_EQ(server.GetState(), Process::RUNNING);
::Display *dpy = XOpenDisplay(server.GetDisplayString().c_str());
- ASSERT_TRUE(dpy != NULL);
+ ASSERT_TRUE(dpy != nullptr);
server.Terminate();
ASSERT_EQ(server.GetState(), Process::RUNNING);
@@ -331,7 +331,7 @@ TEST(XServer, KeepAlive)
sigemptyset(&sig_mask);
sigaddset(&sig_mask, SIGCHLD);
struct timespec tv = { 1, 0 };
- sigprocmask(SIG_BLOCK, &sig_mask, NULL);
+ sigprocmask(SIG_BLOCK, &sig_mask, nullptr);
/* parent */
close(pipefd[1]);
@@ -341,7 +341,7 @@ TEST(XServer, KeepAlive)
close(pipefd[0]);
/* wait for forked child to die */
- ASSERT_EQ(sigtimedwait(&sig_mask, NULL, &tv), SIGCHLD);
+ ASSERT_EQ(sigtimedwait(&sig_mask, nullptr, &tv), SIGCHLD);
pid_t server_pid = atoi(buffer);