Fix divelogs.de upload error

The order of arguments to fread was incorrect.
In case of arguments "streamsize, 1" the returning value is 1, and
hence due to membuf[streamsize] = 0; line, membuf ends up being one
character long.
Fixed it by exchanging arguments to "1, streamsize". This way,
streamsize has the correct value.

Fixes #483

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Acked-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Venkatesh Shukla 2014-04-05 21:29:34 +05:30 committed by Dirk Hohndel
parent ecc8c1d995
commit 62e4c4069b

View file

@ -159,7 +159,7 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile,
rewind(f);
membuf = (char *)malloc(streamsize + 1);
if (!membuf || (streamsize = fread(membuf, streamsize, 1, f)) == 0) {
if (!membuf || (streamsize = fread(membuf, 1, streamsize, f)) == 0) {
report_error(tr("internal error: %s").toUtf8(), qt_error_string().toUtf8().data());
fclose(f);
free((void *)membuf);