diff --git a/src/cyrsasl_anonymous.erl b/src/cyrsasl_anonymous.erl index 802e1cd7b..15980afc5 100644 --- a/src/cyrsasl_anonymous.erl +++ b/src/cyrsasl_anonymous.erl @@ -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}]} diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index d89290d47..02540259a 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -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. diff --git a/src/ejabberd_captcha.erl b/src/ejabberd_captcha.erl index df74a68b1..9650f3773 100644 --- a/src/ejabberd_captcha.erl +++ b/src/ejabberd_captcha.erl @@ -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). diff --git a/src/ejabberd_commands_doc.erl b/src/ejabberd_commands_doc.erl index dc00c5d2a..477e4f5d5 100644 --- a/src/ejabberd_commands_doc.erl +++ b/src/ejabberd_commands_doc.erl @@ -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)), diff --git a/src/ejabberd_http.erl b/src/ejabberd_http.erl index 1c8de2fbf..35679ccd3 100644 --- a/src/ejabberd_http.erl +++ b/src/ejabberd_http.erl @@ -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' -> <<"">>; diff --git a/src/ejabberd_http_bind.erl b/src/ejabberd_http_bind.erl index 1a238607a..20edaa178 100644 --- a/src/ejabberd_http_bind.erl +++ b/src/ejabberd_http_bind.erl @@ -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}; diff --git a/src/ejabberd_sm_sql.erl b/src/ejabberd_sm_sql.erl index 28796aca0..2a7b80c19 100644 --- a/src/ejabberd_sm_sql.erl +++ b/src/ejabberd_sm_sql.erl @@ -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), diff --git a/src/ejabberd_sql.erl b/src/ejabberd_sql.erl index a480a1bd3..8116d617f 100644 --- a/src/ejabberd_sql.erl +++ b/src/ejabberd_sql.erl @@ -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], diff --git a/src/ejabberd_system_monitor.erl b/src/ejabberd_system_monitor.erl index 7f815a57e..df6af1c95 100644 --- a/src/ejabberd_system_monitor.erl +++ b/src/ejabberd_system_monitor.erl @@ -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()); diff --git a/src/ejabberd_web_admin.erl b/src/ejabberd_web_admin.erl index 2740e2879..498fcf9b0 100644 --- a/src/ejabberd_web_admin.erl +++ b/src/ejabberd_web_admin.erl @@ -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]) diff --git a/src/jd2ejd.erl b/src/jd2ejd.erl index 037d6d63a..fd70f8b1e 100644 --- a/src/jd2ejd.erl +++ b/src/jd2ejd.erl @@ -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 -> diff --git a/src/jlib.erl b/src/jlib.erl index 532a74610..b79b8fa7c 100644 --- a/src/jlib.erl +++ b/src/jlib.erl @@ -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"). diff --git a/src/mod_caps.erl b/src/mod_caps.erl index ae11ab651..4d9bdd61f 100644 --- a/src/mod_caps.erl +++ b/src/mod_caps.erl @@ -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, diff --git a/src/mod_caps_sql.erl b/src/mod_caps_sql.erl index 5faff98b6..dde301575 100644 --- a/src/mod_caps_sql.erl +++ b/src/mod_caps_sql.erl @@ -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, diff --git a/src/mod_configure.erl b/src/mod_configure.erl index dd361028b..5e2ff351c 100644 --- a/src/mod_configure.erl +++ b/src/mod_configure.erl @@ -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 <<"">> -> []; diff --git a/src/mod_http_api.erl b/src/mod_http_api.erl index f3a69aa80..1578be964 100644 --- a/src/mod_http_api.erl +++ b/src/mod_http_api.erl @@ -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; _ -> diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl index f1f5d8173..6ad18531c 100644 --- a/src/mod_http_upload.erl +++ b/src/mod_http_upload.erl @@ -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]}, diff --git a/src/mod_last_sql.erl b/src/mod_last_sql.erl index 13b028c6f..718f01dff 100644 --- a/src/mod_last_sql.erl +++ b/src/mod_last_sql.erl @@ -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}]. diff --git a/src/mod_mam_mnesia.erl b/src/mod_mam_mnesia.erl index ecaa4d053..e913d5a45 100644 --- a/src/mod_mam_mnesia.erl +++ b/src/mod_mam_mnesia.erl @@ -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}, diff --git a/src/mod_mam_sql.erl b/src/mod_mam_sql.erl index 2a0dcce95..1491f70f2 100644 --- a/src/mod_mam_sql.erl +++ b/src/mod_mam_sql.erl @@ -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, diff --git a/src/mod_muc_admin.erl b/src/mod_muc_admin.erl index a7ba16138..4d56093e1 100644 --- a/src/mod_muc_admin.erl +++ b/src/mod_muc_admin.erl @@ -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). diff --git a/src/mod_offline.erl b/src/mod_offline.erl index 9c062065d..258c97d4f 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -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; diff --git a/src/mod_privacy_sql.erl b/src/mod_privacy_sql.erl index a1f743657..7ca19b5e9 100644 --- a/src/mod_privacy_sql.erl +++ b/src/mod_privacy_sql.erl @@ -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, diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index f7e1a9834..b55115c9a 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -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)); diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl index 8b620514b..45d91bccd 100644 --- a/src/mod_shared_roster.erl +++ b/src/mod_shared_roster.erl @@ -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">>)), diff --git a/src/mod_vcard_sql.erl b/src/mod_vcard_sql.erl index f8ac6be97..129f76b5a 100644 --- a/src/mod_vcard_sql.erl +++ b/src/mod_vcard_sql.erl @@ -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, diff --git a/src/pubsub_db_sql.erl b/src/pubsub_db_sql.erl index a6f8888a9..69b476539 100644 --- a/src/pubsub_db_sql.erl +++ b/src/pubsub_db_sql.erl @@ -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">>. diff --git a/src/pubsub_subscription.erl b/src/pubsub_subscription.erl index 33c884afb..de1a363db 100644 --- a/src/pubsub_subscription.erl +++ b/src/pubsub_subscription.erl @@ -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">>, diff --git a/src/pubsub_subscription_sql.erl b/src/pubsub_subscription_sql.erl index 7c0670957..32aa41a93 100644 --- a/src/pubsub_subscription_sql.erl +++ b/src/pubsub_subscription_sql.erl @@ -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">>, diff --git a/src/randoms.erl b/src/randoms.erl index 52fceef4e..60d0b4e3d 100644 --- a/src/randoms.erl +++ b/src/randoms.erl @@ -36,5 +36,5 @@ start() -> get_string() -> R = crypto:rand_uniform(0, 16#10000000000000000), - jlib:integer_to_binary(R). + integer_to_binary(R). diff --git a/src/xmpp_codec.erl b/src/xmpp_codec.erl index bffe2f1ad..a0181e1e6 100644 --- a/src/xmpp_codec.erl +++ b/src/xmpp_codec.erl @@ -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, diff --git a/tools/xmpp_codec.spec b/tools/xmpp_codec.spec index ba402969e..6824cf387 100644 --- a/tools/xmpp_codec.spec +++ b/tools/xmpp_codec.spec @@ -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.