From f352f2d1141f352be0c44c3879fa03b4855b44cb Mon Sep 17 00:00:00 2001 From: SisMaker <1713699517@qq.com> Date: Wed, 26 May 2021 18:30:02 +0800 Subject: [PATCH] =?UTF-8?q?ft:=20=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/tpTermCut.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/tpTermCut.erl b/src/utils/tpTermCut.erl index ed928d2..c230615 100644 --- a/src/utils/tpTermCut.erl +++ b/src/utils/tpTermCut.erl @@ -1,4 +1,5 @@ -module(tpTermCut). +-include("eTpf.hrl"). %% 现在要使用硬编码的值。我们不能花时间在记录或地图中查找。 @@ -15,8 +16,6 @@ cut(_, Depth) when Depth > ?MaxDepth -> cut(Bits, _) when is_bitstring(Bits), bit_size(Bits) > ?MaxBitSize -> <> = Bits, <>; -cut(Term, Depth) when is_list(Term), Depth =:= ?MaxDepth -> - ['$truncated']; cut(Term, Depth) when is_list(Term) -> cutList(Term, Depth, 0, ?MaxListSize, 0, []); cut(Term, Depth) when is_map(Term), Depth =:= ?MaxDepth -> @@ -33,11 +32,12 @@ cut(Term, _) -> cutList([], _, _, _, _, Acc) -> lists:reverse(Acc); cutList([Term | Tail], Depth, Len, MaxLen, NumStructs, Acc) -> - case Len > MaxLen orelse NumStructs > ?MaxNestStruct of + case Len >= MaxLen orelse NumStructs >= ?MaxNestStruct of true -> - lists:reverse(['$truncated' | Acc]); + lists:reverse(['$truncated33' | Acc]); _ -> %% if List was a cons, Tail can be anything + io:format("IMY********************1111 ~p~n", [{Len, NumStructs, Term}]), cutList(Tail, Depth, Len + 1, MaxLen, NumStructs + isStruct(Term), [cut(Term, Depth + 1) | Acc]) end; cutList(Term, Depth, _, _, _, Acc) -> %% if List was a cons [[[a,a,a|b],1,2,3]|bbbb]