mirror of
https://github.com/minio/minio.git
synced 2025-11-08 21:24:55 -05:00
encoded size function is now public + some janitor duty
This commit is contained in:
@@ -39,10 +39,10 @@ func (e *Encoder) Decode(chunks [][]byte, length int) ([]byte, error) {
|
||||
|
||||
k := int(e.k)
|
||||
n := int(e.k + e.m)
|
||||
if len(chunks) != n {
|
||||
if len(chunks) != int(n) {
|
||||
return nil, errors.New(fmt.Sprintf("chunks length must be %d", n))
|
||||
}
|
||||
chunk_size := getChunkSize(k, length)
|
||||
chunk_size := GetEncodedChunkLen(length, k)
|
||||
|
||||
error_index := make([]int, n+1)
|
||||
var err_count int = 0
|
||||
@@ -58,7 +58,7 @@ func (e *Encoder) Decode(chunks [][]byte, length int) ([]byte, error) {
|
||||
err_count++
|
||||
|
||||
// Too many missing chunks, cannot be more than parity `m`
|
||||
if err_count-1 > (n - k) {
|
||||
if err_count-1 > int(n-k) {
|
||||
return nil, errors.New("too many erasures requested, can't decode")
|
||||
}
|
||||
|
||||
@@ -90,8 +90,8 @@ func (e *Encoder) Decode(chunks [][]byte, length int) ([]byte, error) {
|
||||
C.ec_encode_data(C.int(chunk_size), e.k, C.int(err_count-1), decode_tbls,
|
||||
source, target)
|
||||
|
||||
recovered_output := make([]byte, 0, chunk_size*k)
|
||||
for i := 0; i < k; i++ {
|
||||
recovered_output := make([]byte, 0, chunk_size*int(k))
|
||||
for i := 0; i < int(k); i++ {
|
||||
recovered_output = append(recovered_output, chunks[i]...)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user