Skip to content

Commit

Permalink
fix some dialyzing
Browse files Browse the repository at this point in the history
  • Loading branch information
kuenishi committed Jan 17, 2014
1 parent b700879 commit 6733800
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dialyzer: xref
@echo Use "'make build_plt'" to build PLT prior to using this target.
@echo
@sleep 1
dialyzer -Wno_return --plt $(COMBO_PLT) | fgrep -v -f ./dialyzer.ignore-warnings
dialyzer -Wno_return --plt $(COMBO_PLT) ebin | fgrep -v -f ./dialyzer.ignore-warnings



Expand Down
Empty file added dialyzer.ignore-warnings
Empty file.
2 changes: 1 addition & 1 deletion include/msgpack.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
impl = erlang :: erlang | nif,
allow_atom = none :: none | pack, %% allows atom when packing
enable_str = false :: boolean(), %% true for new spec
ext_packer = undefined :: msgpack_ext_packer(),
ext_packer = undefined :: msgpack_ext_packer(),
ext_unpacker = undefined :: msgpack_ext_unpacker(),
original_list = [] :: msgpack_list_options()
}).
Expand Down
3 changes: 2 additions & 1 deletion src/msgpack.erl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ unpack(Bin, Opts) ->
| {error, {badarg, term()}}.
unpack_stream(Bin) -> unpack_stream(Bin, []).

-spec unpack_stream(binary(), msgpack_option())-> {msgpack:object(), binary()}
-spec unpack_stream(binary(), msgpack:options())-> {msgpack:object(), binary()}
| {error, incomplete}
| {error, {badarg, term()}}.
unpack_stream(Bin, Opts0) when is_binary(Bin) ->
Expand All @@ -116,6 +116,7 @@ unpack_stream(Other, _) -> {error, {badarg, Other}}.
parse_options(Opt) -> parse_options(Opt, ?OPTION{original_list=Opt}).

%% @private
-spec parse_options(msgpack:options(), msgpack_option()) -> msgpack_option().
parse_options([], Opt) -> Opt;
parse_options([jsx|TL], Opt0) ->
Opt = Opt0?OPTION{interface=jsx,
Expand Down
8 changes: 5 additions & 3 deletions src/msgpack_term.erl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

-export([to_binary/1, from_binary/2,
pack_ext/2, unpack_ext/3]).
-behabiour(msgpack_ext).
-behaviour(msgpack_ext).

-define(ERLANG_TERM, 131).
-define(TERM_OPTION, [{enable_str,true},{ext,?MODULE},{allow_atom,none}]).
Expand All @@ -32,8 +32,10 @@ to_binary(Term) ->
%% @doc experimental
-spec from_binary(binary(), []|[safe]) -> term().
from_binary(Bin, Opt) ->
{ok, Term} = msgpack:unpack(Bin, Opt ++ ?TERM_OPTION),
Term.
case msgpack:unpack(Bin, Opt ++ ?TERM_OPTION) of
{ok, Term} -> Term;
Error -> error(Error)
end.

-spec pack_ext(tuple(), msgpack:options()) ->
{ok, {Type::byte(), Data::binary()}} |
Expand Down

0 comments on commit 6733800

Please sign in to comment.