--- zopfli-zopfli-1.0.2/src/zopfli/deflate.c.orig	2018-08-15 06:14:22.925696200 -0400
+++ zopfli-zopfli-1.0.2/src/zopfli/deflate.c	2018-08-15 06:20:54.096191800 -0400
@@ -431,10 +431,17 @@ Changes the population counts in a way t
 compression, especially its rle-part, will be more likely to compress this data
 more efficiently. length contains the size of the histogram.
 */
+#ifdef _WIN32
+void OptimizeHuffmanForRle(size_t length, size_t* counts) {
+  int i, k, stride;
+  size_t symbol, sum, limit;
+  size_t* good_for_rle;
+#else
 void OptimizeHuffmanForRle(int length, size_t* counts) {
   int i, k, stride;
   size_t symbol, sum, limit;
   int* good_for_rle;
+#endif
 
   /* 1) We don't want to touch the trailing zeros. We may break the
   rules of the format by adding more data in the distance codes. */
@@ -449,7 +456,11 @@ void OptimizeHuffmanForRle(int length, s
   }
   /* 2) Let's mark all population counts that already can be encoded
   with an rle code.*/
+#ifdef _WIN32
+  good_for_rle = (size_t*)malloc((unsigned)length * sizeof(size_t));
+#else
   good_for_rle = (int*)malloc((unsigned)length * sizeof(int));
+#endif
   for (i = 0; i < length; ++i) good_for_rle[i] = 0;
 
   /* Let's not spoil any of the existing good rle codes.
