Skip to content

Commit df1953b

Browse files
authored
Merge pull request #69 from JohnHBrock/pull-request/74f8c25b
Fix del_format when magic bytes are generated by function and add rel…
2 parents 7d1298e + 74f8c25 commit df1953b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/query.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ function del_magic{N}(magic::NTuple{N, UInt8}, sym)
148148
nothing
149149
end
150150

151+
function del_magic(magic::Function, sym)
152+
deleteat!(magic_func, findfirst(magic_func, Pair(magic,sym)))
153+
nothing
154+
end
155+
151156
"""
152157
`info(fmt)` returns the magic bytes/extension information for
153158
`DataFormat` `fmt`."""

test/query.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,7 @@ context("AVI Detection") do
309309
q = query(joinpath(file_dir, "bees.avi"))
310310
@fact typeof(q) --> File{format"AVI"}
311311
end
312+
context("Format with function for magic bytes") do
313+
add_format(format"FUNCTION_FOR_MAGIC_BYTES", x -> 0x00, ".wav", [:WAV])
314+
del_format(format"FUNCTION_FOR_MAGIC_BYTES")
315+
end

0 commit comments

Comments
 (0)