File 1124-stdlib-Fix-unicode-characters_to_binary-3.patch of Package erlang
From f86fe36cb0decb54cb1689a4eec6654ccca970ec Mon Sep 17 00:00:00 2001
From: Rickard Green <rickard@erlang.org>
Date: Sat, 26 Nov 2022 05:28:37 +0100
Subject: [PATCH] [stdlib] Fix unicode:characters_to_binary/3
---
lib/stdlib/src/unicode.erl | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/lib/stdlib/src/unicode.erl b/lib/stdlib/src/unicode.erl
index fbe8a94074..026f4cd438 100644
--- a/lib/stdlib/src/unicode.erl
+++ b/lib/stdlib/src/unicode.erl
@@ -445,10 +445,12 @@ characters_to_binary_int(ML, InEncoding, OutEncoding) ->
{error, Accum, [Part]}
end,<<>>),
case Res of
+ Bin when is_binary(Bin) ->
+ Bin;
{incomplete,A,B,_} ->
{incomplete,A,B};
- _ ->
- Res
+ {error, _Converted, _Rest} = Error ->
+ Error
end.
@@ -528,14 +530,7 @@ ml_map([Part|_] = Whole,_,{{Incomplete, _}, Accum}) when is_integer(Part) ->
ml_map([Part|T],Fun,Accum) when is_integer(Part) ->
case Fun(Part,Accum) of
Bin when is_binary(Bin) ->
- case ml_map(T,Fun,Bin) of
- Bin2 when is_binary(Bin2) ->
- Bin2;
- {error, Converted, Rest} ->
- {error, Converted, Rest};
- {incomplete, Converted, Rest,X} ->
- {incomplete, Converted, Rest,X}
- end;
+ ml_map(T,Fun,Bin);
% Can not be incomplete - it's an integer
{error, Converted, Rest} ->
{error, Converted, [Rest|T]}
--
2.35.3