Skip to content

Instantly share code, notes, and snippets.

@CharlesOkwuagwu CharlesOkwuagwu/log.txt Secret
Created Jun 1, 2016

Embed
What would you like to do?
Some unsafe warnings are incorrect
Unsafe variable found at:
lib/tl/upload_link.ex:88 (line 7 above)
warning: the variable "s" is unsafe as it has been set inside a case/cond/receive/if/&&/||. Please explicitly return the variable value instead. For example:
case int do
1 -> atom = :one
2 -> atom = :two
end
should be written as
atom =
case int do
1 -> :one
2 -> :two
end
Unsafe variable found at:
lib/tl/upload_link.ex:91 (line 10 above)
warning: the variable "s" is unsafe as it has been set inside a case/cond/receive/if/&&/||. Please explicitly return the variable value instead. For example:
case int do
1 -> atom = :one
2 -> atom = :two
end
should be written as
atom =
case int do
1 -> :one
2 -> :two
end
Unsafe variable found at:
lib/tl/upload_link.ex:94 (line 13 above)
defp proc_msg_data(<<msg_id::little-8*8, seq_no::little-4*8, len::little-4*8, data::binary-size(len)-unit(8), pad::binary>>, s, ix) do
if div(seq_no, 2) >= s.content_count, do: s = %{s | content_count: div(seq_no, 2)}
case data do
<<0x73F1F8DC::little-4*8, _count::little-4*8, msgs::binary>> ->
# log "#{s.tag}: << [#{TL.head(data)}] msg_id: #{msg_id}, seq_no: #{seq_no}, content: #{s.content_count} - [#{inspect self()}]"
proc_msg_data(msgs, s, ix + 1) # how is using s unsafe here? it is not being assigned, it is being passed as a variable
<<body::binary-size(len)-unit(8)>> when byte_size(pad) < 16 ->
# log "#{s.tag}: <- [#{TL.head(body)}] msg_id: #{msg_id}, seq_no: #{seq_no}, content: #{s.content_count} - [#{inspect self()}]"
_process(body, msg_id, s)
<<body::binary-size(len)-unit(8)>> ->
# log "#{s.tag}: <- [#{TL.head(body)}] msg_id: #{msg_id}, seq_no: #{seq_no}, content: #{s.content_count} - [#{inspect self()}]"
s = _process(body, msg_id, s)
proc_msg_data(pad, s, ix + 1)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.