Commits

Ondřej Surý committed 9336856

Use standard int types in gd_tga.* instead of using 'byte' defined as int

Comments (0)

Files changed (2)

 {
 	int pixel_block_size = (tga->bits / 8);
 	int image_block_size = (tga->width * tga->height) * pixel_block_size;
-	byte* decompression_buffer = NULL;
+	uint8_t* decompression_buffer = NULL;
 	unsigned char* conversion_buffer = NULL;
 	int buffer_caret = 0;
 	int bitmap_caret = 0;
 	int i = 0;
 	int j = 0;
-	byte encoded_pixels;
+	uint8_t encoded_pixels;
 
 	if(overflow2(tga->width, tga->height)) {
 		return -1;
 		return -1;
 	}
 
-	if(overflow2(image_block_size, sizeof(byte))) {
+	if(overflow2(image_block_size, sizeof(uint8_t))) {
 		return -1;
 	}
 
 	/*!	\brief Allocate memmory for image block
 	 *  Allocate a chunk of memory for the image block to be passed into.
 	 */
-	tga->bitmap = (int *) gdMalloc(image_block_size * sizeof(byte));
+	tga->bitmap = (int *) gdMalloc(image_block_size * sizeof(uint8_t));
 	if (tga->bitmap == NULL) {
 		return -1;
 	}
 	 *  Chunk load the pixel data from an RLE compressed RGB type TGA.
 	 */
 	if (tga->imagetype == TGA_TYPE_RGB_RLE) {
-		decompression_buffer = (byte*) gdMalloc(image_block_size * sizeof(byte));
+		decompression_buffer = (uint8_t*) gdMalloc(image_block_size * sizeof(uint8_t));
 		if (decompression_buffer == NULL) {
 			gdFree( decompression_buffer );
 			return -1;
 #include "config.h"
 #endif
 
-#include "gd.h"
-#include "gdhelpers.h"
-
-#ifndef BGDWIN32
-#ifndef O_BYTE
-#define O_BYTE	1
-typedef int byte;
+#if HAVE_STDINT_H
+#include <stdint.h>
+#else
+#include "msinttypes/stdint.h"
 #endif
+#if  HAVE_INTTYPES_H
+#include <inttypes.h>
+#else
+#include "msinttypes/inttypes.h"
 #endif
 
-#ifndef O_SHORT_INT
-#define O_SHORT_INT	1
-typedef int short_int;
-#endif
+#include "gd.h"
+#include "gdhelpers.h"
 
 typedef struct oTga_ {
-	byte  identsize;	// size of ID field that follows 18 byte header (0 usually)
-	byte  colormaptype;	// type of colour map 0=none, 1=has palette					[IGNORED] Adrian requested no support
-	byte  imagetype;	// type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
+	uint8_t  identsize;	// size of ID field that follows 18 uint8_t header (0 usually)
+	uint8_t  colormaptype;	// type of colour map 0=none, 1=has palette					[IGNORED] Adrian requested no support
+	uint8_t  imagetype;	// type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
 
 	int colormapstart;	// first colour map entry in palette						[IGNORED] Adrian requested no support
 	int colormaplength;	// number of colours in palette								[IGNORED] Adrian requested no support
-	byte  colormapbits;	// number of bits per palette entry 15,16,24,32				[IGNORED] Adrian requested no support
+	uint8_t  colormapbits;	// number of bits per palette entry 15,16,24,32				[IGNORED] Adrian requested no support
 
 	int xstart;			// image x origin
 	int ystart;			// image y origin
 	int width;			// image width in pixels
 	int height;			// image height in pixels
-	byte  bits;			// image bits per pixel 8,16,24,32
-	byte alphabits;		// alpha bits (low 4bits of header 17)
-	byte fliph;			// horizontal or vertical
-	byte flipv;			// flip
+	uint8_t  bits;			// image bits per pixel 8,16,24,32
+	uint8_t alphabits;		// alpha bits (low 4bits of header 17)
+	uint8_t fliph;			// horizontal or vertical
+	uint8_t flipv;			// flip
 	char *ident;		// identifcation tag string
 	int *bitmap;		// bitmap data
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.