summaryrefslogtreecommitdiff
path: root/src/net/download.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-02 17:00:07 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-02 21:16:56 +0300
commitfb1709d774139b2173da6ee95770abaad23f726e (patch)
treea6e6530dd623de4f6719a190eb6d9f19da20f027 /src/net/download.cpp
parentf06505b08060ad0720653fdf21fcc306ca93eb13 (diff)
downloadmv-fb1709d774139b2173da6ee95770abaad23f726e.tar.gz
mv-fb1709d774139b2173da6ee95770abaad23f726e.tar.bz2
mv-fb1709d774139b2173da6ee95770abaad23f726e.tar.xz
mv-fb1709d774139b2173da6ee95770abaad23f726e.zip
Some fixes after coverity checks.
Diffstat (limited to 'src/net/download.cpp')
-rw-r--r--src/net/download.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 838038f7c..32625b181 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -68,6 +68,8 @@ Download::Download(void *ptr, const std::string &url,
mError[0] = 0;
mOptions.cancel = 0;
+ mOptions.memoryWrite = 0;
+ mOptions.checkAdler = true;
}
Download::~Download()
@@ -88,9 +90,16 @@ Download::~Download()
*/
unsigned long Download::fadler32(FILE *file)
{
+ if (!file)
+ return 0;
+
// Obtain file size
fseek(file, 0, SEEK_END);
long fileSize = ftell(file);
+ if (fileSize < 0)
+ { // file size error
+ return 0;
+ }
rewind(file);
// Calculate Adler-32 checksum