Skip to content

Commit 6733800

Browse files
committed
fix some dialyzing
1 parent b700879 commit 6733800

5 files changed

Lines changed: 9 additions & 6 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dialyzer: xref
4545
@echo Use "'make build_plt'" to build PLT prior to using this target.
4646
@echo
4747
@sleep 1
48-
dialyzer -Wno_return --plt $(COMBO_PLT) | fgrep -v -f ./dialyzer.ignore-warnings
48+
dialyzer -Wno_return --plt $(COMBO_PLT) ebin | fgrep -v -f ./dialyzer.ignore-warnings
4949

5050

5151

dialyzer.ignore-warnings

Whitespace-only changes.

include/msgpack.hrl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
impl = erlang :: erlang | nif,
6464
allow_atom = none :: none | pack, %% allows atom when packing
6565
enable_str = false :: boolean(), %% true for new spec
66-
ext_packer = undefined :: msgpack_ext_packer(),
66+
ext_packer = undefined :: msgpack_ext_packer(),
6767
ext_unpacker = undefined :: msgpack_ext_unpacker(),
6868
original_list = [] :: msgpack_list_options()
6969
}).

src/msgpack.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ unpack(Bin, Opts) ->
9999
| {error, {badarg, term()}}.
100100
unpack_stream(Bin) -> unpack_stream(Bin, []).
101101

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

118118
%% @private
119+
-spec parse_options(msgpack:options(), msgpack_option()) -> msgpack_option().
119120
parse_options([], Opt) -> Opt;
120121
parse_options([jsx|TL], Opt0) ->
121122
Opt = Opt0?OPTION{interface=jsx,

src/msgpack_term.erl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
-export([to_binary/1, from_binary/2,
2121
pack_ext/2, unpack_ext/3]).
22-
-behabiour(msgpack_ext).
22+
-behaviour(msgpack_ext).
2323

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

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

0 commit comments

Comments
 (0)