From 3816385ba44d0cb9a49703569cda3114dbe9f5d8 Mon Sep 17 00:00:00 2001 From: RTB CI Bot <42817598+adroll-rtb-ci@users.noreply.github.com> Date: Mon, 13 Jun 2022 09:09:07 +0200 Subject: [PATCH 01/10] Update dependencies (#67) --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 1d26e8a..e97ed8a 100644 --- a/rebar.config +++ b/rebar.config @@ -8,7 +8,7 @@ {cover_opts, [verbose]}. {project_plugins, - [{rebar3_hex, "~> 7.0.1"}, + [{rebar3_hex, "~> 7.0.2"}, {rebar3_format, "~> 1.2.1"}, {rebar3_lint, "~> 1.1.0"}, {rebar3_hank, "~> 1.3.0"}]}. From 848dd7e160b5bf4913fd1c5c52840c3762b08469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Costas=20S=C3=A1nchez?= Date: Thu, 30 Jun 2022 15:40:11 +0200 Subject: [PATCH 02/10] [RTI-11279] Switch to jiffy from mochijson (#68) --- rebar.config | 4 +- rebar.lock | 2 +- src/dinerl_client.erl | 4 +- src/dmochijson2.erl | 840 ------------------------------------------ src/dmochinum.erl | 331 ----------------- 5 files changed, 5 insertions(+), 1176 deletions(-) delete mode 100644 src/dmochijson2.erl delete mode 100644 src/dmochinum.erl diff --git a/rebar.config b/rebar.config index e97ed8a..fd7408b 100644 --- a/rebar.config +++ b/rebar.config @@ -1,7 +1,7 @@ {erl_opts, [warn_unused_import, warn_export_vars, warnings_as_errors, verbose, report, debug_info]}. -{deps, [{lhttpc, "1.3.1", {pkg, nextroll_lhttpc}}, {erliam, "0.4.1"}]}. +{deps, [{lhttpc, "1.3.1", {pkg, nextroll_lhttpc}}, {erliam, "0.4.1"}, {jiffy, "1.1.1"}]}. {cover_enabled, true}. @@ -17,7 +17,7 @@ [{warnings, [unknown, no_return, error_handling]}, {get_warnings, true}, {plt_apps, top_level_deps}, - {plt_extra_apps, []}, + {plt_extra_apps, [jiffy]}, {plt_location, local}, {base_plt_apps, [erts, stdlib, kernel]}, {base_plt_location, global}]}. diff --git a/rebar.lock b/rebar.lock index c36b925..800f856 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,6 +1,6 @@ {"1.2.0", [{<<"erliam">>,{pkg,<<"erliam">>,<<"0.4.1">>},0}, - {<<"jiffy">>,{pkg,<<"jiffy">>,<<"1.1.1">>},1}, + {<<"jiffy">>,{pkg,<<"jiffy">>,<<"1.1.1">>},0}, {<<"lhttpc">>,{pkg,<<"nextroll_lhttpc">>,<<"1.3.1">>},0}]}. [ {pkg_hash,[ diff --git a/src/dinerl_client.erl b/src/dinerl_client.erl index 4b1aad1..1f0c13c 100644 --- a/src/dinerl_client.erl +++ b/src/dinerl_client.erl @@ -57,11 +57,11 @@ api(Credentials, Zone, ISODate, Name, Body, Timeout) -> Zone, method_name(Name), ISODate, - dmochijson2:encode(Body), + jiffy:encode(Body), Timeout) of {ok, Response} -> - {ok, dmochijson2:decode(Response)}; + {ok, jiffy:decode(Response)}; {error, Code, Reason} -> {error, Code, Reason} end. diff --git a/src/dmochijson2.erl b/src/dmochijson2.erl deleted file mode 100644 index f31ad77..0000000 --- a/src/dmochijson2.erl +++ /dev/null @@ -1,840 +0,0 @@ -%% @author Bob Ippolito -%% @copyright 2007 Mochi Media, Inc. - -%% @doc Yet another JSON (RFC 4627) library for Erlang. mochijson2 works -%% with binaries as strings, arrays as lists (without an {array, _}) -%% wrapper and it only knows how to decode UTF-8 (and ASCII). -%% -%% JSON terms are decoded as follows (javascript -> erlang): -%% -%% -%% The encoder will accept the same format that the decoder will produce, -%% but will also allow additional cases for leniency: -%% - --module(dmochijson2). - --author('bob@mochimedia.com'). - --export([encoder/1, encode/1]). --export([decoder/1, decode/1, decode/2]). - -%% This is a macro to placate syntax highlighters.. --define(Q, $\"). --define(ADV_COL(S, N), - S#decoder{offset = N + S#decoder.offset, column = N + S#decoder.column}). --define(INC_COL(S), - S#decoder{offset = 1 + S#decoder.offset, column = 1 + S#decoder.column}). --define(INC_CHAR(S, C), - case C of - $\n -> - S#decoder{column = 1, - line = 1 + S#decoder.line, - offset = 1 + S#decoder.offset}; - _ -> - S#decoder{column = 1 + S#decoder.column, offset = 1 + S#decoder.offset} - end). --define(IS_WHITESPACE(C), C =:= $\s orelse C =:= $\t orelse C =:= $\r orelse C =:= $\n). - --type json_string() :: atom | binary(). --type json_number() :: integer() | float(). --type json_array() :: [json_term()]. --type json_object() :: {struct, [{json_string(), json_term()}]}. --type json_eep18_object() :: {[{json_string(), json_term()}]}. --type json_iodata() :: {json, iodata()}. --type json_term() :: - json_string() | - json_number() | - json_array() | - json_object() | - json_eep18_object() | - json_iodata(). - --record(encoder, {handler = null, utf8 = false}). --record(decoder, {object_hook = null, offset = 0, line = 1, column = 1, state = null}). - -%% @spec encoder([encoder_option()]) -> function() -%% @doc Create an encoder/1 with the given options. -%% @type encoder_option() = handler_option() | utf8_option() -%% @type utf8_option() = boolean(). Emit unicode as utf8 (default - false) -encoder(Options) -> - State = parse_encoder_options(Options, #encoder{}), - fun(O) -> json_encode(O, State) end. - -%% @spec encode(json_term()) -> iodata() -%% @doc Encode the given as JSON to an iodata. --spec encode(json_term()) -> iodata(). -encode(Any) -> - json_encode(Any, #encoder{}). - -%% @spec decoder([decoder_option()]) -> function() -%% @doc Create a decoder/1 with the given options. -decoder(Options) -> - State = parse_decoder_options(Options, #decoder{}), - fun(O) -> json_decode(O, State) end. - -%% @spec decode(iodata(), [{format, proplist | eep18 | struct}]) -> json_term() -%% @doc Decode the given iodata to Erlang terms using the given object format -%% for decoding, where proplist returns JSON objects as [{binary(), json_term()}] -%% proplists, eep18 returns JSON objects as {[binary(), json_term()]}, and struct -%% returns them as-is. -decode(S, Options) -> - json_decode(S, parse_decoder_options(Options, #decoder{})). - -%% @spec decode(iodata()) -> json_term() -%% @doc Decode the given iodata to Erlang terms. -decode(S) -> - json_decode(S, #decoder{}). - -%% Internal API - -parse_encoder_options([], State) -> - State; -parse_encoder_options([{handler, Handler} | Rest], State) -> - parse_encoder_options(Rest, State#encoder{handler = Handler}); -parse_encoder_options([{utf8, Switch} | Rest], State) -> - parse_encoder_options(Rest, State#encoder{utf8 = Switch}). - -parse_decoder_options([], State) -> - State; -parse_decoder_options([{object_hook, Hook} | Rest], State) -> - parse_decoder_options(Rest, State#decoder{object_hook = Hook}); -parse_decoder_options([{format, Format} | Rest], State) - when Format =:= struct orelse Format =:= eep18 orelse Format =:= proplist -> - parse_decoder_options(Rest, State#decoder{object_hook = Format}). - -json_encode(true, _State) -> - <<"true">>; -json_encode(false, _State) -> - <<"false">>; -json_encode(null, _State) -> - <<"null">>; -json_encode(I, _State) when is_integer(I) -> - integer_to_list(I); -json_encode(F, _State) when is_float(F) -> - dmochinum:digits(F); -json_encode(S, State) when is_binary(S); is_atom(S) -> - json_encode_string(S, State); -json_encode([{K, _} | _] = Props, State) - when K =/= struct andalso K =/= array andalso K =/= json -> - json_encode_proplist(Props, State); -json_encode({struct, Props}, State) when is_list(Props) -> - json_encode_proplist(Props, State); -json_encode({Props}, State) when is_list(Props) -> - json_encode_proplist(Props, State); -json_encode({}, State) -> - json_encode_proplist([], State); -json_encode(Array, State) when is_list(Array) -> - json_encode_array(Array, State); -json_encode({array, Array}, State) when is_list(Array) -> - json_encode_array(Array, State); -json_encode({json, IoList}, _State) -> - IoList; -json_encode(Bad, #encoder{handler = null}) -> - exit({json_encode, {bad_term, Bad}}); -json_encode(Bad, State = #encoder{handler = Handler}) -> - json_encode(Handler(Bad), State). - -json_encode_array([], _State) -> - <<"[]">>; -json_encode_array(L, State) -> - F = fun(O, Acc) -> [$,, json_encode(O, State) | Acc] end, - [$, | Acc1] = lists:foldl(F, "[", L), - lists:reverse([$\] | Acc1]). - -json_encode_proplist([], _State) -> - <<"{}">>; -json_encode_proplist(Props, State) -> - F = fun({K, V}, Acc) -> - KS = json_encode_string(K, State), - VS = json_encode(V, State), - [$,, VS, $:, KS | Acc] - end, - [$, | Acc1] = lists:foldl(F, "{", Props), - lists:reverse([$\} | Acc1]). - -json_encode_string(A, State) when is_atom(A) -> - L = atom_to_list(A), - case json_string_is_safe(L) of - true -> - [?Q, L, ?Q]; - false -> - json_encode_string_unicode(xmerl_ucs:from_utf8(L), State, [?Q]) - end; -json_encode_string(B, State) when is_binary(B) -> - case json_bin_is_safe(B) of - true -> - [?Q, B, ?Q]; - false -> - json_encode_string_unicode(xmerl_ucs:from_utf8(B), State, [?Q]) - end; -json_encode_string(I, _State) when is_integer(I) -> - [?Q, integer_to_list(I), ?Q]; -json_encode_string(L, State) when is_list(L) -> - case json_string_is_safe(L) of - true -> - [?Q, L, ?Q]; - false -> - json_encode_string_unicode(L, State, [?Q]) - end. - -json_string_is_safe([]) -> - true; -json_string_is_safe([C | Rest]) -> - case C of - ?Q -> - false; - $\\ -> - false; - $\b -> - false; - $\f -> - false; - $\n -> - false; - $\r -> - false; - $\t -> - false; - C when C >= 0, C < $\s; C >= 16#7f, C =< 16#10FFFF -> - false; - C when C < 16#7f -> - json_string_is_safe(Rest); - _ -> - false - end. - -json_bin_is_safe(<<>>) -> - true; -json_bin_is_safe(<>) -> - case C of - ?Q -> - false; - $\\ -> - false; - $\b -> - false; - $\f -> - false; - $\n -> - false; - $\r -> - false; - $\t -> - false; - C when C >= 0, C < $\s; C >= 16#7f -> - false; - C when C < 16#7f -> - json_bin_is_safe(Rest) - end. - -json_encode_string_unicode([], _State, Acc) -> - lists:reverse([$\" | Acc]); -json_encode_string_unicode([C | Cs], State, Acc) -> - Acc1 = - case C of - ?Q -> - [?Q, $\\ | Acc]; - %% Escaping solidus is only useful when trying to protect - %% against "" injection attacks which are only - %% possible when JSON is inserted into a HTML document - %% in-line. mochijson2 does not protect you from this, so - %% if you do insert directly into HTML then you need to - %% uncomment the following case or escape the output of encode. - %% - %% $/ -> - %% [$/, $\\ | Acc]; - %% - $\\ -> - [$\\, $\\ | Acc]; - $\b -> - [$b, $\\ | Acc]; - $\f -> - [$f, $\\ | Acc]; - $\n -> - [$n, $\\ | Acc]; - $\r -> - [$r, $\\ | Acc]; - $\t -> - [$t, $\\ | Acc]; - C when C >= 0, C < $\s -> - [unihex(C) | Acc]; - C when C >= 16#7f, C =< 16#10FFFF, State#encoder.utf8 -> - [xmerl_ucs:to_utf8(C) | Acc]; - C when C >= 16#7f, C =< 16#10FFFF, not State#encoder.utf8 -> - [unihex(C) | Acc]; - C when C < 16#7f -> - [C | Acc]; - _ -> - exit({json_encode, {bad_char, C}}) - end, - json_encode_string_unicode(Cs, State, Acc1). - -hexdigit(C) when C >= 0, C =< 9 -> - C + $0; -hexdigit(C) when C =< 15 -> - C + $a - 10. - -unihex(C) when C < 16#10000 -> - <> = <>, - Digits = [hexdigit(D) || D <- [D3, D2, D1, D0]], - [$\\, $u | Digits]; -unihex(C) when C =< 16#10FFFF -> - N = C - 16#10000, - S1 = 16#d800 bor (N bsr 10) band 16#3ff, - S2 = 16#dc00 bor N band 16#3ff, - [unihex(S1), unihex(S2)]. - -json_decode(L, S) when is_list(L) -> - json_decode(iolist_to_binary(L), S); -json_decode(B, S) -> - {Res, S1} = decode1(B, S), - {eof, _} = tokenize(B, S1#decoder{state = trim}), - Res. - -decode1(B, S = #decoder{state = null}) -> - case tokenize(B, S#decoder{state = any}) of - {{const, C}, S1} -> - {C, S1}; - {start_array, S1} -> - decode_array(B, S1); - {start_object, S1} -> - decode_object(B, S1) - end. - -make_object(V, #decoder{object_hook = N}) when N =:= null orelse N =:= struct -> - V; -make_object({struct, P}, #decoder{object_hook = eep18}) -> - {P}; -make_object({struct, P}, #decoder{object_hook = proplist}) -> - P; -make_object(V, #decoder{object_hook = Hook}) -> - Hook(V). - -decode_object(B, S) -> - decode_object(B, S#decoder{state = key}, []). - -decode_object(B, S = #decoder{state = key}, Acc) -> - case tokenize(B, S) of - {end_object, S1} -> - V = make_object({struct, lists:reverse(Acc)}, S1), - {V, S1#decoder{state = null}}; - {{const, K}, S1} -> - {colon, S2} = tokenize(B, S1), - {V, S3} = decode1(B, S2#decoder{state = null}), - decode_object(B, S3#decoder{state = comma}, [{K, V} | Acc]) - end; -decode_object(B, S = #decoder{state = comma}, Acc) -> - case tokenize(B, S) of - {end_object, S1} -> - V = make_object({struct, lists:reverse(Acc)}, S1), - {V, S1#decoder{state = null}}; - {comma, S1} -> - decode_object(B, S1#decoder{state = key}, Acc) - end. - -decode_array(B, S) -> - decode_array(B, S#decoder{state = any}, []). - -decode_array(B, S = #decoder{state = any}, Acc) -> - case tokenize(B, S) of - {end_array, S1} -> - {lists:reverse(Acc), S1#decoder{state = null}}; - {start_array, S1} -> - {Array, S2} = decode_array(B, S1), - decode_array(B, S2#decoder{state = comma}, [Array | Acc]); - {start_object, S1} -> - {Array, S2} = decode_object(B, S1), - decode_array(B, S2#decoder{state = comma}, [Array | Acc]); - {{const, Const}, S1} -> - decode_array(B, S1#decoder{state = comma}, [Const | Acc]) - end; -decode_array(B, S = #decoder{state = comma}, Acc) -> - case tokenize(B, S) of - {end_array, S1} -> - {lists:reverse(Acc), S1#decoder{state = null}}; - {comma, S1} -> - decode_array(B, S1#decoder{state = any}, Acc) - end. - -tokenize_string(B, S = #decoder{offset = O}) -> - case tokenize_string_fast(B, O) of - {escape, O1} -> - Length = O1 - O, - S1 = ?ADV_COL(S, Length), - <<_:O/binary, Head:Length/binary, _/binary>> = B, - tokenize_string(B, S1, lists:reverse(binary_to_list(Head))); - O1 -> - Length = O1 - O, - <<_:O/binary, String:Length/binary, ?Q, _/binary>> = B, - {{const, String}, ?ADV_COL(S, Length + 1)} - end. - -tokenize_string_fast(B, O) -> - case B of - <<_:O/binary, ?Q, _/binary>> -> - O; - <<_:O/binary, $\\, _/binary>> -> - {escape, O}; - <<_:O/binary, C1, _/binary>> when C1 < 128 -> - tokenize_string_fast(B, 1 + O); - <<_:O/binary, C1, C2, _/binary>> - when C1 >= 194 andalso C1 =< 223, C2 >= 128 andalso C2 =< 191 -> - tokenize_string_fast(B, 2 + O); - <<_:O/binary, C1, C2, C3, _/binary>> - when C1 >= 224 andalso C1 =< 239, C2 >= 128 andalso C2 =< 191, - C3 >= 128 andalso C3 =< 191 -> - tokenize_string_fast(B, 3 + O); - <<_:O/binary, C1, C2, C3, C4, _/binary>> - when C1 >= 240 andalso C1 =< 244, C2 >= 128 andalso C2 =< 191, - C3 >= 128 andalso C3 =< 191, C4 >= 128 andalso C4 =< 191 -> - tokenize_string_fast(B, 4 + O); - _ -> - error(invalid_utf8) - end. - -tokenize_string(B, S = #decoder{offset = O}, Acc) -> - case B of - <<_:O/binary, ?Q, _/binary>> -> - {{const, iolist_to_binary(lists:reverse(Acc))}, ?INC_COL(S)}; - <<_:O/binary, "\\\"", _/binary>> -> - tokenize_string(B, ?ADV_COL(S, 2), [$\" | Acc]); - <<_:O/binary, "\\\\", _/binary>> -> - tokenize_string(B, ?ADV_COL(S, 2), [$\\ | Acc]); - <<_:O/binary, "\\/", _/binary>> -> - tokenize_string(B, ?ADV_COL(S, 2), [$/ | Acc]); - <<_:O/binary, "\\b", _/binary>> -> - tokenize_string(B, ?ADV_COL(S, 2), [$\b | Acc]); - <<_:O/binary, "\\f", _/binary>> -> - tokenize_string(B, ?ADV_COL(S, 2), [$\f | Acc]); - <<_:O/binary, "\\n", _/binary>> -> - tokenize_string(B, ?ADV_COL(S, 2), [$\n | Acc]); - <<_:O/binary, "\\r", _/binary>> -> - tokenize_string(B, ?ADV_COL(S, 2), [$\r | Acc]); - <<_:O/binary, "\\t", _/binary>> -> - tokenize_string(B, ?ADV_COL(S, 2), [$\t | Acc]); - <<_:O/binary, "\\u", C3, C2, C1, C0, Rest/binary>> -> - case erlang:list_to_integer([C3, C2, C1, C0], 16) of - C when C > 16#D7FF, C < 16#DC00 -> - %% coalesce UTF-16 surrogate pair - <<"\\u", D3, D2, D1, D0, _/binary>> = Rest, - D = erlang:list_to_integer([D3, D2, D1, D0], 16), - [CodePoint] = - xmerl_ucs:from_utf16be(<>), - Acc1 = - lists:reverse( - xmerl_ucs:to_utf8(CodePoint), Acc), - tokenize_string(B, ?ADV_COL(S, 12), Acc1); - C -> - Acc1 = - lists:reverse( - xmerl_ucs:to_utf8(C), Acc), - tokenize_string(B, ?ADV_COL(S, 6), Acc1) - end; - <<_:O/binary, C1, _/binary>> when C1 < 128 -> - tokenize_string(B, ?INC_CHAR(S, C1), [C1 | Acc]); - <<_:O/binary, C1, C2, _/binary>> - when C1 >= 194 andalso C1 =< 223, C2 >= 128 andalso C2 =< 191 -> - tokenize_string(B, ?ADV_COL(S, 2), [C2, C1 | Acc]); - <<_:O/binary, C1, C2, C3, _/binary>> - when C1 >= 224 andalso C1 =< 239, C2 >= 128 andalso C2 =< 191, - C3 >= 128 andalso C3 =< 191 -> - tokenize_string(B, ?ADV_COL(S, 3), [C3, C2, C1 | Acc]); - <<_:O/binary, C1, C2, C3, C4, _/binary>> - when C1 >= 240 andalso C1 =< 244, C2 >= 128 andalso C2 =< 191, - C3 >= 128 andalso C3 =< 191, C4 >= 128 andalso C4 =< 191 -> - tokenize_string(B, ?ADV_COL(S, 4), [C4, C3, C2, C1 | Acc]); - _ -> - error(invalid_utf8) - end. - -tokenize_number(B, S) -> - case tokenize_number(B, sign, S, []) of - {{int, Int}, S1} -> - {{const, list_to_integer(Int)}, S1}; - {{float, Float}, S1} -> - {{const, list_to_float(Float)}, S1} - end. - -tokenize_number(B, sign, S = #decoder{offset = O}, []) -> - case B of - <<_:O/binary, $-, _/binary>> -> - tokenize_number(B, int, ?INC_COL(S), [$-]); - _ -> - tokenize_number(B, int, S, []) - end; -tokenize_number(B, int, S = #decoder{offset = O}, Acc) -> - case B of - <<_:O/binary, $0, _/binary>> -> - tokenize_number(B, frac, ?INC_COL(S), [$0 | Acc]); - <<_:O/binary, C, _/binary>> when C >= $1 andalso C =< $9 -> - tokenize_number(B, int1, ?INC_COL(S), [C | Acc]) - end; -tokenize_number(B, int1, S = #decoder{offset = O}, Acc) -> - case B of - <<_:O/binary, C, _/binary>> when C >= $0 andalso C =< $9 -> - tokenize_number(B, int1, ?INC_COL(S), [C | Acc]); - _ -> - tokenize_number(B, frac, S, Acc) - end; -tokenize_number(B, frac, S = #decoder{offset = O}, Acc) -> - case B of - <<_:O/binary, $., C, _/binary>> when C >= $0, C =< $9 -> - tokenize_number(B, frac1, ?ADV_COL(S, 2), [C, $. | Acc]); - <<_:O/binary, E, _/binary>> when E =:= $e orelse E =:= $E -> - tokenize_number(B, esign, ?INC_COL(S), [$e, $0, $. | Acc]); - _ -> - {{int, lists:reverse(Acc)}, S} - end; -tokenize_number(B, frac1, S = #decoder{offset = O}, Acc) -> - case B of - <<_:O/binary, C, _/binary>> when C >= $0 andalso C =< $9 -> - tokenize_number(B, frac1, ?INC_COL(S), [C | Acc]); - <<_:O/binary, E, _/binary>> when E =:= $e orelse E =:= $E -> - tokenize_number(B, esign, ?INC_COL(S), [$e | Acc]); - _ -> - {{float, lists:reverse(Acc)}, S} - end; -tokenize_number(B, esign, S = #decoder{offset = O}, Acc) -> - case B of - <<_:O/binary, C, _/binary>> when C =:= $- orelse C =:= $+ -> - tokenize_number(B, eint, ?INC_COL(S), [C | Acc]); - _ -> - tokenize_number(B, eint, S, Acc) - end; -tokenize_number(B, eint, S = #decoder{offset = O}, Acc) -> - case B of - <<_:O/binary, C, _/binary>> when C >= $0 andalso C =< $9 -> - tokenize_number(B, eint1, ?INC_COL(S), [C | Acc]) - end; -tokenize_number(B, eint1, S = #decoder{offset = O}, Acc) -> - case B of - <<_:O/binary, C, _/binary>> when C >= $0 andalso C =< $9 -> - tokenize_number(B, eint1, ?INC_COL(S), [C | Acc]); - _ -> - {{float, lists:reverse(Acc)}, S} - end. - -tokenize(B, S = #decoder{offset = O}) -> - case B of - <<_:O/binary, C, _/binary>> when ?IS_WHITESPACE(C) -> - tokenize(B, ?INC_CHAR(S, C)); - <<_:O/binary, "{", _/binary>> -> - {start_object, ?INC_COL(S)}; - <<_:O/binary, "}", _/binary>> -> - {end_object, ?INC_COL(S)}; - <<_:O/binary, "[", _/binary>> -> - {start_array, ?INC_COL(S)}; - <<_:O/binary, "]", _/binary>> -> - {end_array, ?INC_COL(S)}; - <<_:O/binary, ",", _/binary>> -> - {comma, ?INC_COL(S)}; - <<_:O/binary, ":", _/binary>> -> - {colon, ?INC_COL(S)}; - <<_:O/binary, "null", _/binary>> -> - {{const, null}, ?ADV_COL(S, 4)}; - <<_:O/binary, "true", _/binary>> -> - {{const, true}, ?ADV_COL(S, 4)}; - <<_:O/binary, "false", _/binary>> -> - {{const, false}, ?ADV_COL(S, 5)}; - <<_:O/binary, "\"", _/binary>> -> - tokenize_string(B, ?INC_COL(S)); - <<_:O/binary, C, _/binary>> when C >= $0 andalso C =< $9 orelse C =:= $- -> - tokenize_number(B, S); - <<_:O/binary>> -> - trim = S#decoder.state, - {eof, S} - end. - -%% -%% Tests -%% --ifdef(TEST). - --include_lib("eunit/include/eunit.hrl"). - -%% testing constructs borrowed from the Yaws JSON implementation. - -%% Create an object from a list of Key/Value pairs. - -obj_new() -> - {struct, []}. - -is_obj({struct, Props}) -> - F = fun({K, _}) when is_binary(K) -> true end, - lists:all(F, Props). - -obj_from_list(Props) -> - Obj = {struct, Props}, - ?assert(is_obj(Obj)), - Obj. - -%% Test for equivalence of Erlang terms. -%% Due to arbitrary order of construction, equivalent objects might -%% compare unequal as erlang terms, so we need to carefully recurse -%% through aggregates (tuples and objects). - -equiv({struct, Props1}, {struct, Props2}) -> - equiv_object(Props1, Props2); -equiv(L1, L2) when is_list(L1), is_list(L2) -> - equiv_list(L1, L2); -equiv(N1, N2) when is_number(N1), is_number(N2) -> - N1 == N2; -equiv(B1, B2) when is_binary(B1), is_binary(B2) -> - B1 == B2; -equiv(A, A) when A =:= true orelse A =:= false orelse A =:= null -> - true. - -%% Object representation and traversal order is unknown. -%% Use the sledgehammer and sort property lists. - -equiv_object(Props1, Props2) -> - L1 = lists:keysort(1, Props1), - L2 = lists:keysort(1, Props2), - Pairs = lists:zip(L1, L2), - true = lists:all(fun({{K1, V1}, {K2, V2}}) -> equiv(K1, K2) and equiv(V1, V2) end, Pairs). - -%% Recursively compare tuple elements for equivalence. - -equiv_list([], []) -> - true; -equiv_list([V1 | L1], [V2 | L2]) -> - equiv(V1, V2) andalso equiv_list(L1, L2). - -decode_test() -> - [1199344435545.0, 1] = decode(<<"[1199344435545.0,1]">>), - <<16#F0, 16#9D, 16#9C, 16#95>> = decode([34, "\\ud835", "\\udf15", 34]). - -e2j_vec_test() -> - test_one(e2j_test_vec(utf8), 1). - -test_one([], _N) -> - %% io:format("~p tests passed~n", [N-1]), - ok; -test_one([{E, J} | Rest], N) -> - %% io:format("[~p] ~p ~p~n", [N, E, J]), - true = equiv(E, decode(J)), - true = equiv(E, decode(encode(E))), - test_one(Rest, 1 + N). - -e2j_test_vec(utf8) -> - [{1, "1"}, - {3.1416, "3.14160"}, %% text representation may truncate, trail zeroes - {-1, "-1"}, - {-3.1416, "-3.14160"}, - {12.0e10, "1.20000e+11"}, - {1.234E+10, "1.23400e+10"}, - {-1.234E-10, "-1.23400e-10"}, - {10.0, "1.0e+01"}, - {123.456, "1.23456E+2"}, - {10.0, "1e1"}, - {<<"foo">>, "\"foo\""}, - {<<"foo", 5, "bar">>, "\"foo\\u0005bar\""}, - {<<"">>, "\"\""}, - {<<"\n\n\n">>, "\"\\n\\n\\n\""}, - {<<"\" \b\f\r\n\t\"">>, "\"\\\" \\b\\f\\r\\n\\t\\\"\""}, - {obj_new(), "{}"}, - {obj_from_list([{<<"foo">>, <<"bar">>}]), "{\"foo\":\"bar\"}"}, - {obj_from_list([{<<"foo">>, <<"bar">>}, {<<"baz">>, 123}]), - "{\"foo\":\"bar\",\"baz\":123}"}, - {[], "[]"}, - {[[]], "[[]]"}, - {[1, <<"foo">>], "[1,\"foo\"]"}, - %% json array in a json object - {obj_from_list([{<<"foo">>, [123]}]), "{\"foo\":[123]}"}, - %% json object in a json object - {obj_from_list([{<<"foo">>, obj_from_list([{<<"bar">>, true}])}]), - "{\"foo\":{\"bar\":true}}"}, - %% fold evaluation order - {obj_from_list([{<<"foo">>, []}, - {<<"bar">>, obj_from_list([{<<"baz">>, true}])}, - {<<"alice">>, <<"bob">>}]), - "{\"foo\":[],\"bar\":{\"baz\":true},\"alice\":\"bob\"}"}, - %% json object in a json array - {[-123, <<"foo">>, obj_from_list([{<<"bar">>, []}]), null], - "[-123,\"foo\",{\"bar\":[]},null]"}]. - -%% test utf8 encoding -encoder_utf8_test() -> - %% safe conversion case (default) - [34, "\\u0001", "\\u0442", "\\u0435", "\\u0441", "\\u0442", 34] = - encode(<<1, "\321\202\320\265\321\201\321\202">>), - - %% raw utf8 output (optional) - Enc = dmochijson2:encoder([{utf8, true}]), - [34, "\\u0001", [209, 130], [208, 181], [209, 129], [209, 130], 34] = - Enc(<<1, "\321\202\320\265\321\201\321\202">>). - -input_validation_test() -> - Good = - [{16#00A3, <>}, %% pound - {16#20AC, <>}, %% euro - {16#10196, <>}], %% denarius - lists:foreach(fun({CodePoint, UTF8}) -> - Expect = list_to_binary(xmerl_ucs:to_utf8(CodePoint)), - Expect = decode(UTF8) - end, - Good), - - Bad = [%% 2nd, 3rd, or 4th byte of a multi-byte sequence w/o leading byte - <>, - %% missing continuations, last byte in each should be 80-BF - <>, - <>, - <>, - %% we don't support code points > 10FFFF per RFC 3629 - <>, - %% escape characters trigger a different code path - <>], - lists:foreach(fun(X) -> - ok = - try - decode(X) - catch - _:invalid_utf8 -> - ok - end, - try encode(X) of - Result -> - exit({unexpected_result, Result}) - catch - _:Error -> - %% could be {ucs,{bad_utf8_character_code}} or - %% {json_encode,{bad_char,_}} - ?assert(is_tuple(Error)) - end - end, - Bad). - -inline_json_test() -> - ?assertEqual(<<"\"iodata iodata\"">>, - iolist_to_binary(encode({json, [<<"\"iodata">>, " iodata\""]}))), - ?assertEqual({struct, [{<<"key">>, <<"iodata iodata">>}]}, - decode(encode({struct, [{key, {json, [<<"\"iodata">>, " iodata\""]}}]}))), - ok. - -big_unicode_test() -> - UTF8Seq = list_to_binary(xmerl_ucs:to_utf8(16#0001d120)), - ?assertEqual(<<"\"\\ud834\\udd20\"">>, iolist_to_binary(encode(UTF8Seq))), - ?assertEqual(UTF8Seq, decode(iolist_to_binary(encode(UTF8Seq)))), - ok. - -custom_decoder_test() -> - ?assertEqual({struct, [{<<"key">>, <<"value">>}]}, (decoder([]))("{\"key\": \"value\"}")), - F = fun({struct, [{<<"key">>, <<"value">>}]}) -> win end, - ?assertEqual(win, (decoder([{object_hook, F}]))("{\"key\": \"value\"}")), - ok. - -atom_test() -> - %% JSON native atoms - lists:foreach(fun(A) -> - ?assertEqual(A, decode(atom_to_list(A))), - ?assertEqual(iolist_to_binary(atom_to_list(A)), iolist_to_binary(encode(A))) - end, - [true, false, null]), - %% Atom to string - ?assertEqual(<<"\"foo\"">>, iolist_to_binary(encode(foo))), - ?assertEqual(<<"\"\\ud834\\udd20\"">>, - iolist_to_binary(encode(list_to_atom(xmerl_ucs:to_utf8(16#0001d120))))), - ok. - -key_encode_test() -> - %% Some forms are accepted as keys that would not be strings in other - %% cases - ?assertEqual(<<"{\"foo\":1}">>, iolist_to_binary(encode({struct, [{foo, 1}]}))), - ?assertEqual(<<"{\"foo\":1}">>, iolist_to_binary(encode({struct, [{<<"foo">>, 1}]}))), - ?assertEqual(<<"{\"foo\":1}">>, iolist_to_binary(encode({struct, [{"foo", 1}]}))), - ?assertEqual(<<"{\"foo\":1}">>, iolist_to_binary(encode([{foo, 1}]))), - ?assertEqual(<<"{\"foo\":1}">>, iolist_to_binary(encode([{<<"foo">>, 1}]))), - ?assertEqual(<<"{\"foo\":1}">>, iolist_to_binary(encode([{"foo", 1}]))), - ?assertEqual(<<"{\"\\ud834\\udd20\":1}">>, - iolist_to_binary(encode({struct, [{[16#0001d120], 1}]}))), - ?assertEqual(<<"{\"1\":1}">>, iolist_to_binary(encode({struct, [{1, 1}]}))), - ok. - -unsafe_chars_test() -> - Chars = "\"\\\b\f\n\r\t", - lists:foreach(fun(C) -> - ?assertEqual(false, json_string_is_safe([C])), - ?assertEqual(false, json_bin_is_safe(<>)), - ?assertEqual(<>, decode(encode(<>))) - end, - Chars), - ?assertEqual(false, json_string_is_safe([16#0001d120])), - ?assertEqual(false, json_bin_is_safe(list_to_binary(xmerl_ucs:to_utf8(16#0001d120)))), - ?assertEqual([16#0001d120], - xmerl_ucs:from_utf8(binary_to_list(decode(encode(list_to_atom(xmerl_ucs:to_utf8(16#0001d120))))))), - ?assertEqual(false, json_string_is_safe([16#110000])), - ?assertEqual(false, json_bin_is_safe(list_to_binary(xmerl_ucs:to_utf8([16#110000])))), - %% solidus can be escaped but isn't unsafe by default - ?assertEqual(<<"/">>, decode(<<"\"\\/\"">>)), - ok. - -int_test() -> - ?assertEqual(0, decode("0")), - ?assertEqual(1, decode("1")), - ?assertEqual(11, decode("11")), - ok. - -large_int_test() -> - ?assertEqual(<<"-2147483649214748364921474836492147483649">>, - iolist_to_binary(encode(-2147483649214748364921474836492147483649))), - ?assertEqual(<<"2147483649214748364921474836492147483649">>, - iolist_to_binary(encode(2147483649214748364921474836492147483649))), - ok. - -float_test() -> - ?assertEqual(<<"-2147483649.0">>, iolist_to_binary(encode(-2147483649.0))), - ?assertEqual(<<"2147483648.0">>, iolist_to_binary(encode(2147483648.0))), - ok. - -handler_test() -> - ?assertExit({json_encode, {bad_term, {x, y}}}, encode({x, y})), - F = fun({x, y}) -> [] end, - ?assertEqual(<<"[]">>, iolist_to_binary((encoder([{handler, F}]))({x, y}))), - ok. - -encode_empty_test_() -> - [{A, ?_assertEqual(<<"{}">>, iolist_to_binary(encode(B)))} - || {A, B} <- [{"eep18 {}", {}}, {"eep18 {[]}", {[]}}, {"{struct, []}", {struct, []}}]]. - -encode_test_() -> - P = [{<<"k">>, <<"v">>}], - JSON = iolist_to_binary(encode({struct, P})), - [{atom_to_list(F), - ?_assertEqual(JSON, iolist_to_binary(encode(decode(JSON, [{format, F}]))))} - || F <- [struct, eep18, proplist]]. - -format_test_() -> - P = [{<<"k">>, <<"v">>}], - JSON = iolist_to_binary(encode({struct, P})), - [{atom_to_list(F), ?_assertEqual(A, decode(JSON, [{format, F}]))} - || {F, A} <- [{struct, {struct, P}}, {eep18, {P}}, {proplist, P}]]. - --endif. diff --git a/src/dmochinum.erl b/src/dmochinum.erl deleted file mode 100644 index 3d3014d..0000000 --- a/src/dmochinum.erl +++ /dev/null @@ -1,331 +0,0 @@ -%% @copyright 2007 Mochi Media, Inc. -%% @author Bob Ippolito - -%% @doc Useful numeric algorithms for floats that cover some deficiencies -%% in the math module. More interesting is digits/1, which implements -%% the algorithm from: -%% http://www.cs.indiana.edu/~burger/fp/index.html -%% See also "Printing Floating-Point Numbers Quickly and Accurately" -%% in Proceedings of the SIGPLAN '96 Conference on Programming Language -%% Design and Implementation. - --module(dmochinum). - --author("Bob Ippolito "). - --export([digits/1, frexp/1, int_pow/2, int_ceil/1]). - -%% IEEE 754 Float exponent bias --define(FLOAT_BIAS, 1022). --define(MIN_EXP, -1074). --define(BIG_POW, 4503599627370496). - -%% External API - -%% @spec digits(number()) -> string() -%% @doc Returns a string that accurately represents the given integer or float -%% using a conservative amount of digits. Great for generating -%% human-readable output, or compact ASCII serializations for floats. -digits(N) when is_integer(N) -> - integer_to_list(N); -digits(0.0) -> - "0.0"; -digits(Float) -> - {Frac1, Exp1} = frexp_int(Float), - [Place0 | Digits0] = digits1(Float, Exp1, Frac1), - {Place, Digits} = transform_digits(Place0, Digits0), - R = insert_decimal(Place, Digits), - case Float < 0 of - true -> - [$- | R]; - _ -> - R - end. - -%% @spec frexp(F::float()) -> {Frac::float(), Exp::float()} -%% @doc Return the fractional and exponent part of an IEEE 754 double, -%% equivalent to the libc function of the same name. -%% F = Frac * pow(2, Exp). -frexp(F) -> - frexp1(unpack(F)). - -%% @spec int_pow(X::integer(), N::integer()) -> Y::integer() -%% @doc Moderately efficient way to exponentiate integers. -%% int_pow(10, 2) = 100. -int_pow(_X, 0) -> - 1; -int_pow(X, N) when N > 0 -> - int_pow(X, N, 1). - -%% @spec int_ceil(F::float()) -> integer() -%% @doc Return the ceiling of F as an integer. The ceiling is defined as -%% F when F == trunc(F); -%% trunc(F) when F < 0; -%% trunc(F) + 1 when F > 0. -int_ceil(X) -> - T = trunc(X), - case X - T of - Pos when Pos > 0 -> - T + 1; - _ -> - T - end. - -%% Internal API - -int_pow(X, N, R) when N < 2 -> - R * X; -int_pow(X, N, R) -> - int_pow(X * X, - N bsr 1, - case N band 1 of - 1 -> - R * X; - 0 -> - R - end). - -insert_decimal(0, S) -> - "0." ++ S; -insert_decimal(Place, S) when Place > 0 -> - L = length(S), - case Place - L of - 0 -> - S ++ ".0"; - N when N < 0 -> - {S0, S1} = lists:split(L + N, S), - S0 ++ "." ++ S1; - N when N < 6 -> - %% More places than digits - S ++ lists:duplicate(N, $0) ++ ".0"; - _ -> - insert_decimal_exp(Place, S) - end; -insert_decimal(Place, S) when Place > -6 -> - "0." ++ lists:duplicate(abs(Place), $0) ++ S; -insert_decimal(Place, S) -> - insert_decimal_exp(Place, S). - -insert_decimal_exp(Place, S) -> - [C | S0] = S, - S1 = case S0 of - [] -> - "0"; - _ -> - S0 - end, - Exp = case Place < 0 of - true -> - "e-"; - false -> - "e+" - end, - [C] ++ "." ++ S1 ++ Exp ++ integer_to_list(abs(Place - 1)). - -digits1(Float, Exp, Frac) -> - Round = Frac band 1 =:= 0, - case Exp >= 0 of - true -> - BExp = 1 bsl Exp, - case Frac =/= ?BIG_POW of - true -> - scale(Frac * BExp * 2, 2, BExp, BExp, Round, Round, Float); - false -> - scale(Frac * BExp * 4, 4, BExp * 2, BExp, Round, Round, Float) - end; - false -> - case Exp =:= ?MIN_EXP orelse Frac =/= ?BIG_POW of - true -> - scale(Frac * 2, 1 bsl (1 - Exp), 1, 1, Round, Round, Float); - false -> - scale(Frac * 4, 1 bsl (2 - Exp), 2, 1, Round, Round, Float) - end - end. - -scale(R, S, MPlus, MMinus, LowOk, HighOk, Float) -> - Est = int_ceil(math:log10(abs(Float)) - 1.0e-10), - %% Note that the scheme implementation uses a 326 element look-up table - %% for int_pow(10, N) where we do not. - case Est >= 0 of - true -> - fixup(R, S * int_pow(10, Est), MPlus, MMinus, Est, LowOk, HighOk); - false -> - Scale = int_pow(10, -Est), - fixup(R * Scale, S, MPlus * Scale, MMinus * Scale, Est, LowOk, HighOk) - end. - -fixup(R, S, MPlus, MMinus, K, LowOk, HighOk) -> - TooLow = - case HighOk of - true -> - R + MPlus >= S; - false -> - R + MPlus > S - end, - case TooLow of - true -> - [K + 1 | generate(R, S, MPlus, MMinus, LowOk, HighOk)]; - false -> - [K | generate(R * 10, S, MPlus * 10, MMinus * 10, LowOk, HighOk)] - end. - -generate(R0, S, MPlus, MMinus, LowOk, HighOk) -> - D = R0 div S, - R = R0 rem S, - TC1 = case LowOk of - true -> - R =< MMinus; - false -> - R < MMinus - end, - TC2 = case HighOk of - true -> - R + MPlus >= S; - false -> - R + MPlus > S - end, - case TC1 of - false -> - case TC2 of - false -> - [D | generate(R * 10, S, MPlus * 10, MMinus * 10, LowOk, HighOk)]; - true -> - [D + 1] - end; - true -> - case TC2 of - false -> - [D]; - true -> - case R * 2 < S of - true -> - [D]; - false -> - [D + 1] - end - end - end. - -unpack(Float) -> - <> = <>, - {Sign, Exp, Frac}. - -frexp1({_Sign, 0, 0}) -> - {0.0, 0}; -frexp1({Sign, 0, Frac}) -> - Exp = log2floor(Frac), - <> = <>, - {Frac1, -?FLOAT_BIAS - 52 + Exp}; -frexp1({Sign, Exp, Frac}) -> - <> = <>, - {Frac1, Exp - ?FLOAT_BIAS}. - -log2floor(Int) -> - log2floor(Int, 0). - -log2floor(0, N) -> - N; -log2floor(Int, N) -> - log2floor(Int bsr 1, 1 + N). - -transform_digits(Place, [0 | Rest]) -> - transform_digits(Place, Rest); -transform_digits(Place, Digits) -> - {Place, [$0 + D || D <- Digits]}. - -frexp_int(F) -> - case unpack(F) of - {_Sign, 0, Frac} -> - {Frac, ?MIN_EXP}; - {_Sign, Exp, Frac} -> - {Frac + (1 bsl 52), Exp - 53 - ?FLOAT_BIAS} - end. - -%% -%% Tests -%% --ifdef(TEST). - --include_lib("eunit/include/eunit.hrl"). - -int_ceil_test() -> - ?assertEqual(1, int_ceil(0.0001)), - ?assertEqual(0, int_ceil(0.0)), - ?assertEqual(1, int_ceil(0.99)), - ?assertEqual(1, int_ceil(1.0)), - ?assertEqual(-1, int_ceil(-1.5)), - ?assertEqual(-2, int_ceil(-2.0)), - ok. - -int_pow_test() -> - ?assertEqual(1, int_pow(1, 1)), - ?assertEqual(1, int_pow(1, 0)), - ?assertEqual(1, int_pow(10, 0)), - ?assertEqual(10, int_pow(10, 1)), - ?assertEqual(100, int_pow(10, 2)), - ?assertEqual(1000, int_pow(10, 3)), - ok. - -digits_test() -> - ?assertEqual("0", digits(0)), - ?assertEqual("0.0", digits(0.0)), - ?assertEqual("1.0", digits(1.0)), - ?assertEqual("-1.0", digits(-1.0)), - ?assertEqual("0.1", digits(0.1)), - ?assertEqual("0.01", digits(0.01)), - ?assertEqual("0.001", digits(0.001)), - ?assertEqual("1.0e+6", digits(1000000.0)), - ?assertEqual("0.5", digits(0.5)), - ?assertEqual("4503599627370496.0", digits(4503599627370496.0)), - %% small denormalized number - %% 4.94065645841246544177e-324 =:= 5.0e-324 - <> = <<0, 0, 0, 0, 0, 0, 0, 1>>, - ?assertEqual("5.0e-324", digits(SmallDenorm)), - ?assertEqual(SmallDenorm, list_to_float(digits(SmallDenorm))), - %% large denormalized number - %% 2.22507385850720088902e-308 - <> = <<0, 15, 255, 255, 255, 255, 255, 255>>, - ?assertEqual("2.225073858507201e-308", digits(BigDenorm)), - ?assertEqual(BigDenorm, list_to_float(digits(BigDenorm))), - %% small normalized number - %% 2.22507385850720138309e-308 - <> = <<0, 16, 0, 0, 0, 0, 0, 0>>, - ?assertEqual("2.2250738585072014e-308", digits(SmallNorm)), - ?assertEqual(SmallNorm, list_to_float(digits(SmallNorm))), - %% large normalized number - %% 1.79769313486231570815e+308 - <> = <<127, 239, 255, 255, 255, 255, 255, 255>>, - ?assertEqual("1.7976931348623157e+308", digits(LargeNorm)), - ?assertEqual(LargeNorm, list_to_float(digits(LargeNorm))), - %% issue #10 - mochinum:frexp(math:pow(2, -1074)). - ?assertEqual("5.0e-324", digits(math:pow(2, -1074))), - ok. - -frexp_test() -> - %% zero - ?assertEqual({0.0, 0}, frexp(0.0)), - %% one - ?assertEqual({0.5, 1}, frexp(1.0)), - %% negative one - ?assertEqual({-0.5, 1}, frexp(-1.0)), - %% small denormalized number - %% 4.94065645841246544177e-324 - <> = <<0, 0, 0, 0, 0, 0, 0, 1>>, - ?assertEqual({0.5, -1073}, frexp(SmallDenorm)), - %% large denormalized number - %% 2.22507385850720088902e-308 - <> = <<0, 15, 255, 255, 255, 255, 255, 255>>, - ?assertEqual({0.99999999999999978, -1022}, frexp(BigDenorm)), - %% small normalized number - %% 2.22507385850720138309e-308 - <> = <<0, 16, 0, 0, 0, 0, 0, 0>>, - ?assertEqual({0.5, -1021}, frexp(SmallNorm)), - %% large normalized number - %% 1.79769313486231570815e+308 - <> = <<127, 239, 255, 255, 255, 255, 255, 255>>, - ?assertEqual({0.99999999999999989, 1024}, frexp(LargeNorm)), - %% issue #10 - mochinum:frexp(math:pow(2, -1074)). - ?assertEqual({0.5, -1073}, frexp(math:pow(2, -1074))), - ok. - --endif. From 2e8a764e356a28d8264d227d3fb76807918eed9f Mon Sep 17 00:00:00 2001 From: RTB CI Bot <42817598+adroll-rtb-ci@users.noreply.github.com> Date: Mon, 25 Jul 2022 07:58:08 +0200 Subject: [PATCH 03/10] [AUTO] [ RTI-12633 ] Update Dependencies (#75) * Update dependencies * [update-deps] Remove -author Co-authored-by: Brujo Benavides --- rebar.config | 2 +- src/dinerl.erl | 2 -- src/dinerl_client.erl | 2 -- src/dynamodb.erl | 2 -- 4 files changed, 1 insertion(+), 7 deletions(-) diff --git a/rebar.config b/rebar.config index fd7408b..c6ca350 100644 --- a/rebar.config +++ b/rebar.config @@ -10,7 +10,7 @@ {project_plugins, [{rebar3_hex, "~> 7.0.2"}, {rebar3_format, "~> 1.2.1"}, - {rebar3_lint, "~> 1.1.0"}, + {rebar3_lint, "~> 2.0.0"}, {rebar3_hank, "~> 1.3.0"}]}. {dialyzer, diff --git a/src/dinerl.erl b/src/dinerl.erl index 94c759e..4f833fb 100644 --- a/src/dinerl.erl +++ b/src/dinerl.erl @@ -1,7 +1,5 @@ -module(dinerl). --author('Valentino Volonghi '). - -define(DINERL_DATA, dinerl_data). -define(ARGS_KEY, args). -define(NONE, <<"NONE">>). diff --git a/src/dinerl_client.erl b/src/dinerl_client.erl index 1f0c13c..12b637a 100644 --- a/src/dinerl_client.erl +++ b/src/dinerl_client.erl @@ -1,7 +1,5 @@ -module(dinerl_client). --author('Valentino Volonghi '). - -include("dinerl_types.hrl"). -export([api/5, api/6]). diff --git a/src/dynamodb.erl b/src/dynamodb.erl index 1d835c4..71f8484 100644 --- a/src/dynamodb.erl +++ b/src/dynamodb.erl @@ -1,7 +1,5 @@ -module(dynamodb). --author('Valentino Volonghi '). - -include("dinerl_types.hrl"). -export([call/5, call/6]). From 9881e04af078749e8a77f84ee5c1e6b42b4ff199 Mon Sep 17 00:00:00 2001 From: Nicolas Valcarcel Date: Sat, 5 Nov 2022 00:28:13 -0500 Subject: [PATCH 04/10] Add CODEOWNERS file (#76) --- CODEOWNERS | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..71d261c --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,13 @@ +# This is a comment. + # Each line is a file pattern followed by one or more owners. + + # These owners will be the default owners for everything in + # the repo. Unless a later match takes precedence, + # @global-owner1 and @global-owner2 will be requested for + # review when someone opens a pull request. + + # Environment: Undefined + # Owner was chosen between ['rtb', 'owners-old'] + + * @SemanticSugar/rtb + \ No newline at end of file From 2aba1560f5a60a49cf1aa7ec01db9084962d8de6 Mon Sep 17 00:00:00 2001 From: RTB CI Bot <42817598+adroll-rtb-ci@users.noreply.github.com> Date: Thu, 24 Nov 2022 10:34:47 +0100 Subject: [PATCH 05/10] Update dependencies (#77) --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index c6ca350..189aff8 100644 --- a/rebar.config +++ b/rebar.config @@ -10,7 +10,7 @@ {project_plugins, [{rebar3_hex, "~> 7.0.2"}, {rebar3_format, "~> 1.2.1"}, - {rebar3_lint, "~> 2.0.0"}, + {rebar3_lint, "~> 2.0.1"}, {rebar3_hank, "~> 1.3.0"}]}. {dialyzer, From 2476e9262f18acd0978e1b777e06e1b5d8e876b9 Mon Sep 17 00:00:00 2001 From: RTB CI Bot <42817598+adroll-rtb-ci@users.noreply.github.com> Date: Mon, 30 Jan 2023 07:54:49 +0100 Subject: [PATCH 06/10] Update dependencies (#78) --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 189aff8..95ef359 100644 --- a/rebar.config +++ b/rebar.config @@ -8,7 +8,7 @@ {cover_opts, [verbose]}. {project_plugins, - [{rebar3_hex, "~> 7.0.2"}, + [{rebar3_hex, "~> 7.0.3"}, {rebar3_format, "~> 1.2.1"}, {rebar3_lint, "~> 2.0.1"}, {rebar3_hank, "~> 1.3.0"}]}. From 375f5ea610b50db52f8396e9b6cfdb4fc39888a0 Mon Sep 17 00:00:00 2001 From: Brujo Benavides Date: Fri, 3 Feb 2023 12:05:36 +0100 Subject: [PATCH 07/10] [RTI-13896] Add more dialyzer checks (#79) --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 95ef359..81b6701 100644 --- a/rebar.config +++ b/rebar.config @@ -14,7 +14,7 @@ {rebar3_hank, "~> 1.3.0"}]}. {dialyzer, - [{warnings, [unknown, no_return, error_handling]}, + [{warnings, [unknown, no_return, error_handling, missing_return, extra_return]}, {get_warnings, true}, {plt_apps, top_level_deps}, {plt_extra_apps, [jiffy]}, From 32630873485033aadcb453c0f6e4ea6f5a57bd59 Mon Sep 17 00:00:00 2001 From: RTB CI Bot <42817598+adroll-rtb-ci@users.noreply.github.com> Date: Mon, 6 Feb 2023 07:58:11 +0100 Subject: [PATCH 08/10] Update dependencies (#80) --- rebar.config | 4 ++-- rebar.lock | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rebar.config b/rebar.config index 81b6701..01433d6 100644 --- a/rebar.config +++ b/rebar.config @@ -1,14 +1,14 @@ {erl_opts, [warn_unused_import, warn_export_vars, warnings_as_errors, verbose, report, debug_info]}. -{deps, [{lhttpc, "1.3.1", {pkg, nextroll_lhttpc}}, {erliam, "0.4.1"}, {jiffy, "1.1.1"}]}. +{deps, [{lhttpc, "1.3.2", {pkg, nextroll_lhttpc}}, {erliam, "0.4.1"}, {jiffy, "1.1.1"}]}. {cover_enabled, true}. {cover_opts, [verbose]}. {project_plugins, - [{rebar3_hex, "~> 7.0.3"}, + [{rebar3_hex, "~> 7.0.4"}, {rebar3_format, "~> 1.2.1"}, {rebar3_lint, "~> 2.0.1"}, {rebar3_hank, "~> 1.3.0"}]}. diff --git a/rebar.lock b/rebar.lock index 800f856..e0baa72 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,14 +1,14 @@ {"1.2.0", [{<<"erliam">>,{pkg,<<"erliam">>,<<"0.4.1">>},0}, {<<"jiffy">>,{pkg,<<"jiffy">>,<<"1.1.1">>},0}, - {<<"lhttpc">>,{pkg,<<"nextroll_lhttpc">>,<<"1.3.1">>},0}]}. + {<<"lhttpc">>,{pkg,<<"nextroll_lhttpc">>,<<"1.3.2">>},0}]}. [ {pkg_hash,[ {<<"erliam">>, <<"D6C4C38CEA143AB22633AA423240861EFA6E63D09CAE9AD130BA3E1437CB40D9">>}, {<<"jiffy">>, <<"ACA10F47AA91697BF24AB9582C74E00E8E95474C7EF9F76D4F1A338D0F5DE21B">>}, - {<<"lhttpc">>, <<"9F7EC32071847BAE326C16270F114396125E8CC75A54BCE44482BD4FCAE0DA3B">>}]}, + {<<"lhttpc">>, <<"5938A05EF0B2F1044A33D28ED767B2EE15BD4271B78916B31ACF0FEF1C1ED381">>}]}, {pkg_hash_ext,[ {<<"erliam">>, <<"0D1EF799285F7AF8C0019ED6B06A2CA5AA9699C77905153F1203D9063B8015A0">>}, {<<"jiffy">>, <<"62E1F0581C3C19C33A725C781DFA88410D8BFF1BBAFC3885A2552286B4785C4C">>}, - {<<"lhttpc">>, <<"A6E729BD3CF3DCC92179B4210D7DA648D5EA316850C483A21D5D97173A6AC08F">>}]} + {<<"lhttpc">>, <<"09C44FE9F2C70BA014BA687406AA9F4B094CA425C65B7DF51AD6D511A6F5C545">>}]} ]. From 899c141d89257bd9317abd57e7f1d20adf23f3a2 Mon Sep 17 00:00:00 2001 From: RTB CI Bot <42817598+adroll-rtb-ci@users.noreply.github.com> Date: Mon, 6 Feb 2023 14:33:32 +0100 Subject: [PATCH 09/10] Update dependencies (#81) --- rebar.config | 2 +- rebar.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rebar.config b/rebar.config index 01433d6..f703bcf 100644 --- a/rebar.config +++ b/rebar.config @@ -1,7 +1,7 @@ {erl_opts, [warn_unused_import, warn_export_vars, warnings_as_errors, verbose, report, debug_info]}. -{deps, [{lhttpc, "1.3.2", {pkg, nextroll_lhttpc}}, {erliam, "0.4.1"}, {jiffy, "1.1.1"}]}. +{deps, [{lhttpc, "1.3.2", {pkg, nextroll_lhttpc}}, {erliam, "1.0.0"}, {jiffy, "1.1.1"}]}. {cover_enabled, true}. diff --git a/rebar.lock b/rebar.lock index e0baa72..2ade8e2 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,14 +1,14 @@ {"1.2.0", -[{<<"erliam">>,{pkg,<<"erliam">>,<<"0.4.1">>},0}, +[{<<"erliam">>,{pkg,<<"erliam">>,<<"1.0.0">>},0}, {<<"jiffy">>,{pkg,<<"jiffy">>,<<"1.1.1">>},0}, {<<"lhttpc">>,{pkg,<<"nextroll_lhttpc">>,<<"1.3.2">>},0}]}. [ {pkg_hash,[ - {<<"erliam">>, <<"D6C4C38CEA143AB22633AA423240861EFA6E63D09CAE9AD130BA3E1437CB40D9">>}, + {<<"erliam">>, <<"55FD69959349080CA44728B34076A004FCAFB8064B7600DD17473B7D33F03415">>}, {<<"jiffy">>, <<"ACA10F47AA91697BF24AB9582C74E00E8E95474C7EF9F76D4F1A338D0F5DE21B">>}, {<<"lhttpc">>, <<"5938A05EF0B2F1044A33D28ED767B2EE15BD4271B78916B31ACF0FEF1C1ED381">>}]}, {pkg_hash_ext,[ - {<<"erliam">>, <<"0D1EF799285F7AF8C0019ED6B06A2CA5AA9699C77905153F1203D9063B8015A0">>}, + {<<"erliam">>, <<"88B039BC7200538A471E747DE720C0CD9839B19A8CC25DFCECB0384346ACF1A1">>}, {<<"jiffy">>, <<"62E1F0581C3C19C33A725C781DFA88410D8BFF1BBAFC3885A2552286B4785C4C">>}, {<<"lhttpc">>, <<"09C44FE9F2C70BA014BA687406AA9F4B094CA425C65B7DF51AD6D511A6F5C545">>}]} ]. From 9bea79c7a809d916148f78df9c26b12112006e50 Mon Sep 17 00:00:00 2001 From: RTB CI Bot <42817598+adroll-rtb-ci@users.noreply.github.com> Date: Tue, 21 Feb 2023 16:32:28 +0100 Subject: [PATCH 10/10] Update dependencies (#82) --- rebar.config | 2 +- rebar.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rebar.config b/rebar.config index f703bcf..24899d4 100644 --- a/rebar.config +++ b/rebar.config @@ -1,7 +1,7 @@ {erl_opts, [warn_unused_import, warn_export_vars, warnings_as_errors, verbose, report, debug_info]}. -{deps, [{lhttpc, "1.3.2", {pkg, nextroll_lhttpc}}, {erliam, "1.0.0"}, {jiffy, "1.1.1"}]}. +{deps, [{lhttpc, "1.3.3", {pkg, nextroll_lhttpc}}, {erliam, "1.0.0"}, {jiffy, "1.1.1"}]}. {cover_enabled, true}. diff --git a/rebar.lock b/rebar.lock index 2ade8e2..aba316c 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,14 +1,14 @@ {"1.2.0", [{<<"erliam">>,{pkg,<<"erliam">>,<<"1.0.0">>},0}, {<<"jiffy">>,{pkg,<<"jiffy">>,<<"1.1.1">>},0}, - {<<"lhttpc">>,{pkg,<<"nextroll_lhttpc">>,<<"1.3.2">>},0}]}. + {<<"lhttpc">>,{pkg,<<"nextroll_lhttpc">>,<<"1.3.3">>},0}]}. [ {pkg_hash,[ {<<"erliam">>, <<"55FD69959349080CA44728B34076A004FCAFB8064B7600DD17473B7D33F03415">>}, {<<"jiffy">>, <<"ACA10F47AA91697BF24AB9582C74E00E8E95474C7EF9F76D4F1A338D0F5DE21B">>}, - {<<"lhttpc">>, <<"5938A05EF0B2F1044A33D28ED767B2EE15BD4271B78916B31ACF0FEF1C1ED381">>}]}, + {<<"lhttpc">>, <<"C1617E2D73A78FED3D973227CA75220B868AB55C0C5DC1C12FBD081DB8D83CB7">>}]}, {pkg_hash_ext,[ {<<"erliam">>, <<"88B039BC7200538A471E747DE720C0CD9839B19A8CC25DFCECB0384346ACF1A1">>}, {<<"jiffy">>, <<"62E1F0581C3C19C33A725C781DFA88410D8BFF1BBAFC3885A2552286B4785C4C">>}, - {<<"lhttpc">>, <<"09C44FE9F2C70BA014BA687406AA9F4B094CA425C65B7DF51AD6D511A6F5C545">>}]} + {<<"lhttpc">>, <<"8033152140E6E82325E68263D193A79A2322D857F69DDF1D875B5045B05EC463">>}]} ].