Source

gd-libgd / src / gd_io.c

Diff from to

src/gd_io.c

 
 int gdGetWordLSB(signed short int *result, gdIOCtx *ctx)
 {
-	int high = 0, low = 0;
-
-	low = (ctx->getC)(ctx);
-	if(low == EOF) {
-		return 0;
+	unsigned int high = 0, low = 0;
+	low = (ctx->getC) (ctx);
+	if (low == EOF) {
+ 		return 0;
 	}
 
-	high = (ctx->getC)(ctx);
-	if(high == EOF) {
-		return 0;
+	high = (ctx->getC) (ctx);
+	if (high == EOF) {
+ 		return 0;
 	}
 
-	if(result) {
+	if (result) {
 		*result = (high << 8) | low;
 	}
 
 
 int gdGetIntLSB(signed int *result, gdIOCtx *ctx)
 {
-	int c = 0, r = 0;
+	int c = 0;
+	unsigned int r = 0;
 
-	c = (ctx->getC)(ctx);
-	if(c == EOF) {
-		return 0;
+	c = (ctx->getC) (ctx);
+	if (c == EOF) {
+ 		return 0;
 	}
-
 	r |= (c << 24);
 	r >>= 8;
 
-	c = (ctx->getC)(ctx);
-	if(c == EOF) {
-		return 0;
+	c = (ctx->getC) (ctx);
+	if (c == EOF) {
+ 		return 0;
 	}
-
 	r |= (c << 24);
 	r >>= 8;
 
-	c = (ctx->getC)(ctx);
-	if(c == EOF) {
-		return 0;
+	c = (ctx->getC) (ctx);
+	if (c == EOF) {
+ 		return 0;
 	}
-
 	r |= (c << 24);
 	r >>= 8;
 
-	c = (ctx->getC)(ctx);
-	if(c == EOF) {
-		return 0;
+	c = (ctx->getC) (ctx);
+	if (c == EOF) {
+ 		return 0;
 	}
-
 	r |= (c << 24);
 
-	if(result) {
-		*result = r;
+	if (result) {
+		*result = (signed int)r;
 	}
 
 	return 1;