diff --git a/src/eFmt.erl b/src/eFmt.erl index b100b1e..1c3a5dc 100644 --- a/src/eFmt.erl +++ b/src/eFmt.erl @@ -35,8 +35,8 @@ format/2 , format/3 - , formatBin/2 - , formatBin/3 + , formatIol/2 + , formatIol/3 , scan/2 , build/1 @@ -86,7 +86,7 @@ on_load() -> -spec format(Format :: format(), Data :: [term()]) -> chars(). format(Format, Args) -> - try fWrite(Format, Args) + try iolist_to_binary(fWrite(Format, Args)) catch C:R:S -> erlang:error(badarg, [Format, Args, {C, R, S}]) @@ -94,27 +94,23 @@ format(Format, Args) -> -spec format(Format :: format(), Data :: [term()], Options :: [{charsLimit, CharsLimit :: charsLimit()}]) -> chars(). format(Format, Args, Options) -> - try fWrite(Format, Args, Options) + try iolist_to_binary(fWrite(Format, Args, Options)) catch C:R:S -> erlang:error(badarg, [Format, Args, {C, R, S}]) end. --spec formatBin(Format :: format(), Data :: [term()]) -> chars(). -formatBin(Format, Args) -> - try fWrite(Format, Args) of - Ret -> - iolist_to_binary(Ret) +-spec formatIol(Format :: format(), Data :: [term()]) -> chars(). +formatIol(Format, Args) -> + try fWrite(Format, Args) catch C:R:S -> erlang:error(badarg, [Format, Args, {C, R, S}]) end. --spec formatBin(Format :: format(), Data :: [term()], Options :: [{charsLimit, CharsLimit :: charsLimit()}]) -> chars(). -formatBin(Format, Args, Options) -> - try fWrite(Format, Args, Options) of - Ret -> - iolist_to_binary(Ret) +-spec formatIol(Format :: format(), Data :: [term()], Options :: [{charsLimit, CharsLimit :: charsLimit()}]) -> chars(). +formatIol(Format, Args, Options) -> + try fWrite(Format, Args, Options) catch C:R:S -> erlang:error(badarg, [Format, Args, {C, R, S}]) diff --git a/src/test/recon-2.5.1/fmtTest.erl b/src/test/recon-2.5.1/fmtTest.erl index 007243c..e43ed84 100644 --- a/src/test/recon-2.5.1/fmtTest.erl +++ b/src/test/recon-2.5.1/fmtTest.erl @@ -1,22 +1,22 @@ -module(fmtTest). --compile([export_all]). +-compile([export_all, nowarn_export_all]). tt1(FmtBinStr) -> - split(FmtBinStr, <<"~">>). + binary:split(FmtBinStr, <<"~">>). tt2(FmtBinStr) -> - split(FmtBinStr, persistent_term:get(eFmtPtMc)). + binary:split(FmtBinStr, persistent_term:get(eFmtPtMc)). tt5(F) -> string:split(F, "~"). tt3(<<>>) -> ok; -tt3(<>) -> +tt3(<<_F/utf8, L/binary>>) -> tt3(L). tt4([]) -> ok; -tt4([F | L]) -> +tt4([_F | L]) -> tt4(L). \ No newline at end of file