mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Re-order rac.ChunkWriter.AddChunk args
This commit is contained in:
1 parent
706e7a2474
commit
a61d735d54
4 files changed
+13
-13
No files matched your search
@@ -343,8 +343,8 @@ func (w *ChunkWriter) AddResource(resource []byte) (OptResource, error) {
|
||||
//
|
||||
// The caller may modify primary's contents after this method returns.
|
||||
func (w *ChunkWriter) AddChunk(
|
||||
dRangeSize uint64, primary []byte,
|
||||
secondary OptResource, tertiary OptResource, codec Codec) error {
|
||||
dRangeSize uint64, codec Codec, primary []byte,
|
||||
secondary OptResource, tertiary OptResource) error {
|
||||
|
||||
if dRangeSize == 0 {
|
||||
return nil
|
||||
|
||||
@@ -72,7 +72,7 @@ func Example_indexLocationAtEnd() {
|
||||
w := &rac.ChunkWriter{
|
||||
Writer: buf,
|
||||
}
|
||||
if err := w.AddChunk(uint64(len(src)), enc, 0, 0, rac.CodecZlib); err != nil {
|
||||
if err := w.AddChunk(uint64(len(src)), rac.CodecZlib, enc, 0, 0); err != nil {
|
||||
log.Fatalf("AddChunk: %v", err)
|
||||
}
|
||||
if err := w.Close(); err != nil {
|
||||
@@ -141,7 +141,7 @@ func Example_indexLocationAtStart() {
|
||||
}
|
||||
encodedChunk := b.Bytes()
|
||||
|
||||
if err := w.AddChunk(uint64(len(chunk)), encodedChunk, dictResource, 0, rac.CodecZlib); err != nil {
|
||||
if err := w.AddChunk(uint64(len(chunk)), rac.CodecZlib, encodedChunk, dictResource, 0); err != nil {
|
||||
log.Fatalf("AddChunk: %v", err)
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -207,9 +207,9 @@ func testWriter(iloc IndexLocation, tempFile io.ReadWriter, cPageSize uint64, em
|
||||
// These {Aa,Bb,Cc} chunks are also used in the reader test.
|
||||
res0, _ := w.AddResource([]byte("Rrr"))
|
||||
res1, _ := w.AddResource([]byte("Ss"))
|
||||
_ = w.AddChunk(0x11, []byte("Aaa"), 0, 0, fakeCodec)
|
||||
_ = w.AddChunk(0x22, []byte("Bbbb"), res0, 0, fakeCodec)
|
||||
_ = w.AddChunk(0x44, []byte("Cccccccccc12"), res0, res1, fakeCodec)
|
||||
_ = w.AddChunk(0x11, fakeCodec, []byte("Aaa"), 0, 0)
|
||||
_ = w.AddChunk(0x22, fakeCodec, []byte("Bbbb"), res0, 0)
|
||||
_ = w.AddChunk(0x44, fakeCodec, []byte("Cccccccccc12"), res0, res1)
|
||||
}
|
||||
|
||||
if err := w.Close(); err != nil {
|
||||
@@ -283,7 +283,7 @@ func TestMultiLevelIndex(t *testing.T) {
|
||||
primary[0] = 'q'
|
||||
}
|
||||
primaries = append(primaries, primary...)
|
||||
_ = w.AddChunk(0x10000, primary, secondary, tertiary, fakeCodec)
|
||||
_ = w.AddChunk(0x10000, fakeCodec, primary, secondary, tertiary)
|
||||
}
|
||||
|
||||
if err := w.Close(); err != nil {
|
||||
@@ -391,9 +391,9 @@ loop:
|
||||
res, _ := w.AddResource(data)
|
||||
for i := 0; i < 1000; i++ {
|
||||
if i == 2*255 {
|
||||
_ = w.AddChunk(1, data, res, 0, fakeCodec)
|
||||
_ = w.AddChunk(1, fakeCodec, data, res, 0)
|
||||
} else {
|
||||
_ = w.AddChunk(1, data, 0, 0, fakeCodec)
|
||||
_ = w.AddChunk(1, fakeCodec, data, 0, 0)
|
||||
}
|
||||
}
|
||||
if err := w.Close(); err != nil {
|
||||
|
||||
+3
-3
@@ -442,7 +442,7 @@ func (w *Writer) writeDChunks(eof bool) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := w.chunkWriter.AddChunk(dSize, cBytes, res2, res3, codec); err != nil {
|
||||
if err := w.chunkWriter.AddChunk(dSize, codec, cBytes, res2, res3); err != nil {
|
||||
w.err = err
|
||||
return err
|
||||
}
|
||||
@@ -521,7 +521,7 @@ func (w *Writer) tryCChunk(targetDChunkSize uint64, force bool) error {
|
||||
case uint64(len(cBytes)) == w.cChunkSize:
|
||||
w.uncompressed.advance(dSize)
|
||||
dSize += w.uncompressed.advancePastLeadingZeroes()
|
||||
if err := w.chunkWriter.AddChunk(dSize, cBytes, res2, res3, codec); err != nil {
|
||||
if err := w.chunkWriter.AddChunk(dSize, codec, cBytes, res2, res3); err != nil {
|
||||
w.err = err
|
||||
return err
|
||||
}
|
||||
@@ -540,7 +540,7 @@ func (w *Writer) tryCChunk(targetDChunkSize uint64, force bool) error {
|
||||
dSize, cBytes = uint64(dLen), cBytes[:eLen]
|
||||
w.uncompressed.advance(dSize)
|
||||
dSize += w.uncompressed.advancePastLeadingZeroes()
|
||||
if err := w.chunkWriter.AddChunk(dSize, cBytes, res2, res3, codec); err != nil {
|
||||
if err := w.chunkWriter.AddChunk(dSize, codec, cBytes, res2, res3); err != nil {
|
||||
w.err = err
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user