Skip to content

Commit

Permalink
Fix a bug in zip:zip_open/1,2.
Browse files Browse the repository at this point in the history
zip:zip_open/1,2 did not accept binary archives.
Also corrected the contracts of t/1 and tt/1.
  • Loading branch information
uabboli committed Aug 18, 2011
1 parent aeaf6c7 commit 338d144
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/stdlib/src/zip.erl
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ openzip_open(F, Options) ->
do_openzip_open(F, Options) ->
Opts = get_openzip_options(Options),
#openzip_opts{output = Output, open_opts = OpO, cwd = CWD} = Opts,
Input = get_zip_input(F),
Input = get_input(F),
In0 = Input({open, F, OpO -- [write]}, []),
{[#zip_comment{comment = C} | Files], In1} =
get_central_dir(In0, fun raw_file_info_etc/5, Input),
Expand Down Expand Up @@ -489,7 +489,7 @@ do_list_dir(F, Options) ->
%% Print zip directory in short form

-spec(t(Archive) -> ok when
Archive :: file:name() | binary | ZipHandle,
Archive :: file:name() | binary() | ZipHandle,
ZipHandle :: pid()).

t(F) when is_pid(F) -> zip_t(F);
Expand All @@ -513,7 +513,7 @@ do_t(F, RawPrint) ->
%% Print zip directory in long form (like ls -l)

-spec(tt(Archive) -> ok when
Archive :: file:name() | binary | ZipHandle,
Archive :: file:name() | binary() | ZipHandle,
ZipHandle :: pid()).

tt(F) when is_pid(F) -> zip_tt(F);
Expand Down
3 changes: 2 additions & 1 deletion lib/stdlib/test/zip_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ zip_options(Config) when is_list(Config) ->
ok = file:set_cwd(?config(data_dir, Config)),

%% Create a zip archive
{ok, Zip} = zip:zip("filename_not_used.zip", Names, [memory, {cwd, PrivDir}]),
{ok, {_,Zip}} =
zip:zip("filename_not_used.zip", Names, [memory, {cwd, PrivDir}]),

%% Open archive
{ok, ZipSrv} = zip:zip_open(Zip, [memory]),
Expand Down

0 comments on commit 338d144

Please sign in to comment.