aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/compiler
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2014-03-31 10:58:44 +0200
committerAnders Svensson <[email protected]>2014-03-31 10:58:44 +0200
commit91cc9ce5112591c274a1b0850b0a9f3ec0a49676 (patch)
treee558fe0dd3cd138b0855d1febdd341c739885b43 /lib/diameter/src/compiler
parent19a391b42dffeb88b8ec615ca4cc3a8b4936f1a0 (diff)
parenta97103b601e3ec37b7ed3ae3799ff63422732b59 (diff)
downloadotp-91cc9ce5112591c274a1b0850b0a9f3ec0a49676.tar.gz
otp-91cc9ce5112591c274a1b0850b0a9f3ec0a49676.tar.bz2
otp-91cc9ce5112591c274a1b0850b0a9f3ec0a49676.zip
Merge branch 'anders/diameter/unicode_path/OTP-11655'
* anders/diameter/unicode_path/OTP-11655: Fix unicode path failure in diameter_make:codec/2
Diffstat (limited to 'lib/diameter/src/compiler')
-rw-r--r--lib/diameter/src/compiler/diameter_make.erl32
1 files changed, 20 insertions, 12 deletions
diff --git a/lib/diameter/src/compiler/diameter_make.erl b/lib/diameter/src/compiler/diameter_make.erl
index adc7808e49..72f5d36da4 100644
--- a/lib/diameter/src/compiler/diameter_make.erl
+++ b/lib/diameter/src/compiler/diameter_make.erl
@@ -232,21 +232,29 @@ identify([Vsn | [T|_] = ParseD])
identify({path, File} = T) ->
{T, File};
identify(File) ->
- Bin = iolist_to_binary([File]),
- case is_path(Bin) of
+ case is_path([File]) of
true -> {{path, File}, File};
- false -> {Bin, ?DEFAULT_DICT_FILE}
+ false -> {File, ?DEFAULT_DICT_FILE}
end.
-%% Interpret anything containing \n or \r as a literal dictionary,
-%% otherwise a path. (Which might be the wrong guess in the worst case.)
-is_path(Bin) ->
- try
- [throw(C) || <<C>> <= Bin, $\n == C orelse $\r == C],
- true
- catch
- throw:_ -> false
- end.
+%% Interpret anything containing \n or \r as a literal dictionary.
+
+is_path([<<C,B/binary>> | T]) ->
+ is_path([C, B | T]);
+
+is_path([[C|L] | T]) ->
+ is_path([C, L | T]);
+
+is_path([C|_])
+ when $\n == C;
+ $\r == C ->
+ false;
+
+is_path([_|T]) ->
+ is_path(T);
+
+is_path([]) ->
+ true.
make(File, Opts, Dict) ->
ok(lists:foldl(fun(M,A) -> [make(File, Opts, Dict, M) | A] end,