diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-07-13 22:44:23 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-07-13 22:44:23 +0000 |
commit | 4ecc89dcc6516b10c6dab8b79dcaa435ec9e1435 (patch) | |
tree | af49a9d05531e9cf9c87b6ad543338c2d68de4ee /src/gui/updatewindow.cpp | |
parent | 1ae9c54d120338e4165d168c72ef16eb7f76ac18 (diff) | |
download | mana-4ecc89dcc6516b10c6dab8b79dcaa435ec9e1435.tar.gz mana-4ecc89dcc6516b10c6dab8b79dcaa435ec9e1435.tar.bz2 mana-4ecc89dcc6516b10c6dab8b79dcaa435ec9e1435.tar.xz mana-4ecc89dcc6516b10c6dab8b79dcaa435ec9e1435.zip |
* Committing some cleanups by Doener
* Fixed some compiler warnings
* Restored a USE_OPENGL check around OpenGL headers
* Fixed error about FALSE not being defined
* Fixed issue with font to become speechFont when the latter is not installed
Diffstat (limited to 'src/gui/updatewindow.cpp')
-rw-r--r-- | src/gui/updatewindow.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 7ad9b175..15c7afb3 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -117,14 +117,17 @@ int updateProgress(void *ptr, labelString << (char *)ptr << " (" << (int)(progress*100) << "%)"; updaterWindow->setLabel(labelString.str()); updaterWindow->setProgress(progress); - if(state!=UPDATE) { + + if (state != UPDATE) { // If the action was canceled return an error code to stop the thread return -1; } + return 0; } -int downloadThread(void *ptr) { +int downloadThread(void *ptr) +{ CURL *curl; CURLcode res; FILE *outfile; @@ -134,7 +137,7 @@ int downloadThread(void *ptr) { logger->log("Downloading: %s", url.c_str()); curl = curl_easy_init(); - if(curl) + if (curl) { downloadComplete = false; progress = 0.0f; @@ -142,7 +145,7 @@ int downloadThread(void *ptr) { outfile = fopen(fileName.c_str(), "wb"); curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile); - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, updateProgress); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, ptr); @@ -152,17 +155,23 @@ int downloadThread(void *ptr) { curl_easy_cleanup(curl); downloadComplete = true; } + + return 0; } -int download(std::string url) { +int download(std::string url) +{ thread = SDL_CreateThread(downloadThread, (void *)url.c_str()); - if ( thread == NULL ) { + + if (thread == NULL) { logger->log("Unable to create thread"); - return 0; } + + return 0; } -void updateData() { +void updateData() +{ updaterWindow = new UpdaterWindow(); state = UPDATE; |