diff --git a/uppsrc/Core/z.cpp b/uppsrc/Core/z.cpp index 24db8ecb1..73f058221 100644 --- a/uppsrc/Core/z.cpp +++ b/uppsrc/Core/z.cpp @@ -427,7 +427,7 @@ bool GZCompressFile(const char *dstfile, const char *srcfile, Gate FileOut out(dstfile); if(!out) return false; - if(GZCompress(out, in, (int)in.GetLeft(), progress) < 0) + if(GZCompress(out, in, in.GetLeft(), progress) < 0) return false; out.Close(); return !out.IsError(); @@ -446,7 +446,7 @@ bool GZDecompressFile(const char *dstfile, const char *srcfile, Gateprogress) Gate AsGate64(Gate gate) { Gate h; - h << [=](int64 a, int64 b) { return gate((int)a, (int)b); }; + h << [=](int64 a, int64 b) { + if(b > ((int64)INT_MAX << 10)) + return gate((int)(a>>32), (int)(b>>32)); + if(b > INT_MAX) + return gate((int)(a>>22), (int)(b>>22)); + return gate((int)a, (int)b); + }; return h; }