浏览代码

ft: 去掉编译警告

master
SisMaker 3 年前
父节点
当前提交
a07dad35ed
共有 19 个文件被更改,包括 28 次插入353 次删除
  1. +1
    -1
      rebar.config
  2. +2
    -1
      src/bStar/bStar.erl
  3. +2
    -3
      src/comMisc/utPid.erl
  4. +2
    -1
      src/dataType/utString.erl
  5. +2
    -2
      src/hotUpdate/reloader.erl
  6. +0
    -267
      src/httpSocket/http_lib.erl
  7. +1
    -4
      src/httpSocket/utHttpOn.erl
  8. +1
    -1
      src/measure/utProf.erl
  9. +2
    -2
      src/nifSrc/dsInterface/utHashBbl.erl
  10. +0
    -57
      src/nifSrc/dsInterface/utHashBbl1.erl
  11. +2
    -2
      src/nifSrc/nifArray/nifArray.erl
  12. +2
    -0
      src/nifSrc/nifHashb/nifHashb.erl
  13. +2
    -0
      src/nifSrc/nifHashb/nifHashbback.erl
  14. +1
    -1
      src/srvNodeMgr/mtop.erl
  15. +1
    -1
      src/srvNodeMgr/utAppStart.erl
  16. +3
    -0
      src/srvNodeMgr/utVMInfo.erl
  17. +2
    -3
      src/template/ut_gen_apu.erl
  18. +2
    -1
      src/template/ut_gen_srv.erl
  19. +0
    -6
      src/testCase/utTpfm.erl

+ 1
- 1
rebar.config 查看文件

@ -1,4 +1,4 @@
{erl_opts, [no_debug_info, {i, "include"}]}.
{erl_opts, [no_debug_info, {i, "include"}, nowarn_unused_function, nowarn_unused_vars, nowarn_export_all]}.
{deps, [
{eFmt, ".*", {git, "http://sismaker.tpddns.cn:53000/SisMaker/eFmt.git", {branch, "master"}}},
{eSync, ".*", {git, "http://sismaker.tpddns.cn:53000/SisMaker/eSync.git", {branch, "master"}}}

+ 2
- 1
src/bStar/bStar.erl 查看文件

@ -1,7 +1,8 @@
-module(bStar). %% B星寻路逻辑
-include("utComMisc.hrl").
-compile(export_all).
-compile([nowarn_unused_function, nowarn_unused_vars, nowarn_export_all]).
-export([
bstar_search/5
, test/0

+ 2
- 3
src/comMisc/utPid.erl 查看文件

@ -1,7 +1,6 @@
-module(utPid).
%%
%% Exported Functions
%%
-compile([nowarn_unused_function, nowarn_unused_vars, nowarn_export_all]).
-export([
whereis_name/1,
register/3,

+ 2
- 1
src/dataType/utString.erl 查看文件

@ -1,6 +1,7 @@
-module(utString).
%% API
-compile([nowarn_unused_function, nowarn_unused_vars, nowarn_export_all]).
-export([
toLowerStr/1
, toUpperStr/1

+ 2
- 2
src/hotUpdate/reloader.erl 查看文件

@ -64,9 +64,9 @@ handle_cast(doit, State) ->
error_logger:info_msg("reloader done ... ~n", []),
{noreply, State#state{last = Now}}
catch
_:R ->
_:R:S ->
error_logger:error_msg(
"reload failed R:~w Stack:~p~n", [R, erlang:get_stacktrace()]),
"reload failed R:~w Stack:~p~n", [R, S]),
%% reloader failed, no state update
{noreply, State}
end;

+ 0
- 267
src/httpSocket/http_lib.erl 查看文件

@ -1,267 +0,0 @@
-module(http_lib).
-export([etag/1,
local_time_to_rfc1123/1, rfc1123_to_date_time/1, mime_type/1,
mime_type/2, extension/1, is_compressible/1, month_to_list/1,
url_decode/1, chunk/1,
accept/1, recv/2, recv/3, send/2, setopts/2, close/1, peername/1,
dir/1, is_idempotent/1, is_modified/2,
reason_phrase/1]).
-include_lib("kernel/include/file.hrl").
-include_lib("eunit/include/eunit.hrl").
%% --------------------------------------------------------------------
%% Macros
%% --------------------------------------------------------------------
-define(CS_DEBUG(F, D), io:format(lists:concat(["D(", ?MODULE, ":", ?LINE, ") :", F, "~n"]), D)).
any_to_list(A) when is_atom(A) ->
atom_to_list(A);
any_to_list(I) when is_integer(I) ->
integer_to_list(I);
any_to_list(L) when is_list(L) ->
L.
chunk(IoList) ->
[erlang:integer_to_list(iolist_size(IoList), 16), "\r\n", IoList, "\r\n"].
local_time_to_rfc1123(LocalTime) ->
[{{YYYY, MM, DD}, {H, M, S}} | _] =
calendar:local_time_to_universal_time_dst(LocalTime),
Day = calendar:day_of_the_week({YYYY, MM, DD}),
lists:flatten(
io_lib:format("~s, ~2.2.0w ~3.s ~4.4.0w ~2.2.0w:~2.2.0w:~2.2.0w GMT",
[day(Day), DD, month_to_list(MM), YYYY, H, M, S])).
rfc1123_to_date_time([_D, _A, _Y, $,, $ , D1, D2, $ , M, O, N, $ , Y1, Y2, Y3, Y4, $ ,
H1, H2, $:, M1, M2, $:, S1, S2 | _]) ->
Year = list_to_integer([Y1, Y2, Y3, Y4]),
Day = list_to_integer([D1, D2]),
Month = list_to_month([M, O, N]),
Hour = list_to_integer([H1, H2]),
Min = list_to_integer([M1, M2]),
Sec = list_to_integer([S1, S2]),
{{Year, Month, Day}, {Hour, Min, Sec}}.
day(1) -> "Mon";
day(2) -> "Tue";
day(3) -> "Wed";
day(4) -> "Thu";
day(5) -> "Fri";
day(6) -> "Sat";
day(7) -> "Sun".
month_to_list(1) -> "Jan";
month_to_list(2) -> "Feb";
month_to_list(3) -> "Mar";
month_to_list(4) -> "Apr";
month_to_list(5) -> "May";
month_to_list(6) -> "Jun";
month_to_list(7) -> "Jul";
month_to_list(8) -> "Aug";
month_to_list(9) -> "Sep";
month_to_list(10) -> "Oct";
month_to_list(11) -> "Nov";
month_to_list(12) -> "Dec".
list_to_month("Jan") -> 1;
list_to_month("Feb") -> 2;
list_to_month("Mar") -> 3;
list_to_month("Apr") -> 4;
list_to_month("May") -> 5;
list_to_month("Jun") -> 6;
list_to_month("Jul") -> 7;
list_to_month("Aug") -> 8;
list_to_month("Sep") -> 9;
list_to_month("Oct") -> 10;
list_to_month("Nov") -> 11;
list_to_month("Dec") -> 12.
is_modified(#file_info{mtime = Mtime}, Since) ->
erlang:localtime_to_universaltime(Mtime) > rfc1123_to_date_time(Since).
is_idempotent('HEAD') -> true;
is_idempotent('GET') -> true;
is_idempotent('PUT') -> true;
is_idempotent('DELETE') -> true;
is_idempotent('TRACE') -> true;
is_idempotent('OPTIONS') -> true;
is_idempotent(_) -> false.
url_decode(URL) ->
url_decode(URL, []).
url_decode([], Acc) ->
lists:reverse(Acc);
url_decode([37, H, L | T], Acc) ->
url_decode(T, [erlang:list_to_integer([H, L], 16) | Acc]);
url_decode([$+ | T], Acc) ->
url_decode(T, [32 | Acc]);
url_decode([H | T], Acc) ->
url_decode(T, [H | Acc]).
url_decode_test() ->
?assertEqual("I am decoded", url_decode("I+am+decoded")),
?assertEqual("#$%&+=<> /", url_decode("%23%24%25%26%2B%3D%3C%3D%20%2F")).
%% @doc Generates Etag based on file modification time and size.
%% @spec etag(#file_info{}) -> string()
etag(#file_info{mtime = MTime, size = Size}) ->
{{Year, Month, Day}, {Hour, Min, Sec}} = MTime,
F = fun(X) when X =< 25 -> X + $A;
(X) when X =< 50 -> X - 26 + $a;
(X) -> X - 3
end,
SizeStr = integer_to_list(Size),
lists:map(F, [X rem 60 || X <- [Year, Month, Day, Hour, Min, Sec]]) ++ SizeStr.
mime_type(Path) ->
mime_type(Path, undefined).
mime_type(Path, Default) ->
Ext = extension(Path),
case ets:lookup(http_mime_types, Ext) of
[{mime_type, Ext, Type, _Compressible} | _] ->
Type;
[] ->
Default
end.
extension(Path) ->
case filename:extension(Path) of
[] ->
[];
Extension ->
tl(Extension)
end.
is_compressible(Path) ->
Ext = extension(Path),
case ets:lookup(http_mime_types, Ext) of
[{mime_type, Ext, _Type, Compressible} | _] ->
Compressible;
[] ->
true
end.
dir(priv_dir) ->
priv_dir(http);
dir({priv_dir, Module}) ->
priv_dir(Module);
dir({priv_dir, Module, SubDir}) ->
filename:join([priv_dir(Module), any_to_list(SubDir)]);
dir({lib_dir, SubDir}) ->
code:lib_dir(http, SubDir);
dir({lib_dir, App, SubDir}) ->
code:lib_dir(App, SubDir);
dir(Path) when is_list(Path) ->
Path.
priv_dir(Module) ->
filename:join(get_base_dir(Module), "priv").
get_base_dir(Module) ->
{file, Here} = code:is_loaded(Module),
filename:dirname(filename:dirname(Here)).
accept(Socket) when element(1, Socket) == sslsocket ->
case ssl:transport_accept(Socket) of
{ok, SSLSocket} ->
case ssl:ssl_accept(SSLSocket) of
ok ->
{ok, SSLSocket};
Else ->
Else
end;
Else ->
Else
end;
accept(Socket) ->
gen_tcp:accept(Socket).
recv(Socket, Length) when element(1, Socket) == sslsocket ->
ssl:recv(Socket, Length);
recv(Socket, Length) ->
gen_tcp:recv(Socket, Length).
recv(Socket, Length, Timeout) when element(1, Socket) == sslsocket ->
ssl:recv(Socket, Length, Timeout);
recv(Socket, Length, Timeout) ->
gen_tcp:recv(Socket, Length, Timeout).
send(Socket, Data) when element(1, Socket) == sslsocket ->
ssl:send(Socket, Data);
send(Socket, Data) ->
gen_tcp:send(Socket, Data).
setopts(Socket, Options) when element(1, Socket) == sslsocket ->
ssl:setopts(Socket, Options);
setopts(Socket, Options) ->
inet:setopts(Socket, Options).
close(Socket) when element(1, Socket) == sslsocket ->
ssl:close(Socket);
close(Socket) ->
gen_tcp:close(Socket).
peername(Socket) when element(1, Socket) == sslsocket ->
ssl:peername(Socket);
peername(Socket) ->
gen_tcp:peername(Socket).
%% RFC 2616, HTTP 1.1 Status codes
reason_phrase(100) -> "Continue";
reason_phrase(101) -> "Switching Protocols";
reason_phrase(200) -> "OK";
reason_phrase(201) -> "Created";
reason_phrase(202) -> "Accepted";
reason_phrase(203) -> "Non-Authoritative Information";
reason_phrase(204) -> "No Content";
reason_phrase(205) -> "Reset Content";
reason_phrase(206) -> "Partial Content";
reason_phrase(300) -> "Multiple Choices";
reason_phrase(301) -> "Moved Permanently";
reason_phrase(302) -> "Moved Temporarily";
reason_phrase(303) -> "See Other";
reason_phrase(304) -> "Not Modified";
reason_phrase(305) -> "Use Proxy";
reason_phrase(306) -> "(unused)";
reason_phrase(307) -> "Temporary Redirect";
reason_phrase(400) -> "Bad Request";
reason_phrase(401) -> "Unauthorized";
reason_phrase(402) -> "Payment Required";
reason_phrase(403) -> "Forbidden";
reason_phrase(404) -> "Object Not Found";
reason_phrase(405) -> "Method Not Allowed";
reason_phrase(406) -> "Not Acceptable";
reason_phrase(407) -> "Proxy Authentication Required";
reason_phrase(408) -> "Request Time-out";
reason_phrase(409) -> "Conflict";
reason_phrase(410) -> "Gone";
reason_phrase(411) -> "Length Required";
reason_phrase(412) -> "Precondition Failed";
reason_phrase(413) -> "Request Entity Too Large";
reason_phrase(414) -> "Request-URI Too Large";
reason_phrase(415) -> "Unsupported Media Type";
reason_phrase(416) -> "Requested Range Not Satisfiable";
reason_phrase(417) -> "Expectation Failed";
reason_phrase(500) -> "Internal Server Error";
reason_phrase(501) -> "Not Implemented";
reason_phrase(502) -> "Bad Gateway";
reason_phrase(503) -> "Service Unavailable";
reason_phrase(504) -> "Gateway Time-out";
reason_phrase(505) -> "HTTP Version not supported";
%% RFC 2518, HTTP Extensions for Distributed Authoring -- WEBDAV
reason_phrase(102) -> "Processing";
reason_phrase(207) -> "Multi-Status";
reason_phrase(422) -> "Unprocessable Entity";
reason_phrase(423) -> "Locked";
reason_phrase(424) -> "Failed Dependency";
reason_phrase(507) -> "Insufficient Storage";
%% (Work in Progress) WebDAV Advanced Collections
reason_phrase(425) -> "";
%% RFC 2817, HTTP Upgrade to TLS
reason_phrase(426) -> "Upgrade Required";
%% RFC 3229, Delta encoding in HTTP
reason_phrase(226) -> "IM Used";
reason_phrase(_) -> "Internal Server Error".

+ 1
- 4
src/httpSocket/utHttpOn.erl 查看文件

@ -1,8 +1,5 @@
-module(utHttpOn).
%% API
-export([]).
%% API
-export([
req/6, %% Post, Put, Delete Only
@ -21,7 +18,7 @@ get_unique_ref(Length) ->
random_num(NumeralSystemBase, Length) ->
Min = round(math:pow(NumeralSystemBase, Length - 1)),
Max = round(math:pow(NumeralSystemBase, Length)),
crypto:rand_uniform(Min, Max).
rand:uniform(Min, Max).
req(Method, Url, Headers, ContType, Body, HttpOpts)
when Method == post orelse Method == put orelse Method == delete ->

+ 1
- 1
src/measure/utProf.erl 查看文件

@ -1,6 +1,6 @@
-module(utProf).
-compile([nowarn_unused_function, nowarn_unused_vars, nowarn_export_all]).
% eprof, eprof 线,!
% TimeoutSec<10s< 1000crash

+ 2
- 2
src/nifSrc/dsInterface/utHashBbl.erl 查看文件

@ -10,7 +10,7 @@ new() ->
put(Key, Value, HashBbl1) ->
BblNum1 = erlang:phash2(Key, ?Solt_1) + 1,
BblNum2 = erlang:phash(Key, ?Solt_2),
BblNum2 = erlang:phash2(Key, ?Solt_2),
HashBbl2 = erlang:element(BblNum1, HashBbl1),
ValueList = erlang:element(BblNum2, HashBbl2),
case ValueList of
@ -35,7 +35,7 @@ put(Key, Value, HashBbl1) ->
get(Key, HashBbl1) ->
BblNum1 = erlang:phash2(Key, ?Solt_1) + 1,
BblNum2 = erlang:phash(Key, ?Solt_2),
BblNum2 = erlang:phash2(Key, ?Solt_2),
HashBbl2 = erlang:element(BblNum1, HashBbl1),
ValueList = erlang:element(BblNum2, HashBbl2),
case ValueList of

+ 0
- 57
src/nifSrc/dsInterface/utHashBbl1.erl 查看文件

@ -1,57 +0,0 @@
-module(utHashBbl1).
-import(erlang, [make_tuple/2, make_tuple/3]).
-compile([export_all, nowarn_unused_function, nowarn_unused_vars, nowarn_export_all]).
-define(Solt_1, 128).
-define(Solt_2, 128).
new() ->
erlang:make_tuple(?Solt_1, []).
put(Key, Value, HashBbl1) ->
BblNum1 = erlang:phash2(Key, ?Solt_1) + 1,
BblNum2 = erlang:phash(Key, ?Solt_2),
HashBbl2 = erlang:element(BblNum1, HashBbl1),
case lists:keyfind(BblNum2, 1, HashBbl2) of
false ->
erlang:setelement(BblNum1, HashBbl1, [{BblNum2, {Key, Value}} | HashBbl2]);
{BblNum2, ValueList} ->
case ValueList of
{Key, Value} ->
HashBbl1;
{Key, _OldValue} ->
erlang:setelement(BblNum1, HashBbl1, lists:keyreplace(BblNum2, 1, HashBbl2, {BblNum2, {Key, Value}}));
{_OldKey, _OldValue} = OldInfo ->
erlang:setelement(BblNum1, HashBbl1, lists:keyreplace(BblNum2, 1, HashBbl2, {BblNum2, [{Key, Value}, OldInfo]}));
List ->
case lists:keyfind(Key, 1, List) of
false ->
erlang:setelement(BblNum1, HashBbl1, lists:keyreplace(BblNum2, 1, HashBbl2, {BblNum2, [{Key, Value} | List]}));
{Key, Value} ->
HashBbl1;
{Key, _OldValue} ->
erlang:setelement(BblNum1, HashBbl1, lists:keyreplace(BblNum2, 1, HashBbl2, {BblNum2, lists:keyreplace(Key, 1, List, {Key, Value})}))
end
end
end.
get(Key, HashBbl1) ->
BblNum1 = erlang:phash2(Key, ?Solt_1) + 1,
BblNum2 = erlang:phash(Key, ?Solt_2),
HashBbl2 = erlang:element(BblNum1, HashBbl1),
case lists:keyfind(BblNum2, 1, HashBbl2) of
false ->
undefined;
{BblNum2, ValueList} ->
case ValueList of
{Key, Value} ->
Value;
List ->
case lists:keyfind(Key, 1, List) of
false ->
undefined;
{Key, Value} ->
Value
end
end
end.

+ 2
- 2
src/nifSrc/nifArray/nifArray.erl 查看文件

@ -39,11 +39,11 @@ get(_Ref, _Index) ->
put(_Ref, _Index, _Value) ->
erlang:nif_error({nif_not_loaded, module, ?MODULE, line, ?LINE}).
test(Value) ->
test(_Value) ->
erlang:nif_error({nif_not_loaded, module, ?MODULE, line, ?LINE}).
test1(Value) ->
Bin = term_to_binary(Value),
Term = binary_to_term(Bin).
binary_to_term(Bin).

+ 2
- 0
src/nifSrc/nifHashb/nifHashb.erl 查看文件

@ -1,5 +1,7 @@
-module(nifHashb).
-compile([nowarn_unused_function, nowarn_unused_vars, nowarn_export_all]).
-on_load(init/0).
-export([

+ 2
- 0
src/nifSrc/nifHashb/nifHashbback.erl 查看文件

@ -1,5 +1,7 @@
-module(nifHashbback).
-compile([nowarn_unused_function, nowarn_unused_vars, nowarn_export_all]).
-on_load(init/0).
-export([

+ 1
- 1
src/srvNodeMgr/mtop.erl 查看文件

@ -46,7 +46,7 @@
make_info(ProcInfo) ->
#mtop_info{now = now(),
#mtop_info{now = utTime:now(),
n_procs = length(ProcInfo),
run_queue = erlang:statistics(run_queue),
wall_clock = erlang:statistics(wall_clock),

+ 1
- 1
src/srvNodeMgr/utAppStart.erl 查看文件

@ -24,7 +24,7 @@ startApp(App, Type) ->
startRely(ok, _App, _Type) ->
ok;
startRely({error, {already_started, _App}}, _App, _Type) ->
startRely({error, {already_started, _App}}, _, _Type) ->
ok;
startRely({error, {not_started, Rely}}, App, Type) ->
ok = start(Rely, Type),

+ 3
- 0
src/srvNodeMgr/utVMInfo.erl 查看文件

@ -2,6 +2,9 @@
-include("utComMisc.hrl").
-compile([nowarn_unused_function, nowarn_unused_vars, nowarn_export_all]).
-export([
vmInfo/0 %%
, processInfo/1 %%

+ 2
- 3
src/template/ut_gen_apu.erl 查看文件

@ -1,5 +1,6 @@
-module(ut_gen_apu).
-behaviour(ut_gen_apu).
% -behaviour(gen_apu).
-compile(inline).
-compile({inline_size, 128}).
@ -32,11 +33,9 @@ init(_Args) ->
{ok, #state{}}.
xxxCall({xxxCall, Arg1, Arg2}, _State, _From) ->
{Arg1, Arg2},
{reply, ok}.
xxxCast({xxxCast, Arg1, Arg2}, _State) ->
{Arg1, Arg2},
kpS.
handleInfo(_Msg, _State) ->

+ 2
- 1
src/template/ut_gen_srv.erl 查看文件

@ -1,5 +1,6 @@
-module(ut_gen_srv).
-behaviour(ut_gen_srv).
% -behaviour(gen_srv).
-compile(inline).
-compile({inline_size, 128}).

+ 0
- 6
src/testCase/utTpfm.erl 查看文件

@ -230,9 +230,6 @@ ht(N, Fun) ->
[?MODULE:Fun(Term) || Term <- ?List],
ht(N - 1, Fun).
hash1(Term) ->
erlang:phash(Term, 256).
hash2(Term) ->
erlang:phash2(Term, 256).
@ -251,9 +248,6 @@ ht1(N, Fun, Term) ->
?MODULE:Fun(Term),
ht1(N - 1, Fun, Term).
hash3(Term) ->
erlang:phash(Term, 256).
hash4(Term) ->
erlang:phash2(Term, 256).

正在加载...
取消
保存