diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-26 16:07:54 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-26 16:07:54 +0100 |
commit | 5afe88df2538274859a162ffd63ed52118e80c19 (patch) | |
tree | b610dfd58dc748fd63f49565b2a43eea2316714f /src/net/download.cpp | |
parent | 73ba2a95f5bd4a0dd09af52d5864800be2b0a4c6 (diff) | |
download | mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.gz mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.bz2 mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.xz mana-5afe88df2538274859a162ffd63ed52118e80c19.zip |
Apply C++11 fixits
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
Diffstat (limited to 'src/net/download.cpp')
-rw-r--r-- | src/net/download.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
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<Download*>(clientp); + auto *d = reinterpret_cast<Download*>(clientp); if (d->mOptions.cancel) { @@ -174,7 +174,7 @@ int Download::downloadThread(void *ptr) { int attempts = 0; bool complete = false; - Download *d = reinterpret_cast<Download*>(ptr); + auto *d = reinterpret_cast<Download*>(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; } |