mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 16:47:28 +01:00
Add testdata/romeo.txt.{flate,zlib}.
This commit is contained in:
1 parent
1e39d0302a
commit
547351cfec
4 files changed
+34
-7
No files matched your search
@@ -10,6 +10,8 @@ package main
|
|||||||
//
|
//
|
||||||
// Usage: go run extract-flate-offsets.go foo.gz bar.gz
|
// Usage: go run extract-flate-offsets.go foo.gz bar.gz
|
||||||
//
|
//
|
||||||
|
// Alternatively: go run extract-flate-offsets.go -write-flate foo.gz
|
||||||
|
//
|
||||||
// Alternatively: go run extract-flate-offsets.go -write-zlib foo.gz
|
// Alternatively: go run extract-flate-offsets.go -write-zlib foo.gz
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -26,7 +28,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
writeZlib = flag.Bool("write-zlib", false, "whether to convert gzip to zlib")
|
writeFlate = flag.Bool("write-flate", false, "whether to convert gzip to raw flate")
|
||||||
|
writeZlib = flag.Bool("write-zlib", false, "whether to convert gzip to zlib")
|
||||||
)
|
)
|
||||||
|
|
||||||
// GZIP wraps a header and footer around flate data. The format is described in
|
// GZIP wraps a header and footer around flate data. The format is described in
|
||||||
@@ -102,13 +105,27 @@ func decode(filename string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if *writeZlib {
|
if *writeFlate {
|
||||||
|
return doWriteFlate(src[i:], uncompressed, filename)
|
||||||
|
} else if *writeZlib {
|
||||||
return doWriteZlib(src[i:], uncompressed, filename)
|
return doWriteZlib(src[i:], uncompressed, filename)
|
||||||
}
|
}
|
||||||
fmt.Printf("%7d %7d %x %s\n", i, len(src), md5.Sum(uncompressed), filename)
|
fmt.Printf("%7d %7d %x %s\n", i, len(src), md5.Sum(uncompressed), filename)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func doWriteFlate(flateCompressed []byte, uncompressed []byte, filename string) error {
|
||||||
|
if strings.HasSuffix(filename, ".gz") {
|
||||||
|
filename = filename[:len(filename)-3]
|
||||||
|
}
|
||||||
|
filename += ".flate"
|
||||||
|
if err := ioutil.WriteFile(filename, flateCompressed, 0666); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Printf("wrote %s\n", filename)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func doWriteZlib(flateCompressed []byte, uncompressed []byte, filename string) error {
|
func doWriteZlib(flateCompressed []byte, uncompressed []byte, filename string) error {
|
||||||
buf := bytes.NewBuffer(nil)
|
buf := bytes.NewBuffer(nil)
|
||||||
// The ZLIB header (as per https://www.ietf.org/rfc/rfc1950.txt) is 2
|
// The ZLIB header (as per https://www.ietf.org/rfc/rfc1950.txt) is 2
|
||||||
|
|||||||
Vendored
+15
-5
@@ -1,9 +1,20 @@
|
|||||||
|
Unless otherwise noted, the *.gz files were generated by the gzip command line
|
||||||
|
tool and the .flate and .zlib versions were then generated by
|
||||||
|
script/extract-flate-offsets.go. Similarly, the *.giflzw files were generated
|
||||||
|
by script/extract-giflzw.go and the *.palette and *.indexes files were
|
||||||
|
generated by script/extract-palette-indexes.go
|
||||||
|
|
||||||
|
The *.jpeg files are usually the canonical versions of the testdata images, and
|
||||||
|
other versions (*.bmp, *.gif, *.png, *.tiff) were generated by ImageMagick's
|
||||||
|
convert command line tool. The *.webp versions were generated by the cwebp
|
||||||
|
command line tool.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
256.bytes just holds "\x00\x01\x02\x03...\xff".
|
256.bytes just holds "\x00\x01\x02\x03...\xff".
|
||||||
|
|
||||||
bricks-* are various encodings of an original photo by Nigel Tao
|
bricks-* are various encodings of an original photo by Nigel Tao
|
||||||
<nigeltao@golang.org>. The *.giflzw files were generated by
|
<nigeltao@golang.org>.
|
||||||
script/extract-giflzw.go and the *.palette and *.indexes files were generated
|
|
||||||
by script/extract-palette-indexes.go
|
|
||||||
|
|
||||||
harvesters.* are various encodings of a photo of "The Harvesters" by Pieter
|
harvesters.* are various encodings of a photo of "The Harvesters" by Pieter
|
||||||
Bruegel the Elder, held by the Metropolitan Museum of Art.
|
Bruegel the Elder, held by the Metropolitan Museum of Art.
|
||||||
@@ -30,8 +41,7 @@ Museum."
|
|||||||
midsummer.txt is an excerpt of Shakespeare's "A Midsummer Night's Dream",
|
midsummer.txt is an excerpt of Shakespeare's "A Midsummer Night's Dream",
|
||||||
copied from http://shakespeare.mit.edu/midsummer/midsummer.1.1.html
|
copied from http://shakespeare.mit.edu/midsummer/midsummer.1.1.html
|
||||||
|
|
||||||
pi.txt contains the digits of pi. The *.giflzw file was generated by
|
pi.txt contains the digits of pi.
|
||||||
script/compress-giflzw.go
|
|
||||||
|
|
||||||
pjw-thumbnail.* are various encodings of an image derived from an iconic,
|
pjw-thumbnail.* are various encodings of an image derived from an iconic,
|
||||||
original photo of Peter J. Weinberger by Rob Pike <r@golang.org>.
|
original photo of Peter J. Weinberger by Rob Pike <r@golang.org>.
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Reference in new issue
Block a user