MCPcopy Create free account
hub / github.com/ActiveState/code / search_bmp

Function search_bmp

recipes/Python/456375_File_Extractor/recipe-456375.py:130–144  ·  view source on GitHub ↗
(data, size)

Source from the content-addressed store, hash-verified

128 print 'ERROR: Size Must Be A Number'
129
130def search_bmp(data, size):
131 global bmp_magic_a
132 file_list = list()
133 search_string = bmp_magic_a \
134 + chr((size & 0xFF) >> (8 * 0)) \
135 + chr((size & 0xFF00) >> (8 * 1)) \
136 + chr((size & 0xFF0000) >> (8 * 2)) \
137 + chr((size & 0xFF000000) >> (8 * 3))
138 index = data.find(search_string)
139 while index != -1:
140 file_list.append(data[index:index+size])
141 index = data.find(search_string, index + 1)
142 while len(file_list) != 0 and len(file_list[-1]) != size:
143 del file_list[-1]
144 return file_list
145
146def search_jpg(data, size):
147 global jpg_magic_a, jpg_magic_z

Callers 1

extractFunction · 0.70

Calls 3

listClass · 0.85
findMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected