Commits

Fredrik Lundh committed 6cfb688

Fixed some minor lint issues.

Comments (0)

Files changed (1)

libImaging/UnsharpMask.c

        properly. */
 
     remainder = floatRadius - ((int) floatRadius);
-    floatRadius = (int) (floatRadius + 0.999999);
+    floatRadius = ceil(floatRadius);
 
     /* Next, double the radius and offset by 2.0... that way "0" returns
        the original image instead of a black one.  We multiply it by 2.0
        memset the buffer to 0 so we can use it directly with += */
 
     /* don't bother about alpha/padding */
-    buffer = calloc(im->xsize * im->ysize * channels, sizeof(float));
+    buffer = calloc((size_t) (im->xsize * im->ysize * channels),
+		    sizeof(float));
     if (buffer == NULL)
 	return ImagingError_MemoryError();
 
 	       newPixel, so it gets put in imOut */
 	    if (strcmp(im->mode, "RGBX") == 0
 		|| strcmp(im->mode, "RGBA") == 0) {
-		newPixel[3] = ((UINT8 *) & line[x + offset])[3];
+	      newPixel[3] = (float) ((UINT8 *) & line[x + offset])[3];
 	    }
 
 	    /* pack the channels into an INT32 so we can put them back in
     } else if (strcmp(im->mode, "L") == 0) {
 	channels = 1;
 	padding = 0;
-    } else {
-	ImagingError_ModeError();
-	return NULL;
-    }
+    } else
+	return ImagingError_ModeError();
 
     return gblur(im, imOut, radius, channels, padding);
 }
     } else if (strcmp(im->mode, "L") == 0) {
 	channels = 1;
 	padding = 0;
-    } else {
-	ImagingError_ModeError();
-	return NULL;
-    }
+    } else
+	return ImagingError_ModeError();
 
     /* first, do a gaussian blur on the image, putting results in imOut
        temporarily */
 
 	    else {
 		for (channel = 0; channel < channels; channel++) {
-		    diff =
-			(float) ((((UINT8 *) & lineIn[x])[channel]) -
-				 (((UINT8 *) & lineOut[x])[channel]));
+		    diff = (int) ((((UINT8 *) & lineIn[x])[channel]) -
+				  (((UINT8 *) & lineOut[x])[channel]));
 		    if (abs(diff) > threshold) {
 			/* add the diff*percent to the original pixel
 			   this may not work for little-endian systems, fix it! */