25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Avoid using 64-bit unsigned integers

This commit is contained in:
Evgeny Khramtsov 2019-10-29 13:27:59 +03:00
parent f51ba687e2
commit 86c4f76c51

View File

@ -77,11 +77,11 @@ send_non_existent(Config) ->
disconnect(Config). disconnect(Config).
view_non_existent(Config) -> view_non_existent(Config) ->
#stanza_error{reason = 'item-not-found'} = view(Config, [p1_rand:get_string()], false), #stanza_error{reason = 'item-not-found'} = view(Config, [rand_string()], false),
disconnect(Config). disconnect(Config).
remove_non_existent(Config) -> remove_non_existent(Config) ->
ok = remove(Config, [p1_rand:get_string()]), ok = remove(Config, [rand_string()]),
disconnect(Config). disconnect(Config).
view_non_integer(Config) -> view_non_integer(Config) ->
@ -93,7 +93,7 @@ remove_non_integer(Config) ->
disconnect(Config). disconnect(Config).
malformed_iq(Config) -> malformed_iq(Config) ->
Item = #offline_item{node = p1_rand:get_string()}, Item = #offline_item{node = rand_string()},
Range = [{Type, SubEl} || Type <- [set, get], Range = [{Type, SubEl} || Type <- [set, get],
SubEl <- [#offline{items = [], _ = false}, SubEl <- [#offline{items = [], _ = false},
#offline{items = [Item], _ = true}]] #offline{items = [Item], _ = true}]]
@ -112,7 +112,7 @@ malformed_iq(Config) ->
wrong_user(Config) -> wrong_user(Config) ->
Server = ?config(server, Config), Server = ?config(server, Config),
To = jid:make(<<"foo">>, Server), To = jid:make(<<"foo">>, Server),
Item = #offline_item{node = p1_rand:get_string()}, Item = #offline_item{node = rand_string()},
Range = [{Type, Items, Purge, Fetch} || Range = [{Type, Items, Purge, Fetch} ||
Type <- [set, get], Type <- [set, get],
Items <- [[], [Item]], Items <- [[], [Item]],
@ -130,7 +130,7 @@ wrong_user(Config) ->
disconnect(Config). disconnect(Config).
unsupported_iq(Config) -> unsupported_iq(Config) ->
Item = #offline_item{node = p1_rand:get_string()}, Item = #offline_item{node = rand_string()},
lists:foreach( lists:foreach(
fun(Type) -> fun(Type) ->
#iq{type = error} = Err = #iq{type = error} = Err =
@ -495,7 +495,7 @@ message_iterator(Config) ->
Offline = [[#offline{}]], Offline = [[#offline{}]],
Hints = [[#hint{type = T}] || T <- [store, 'no-store']], Hints = [[#hint{type = T}] || T <- [store, 'no-store']],
XEvent = [[#xevent{id = ID, offline = OfflineFlag}] XEvent = [[#xevent{id = ID, offline = OfflineFlag}]
|| ID <- [undefined, p1_rand:get_string()], || ID <- [undefined, rand_string()],
OfflineFlag <- [false, true]], OfflineFlag <- [false, true]],
Delay = [[#delay{stamp = p1_time_compat:timestamp(), from = ServerJID}]], Delay = [[#delay{stamp = p1_time_compat:timestamp(), from = ServerJID}]],
AllEls = [Els1 ++ Els2 || Els1 <- [[]] ++ ChatStates ++ Delay ++ Hints ++ Offline, AllEls = [Els1 ++ Els2 || Els1 <- [[]] ++ ChatStates ++ Delay ++ Hints ++ Offline,
@ -520,3 +520,6 @@ message_iterator(Config) ->
(#message{type = Type}) -> (Type == chat) or (Type == normal); (#message{type = Type}) -> (Type == chat) or (Type == normal);
(_) -> false (_) -> false
end, All). end, All).
rand_string() ->
integer_to_binary(p1_rand:uniform((1 bsl 63)-1)).