Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing R13 compiler warnings.

  • Loading branch information...
commit 61fe1121b5888ecfa8e735d9db8dc26f70328d12 1 parent a95d51e
@archaelus authored
View
42 src/base_syntax.erl
@@ -242,16 +242,16 @@
%% @end
decode(Binary, #constant{value = Value} = Type) ->
Cons = if
- list(Value) ->
+ is_list(Value) ->
list_to_binary(Value);
- integer(Value) ->
+ is_integer(Value) ->
<<Value/integer>>;
- binary(Value) ->
+ is_binary(Value) ->
<<Value/binary>>;
true -> % Should *NOT* happen
term_to_binary(Value)
end,
- Size = size(Cons),
+ Size = byte_size(Cons),
case Binary of
<<Cons:Size/binary-unit:8, Rest/binary>> ->
{ok, Value, Rest};
@@ -591,14 +591,14 @@ decode_try(Binary, [Type|Types], Error, Priority) ->
%% @see encode_list/2
%% @see encode_try/2
%% @end
-encode(Value, #constant{value = Value}) when list(Value) ->
+encode(Value, #constant{value = Value}) when is_list(Value) ->
{ok, list_to_binary(Value)};
-encode(Value, #constant{value = Value}) when integer(Value) ->
+encode(Value, #constant{value = Value}) when is_integer(Value) ->
{ok, <<Value/integer>>};
-encode(Value, #constant{value = Value}) when binary(Value) ->
+encode(Value, #constant{value = Value}) when is_binary(Value) ->
{ok, <<Value/binary>>};
encode(Value, #integer{size = Size, min = Min, max = Max})
- when integer(Value), Value >= Min, Value =< Max ->
+ when is_integer(Value), Value >= Min, Value =< Max ->
{ok, <<Value:Size/integer-unit:8>>};
encode(Value, #c_octet_string{format = F} = Type) when F /= undefined ->
case F(Value) of
@@ -608,10 +608,10 @@ encode(Value, #c_octet_string{format = F} = Type) when F /= undefined ->
{error, {type_mismatch, Type, Value}}
end;
encode(Value, #c_octet_string{fixed = true, size = Size})
- when list(Value), (length(Value) == Size - 1) or (length(Value) == 0) ->
+ when is_list(Value), (length(Value) == Size - 1) or (length(Value) == 0) ->
{ok, list_to_binary(Value ++ [?NULL_CHARACTER])};
encode(Value, #c_octet_string{size = Size})
- when list(Value), length(Value) < Size -> % was =<
+ when is_list(Value), length(Value) < Size -> % was =<
{ok, list_to_binary(Value ++ [?NULL_CHARACTER])};
encode(Value, #octet_string{format = F} = Type) when F /= undefined ->
case F(Value) of
@@ -621,13 +621,13 @@ encode(Value, #octet_string{format = F} = Type) when F /= undefined ->
{error, {type_mismatch, Type, Value}}
end;
encode(Value, #octet_string{fixed = true, size = Size})
- when list(Value), (length(Value) == Size) or (length(Value) == 0) ->
+ when is_list(Value), (length(Value) == Size) or (length(Value) == 0) ->
{ok, list_to_binary(Value)};
encode(Value, #octet_string{size = Size})
- when list(Value), length(Value) =< Size ->
+ when is_list(Value), length(Value) =< Size ->
{ok, list_to_binary(Value)};
encode(Values, #list{type = InnerType, size = Size} = Type)
- when list(Values), length(Values) =< Size ->
+ when is_list(Values), length(Values) =< Size ->
case encode_iter(Values, InnerType) of
{ok, Binary} ->
LenSize = trunc(Size / 256) + 1,
@@ -636,7 +636,7 @@ encode(Values, #list{type = InnerType, size = Size} = Type)
{error, {type_mismatch, Type, Reason}}
end;
encode(Value, #composite{name = undefined, tuple = Tuple} = Type)
- when tuple(Value), size(Value) == size(Tuple) ->
+ when is_tuple(Value), byte_size(Value) == byte_size(Tuple) ->
case encode_list(tuple_to_list(Value), tuple_to_list(Tuple)) of
{error, Reason} ->
{error, {type_mismatch, Type, Reason}};
@@ -644,7 +644,7 @@ encode(Value, #composite{name = undefined, tuple = Tuple} = Type)
Ok
end;
encode(Value, #composite{name = Name, tuple = Tuple} = Type)
- when element(1, Value) == Name, size(Value) - 1 == size(Tuple) ->
+ when element(1, Value) == Name, byte_size(Value) - 1 == byte_size(Tuple) ->
case encode_list(tl(tuple_to_list(Value)), tuple_to_list(Tuple)) of
{error, Reason} ->
{error, {type_mismatch, Type, Reason}};
@@ -836,13 +836,13 @@ error_priority(_Error) ->
%% @end
error_priority({type_mismatch, _Type, {type_mismatch, Type, Reason}}, Depth) ->
error_priority({type_mismatch, Type, Reason}, Depth + 1);
-error_priority({type_mismatch, T, _R}, Depth) when record(T, integer);
- record(T, c_octet_string);
- record(T, octet_string) ->
+error_priority({type_mismatch, T, _R}, Depth) when is_record(T, integer);
+ is_record(T, c_octet_string);
+ is_record(T, octet_string) ->
(Depth * 3) + 1;
-error_priority({type_mismatch, T, _R}, Depth) when record(T, union);
- record(T, list);
- record(T, composite) ->
+error_priority({type_mismatch, T, _R}, Depth) when is_record(T, union);
+ is_record(T, list);
+ is_record(T, composite) ->
(Depth * 3) + 2;
error_priority(_Other, Depth) -> % contants and unknown errors
(Depth * 3) + 0.
View
6 src/gen_smsc_session.erl
@@ -1312,7 +1312,7 @@ handle_input_corrupt_pdu(CmdId, Status, SeqNum, S) ->
%% @end
congestion_state(Lapse, Index, Time) ->
case catch ((99 * Time) / ((Lapse / Index) + Time)) of
- Result when float(Result) ->
+ Result when is_float(Result) ->
trunc(Result);
_DivisionByZero ->
0
@@ -1737,7 +1737,7 @@ timer_loop(FsmRef, Time, Event) ->
%% @doc Aborts the timer process whose PID is <tt>Timer</tt>. Only
%% the timer's parent is allowed to stop it.
%% @end
-cancel_timer(Timer) when pid(Timer) ->
+cancel_timer(Timer) when is_pid(Timer) ->
Timer ! {self(), cancel_timer};
cancel_timer(_Timer) -> % might be the atom undefined
ok.
@@ -1749,7 +1749,7 @@ cancel_timer(_Timer) -> % might be the atom undefined
%% @doc Restarts the timer process whose PID is <tt>Timer</tt>. Only
%% the timer's parent is allowed to restart it.
%% @end
-reset_timer(Timer) when pid(Timer) ->
+reset_timer(Timer) when is_pid(Timer) ->
Timer ! {self(), reset};
reset_timer(_Timer) -> % might be the atom undefined
ok.
View
16 src/param_syntax.erl
@@ -116,9 +116,9 @@ chop_tlv(Binary) ->
%% @see decode_std/2
%% @see decode_tlv/2
%% @end
-decode(Binary, ParamType) when record(ParamType, standard) ->
+decode(Binary, ParamType) when is_record(ParamType, standard) ->
decode_std(Binary, ParamType);
-decode(Binary, ParamType) when record(ParamType, tlv) ->
+decode(Binary, ParamType) when is_record(ParamType, tlv) ->
decode_tlv(Binary, ParamType);
decode(_Binary, _ParamType) ->
{error, ?ESME_RUNKNOWNERR}.
@@ -137,9 +137,9 @@ decode(_Binary, _ParamType) ->
%% @see encode_std/2
%% @see encode_tlv/2
%% @end
-encode(Value, ParamType) when record(ParamType, standard) ->
+encode(Value, ParamType) when is_record(ParamType, standard) ->
encode_std(Value, ParamType);
-encode(Value, ParamType) when record(ParamType, tlv) ->
+encode(Value, ParamType) when is_record(ParamType, tlv) ->
encode_tlv(Value, ParamType);
encode(_Value, _ParamType) ->
{error, ?ESME_RUNKNOWNERR}.
@@ -152,9 +152,9 @@ encode(_Value, _ParamType) ->
%%
%% @doc Gets the name from a parameter type declaration.
%% @end
-get_name(ParamType) when record(ParamType, standard) ->
+get_name(ParamType) when is_record(ParamType, standard) ->
ParamType#standard.name;
-get_name(ParamType) when record(ParamType, tlv) ->
+get_name(ParamType) when is_record(ParamType, tlv) ->
ParamType#tlv.name.
@@ -489,7 +489,7 @@ encode_tlv(undefined, _TlvType) ->
{ok, <<>>};
encode_tlv([], #tlv{multiple = true}) ->
{ok, <<>>};
-encode_tlv(Values, #tlv{multiple = true} = TlvType) when list(Values) ->
+encode_tlv(Values, #tlv{multiple = true} = TlvType) when is_list(Values) ->
encode_multiple_tlv(Values, TlvType);
encode_tlv(Value, TlvType) ->
encode_single_tlv(Value, TlvType).
@@ -525,7 +525,7 @@ encode_multiple_tlv([Value|Values], TlvType, Acc) ->
encode_single_tlv(Value, #tlv{tag = Tag, domain = Domain, error = Error}) ->
case base_syntax:encode(Value, Domain) of
{ok, Binary} ->
- {ok, [<<Tag:16/integer, (size(Binary)):16/integer>>, Binary]};
+ {ok, [<<Tag:16/integer, (byte_size(Binary)):16/integer>>, Binary]};
{error, _Reason} ->
if
Error == undefined ->
View
4 src/sm.erl
@@ -257,7 +257,7 @@ join_user_data(Segments) ->
%% @doc Gets the message user data from a PDU. The message user data may came
%% in the <i>short_message</i> or in the <i>message_payload</i> parameter.
%% @end
-message_user_data(ParamList) when list(ParamList) ->
+message_user_data(ParamList) when is_list(ParamList) ->
case lists:keysearch(message_payload, 1, ParamList) of
{value, Value} ->
Value;
@@ -480,7 +480,7 @@ total_segments(Pdu) ->
%%
%% @doc Returns <tt>true</tt> if UDHI is set, <tt>false</tt> otherwise.
%% @end
-udhi(ParamList) when list(ParamList) ->
+udhi(ParamList) when is_list(ParamList) ->
case lists:keysearch(esm_class, 1, ParamList) of
{value, {esm_class, EsmClass}} ->
udhi_value(EsmClass);
View
2  src/smpp_log.erl
@@ -662,7 +662,7 @@ init(Args) ->
%% Id = term()
%% @doc
%% @end
-handle_event({From, IoList}, S) when list(IoList) ->
+handle_event({From, IoList}, S) when is_list(IoList) ->
handle_event({From, concat_binary(IoList)}, S);
handle_event({From, BinaryPdu}, #state{type=T, pred=P, format=F} = S) ->
case catch P(BinaryPdu) of
Please sign in to comment.
Something went wrong with that request. Please try again.