mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-08 16:33:22 +01:00
Fixed segmentation fault on startup on 32 bit platforms.
Fixed downloading files > 2GB on 32 bit systems.
This commit is contained in:
parent
9fbf791a78
commit
7e8f707846
@ -99,9 +99,9 @@ class Downloader
|
|||||||
void saveSerials(const std::string& serials, const std::string& filepath);
|
void saveSerials(const std::string& serials, const std::string& filepath);
|
||||||
|
|
||||||
static int progressCallback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
static int progressCallback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||||
static uintmax_t writeMemoryCallback(char *ptr, uintmax_t size, uintmax_t nmemb, void *userp);
|
static size_t writeMemoryCallback(char *ptr, size_t size, size_t nmemb, void *userp);
|
||||||
static uintmax_t writeData(void *ptr, uintmax_t size, uintmax_t nmemb, FILE *stream);
|
static size_t writeData(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||||
static uintmax_t readData(void *ptr, uintmax_t size, uintmax_t nmemb, FILE *stream);
|
static size_t readData(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||||
|
|
||||||
|
|
||||||
API *gogAPI;
|
API *gogAPI;
|
||||||
@ -109,7 +109,7 @@ class Downloader
|
|||||||
std::vector<gameDetails> games;
|
std::vector<gameDetails> games;
|
||||||
std::string coverXML;
|
std::string coverXML;
|
||||||
|
|
||||||
uintmax_t resume_position;
|
off_t resume_position;
|
||||||
int retries;
|
int retries;
|
||||||
std::ofstream report_ofs;
|
std::ofstream report_ofs;
|
||||||
};
|
};
|
||||||
|
@ -1158,7 +1158,7 @@ CURLcode Downloader::downloadFile(const std::string& url, const std::string& fil
|
|||||||
CURLcode res = CURLE_RECV_ERROR; // assume network error
|
CURLcode res = CURLE_RECV_ERROR; // assume network error
|
||||||
bool bResume = false;
|
bool bResume = false;
|
||||||
FILE *outfile;
|
FILE *outfile;
|
||||||
uintmax_t offset=0;
|
off_t offset=0;
|
||||||
|
|
||||||
// Get directory from filepath
|
// Get directory from filepath
|
||||||
boost::filesystem::path pathname = filepath;
|
boost::filesystem::path pathname = filepath;
|
||||||
@ -1225,7 +1225,7 @@ CURLcode Downloader::downloadFile(const std::string& url, const std::string& fil
|
|||||||
{
|
{
|
||||||
bResume = true;
|
bResume = true;
|
||||||
fseek(outfile, 0, SEEK_END);
|
fseek(outfile, 0, SEEK_END);
|
||||||
offset = ftell(outfile);
|
offset = ftello(outfile);
|
||||||
curl_easy_setopt(curlhandle, CURLOPT_RESUME_FROM_LARGE, offset);
|
curl_easy_setopt(curlhandle, CURLOPT_RESUME_FROM_LARGE, offset);
|
||||||
this->resume_position = offset;
|
this->resume_position = offset;
|
||||||
}
|
}
|
||||||
@ -1870,19 +1870,19 @@ int Downloader::progressCallback(void *clientp, double dltotal, double dlnow, do
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uintmax_t Downloader::writeMemoryCallback(char *ptr, uintmax_t size, uintmax_t nmemb, void *userp) {
|
size_t Downloader::writeMemoryCallback(char *ptr, size_t size, size_t nmemb, void *userp) {
|
||||||
std::ostringstream *stream = (std::ostringstream*)userp;
|
std::ostringstream *stream = (std::ostringstream*)userp;
|
||||||
uintmax_t count = size * nmemb;
|
size_t count = size * nmemb;
|
||||||
stream->write(ptr, count);
|
stream->write(ptr, count);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
uintmax_t Downloader::writeData(void *ptr, uintmax_t size, uintmax_t nmemb, FILE *stream)
|
size_t Downloader::writeData(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||||
{
|
{
|
||||||
return fwrite(ptr, size, nmemb, stream);
|
return fwrite(ptr, size, nmemb, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
uintmax_t Downloader::readData(void *ptr, uintmax_t size, uintmax_t nmemb, FILE *stream)
|
size_t Downloader::readData(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||||
{
|
{
|
||||||
return fread(ptr, size, nmemb, stream);
|
return fread(ptr, size, nmemb, stream);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user