[quake3-commits] r2072 - trunk/code/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Jul 11 20:34:25 EDT 2011


Author: thilo
Date: 2011-07-11 20:34:25 -0400 (Mon, 11 Jul 2011)
New Revision: 2072

Modified:
   trunk/code/client/cl_parse.c
Log:
Permit downloading files larger than 65 Megabytes via UDP by working around short int wraparound.


Modified: trunk/code/client/cl_parse.c
===================================================================
--- trunk/code/client/cl_parse.c	2011-07-08 13:09:59 UTC (rev 2071)
+++ trunk/code/client/cl_parse.c	2011-07-12 00:34:25 UTC (rev 2072)
@@ -560,7 +560,7 @@
 void CL_ParseDownload ( msg_t *msg ) {
 	int		size;
 	unsigned char data[MAX_MSGLEN];
-	int block;
+	uint16_t block;
 
 	if (!*clc.downloadTempName) {
 		Com_Printf("Server sending download, but no download was requested\n");
@@ -571,7 +571,7 @@
 	// read the data
 	block = MSG_ReadShort ( msg );
 
-	if ( !block )
+	if(!block && !clc.downloadBlock)
 	{
 		// block zero is special, contains file size
 		clc.downloadSize = MSG_ReadLong ( msg );
@@ -594,8 +594,9 @@
 	
 	MSG_ReadData(msg, data, size);
 
-	if (clc.downloadBlock != block) {
-		Com_DPrintf( "CL_ParseDownload: Expected block %d, got %d\n", clc.downloadBlock, block);
+	if((clc.downloadBlock & 0xFFFF) != block)
+	{
+		Com_DPrintf( "CL_ParseDownload: Expected block %d, got %d\n", (clc.downloadBlock & 0xFFFF), block);
 		return;
 	}
 



More information about the quake3-commits mailing list