mirror of
https://github.com/google/brotli.git
synced 2024-11-09 21:50:07 +00:00
brotlidump: fix dictionary file discovery (#997)
This commit is contained in:
parent
0ff60731f8
commit
ce92c95601
@ -14,6 +14,8 @@ from itertools import accumulate, repeat
|
|||||||
from collections import defaultdict, deque
|
from collections import defaultdict, deque
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
DICTIONARY_PATH = 'dictionary.bin'
|
||||||
|
|
||||||
class InvalidStream(Exception): pass
|
class InvalidStream(Exception): pass
|
||||||
#lookup table
|
#lookup table
|
||||||
L, I, D = "literal", "insert©", "distance"
|
L, I, D = "literal", "insert©", "distance"
|
||||||
@ -1263,7 +1265,7 @@ class WordList:
|
|||||||
10, 10, 10, 9, 9, 8, 7, 7, 8, 7,
|
10, 10, 10, 9, 9, 8, 7, 7, 8, 7,
|
||||||
7, 6, 6, 5, 5]
|
7, 6, 6, 5, 5]
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.file = open('dict', 'rb')
|
self.file = open(DICTIONARY_PATH, 'rb')
|
||||||
self.compileActions()
|
self.compileActions()
|
||||||
|
|
||||||
def word(self, size, dist):
|
def word(self, size, dist):
|
||||||
@ -2341,7 +2343,10 @@ __test__ = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
here = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
|
||||||
|
DICTIONARY_PATH = os.path.realpath(os.path.join(here, DICTIONARY_PATH))
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
l = Layout(BitStream(open(sys.argv[1],'rb').read()))
|
l = Layout(BitStream(open(sys.argv[1],'rb').read()))
|
||||||
l.processStream()
|
l.processStream()
|
||||||
|
1
research/dictionary.bin
Symbolic link
1
research/dictionary.bin
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../c/common/dictionary.bin
|
Loading…
Reference in New Issue
Block a user