From: molivier Date: Fri, 4 Jan 2008 23:13:27 +0000 (+0000) Subject: Moved initializations of the pixel_size and attributes fields in the TGA header ealie... X-Git-Tag: xonotic-v0.1.0preview~2594 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=470a2e97832e4f1d3b87580cd0ab76d691a74f4c;p=xonotic%2Fdarkplaces.git Moved initializations of the pixel_size and attributes fields in the TGA header ealier, so they would be properly set before the call to PrintTargaHeader() git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7904 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/image.c b/image.c index 71cacb6e..2146a647 100644 --- a/image.c +++ b/image.c @@ -327,14 +327,15 @@ unsigned char *LoadTGA_BGRA (const unsigned char *f, int filesize) targa_header.y_origin = f[10] + f[11] * 256; targa_header.width = image_width = f[12] + f[13] * 256; targa_header.height = image_height = f[14] + f[15] * 256; + targa_header.pixel_size = f[16]; + targa_header.attributes = f[17]; + if (image_width > 4096 || image_height > 4096 || image_width <= 0 || image_height <= 0) { Con_Print("LoadTGA: invalid size\n"); PrintTargaHeader(&targa_header); return NULL; } - targa_header.pixel_size = f[16]; - targa_header.attributes = f[17]; // advance to end of header fin = f + 18;