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