25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Deprecate jlib:integer_to_binary/1 and jlib:binary_to_integer/1

This commit is contained in:
Evgeniy Khramtsov 2016-09-24 23:34:28 +03:00
parent 58969fb854
commit fa31e3ef23
32 changed files with 73 additions and 71 deletions

View File

@ -45,7 +45,7 @@ mech_new(Host, _GetPassword, _CheckPassword, _CheckPasswordDigest) ->
mech_step(#state{server = Server} = S, ClientIn) ->
User = iolist_to_binary([randoms:get_string(),
jlib:integer_to_binary(p1_time_compat:unique_integer([positive]))]),
integer_to_binary(p1_time_compat:unique_integer([positive]))]),
case ejabberd_auth:is_user_exists(User, Server) of
true -> mech_step(S, ClientIn);
false -> {ok, [{username, User}, {authzid, User}, {auth_module, ejabberd_auth_anonymous}]}

View File

@ -1633,7 +1633,7 @@ new_id() -> randoms:get_string().
-spec new_uniq_id() -> binary().
new_uniq_id() ->
iolist_to_binary([randoms:get_string(),
jlib:integer_to_binary(p1_time_compat:unique_integer([positive]))]).
integer_to_binary(p1_time_compat:unique_integer([positive]))]).
-spec get_conn_type(state()) -> c2s | c2s_tls | c2s_compressed | websocket |
c2s_compressed_tls | http_bind.

View File

@ -392,7 +392,7 @@ get_url(Str) ->
end.
get_transfer_protocol(PortString) ->
PortNumber = jlib:binary_to_integer(PortString),
PortNumber = binary_to_integer(PortString),
PortListeners = get_port_listeners(PortNumber),
get_captcha_transfer_protocol(PortListeners).

View File

@ -41,7 +41,7 @@
-define(SPAN(N, V), ?TAG_R(span, ??N, V)).
-define(STR(A), ?SPAN(str,[<<"\"">>, A, <<"\"">>])).
-define(NUM(A), ?SPAN(num,jlib:integer_to_binary(A))).
-define(NUM(A), ?SPAN(num,integer_to_binary(A))).
-define(FIELD(A), ?SPAN(field,A)).
-define(ID(A), ?SPAN(id,A)).
-define(OP(A), ?SPAN(op,A)).
@ -171,7 +171,7 @@ xml_gen({Name, integer}, Int, Indent, HTMLOutput) ->
[?XML(member, Indent,
[?XML_L(name, Indent, 1, ?ID_A(Name)),
?XML(value, Indent, 1,
[?XML_L(integer, Indent, 2, ?ID(jlib:integer_to_binary(Int)))])])];
[?XML_L(integer, Indent, 2, ?ID(integer_to_binary(Int)))])])];
xml_gen({Name, string}, Str, Indent, HTMLOutput) ->
[?XML(member, Indent,
[?XML_L(name, Indent, 1, ?ID_A(Name)),

View File

@ -252,7 +252,7 @@ process_header(State, Data) ->
request_headers = add_header(Name, Auth, State)};
{ok,
{http_header, _, 'Content-Length' = Name, _, SLen}} ->
case catch jlib:binary_to_integer(SLen) of
case catch binary_to_integer(SLen) of
Len when is_integer(Len) ->
State#state{request_content_length = Len,
request_headers = add_header(Name, SLen, State)};
@ -327,10 +327,10 @@ get_transfer_protocol(SockMod, HostPort) ->
case {SockMod, PortList} of
{gen_tcp, []} -> {Host, 80, http};
{gen_tcp, [Port]} ->
{Host, jlib:binary_to_integer(Port), http};
{Host, binary_to_integer(Port), http};
{fast_tls, []} -> {Host, 443, https};
{fast_tls, [Port]} ->
{Host, jlib:binary_to_integer(Port), https}
{Host, binary_to_integer(Port), https}
end.
%% XXX bard: search through request handlers looking for one that
@ -587,12 +587,12 @@ make_text_output(State, Status, Reason, Headers, Text) ->
of
{value, _} ->
[{<<"Content-Length">>,
jlib:integer_to_binary(byte_size(Data))}
integer_to_binary(byte_size(Data))}
| Headers];
_ ->
[{<<"Content-Type">>, <<"text/html; charset=utf-8">>},
{<<"Content-Length">>,
jlib:integer_to_binary(byte_size(Data))}
integer_to_binary(byte_size(Data))}
| Headers]
end,
HeadersOut = case {State#state.request_version,
@ -617,7 +617,7 @@ make_text_output(State, Status, Reason, Headers, Text) ->
_ -> Reason
end,
SL = [Version,
jlib:integer_to_binary(Status), <<" ">>,
integer_to_binary(Status), <<" ">>,
NewReason, <<"\r\n">>],
Data2 = case State#state.request_method of
'HEAD' -> <<"">>;

View File

@ -853,7 +853,7 @@ rid_allow(OldRid, NewRid, Attrs, Hold, MaxPause) ->
%% We did not miss any packet, we can process it immediately:
NewRid == OldRid + 1 ->
case catch
jlib:binary_to_integer(fxml:get_attr_s(<<"pause">>,
binary_to_integer(fxml:get_attr_s(<<"pause">>,
Attrs))
of
{'EXIT', _} -> {true, 0};
@ -1119,7 +1119,7 @@ parse_request(Data, PayloadSize, MaxStanzaSize) ->
if Xmlns /= (?NS_HTTP_BIND) -> {error, bad_request};
true ->
case catch
jlib:binary_to_integer(fxml:get_attr_s(<<"rid">>,
binary_to_integer(fxml:get_attr_s(<<"rid">>,
Attrs))
of
{'EXIT', _} -> {error, bad_request};

View File

@ -147,7 +147,7 @@ timestamp_to_now(I) ->
{MSec, Sec, USec}.
dec_priority(Prio) ->
case catch jlib:binary_to_integer(Prio) of
case catch binary_to_integer(Prio) of
{'EXIT', _} ->
undefined;
Int ->
@ -157,7 +157,7 @@ dec_priority(Prio) ->
enc_priority(undefined) ->
<<"">>;
enc_priority(Int) when is_integer(Int) ->
jlib:integer_to_binary(Int).
integer_to_binary(Int).
row_to_session(LServer, {USec, PidS, User, Resource, PrioS, InfoS}) ->
Now = timestamp_to_now(USec),

View File

@ -768,7 +768,7 @@ sqlite_to_odbc(Host, {rowid, _}) ->
sqlite_to_odbc(_Host, [{columns, Columns}, {rows, TRows}]) ->
Rows = [lists:map(
fun(I) when is_integer(I) ->
jlib:integer_to_binary(I);
integer_to_binary(I);
(B) ->
B
end, tuple_to_list(Row)) || Row <- TRows],
@ -813,11 +813,11 @@ pgsql_item_to_odbc({<<"FETCH", _/binary>>, Rows,
{selected, [element(1, Row) || Row <- Rows], Recs};
pgsql_item_to_odbc(<<"INSERT ", OIDN/binary>>) ->
[_OID, N] = str:tokens(OIDN, <<" ">>),
{updated, jlib:binary_to_integer(N)};
{updated, binary_to_integer(N)};
pgsql_item_to_odbc(<<"DELETE ", N/binary>>) ->
{updated, jlib:binary_to_integer(N)};
{updated, binary_to_integer(N)};
pgsql_item_to_odbc(<<"UPDATE ", N/binary>>) ->
{updated, jlib:binary_to_integer(N)};
{updated, binary_to_integer(N)};
pgsql_item_to_odbc({error, Error}) -> {error, Error};
pgsql_item_to_odbc(_) -> {updated, undefined}.
@ -875,7 +875,7 @@ mysql_item_to_odbc(Columns, Recs) ->
to_odbc({selected, Columns, Recs}) ->
Rows = [lists:map(
fun(I) when is_integer(I) ->
jlib:integer_to_binary(I);
integer_to_binary(I);
(B) ->
B
end, Row) || Row <- Recs],

View File

@ -300,7 +300,7 @@ process_command2([<<"showlh">>, SNode], From, To) ->
process_command2([<<"setlh">>, SNode, NewValueString],
From, To) ->
Node = jlib:binary_to_atom(SNode),
NewValue = jlib:binary_to_integer(NewValueString),
NewValue = binary_to_integer(NewValueString),
remote_command(Node, [setlh, NewValue], From, To);
process_command2([<<"help">>], From, To) ->
send_message(To, From, help());

View File

@ -1458,8 +1458,8 @@ list_users_in_diapason(Host, Diap, Lang, URLFunc) ->
Users = ejabberd_auth:get_vh_registered_users(Host),
SUsers = lists:sort([{S, U} || {U, S} <- Users]),
[S1, S2] = ejabberd_regexp:split(Diap, <<"-">>),
N1 = jlib:binary_to_integer(S1),
N2 = jlib:binary_to_integer(S2),
N1 = binary_to_integer(S1),
N2 = binary_to_integer(S2),
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
[list_given_users(Host, Sub, <<"../../">>, Lang,
URLFunc)].
@ -1648,7 +1648,7 @@ user_info(User, Server, Query, Lang) ->
"://",
(jlib:ip_to_list(IP))/binary,
":",
(jlib:integer_to_binary(Port))/binary,
(integer_to_binary(Port))/binary,
"#",
(jlib:atom_to_binary(Node))/binary>>
end,
@ -2520,7 +2520,7 @@ make_netprot_html(NetProt) ->
get_port_data(PortIP, Opts) ->
{Port, IPT, IPS, _IPV, NetProt, OptsClean} =
ejabberd_listener:parse_listener_portip(PortIP, Opts),
SPort = jlib:integer_to_binary(Port),
SPort = integer_to_binary(Port),
SSPort = list_to_binary(
lists:map(fun (N) ->
io_lib:format("~.16b", [N])

View File

@ -126,7 +126,7 @@ xdb_data(User, Server, #xmlel{attrs = Attrs} = El) ->
TimeStamp = fxml:get_attr_s(<<"last">>, Attrs),
Status = fxml:get_tag_cdata(El),
catch mod_last:store_last_info(User, Server,
jlib:binary_to_integer(TimeStamp),
binary_to_integer(TimeStamp),
Status),
ok;
?NS_VCARD ->

View File

@ -74,7 +74,9 @@
{resourceprep, 1},
{jid_tolower, 1},
{jid_remove_resource, 1},
{jid_replace_resource, 2}]).
{jid_replace_resource, 2},
{integer_to_binary, 1},
{binary_to_integer, 1}]).
-include("ejabberd.hrl").
-include("jlib.hrl").

View File

@ -546,7 +546,7 @@ import_start(LServer, DBType) ->
import(_LServer, {sql, _}, _DBType, <<"caps_features">>,
[Node, SubNode, Feature, _TimeStamp]) ->
Feature1 = case catch jlib:binary_to_integer(Feature) of
Feature1 = case catch binary_to_integer(Feature) of
I when is_integer(I), I>0 -> I;
_ -> Feature
end,

View File

@ -29,7 +29,7 @@ caps_read(LServer, {Node, SubNode}) ->
?SQL("select @(feature)s from caps_features where"
" node=%(Node)s and subnode=%(SubNode)s")) of
{selected, [{H}|_] = Fs} ->
case catch jlib:binary_to_integer(H) of
case catch binary_to_integer(H) of
Int when is_integer(Int), Int>=0 ->
{ok, Int};
_ ->
@ -58,7 +58,7 @@ export(_Server) ->
%%%===================================================================
sql_write_features_t({Node, SubNode}, Features) ->
NewFeatures = if is_integer(Features) ->
[jlib:integer_to_binary(Features)];
[integer_to_binary(Features)];
true ->
Features
end,

View File

@ -552,8 +552,8 @@ get_local_items({_, Host},
SUsers = lists:sort([{S, U} || {U, S} <- Users]),
try
[S1, S2] = ejabberd_regexp:split(Diap, <<"-">>),
N1 = jlib:binary_to_integer(S1),
N2 = jlib:binary_to_integer(S2),
N1 = binary_to_integer(S1),
N2 = binary_to_integer(S2),
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
{result, lists:map(
fun({S, U}) ->
@ -1659,11 +1659,11 @@ set_form(From, Host, ?NS_ADMINL(<<"user-stats">>), Lang,
IPs1 = [ejabberd_sm:get_user_ip(User, Server, Resource)
|| Resource <- Resources],
IPs = [<<(jlib:ip_to_list(IP))/binary, ":",
(jlib:integer_to_binary(Port))/binary>>
(integer_to_binary(Port))/binary>>
|| {IP, Port} <- IPs1],
Items = ejabberd_hooks:run_fold(roster_get, Server, [],
[{User, Server}]),
Rostersize = jlib:integer_to_binary(erlang:length(Items)),
Rostersize = integer_to_binary(erlang:length(Items)),
{result,
#xdata{type = form,
fields = [?HFIELD(),
@ -1695,7 +1695,7 @@ search_running_node(SNode, [Node | Nodes]) ->
end.
stop_node(From, Host, ENode, Action, XData) ->
Delay = jlib:binary_to_integer(get_value(<<"delay">>, XData)),
Delay = binary_to_integer(get_value(<<"delay">>, XData)),
Subject = case get_value(<<"subject">>, XData) of
<<"">> ->
[];

View File

@ -267,7 +267,7 @@ process(_Path, Request) ->
get_api_version(#request{path = Path}) ->
get_api_version(lists:reverse(Path));
get_api_version([<<"v", String/binary>> | Tail]) ->
case catch jlib:binary_to_integer(String) of
case catch binary_to_integer(String) of
N when is_integer(N) ->
N;
_ ->

View File

@ -35,7 +35,7 @@
-define(FORMAT(Error), file:format_error(Error)).
-define(URL_ENC(URL), binary_to_list(ejabberd_http:url_encode(URL))).
-define(ADDR_TO_STR(IP), ejabberd_config:may_hide_data(jlib:ip_to_list(IP))).
-define(STR_TO_INT(Str, B), jlib:binary_to_integer(iolist_to_binary(Str), B)).
-define(STR_TO_INT(Str, B), binary_to_integer(iolist_to_binary(Str), B)).
-define(DEFAULT_CONTENT_TYPE, <<"application/octet-stream">>).
-define(CONTENT_TYPES,
[{<<".avi">>, <<"video/avi">>},
@ -578,7 +578,7 @@ process_iq(_From, #iq{}, _State) ->
create_slot(#state{service_url = undefined, max_size = MaxSize},
JID, File, Size, _ContentType, Lang) when MaxSize /= infinity,
Size > MaxSize ->
Text = <<"File larger than ", (jlib:integer_to_binary(MaxSize))/binary,
Text = <<"File larger than ", (integer_to_binary(MaxSize))/binary,
" Bytes.">>,
?INFO_MSG("Rejecting file ~s from ~s (too large: ~B bytes)",
[File, jid:to_string(JID), Size]),
@ -609,7 +609,7 @@ create_slot(#state{service_url = ServiceURL},
Lang) ->
Options = [{body_format, binary}, {full_result, false}],
HttpOptions = [{timeout, ?SERVICE_REQUEST_TIMEOUT}],
SizeStr = jlib:integer_to_binary(Size),
SizeStr = integer_to_binary(Size),
GetRequest = binary_to_list(ServiceURL) ++
"?jid=" ++ ?URL_ENC(jid:to_string({U, S, <<"">>})) ++
"&name=" ++ ?URL_ENC(File) ++
@ -727,7 +727,7 @@ iq_disco_info(Host, Lang, Name, AddInfo) ->
infinity ->
AddInfo;
MaxSize ->
MaxSizeStr = jlib:integer_to_binary(MaxSize),
MaxSizeStr = integer_to_binary(MaxSize),
Fields = [#xdata_field{type = hidden,
var = <<"FORM_TYPE">>,
values = [?NS_HTTP_UPLOAD]},

View File

@ -62,7 +62,7 @@ import(LServer) ->
[{<<"select username, seconds, state from last">>,
fun([LUser, TimeStamp, State]) ->
#last_activity{us = {LUser, LServer},
timestamp = jlib:binary_to_integer(
timestamp = binary_to_integer(
TimeStamp),
status = State}
end}].

View File

@ -97,7 +97,7 @@ store(Pkt, _, {LUser, LServer}, Type, Peer, Nick, _Dir) ->
_ ->
LPeer = {PUser, PServer, _} = jid:tolower(Peer),
TS = p1_time_compat:timestamp(),
ID = jlib:integer_to_binary(now_to_usec(TS)),
ID = integer_to_binary(now_to_usec(TS)),
F = fun() ->
mnesia:write(
#archive_msg{us = {LUser, LServer},
@ -145,7 +145,7 @@ select(_LServer, JidRequestor,
Result = {lists:map(
fun(Msg) ->
{Msg#archive_msg.id,
jlib:binary_to_integer(Msg#archive_msg.id),
binary_to_integer(Msg#archive_msg.id),
mod_mam:msg_to_el(Msg, MsgType, JidRequestor,
JidArchive)}
end, FilteredMsgs), IsComplete, Count},

View File

@ -55,7 +55,7 @@ extended_fields() ->
store(Pkt, LServer, {LUser, LHost}, Type, Peer, Nick, _Dir) ->
TSinteger = p1_time_compat:system_time(micro_seconds),
ID = jlib:integer_to_binary(TSinteger),
ID = integer_to_binary(TSinteger),
SUser = case Type of
chat -> LUser;
groupchat -> jid:to_string({LUser, LHost, <<>>})
@ -154,14 +154,14 @@ select(LServer, JidRequestor, #jid{luser = LUser} = JidArchive,
fun([TS, XML, PeerBin, Kind, Nick]) ->
try
#xmlel{} = El = fxml_stream:parse_element(XML),
Now = usec_to_now(jlib:binary_to_integer(TS)),
Now = usec_to_now(binary_to_integer(TS)),
PeerJid = jid:tolower(jid:from_string(PeerBin)),
T = case Kind of
<<"">> -> chat;
null -> chat;
_ -> jlib:binary_to_atom(Kind)
end,
[{TS, jlib:binary_to_integer(TS),
[{TS, binary_to_integer(TS),
mod_mam:msg_to_el(#archive_msg{timestamp = Now,
packet = El,
type = T,
@ -176,7 +176,7 @@ select(LServer, JidRequestor, #jid{luser = LUser} = JidArchive,
[Err, TS, XML, PeerBin, Kind, Nick]),
[]
end
end, Res1), IsComplete, jlib:binary_to_integer(Count)};
end, Res1), IsComplete, binary_to_integer(Count)};
_ ->
{[], false, 0}
end.
@ -208,12 +208,12 @@ make_sql_query(User, LServer,
_ -> fun ejabberd_sql:escape/1
end,
LimitClause = if is_integer(Max), Max >= 0, ODBCType /= mssql ->
[<<" limit ">>, jlib:integer_to_binary(Max+1)];
[<<" limit ">>, integer_to_binary(Max+1)];
true ->
[]
end,
TopClause = if is_integer(Max), Max >= 0, ODBCType == mssql ->
[<<" TOP ">>, jlib:integer_to_binary(Max+1)];
[<<" TOP ">>, integer_to_binary(Max+1)];
true ->
[]
end,
@ -235,7 +235,7 @@ make_sql_query(User, LServer,
_ ->
[]
end,
PageClause = case catch jlib:binary_to_integer(ID) of
PageClause = case catch binary_to_integer(ID) of
I when is_integer(I), I >= 0 ->
case Direction of
before ->
@ -251,14 +251,14 @@ make_sql_query(User, LServer,
StartClause = case Start of
{_, _, _} ->
[<<" and timestamp >= ">>,
jlib:integer_to_binary(now_to_usec(Start))];
integer_to_binary(now_to_usec(Start))];
_ ->
[]
end,
EndClause = case End of
{_, _, _} ->
[<<" and timestamp <= ">>,
jlib:integer_to_binary(now_to_usec(End))];
integer_to_binary(now_to_usec(End))];
_ ->
[]
end,

View File

@ -761,7 +761,7 @@ change_room_option(Name, Service, OptionString, ValueString) ->
password -> ValueString;
subject ->ValueString;
subject_author ->ValueString;
max_users -> jlib:binary_to_integer(ValueString);
max_users -> binary_to_integer(ValueString);
_ -> jlib:binary_to_atom(ValueString)
end,
change_room_option(Name, Service, Option, Value).

View File

@ -301,7 +301,7 @@ get_sm_items(Acc, _From, _To, _Node, _Lang) ->
([xdata()], jid(), jid(), binary(), binary()) -> [xdata()].
get_info(_Acc, #jid{luser = U, lserver = S, lresource = R},
#jid{luser = U, lserver = S}, ?NS_FLEX_OFFLINE, _Lang) ->
N = jlib:integer_to_binary(count_offline_messages(U, S)),
N = integer_to_binary(count_offline_messages(U, S)),
case ejabberd_sm:get_session_pid(U, S, R) of
Pid when is_pid(Pid) ->
Pid ! dont_ask_offline;

View File

@ -198,7 +198,7 @@ export(Server) ->
[<<"select id from privacy_list order by "
"id desc limit 1;">>]) of
{selected, [<<"id">>], [[I]]} ->
put(id, jlib:binary_to_integer(I));
put(id, binary_to_integer(I));
_ ->
put(id, 0)
end,

View File

@ -3279,7 +3279,7 @@ max_items(Host, Options) ->
-define(INTEGER_CONFIG_FIELD(Label, Var),
?STRINGXFIELD(Label,
<<"pubsub#", (atom_to_binary(Var, latin1))/binary>>,
(jlib:integer_to_binary(get_option(Options, Var))))).
(integer_to_binary(get_option(Options, Var))))).
-define(JLIST_CONFIG_FIELD(Label, Var, Opts),
?LISTXFIELD(Label,
@ -3418,7 +3418,7 @@ add_opt(Key, Value, Opts) ->
set_xoption(Host, Opts, add_opt(Opt, Val, NewOpts))).
-define(SET_INTEGER_XOPT(Opt, Val, Min, Max),
case catch jlib:binary_to_integer(Val) of
case catch binary_to_integer(Val) of
IVal when is_integer(IVal), IVal >= Min ->
if (Max =:= undefined) orelse (IVal =< Max) ->
set_xoption(Host, Opts, add_opt(Opt, IVal, NewOpts));

View File

@ -907,21 +907,21 @@ shared_roster_group(Host, Group, Query, Lang) ->
[?XCT(<<"td">>, <<"Description:">>),
?XE(<<"td">>,
[?TEXTAREA(<<"description">>,
jlib:integer_to_binary(lists:max([3,
integer_to_binary(lists:max([3,
DescNL])),
<<"20">>, Description)])]),
?XE(<<"tr">>,
[?XCT(<<"td">>, <<"Members:">>),
?XE(<<"td">>,
[?TEXTAREA(<<"members">>,
jlib:integer_to_binary(lists:max([3,
integer_to_binary(lists:max([3,
byte_size(FMembers)])),
<<"20">>, FMembers)])]),
?XE(<<"tr">>,
[?XCT(<<"td">>, <<"Displayed Groups:">>),
?XE(<<"td">>,
[?TEXTAREA(<<"dispgroups">>,
jlib:integer_to_binary(lists:max([3, length(FDisplayedGroups)])),
integer_to_binary(lists:max([3, length(FDisplayedGroups)])),
<<"20">>,
list_to_binary(FDisplayedGroups))])])])])),
(?H1GL((?T(<<"Shared Roster Groups">>)),

View File

@ -82,7 +82,7 @@ search(LServer, Data, AllowReturnAll, MaxMatch) ->
infinity ->
<<"">>;
Val ->
[<<" LIMIT ">>, jlib:integer_to_binary(Val)]
[<<" LIMIT ">>, integer_to_binary(Val)]
end,
case catch ejabberd_sql:sql_query(
LServer,

View File

@ -134,7 +134,7 @@ boolean_to_sql(false) -> <<"0">>.
timestamp_to_sql(T) -> jlib:now_to_utc_string(T).
sql_to_integer(N) -> jlib:binary_to_integer(N).
sql_to_integer(N) -> binary_to_integer(N).
sql_to_boolean(B) -> B == <<"1">>.

View File

@ -203,7 +203,7 @@ var_xfield(_) -> {error, badarg}.
val_xfield(deliver = Opt, [Val]) -> xopt_to_bool(Opt, Val);
val_xfield(digest = Opt, [Val]) -> xopt_to_bool(Opt, Val);
val_xfield(digest_frequency = Opt, [Val]) ->
case catch jlib:binary_to_integer(Val) of
case catch binary_to_integer(Val) of
N when is_integer(N) -> N;
_ ->
Txt = <<"Value of '~s' should be integer">>,
@ -225,7 +225,7 @@ val_xfield(subscription_type, [<<"items">>]) -> items;
val_xfield(subscription_type, [<<"nodes">>]) -> nodes;
val_xfield(subscription_depth, [<<"all">>]) -> all;
val_xfield(subscription_depth = Opt, [Depth]) ->
case catch jlib:binary_to_integer(Depth) of
case catch binary_to_integer(Depth) of
N when is_integer(N) -> N;
_ ->
Txt = <<"Value of '~s' should be integer">>,

View File

@ -168,7 +168,7 @@ var_xfield(_) -> {error, badarg}.
val_xfield(deliver = Opt, [Val]) -> xopt_to_bool(Opt, Val);
val_xfield(digest = Opt, [Val]) -> xopt_to_bool(Opt, Val);
val_xfield(digest_frequency = Opt, [Val]) ->
case catch jlib:binary_to_integer(Val) of
case catch binary_to_integer(Val) of
N when is_integer(N) -> N;
_ ->
Txt = <<"Value of '~s' should be integer">>,
@ -190,7 +190,7 @@ val_xfield(subscription_type, [<<"items">>]) -> items;
val_xfield(subscription_type, [<<"nodes">>]) -> nodes;
val_xfield(subscription_depth, [<<"all">>]) -> all;
val_xfield(subscription_depth = Opt, [Depth]) ->
case catch jlib:binary_to_integer(Depth) of
case catch binary_to_integer(Depth) of
N when is_integer(N) -> N;
_ ->
Txt = <<"Value of '~s' should be integer">>,

View File

@ -36,5 +36,5 @@ start() ->
get_string() ->
R = crypto:rand_uniform(0, 16#10000000000000000),
jlib:integer_to_binary(R).
integer_to_binary(R).

View File

@ -6686,8 +6686,8 @@ enc_tzo({H, M}) ->
dec_tzo(Val) ->
[H1, M1] = str:tokens(Val, <<":">>),
H = jlib:binary_to_integer(H1),
M = jlib:binary_to_integer(M1),
H = binary_to_integer(H1),
M = binary_to_integer(M1),
if H >= -12, H =< 12, M >= 0, M < 60 -> {H, M} end.
decode_thumbnail(__TopXMLNS, __IgnoreEls,

View File

@ -3390,8 +3390,8 @@
-spec dec_tzo(_) -> {integer(), integer()}.
dec_tzo(Val) ->
[H1, M1] = str:tokens(Val, <<":">>),
H = jlib:binary_to_integer(H1),
M = jlib:binary_to_integer(M1),
H = binary_to_integer(H1),
M = binary_to_integer(M1),
if H >= -12, H =< 12, M >= 0, M < 60 ->
{H, M}
end.