diff options
author | Pierre Ossman <ossman@cendio.se> | 2024-04-02 16:13:23 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-06-24 13:42:54 +0200 |
commit | 139f0e8a4b81fe3dcd9476ec5ee16ea5e74af901 (patch) | |
tree | 8d06ede9e14516516a44c5ed710058003088eec2 /common/rfb/Congestion.cxx | |
parent | 45198e5235f4b724277665b242cf855a0ff4518b (diff) | |
download | tigervnc-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 'common/rfb/Congestion.cxx')
-rw-r--r-- | common/rfb/Congestion.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/common/rfb/Congestion.cxx b/common/rfb/Congestion.cxx index 1e252165..94f07055 100644 --- a/common/rfb/Congestion.cxx +++ b/common/rfb/Congestion.cxx @@ -85,11 +85,11 @@ Congestion::Congestion() : baseRTT(-1), congWindow(INITIAL_WINDOW), inSlowStart(true), safeBaseRTT(-1), measurements(0), minRTT(-1), minCongestedRTT(-1) { - gettimeofday(&lastUpdate, NULL); - gettimeofday(&lastSent, NULL); + gettimeofday(&lastUpdate, nullptr); + gettimeofday(&lastSent, nullptr); memset(&lastPong, 0, sizeof(lastPong)); - gettimeofday(&lastPongArrival, NULL); - gettimeofday(&lastAdjustment, NULL); + gettimeofday(&lastPongArrival, nullptr); + gettimeofday(&lastAdjustment, nullptr); } Congestion::~Congestion() @@ -101,7 +101,7 @@ void Congestion::updatePosition(unsigned pos) struct timeval now; unsigned delta, consumed; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); delta = pos - lastPosition; if ((delta > 0) || (extraBuffer > 0)) @@ -121,7 +121,7 @@ void Congestion::updatePosition(unsigned pos) congWindow = __rfbmin(INITIAL_WINDOW, congWindow); baseRTT = -1; measurements = 0; - gettimeofday(&lastAdjustment, NULL); + gettimeofday(&lastAdjustment, nullptr); minRTT = minCongestedRTT = -1; inSlowStart = true; } @@ -149,7 +149,7 @@ void Congestion::sentPing() memset(&rttInfo, 0, sizeof(struct RTTInfo)); - gettimeofday(&rttInfo.tv, NULL); + gettimeofday(&rttInfo.tv, nullptr); rttInfo.pos = lastPosition; rttInfo.extra = getExtraBuffer(); rttInfo.congested = isCongested(); @@ -166,7 +166,7 @@ void Congestion::gotPong() if (pings.empty()) return; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); rttInfo = pings.front(); pings.pop_front(); @@ -320,7 +320,7 @@ void Congestion::debugTrace(const char* filename, int fd) #ifdef __linux__ FILE *f; f = fopen(filename, "ab"); - if (f != NULL) { + if (f != nullptr) { struct tcp_info info; int buffered; socklen_t len; @@ -329,7 +329,7 @@ void Congestion::debugTrace(const char* filename, int fd) TCP_INFO, &info, &len) == 0) && (ioctl(fd, SIOCOUTQ, &buffered) == 0)) { struct timeval now; - gettimeofday(&now, NULL); + gettimeofday(&now, nullptr); fprintf(f, "%u.%06u,%u,%u,%u,%u\n", (unsigned)now.tv_sec, (unsigned)now.tv_usec, congWindow, info.tcpi_snd_cwnd * info.tcpi_snd_mss, @@ -494,7 +494,7 @@ void Congestion::updateCongestion() #endif measurements = 0; - gettimeofday(&lastAdjustment, NULL); + gettimeofday(&lastAdjustment, nullptr); minRTT = minCongestedRTT = -1; } |