Fix some dialyzer warnings

This commit is contained in:
Carlos Martín Nieto
2013-07-17 10:37:00 +02:00
parent ed6654fe59
commit bf2a59dbf2
5 changed files with 9 additions and 6 deletions

View File

@@ -8,7 +8,7 @@
-export([lookup/2, size/1, content/1]).
-spec lookup(pid(), geef_oid() | iolist()) -> geef_object().
-spec lookup(pid(), geef_oid() | iolist()) -> {ok, geef_object()} | {error, term()}.
lookup(Repo, Id) ->
geef_obj:lookup(Repo, Id, blob).

View File

@@ -68,13 +68,14 @@ reference_dwim(_Handle, _Name) ->
odb_object_exists(_Val, _Val) ->
nif_error(?LINE).
-spec odb_write(term, iolist(), atom()) -> term.
-spec odb_write(term(), iolist(), atom()) -> term().
odb_write(_Handle, _Contents, _Type) ->
nif_error(?LINE).
oid_fmt(_Oid) ->
nif_error(?LINE).
-spec oid_parse(iolist()) -> binary().
oid_parse(_Sha) ->
nif_error(?LINE).
@@ -108,7 +109,7 @@ blob_size(_ObjHandle) ->
blob_content(_ObjHandle) ->
nif_error(?LINE).
-spec tag_peel(term()) -> {ok, atom(), term()} | {error, term()}.
-spec tag_peel(term()) -> {ok, atom(), binary(), term()} | {error, term()}.
tag_peel(_Tag) ->
?NIF_FN.

View File

@@ -88,7 +88,7 @@ exists(Pid, Sha) ->
#geef_oid{oid=Oid} = geef_oid:parse(Sha),
gen_server:call(Pid, {exists, Oid}).
-spec write(pid(), iolist(), atom()) -> {ok, geef_oid()} | {error, term}.
-spec write(pid(), iolist(), atom()) -> {ok, geef_oid()} | {error, term()}.
write(Pid, Contents, Type) ->
gen_server:call(Pid, {write, Contents, Type}).

View File

@@ -24,7 +24,7 @@ parse(In) ->
parse_pkt(Rest, Len)
end.
-spec parse_request(iolist()) -> geef_request().
-spec parse_request(iolist()) -> {ok, geef_request()} | {error, ebufs}.
parse_request(In) ->
case unpack(In) of
Err = {error, ebufs} ->
@@ -37,6 +37,7 @@ parse_request(In) ->
{ok, #geef_request{service=Service, path=Path, host=Host}}
end.
-spec service_path(binary()) -> {atom(), binary()}.
service_path(<<"git-upload-pack ", Path/binary>>) ->
{upload_pack, Path};
service_path(<<"git-receive-pack ", Path/binary>>) ->
@@ -55,6 +56,7 @@ do_unpack(Len, Rest) when Len - 4 > size(Rest) ->
do_unpack(Len, Rest) ->
{Len - 4, Rest}.
-spec parse_pkt(binary(), non_neg_integer()) -> {{want | have}, geef_oid(), binary()} | {done, binary()} | {flush, binary()}.
parse_pkt(In, 0) ->
{flush, In};
parse_pkt(In, Len) ->

View File

@@ -10,7 +10,7 @@
flags, flags_extended,
path :: iolist()}).
-record(geef_request, {service :: atom, path :: binary(), host :: binary()}).
-record(geef_request, {service :: atom(), path :: binary(), host :: binary()}).
-record(geef_tree_entry, {mode, type, id, name}).
-record(geef_signature, {name :: iolist(), email :: iolist(), time :: geef_time()}).