diff --git a/archive/gzip/reader.go b/archive/gzip/reader.go index e70293aa..ad7f09d8 100644 --- a/archive/gzip/reader.go +++ b/archive/gzip/reader.go @@ -35,17 +35,10 @@ import ( ) func GetFile(src io.ReadSeeker, dst io.WriteSeeker) errors.Error { - var siz = getGunZipSize(src) - - if d, k := dst.(libfpg.Progress); k && siz > 0 { - d.Reset(siz) - } - if _, e := src.Seek(0, io.SeekStart); e != nil { return ErrorFileSeek.Error(e) } else if _, e = dst.Seek(0, io.SeekStart); e != nil { return ErrorFileSeek.Error(e) - } else if siz > 0 { } r, e := gz.NewReader(src) @@ -68,7 +61,7 @@ func GetFile(src io.ReadSeeker, dst io.WriteSeeker) errors.Error { } } -func getGunZipSize(src io.ReadSeeker) int64 { +func GetGunZipSize(src io.ReadSeeker) int64 { if _, e := src.Seek(0, io.SeekStart); e != nil { return 0 } diff --git a/file/progress/progress.go b/file/progress/progress.go index d95fc9ff..b4f506f8 100644 --- a/file/progress/progress.go +++ b/file/progress/progress.go @@ -32,14 +32,26 @@ import ( ) func (o *progress) RegisterFctIncrement(fct FctIncrement) { + if fct == nil { + fct = func(size int64) {} + } + o.fi.Store(fct) } func (o *progress) RegisterFctReset(fct FctReset) { + if fct == nil { + fct = func(size, current int64) {} + } + o.fr.Store(fct) } func (o *progress) RegisterFctEOF(fct FctEOF) { + if fct == nil { + fct = func() {} + } + o.fe.Store(fct) }