diff --git a/coders/jp2.c b/coders/jp2.c
index 56cf3d0..b3f2d27 100644
--- a/coders/jp2.c
+++ b/coders/jp2.c
@@ -238,7 +238,7 @@
   image=(Image *) context;
   count=ReadBlob(image,(ssize_t) length,(unsigned char *) buffer);
   if (count == 0)
-    return(-1);
+    return((OPJ_SIZE_T) -1);
   return((OPJ_SIZE_T) count);
 }