fix some dialyzing

This commit is contained in:
UENISHI Kota 2014-01-18 01:14:53 +09:00
parent b7008794c4
commit 67338009a9
5 changed files with 9 additions and 6 deletions

View File

@ -45,7 +45,7 @@ dialyzer: xref
@echo Use "'make build_plt'" to build PLT prior to using this target. @echo Use "'make build_plt'" to build PLT prior to using this target.
@echo @echo
@sleep 1 @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

0
dialyzer.ignore-warnings Normal file
View File

View File

@ -63,7 +63,7 @@
impl = erlang :: erlang | nif, impl = erlang :: erlang | nif,
allow_atom = none :: none | pack, %% allows atom when packing allow_atom = none :: none | pack, %% allows atom when packing
enable_str = false :: boolean(), %% true for new spec 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(), ext_unpacker = undefined :: msgpack_ext_unpacker(),
original_list = [] :: msgpack_list_options() original_list = [] :: msgpack_list_options()
}). }).

View File

@ -99,7 +99,7 @@ unpack(Bin, Opts) ->
| {error, {badarg, term()}}. | {error, {badarg, term()}}.
unpack_stream(Bin) -> unpack_stream(Bin, []). 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, incomplete}
| {error, {badarg, term()}}. | {error, {badarg, term()}}.
unpack_stream(Bin, Opts0) when is_binary(Bin) -> unpack_stream(Bin, Opts0) when is_binary(Bin) ->
@ -116,6 +116,7 @@ unpack_stream(Other, _) -> {error, {badarg, Other}}.
parse_options(Opt) -> parse_options(Opt, ?OPTION{original_list=Opt}). parse_options(Opt) -> parse_options(Opt, ?OPTION{original_list=Opt}).
%% @private %% @private
-spec parse_options(msgpack:options(), msgpack_option()) -> msgpack_option().
parse_options([], Opt) -> Opt; parse_options([], Opt) -> Opt;
parse_options([jsx|TL], Opt0) -> parse_options([jsx|TL], Opt0) ->
Opt = Opt0?OPTION{interface=jsx, Opt = Opt0?OPTION{interface=jsx,

View File

@ -19,7 +19,7 @@
-export([to_binary/1, from_binary/2, -export([to_binary/1, from_binary/2,
pack_ext/2, unpack_ext/3]). pack_ext/2, unpack_ext/3]).
-behabiour(msgpack_ext). -behaviour(msgpack_ext).
-define(ERLANG_TERM, 131). -define(ERLANG_TERM, 131).
-define(TERM_OPTION, [{enable_str,true},{ext,?MODULE},{allow_atom,none}]). -define(TERM_OPTION, [{enable_str,true},{ext,?MODULE},{allow_atom,none}]).
@ -32,8 +32,10 @@ to_binary(Term) ->
%% @doc experimental %% @doc experimental
-spec from_binary(binary(), []|[safe]) -> term(). -spec from_binary(binary(), []|[safe]) -> term().
from_binary(Bin, Opt) -> from_binary(Bin, Opt) ->
{ok, Term} = msgpack:unpack(Bin, Opt ++ ?TERM_OPTION), case msgpack:unpack(Bin, Opt ++ ?TERM_OPTION) of
Term. {ok, Term} -> Term;
Error -> error(Error)
end.
-spec pack_ext(tuple(), msgpack:options()) -> -spec pack_ext(tuple(), msgpack:options()) ->
{ok, {Type::byte(), Data::binary()}} | {ok, {Type::byte(), Data::binary()}} |