mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
Have make-artificial.go mark incomplete Huffman
This commit is contained in:
1 parent
92ea631055
commit
42de49a938
2 files changed
+14
-2
No files matched your search
@@ -264,8 +264,9 @@ var deflateGlobals struct {
|
||||
huffmans [4]deflateHuffmanTable
|
||||
|
||||
// DHH (Dynamic Huffman, inside a Huffman table) state.
|
||||
prevLine string
|
||||
etcetera bool
|
||||
prevLine string
|
||||
etcetera bool
|
||||
incomplete bool
|
||||
}
|
||||
|
||||
func deflateGlobalsClearDynamicHuffmanState() {
|
||||
@@ -273,6 +274,7 @@ func deflateGlobalsClearDynamicHuffmanState() {
|
||||
deflateGlobals.huffmans = [4]deflateHuffmanTable{}
|
||||
deflateGlobals.prevLine = ""
|
||||
deflateGlobals.etcetera = false
|
||||
deflateGlobals.incomplete = false
|
||||
}
|
||||
|
||||
func deflateGlobalsCountCodes() (numLCodes uint32, numDCodes uint32, numCLCodeLengths uint32, retErr error) {
|
||||
@@ -365,6 +367,9 @@ func deflateGlobalsIsHuffmanCanonical() bool {
|
||||
}
|
||||
prevV = p.v
|
||||
}
|
||||
if next() != g.incomplete {
|
||||
return false // Under-subscribed.
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -696,6 +701,7 @@ outer:
|
||||
g.whichHuffman = 0
|
||||
g.prevLine = ""
|
||||
g.etcetera = false
|
||||
g.incomplete = false
|
||||
|
||||
// If we have all three Huffman tables, write them.
|
||||
for i := 1; ; i++ {
|
||||
@@ -716,6 +722,10 @@ outer:
|
||||
g.etcetera = true
|
||||
return stateDeflateDynamicHuffmanHuffman, nil
|
||||
|
||||
case line == "incomplete":
|
||||
g.incomplete = true
|
||||
return stateDeflateDynamicHuffmanHuffman, nil
|
||||
|
||||
default:
|
||||
s := line
|
||||
n, s, ok := parseNum(s)
|
||||
|
||||
@@ -22,6 +22,7 @@ blockDynamicHuffman (nonFinal) {
|
||||
#
|
||||
# The sole key/value pair is also unused. (The one below is used.)
|
||||
0 0
|
||||
incomplete
|
||||
}
|
||||
|
||||
literal "foo"
|
||||
@@ -56,6 +57,7 @@ blockDynamicHuffman (final) {
|
||||
# Per the second table in RFC 1951 section 3.2.5. "Compressed blocks
|
||||
# (length and distance codes)", code 3 means a distance of 4.
|
||||
3 0
|
||||
incomplete
|
||||
}
|
||||
|
||||
literal "ABCD"
|
||||
|
||||
Reference in new issue
Block a user