From 5afe88df2538274859a162ffd63ed52118e80c19 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 26 Jan 2024 16:07:54 +0100 Subject: Apply C++11 fixits modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using --- src/net/download.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/net/download.cpp') diff --git a/src/net/download.cpp b/src/net/download.cpp index 61cdf114..d15eb18d 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -66,11 +66,11 @@ Download::Download(void *ptr, const std::string &url, mPtr(ptr), mUrl(url), mFileName(""), - mWriteFunction(NULL), + mWriteFunction(nullptr), mUpdateFunction(updateFunction), - mThread(NULL), - mCurl(NULL), - mHeaders(NULL) + mThread(nullptr), + mCurl(nullptr), + mHeaders(nullptr) { mError = (char*) malloc(CURL_ERROR_SIZE); @@ -145,8 +145,8 @@ void Download::cancel() mOptions.cancel = true; if (mThread && SDL_GetThreadID(mThread) != 0) { - SDL_WaitThread(mThread, NULL); - mThread = NULL; + SDL_WaitThread(mThread, nullptr); + mThread = nullptr; } } @@ -158,7 +158,7 @@ char *Download::getError() int Download::downloadProgress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) { - Download *d = reinterpret_cast(clientp); + auto *d = reinterpret_cast(clientp); if (d->mOptions.cancel) { @@ -174,7 +174,7 @@ int Download::downloadThread(void *ptr) { int attempts = 0; bool complete = false; - Download *d = reinterpret_cast(ptr); + auto *d = reinterpret_cast(ptr); CURLcode res; std::string outFilename; @@ -189,13 +189,13 @@ int Download::downloadThread(void *ptr) while (attempts < 3 && !complete && !d->mOptions.cancel) { - FILE *file = NULL; + FILE *file = nullptr; d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_STARTING, 0, 0); if (d->mOptions.cancel) { - d->mThread = NULL; + d->mThread = nullptr; return 0; } @@ -309,7 +309,7 @@ int Download::downloadThread(void *ptr) } if (d->mOptions.cancel) { - d->mThread = NULL; + d->mThread = nullptr; return 0; } attempts++; @@ -328,7 +328,7 @@ int Download::downloadThread(void *ptr) d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_COMPLETE, 0, 0); } - d->mThread = NULL; + d->mThread = nullptr; return 0; } -- cgit v1.2.3-70-g09d2