Fixed progress callback for curl (incorrect parameter declaration).

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7216 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-01-03 03:21:14 +00:00
parent 73a771632b
commit e98f95697c
2 changed files with 10 additions and 7 deletions

View File

@ -308,8 +308,8 @@ void NetworkHttp::downloadFileAsynchron(const std::string &file,
* \param upload_now How muc has been uploaded so far. * \param upload_now How muc has been uploaded so far.
*/ */
int NetworkHttp::progressDownload(void *clientp, int NetworkHttp::progressDownload(void *clientp,
float download_total, float download_now, double download_total, double download_now,
float upload_total, float upload_now) double upload_total, double upload_now)
{ {
float f; float f;
if(download_now < download_total) if(download_now < download_total)
@ -319,8 +319,12 @@ int NetworkHttp::progressDownload(void *clientp,
// 1.0 is only reached when downloadFileInternal is finished // 1.0 is only reached when downloadFileInternal is finished
if (f>=1.0f) f=0.99f; if (f>=1.0f) f=0.99f;
} }
else else
f=1.0f; {
// Don't set progress to 1.0f; this is done in loadFileInternal
// after checking curls return code!
f= download_total==0 ? 0 : 0.99f;
}
network_http->m_progress.set(f); network_http->m_progress.set(f);
static int time_last_print=0; static int time_last_print=0;

View File

@ -76,9 +76,8 @@ private:
bool downloadFileInternal(const std::string &file, bool downloadFileInternal(const std::string &file,
const std::string &save_filename, const std::string &save_filename,
bool is_asynchron); bool is_asynchron);
static int progressDownload(void *clientp, float dltotal, float dlnow, static int progressDownload(void *clientp, double dltotal, double dlnow,
float ultotal, float ulnow); double ultotal, double ulnow);
public: public:
NetworkHttp(); NetworkHttp();
~NetworkHttp(); ~NetworkHttp();