aboutsummaryrefslogtreecommitdiffstats
path: root/unix/vncpasswd/vncpasswd.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2024-04-02 16:13:23 +0200
committerPierre Ossman <ossman@cendio.se>2024-06-24 13:42:54 +0200
commit139f0e8a4b81fe3dcd9476ec5ee16ea5e74af901 (patch)
tree8d06ede9e14516516a44c5ed710058003088eec2 /unix/vncpasswd/vncpasswd.cxx
parent45198e5235f4b724277665b242cf855a0ff4518b (diff)
downloadtigervnc-139f0e8a4b81fe3dcd9476ec5ee16ea5e74af901.tar.gz
tigervnc-139f0e8a4b81fe3dcd9476ec5ee16ea5e74af901.zip
Use nullptr in all C++ code
It's more readable than 0, and a bit safer than NULL, so let's try to follow modern norms.
Diffstat (limited to 'unix/vncpasswd/vncpasswd.cxx')
-rw-r--r--unix/vncpasswd/vncpasswd.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/unix/vncpasswd/vncpasswd.cxx b/unix/vncpasswd/vncpasswd.cxx
index 30091a3d..877ebcbd 100644
--- a/unix/vncpasswd/vncpasswd.cxx
+++ b/unix/vncpasswd/vncpasswd.cxx
@@ -72,7 +72,7 @@ static const char* getpassword(const char* prompt) {
result[strlen(result)-1] = 0;
return buf;
}
- return 0;
+ return nullptr;
}
// Reads passwords from stdin and prints encrypted passwords to stdout.
@@ -81,7 +81,7 @@ static int encrypt_pipe() {
// We support a maximum of two passwords right now
for (i = 0;i < 2;i++) {
- const char *result = getpassword(NULL);
+ const char *result = getpassword(nullptr);
if (!result)
break;
@@ -102,7 +102,7 @@ static int encrypt_pipe() {
static std::vector<uint8_t> readpassword() {
while (true) {
const char *passwd = getpassword("Password:");
- if (passwd == NULL) {
+ if (passwd == nullptr) {
perror("getpassword error");
exit(1);
}
@@ -117,7 +117,7 @@ static std::vector<uint8_t> readpassword() {
}
passwd = getpassword("Verify:");
- if (passwd == NULL) {
+ if (passwd == nullptr) {
perror("getpass error");
exit(1);
}
@@ -158,7 +158,7 @@ int main(int argc, char** argv)
if (fname[0] == '\0') {
const char *configDir = os::getvncconfigdir();
- if (configDir == NULL) {
+ if (configDir == nullptr) {
fprintf(stderr, "Can't obtain VNC config directory\n");
exit(1);
}
@@ -175,7 +175,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Would you like to enter a view-only password (y/n)? ");
char yesno[3];
- if (fgets(yesno, 3, stdin) != NULL && (yesno[0] == 'y' || yesno[0] == 'Y')) {
+ if (fgets(yesno, 3, stdin) != nullptr && (yesno[0] == 'y' || yesno[0] == 'Y')) {
obfuscatedReadOnly = readpassword();
} else {
fprintf(stderr, "A view-only password is not used\n");