Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Core: GZCompress fixes (thanks zsolt)
git-svn-id: svn://ultimatepp.org/upp/trunk@13743 f0d560ea-af0d-0410-9eb7-867de7ffcac7
  • Loading branch information
cxl committed Dec 8, 2019
1 parent 815972a commit e1321e5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions uppsrc/Core/z.cpp
Expand Up @@ -427,7 +427,7 @@ bool GZCompressFile(const char *dstfile, const char *srcfile, Gate<int64, int64>
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();
Expand All @@ -446,7 +446,7 @@ bool GZDecompressFile(const char *dstfile, const char *srcfile, Gate<int64, int6
FileOut out(dstfile);
if(!out)
return false;
if(GZDecompress(out, in, (int)in.GetLeft(), progress) < 0)
if(GZDecompress(out, in, in.GetLeft(), progress) < 0)
return false;
out.Close();
return !out.IsError();
Expand All @@ -468,7 +468,13 @@ bool GZDecompressFile(const char *srcfile, Gate<int64, int64>progress)
Gate<int64, int64> AsGate64(Gate<int, int> gate)
{
Gate<int64, int64> 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;
}

Expand Down

0 comments on commit e1321e5

Please sign in to comment.