mirror of
https://github.com/rehlds/rehlds.git
synced 2025-02-27 14:01:18 +03:00
Netchan_CreateFileFragments: Fixed a very old and rare bug with dlfile while downloading direct from server, when content of resource size is less than header size first fragment
This commit is contained in:
parent
e9045e3b63
commit
d76b06dcc2
@ -1158,7 +1158,10 @@ void Netchan_CreateFileFragmentsFromBuffer(qboolean server, netchan_t *chan, con
|
||||
MSG_WriteString(&buf->frag_message, filename);
|
||||
MSG_WriteString(&buf->frag_message, bCompressed ? "bz2" : "uncompressed");
|
||||
MSG_WriteLong(&buf->frag_message, uncompressed_size);
|
||||
send -= buf->frag_message.cursize;
|
||||
|
||||
// Check if we aren't send more than we should
|
||||
if ((chunksize - send) < buf->frag_message.cursize)
|
||||
send -= buf->frag_message.cursize;
|
||||
}
|
||||
|
||||
buf->isbuffer = TRUE;
|
||||
@ -1321,7 +1324,7 @@ int Netchan_CreateFileFragments_(qboolean server, netchan_t *chan, const char *f
|
||||
remaining = filesize;
|
||||
pos = 0;
|
||||
|
||||
while (remaining)
|
||||
while (remaining > 0)
|
||||
{
|
||||
send = min(chunksize, remaining);
|
||||
buf = Netchan_AllocFragbuf();
|
||||
@ -1353,7 +1356,10 @@ int Netchan_CreateFileFragments_(qboolean server, netchan_t *chan, const char *f
|
||||
MSG_WriteString(&buf->frag_message, filename);
|
||||
MSG_WriteString(&buf->frag_message, bCompressed ? "bz2" : "uncompressed");
|
||||
MSG_WriteLong(&buf->frag_message, uncompressed_size);
|
||||
send -= buf->frag_message.cursize;
|
||||
|
||||
// Check if we aren't send more than we should
|
||||
if ((chunksize - send) < buf->frag_message.cursize)
|
||||
send -= buf->frag_message.cursize;
|
||||
}
|
||||
buf->isfile = TRUE;
|
||||
buf->iscompressed = bCompressed;
|
||||
|
Loading…
x
Reference in New Issue
Block a user