nolint:cyclop,funlen,lll
(r io.ReaderAt, folder int, password string)
| 259 | |
| 260 | //nolint:cyclop,funlen,lll |
| 261 | func (si *streamsInfo) folderReader(r io.ReaderAt, folder int, password string) (*folderReadCloser, uint32, bool, error) { |
| 262 | f := si.unpackInfo.folder[folder] |
| 263 | in := make([]io.ReadCloser, f.in) |
| 264 | out := make([]io.ReadCloser, f.out) |
| 265 | |
| 266 | packedOffset := 0 |
| 267 | for i := range folder { |
| 268 | packedOffset += len(si.unpackInfo.folder[i].packed) |
| 269 | } |
| 270 | |
| 271 | offset := int64(0) |
| 272 | |
| 273 | for i, input := range f.packed { |
| 274 | size := int64(si.packInfo.size[packedOffset+i]) //nolint:gosec |
| 275 | in[input] = util.NopCloser(bufio.NewReader(io.NewSectionReader(r, si.folderOffset(folder)+offset, size))) |
| 276 | offset += size |
| 277 | } |
| 278 | |
| 279 | var ( |
| 280 | hasEncryption bool |
| 281 | input, output uint64 |
| 282 | ) |
| 283 | |
| 284 | for i, c := range f.coder { |
| 285 | if c.out != 1 { |
| 286 | return nil, 0, hasEncryption, errMultipleOutputStreams |
| 287 | } |
| 288 | |
| 289 | for j := input; j < input+c.in; j++ { |
| 290 | if in[j] != nil { |
| 291 | continue |
| 292 | } |
| 293 | |
| 294 | bp := f.findInBindPair(j) |
| 295 | if bp == nil || out[bp.out] == nil { |
| 296 | return nil, 0, hasEncryption, errNoBoundStream |
| 297 | } |
| 298 | |
| 299 | in[j] = out[bp.out] |
| 300 | } |
| 301 | |
| 302 | var ( |
| 303 | isEncrypted bool |
| 304 | err error |
| 305 | ) |
| 306 | |
| 307 | out[output], isEncrypted, err = f.coderReader(in[input:input+c.in], uint64(i), password) |
| 308 | if err != nil { |
| 309 | return nil, 0, hasEncryption, err |
| 310 | } |
| 311 | |
| 312 | if isEncrypted { |
| 313 | hasEncryption = true |
| 314 | } |
| 315 | |
| 316 | input += c.in |
| 317 | output += c.out |
| 318 | } |
nothing calls this directly
no test coverage detected