diff options
author | Rickard Green <[email protected]> | 2017-10-12 16:28:31 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2017-10-12 16:28:31 +0200 |
commit | f28539265d753bbaa473cb488e951bfe47304a01 (patch) | |
tree | 86a53f117f1e33b33e57f890f186dbf9b07d8e19 /lib/stdlib/src | |
parent | 7dcaed64849f830a44da28c0d49e908d173b173d (diff) | |
download | otp-f28539265d753bbaa473cb488e951bfe47304a01.tar.gz otp-f28539265d753bbaa473cb488e951bfe47304a01.tar.bz2 otp-f28539265d753bbaa473cb488e951bfe47304a01.zip |
Revert "Merge branch 'rickard/null-char-filenames/ERL-370/OTP-14543' into maint"
This reverts commit 0717a2194e863f3a78595184ccc5637697f03353, reversing
changes made to 71a40658a0cef8b3e25df3a8e48a72d0563a89bf.
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/filename.erl | 70 | ||||
-rw-r--r-- | lib/stdlib/src/stdlib.app.src | 2 |
2 files changed, 1 insertions, 71 deletions
diff --git a/lib/stdlib/src/filename.erl b/lib/stdlib/src/filename.erl index 1c3ab6d274..9bf4290916 100644 --- a/lib/stdlib/src/filename.erl +++ b/lib/stdlib/src/filename.erl @@ -41,7 +41,6 @@ safe_relative_path/1]). -export([find_src/1, find_src/2]). % deprecated -export([basedir/2, basedir/3]). --export([validate/1]). %% Undocumented and unsupported exports. -export([append/2]). @@ -1136,72 +1135,3 @@ basedir_os_type() -> {win32,_} -> windows; _ -> linux end. - -%% -%% validate/1 -%% - --spec validate(FileName) -> boolean() when - FileName :: file:name_all(). - -validate(FileName) when is_binary(FileName) -> - %% Raw filename... - validate_bin(FileName); -validate(FileName) when is_list(FileName); - is_atom(FileName) -> - validate_list(FileName, - file:native_name_encoding(), - os:type()). - -validate_list(FileName, Enc, Os) -> - try - true = validate_list(FileName, Enc, Os, 0) > 0 - catch - _ : _ -> false - end. - -validate_list([], _Enc, _Os, Chars) -> - Chars; -validate_list(C, Enc, Os, Chars) when is_integer(C) -> - validate_char(C, Enc, Os), - Chars+1; -validate_list(A, Enc, Os, Chars) when is_atom(A) -> - validate_list(atom_to_list(A), Enc, Os, Chars); -validate_list([H|T], Enc, Os, Chars) -> - NewChars = validate_list(H, Enc, Os, Chars), - validate_list(T, Enc, Os, NewChars). - -%% C is always an integer... -% validate_char(C, _, _) when not is_integer(C) -> -% throw(invalid); -validate_char(C, _, _) when C < 1 -> - throw(invalid); %% No negative or null characters... -validate_char(C, latin1, _) when C > 255 -> - throw(invalid); -validate_char(C, utf8, _) when C >= 16#110000 -> - throw(invalid); -validate_char(C, utf8, {win32, _}) when C > 16#ffff -> - throw(invalid); %% invalid win wchar... -validate_char(_C, utf8, {win32, _}) -> - ok; %% Range below is accepted on windows... -validate_char(C, utf8, _) when 16#D800 =< C, C =< 16#DFFF -> - throw(invalid); %% invalid unicode range... -validate_char(_, _, _) -> - ok. - -validate_bin(Bin) -> - %% Raw filename. That is, we do not interpret - %% the encoding, but we still do not accept - %% null characters... - try - true = validate_bin(Bin, 0) > 0 - catch - _ : _ -> false - end. - -validate_bin(<<>>, Bs) -> - Bs; -validate_bin(<<0, _Rest/binary>>, _Bs) -> - throw(invalid); %% No null characters allowed... -validate_bin(<<_B, Rest/binary>>, Bs) -> - validate_bin(Rest, Bs+1). diff --git a/lib/stdlib/src/stdlib.app.src b/lib/stdlib/src/stdlib.app.src index 41c89270aa..3c449d3cb9 100644 --- a/lib/stdlib/src/stdlib.app.src +++ b/lib/stdlib/src/stdlib.app.src @@ -107,7 +107,7 @@ dets]}, {applications, [kernel]}, {env, []}, - {runtime_dependencies, ["sasl-3.0","kernel-5.4.1","erts-9.1.1","crypto-3.3", + {runtime_dependencies, ["sasl-3.0","kernel-5.0","erts-9.0","crypto-3.3", "compiler-5.0"]} ]}. |