IT WORKS (again)
This commit is contained in:
@@ -28,6 +28,7 @@ func NewFullReader(r io.ReaderAt, start uint64, d decompress.Decompressor, block
|
||||
|
||||
func (r *FullReader) AddFragment(rdr func() (io.Reader, error)) {
|
||||
r.fragRdr = rdr
|
||||
r.sizes = append(r.sizes, 0)
|
||||
}
|
||||
|
||||
type outDat struct {
|
||||
|
||||
@@ -27,6 +27,7 @@ func NewReader(r io.Reader, d decompress.Decompressor, blockSizes []uint32, bloc
|
||||
|
||||
func (r *Reader) AddFragment(rdr io.Reader) {
|
||||
r.fragRdr = rdr
|
||||
r.blockSizes = append(r.blockSizes, 0)
|
||||
}
|
||||
|
||||
func realSize(siz uint32) uint32 {
|
||||
|
||||
+11
-5
@@ -2,7 +2,6 @@ package inode
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
)
|
||||
@@ -20,7 +19,7 @@ type File struct {
|
||||
}
|
||||
|
||||
type eFileInit struct {
|
||||
BlockStart uint32
|
||||
BlockStart uint64
|
||||
Size uint64
|
||||
Sparse uint64
|
||||
LinkCount uint32
|
||||
@@ -37,10 +36,13 @@ type EFile struct {
|
||||
func ReadFile(r io.Reader, blockSize uint32) (f File, err error) {
|
||||
err = binary.Read(r, binary.LittleEndian, &f.fileInit)
|
||||
if err != nil {
|
||||
fmt.Println("Hi")
|
||||
return
|
||||
}
|
||||
f.BlockSizes = make([]uint32, int(math.Ceil(float64(f.Size)/float64(blockSize))))
|
||||
toRead := int(math.Floor(float64(f.Size) / float64(blockSize)))
|
||||
if f.FragInd == 0xFFFFFFFF && f.Size%blockSize > 0 {
|
||||
toRead++
|
||||
}
|
||||
f.BlockSizes = make([]uint32, toRead)
|
||||
err = binary.Read(r, binary.LittleEndian, &f.BlockSizes)
|
||||
return
|
||||
}
|
||||
@@ -50,7 +52,11 @@ func ReadEFile(r io.Reader, blockSize uint32) (f EFile, err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
f.BlockSizes = make([]uint32, int(math.Ceil(float64(f.Size)/float64(blockSize))))
|
||||
toRead := int(math.Floor(float64(f.Size) / float64(blockSize)))
|
||||
if f.FragInd == 0xFFFFFFFF && f.Size%uint64(blockSize) > 0 {
|
||||
toRead++
|
||||
}
|
||||
f.BlockSizes = make([]uint32, toRead)
|
||||
err = binary.Read(r, binary.LittleEndian, &f.BlockSizes)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -61,6 +61,9 @@ func (r *Reader) Read(p []byte) (n int, err error) {
|
||||
p[n+i] = tmp[i]
|
||||
}
|
||||
n += tmpN
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user