From commits-return-2721-apmail-couchdb-commits-archive=couchdb.apache.org@couchdb.apache.org Mon Jul 06 00:34:22 2009 Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 89657 invoked from network); 6 Jul 2009 00:34:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 6 Jul 2009 00:34:22 -0000 Received: (qmail 46172 invoked by uid 500); 6 Jul 2009 00:34:32 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 46096 invoked by uid 500); 6 Jul 2009 00:34:32 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 46087 invoked by uid 99); 6 Jul 2009 00:34:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jul 2009 00:34:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jul 2009 00:34:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 70E9F2388904; Mon, 6 Jul 2009 00:34:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r791350 [4/5] - in /couchdb/trunk: etc/couchdb/ share/server/ share/www/ share/www/dialog/ share/www/script/ share/www/script/test/ share/www/style/ src/couchdb/ src/ibrowse/ src/mochiweb/ test/ test/etap/ Date: Mon, 06 Jul 2009 00:33:54 -0000 To: commits@couchdb.apache.org From: nslater@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090706003400.70E9F2388904@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: couchdb/trunk/src/couchdb/couch_view_compactor.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view_compactor.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/couchdb/couch_view_compactor.erl (original) +++ couchdb/trunk/src/couchdb/couch_view_compactor.erl Mon Jul 6 00:33:50 2009 @@ -34,20 +34,20 @@ name = GroupId, views = Views } = Group, - + #group{ db = Db, id_btree = EmptyIdBtree, views = EmptyViews } = EmptyGroup, - + {ok, {Count, _}} = couch_btree:full_reduce(Db#db.fulldocinfo_by_id_btree), - + <<"_design", ShortName/binary>> = GroupId, DbName = couch_db:name(Db), TaskName = <>, couch_task_status:add_task(<<"View Group Compaction">>, TaskName, <<"">>), - + Fun = fun(KV, {Bt, Acc, TotalCopied}) -> if TotalCopied rem 10000 == 0 -> couch_task_status:update("Copied ~p of ~p Ids (~p%)", @@ -58,27 +58,27 @@ {ok, {Bt, [KV|Acc], TotalCopied+1}} end end, - {ok, {Bt3, Uncopied, _Total}} = couch_btree:foldl(IdBtree, Fun, + {ok, {Bt3, Uncopied, _Total}} = couch_btree:foldl(IdBtree, Fun, {EmptyIdBtree, [], 0}), {ok, NewIdBtree} = couch_btree:add(Bt3, lists:reverse(Uncopied)), - + NewViews = lists:map(fun({View, EmptyView}) -> compact_view(View, EmptyView) end, lists:zip(Views, EmptyViews)), - + NewGroup = EmptyGroup#group{ - id_btree=NewIdBtree, - views=NewViews, + id_btree=NewIdBtree, + views=NewViews, current_seq=Seq }, - + Pid = couch_view:get_group_server(DbName, GroupId), gen_server:cast(Pid, {compact_done, NewGroup}). %% @spec compact_view(View, EmptyView, Retry) -> CompactView compact_view(View, EmptyView) -> {ok, Count} = couch_view:get_row_count(View), - + %% Key is {Key,DocId} Fun = fun(KV, {Bt, Acc, TotalCopied}) -> if TotalCopied rem 10000 == 0 -> @@ -86,12 +86,12 @@ [View#view.id_num, TotalCopied, Count, (TotalCopied*100) div Count]), {ok, Bt2} = couch_btree:add(Bt, lists:reverse([KV|Acc])), {ok, {Bt2, [], TotalCopied + 1}}; - true -> + true -> {ok, {Bt, [KV|Acc], TotalCopied + 1}} end end, - - {ok, {Bt3, Uncopied, _Total}} = couch_btree:foldl(View#view.btree, Fun, + + {ok, {Bt3, Uncopied, _Total}} = couch_btree:foldl(View#view.btree, Fun, {EmptyView#view.btree, [], 0}), {ok, NewBt} = couch_btree:add(Bt3, lists:reverse(Uncopied)), EmptyView#view{btree = NewBt}. Modified: couchdb/trunk/src/couchdb/couch_view_group.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view_group.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/couchdb/couch_view_group.erl (original) +++ couchdb/trunk/src/couchdb/couch_view_group.erl Mon Jul 6 00:33:50 2009 @@ -22,7 +22,7 @@ terminate/2, code_change/3]). -include("couch_db.hrl"). - + -record(group_state, { type, db_name, @@ -70,7 +70,7 @@ {InitArgs, self(), Ref = make_ref()}, []) of {ok, Pid} -> {ok, Pid}; - ignore -> + ignore -> receive {Ref, Pid, Error} -> case process_info(self(), trap_exit) of @@ -83,7 +83,7 @@ Error end. -% init creates a closure which spawns the appropriate view_updater. +% init creates a closure which spawns the appropriate view_updater. init({InitArgs, ReturnPid, Ref}) -> process_flag(trap_exit, true), case prepare_group(InitArgs, false) of @@ -118,7 +118,7 @@ % If the request sequence is higher than our current high_target seq, we set % that as the highest seqence. If the updater is not running, we launch it. -handle_call({request_group, RequestSeq}, From, +handle_call({request_group, RequestSeq}, From, #group_state{ db_name=DbName, group=#group{current_seq=Seq}=Group, @@ -128,13 +128,13 @@ {ok, Db} = couch_db:open(DbName, []), Group2 = Group#group{db=Db}, Pid = spawn_link(fun()-> couch_view_updater:update(Group2) end), - + {noreply, State#group_state{ updater_pid=Pid, group=Group2, waiting_list=[{From,RequestSeq}|WaitList] }, infinity}; - + % If the request seqence is less than or equal to the seq_id of a known Group, % we respond with that Group. @@ -159,7 +159,7 @@ GroupInfo = get_group_info(Group, CompactorPid), {reply, {ok, GroupInfo}, State}. -handle_cast({start_compact, CompactFun}, #group_state{ compactor_pid=nil, +handle_cast({start_compact, CompactFun}, #group_state{ compactor_pid=nil, group=Group, init_args={view, RootDir, DbName, GroupId} } = State) -> ?LOG_INFO("Starting view group compaction", []), {ok, Db} = couch_db:open(DbName, []), @@ -171,10 +171,10 @@ %% compact already running, this is a no-op {noreply, State}; -handle_cast({compact_done, #group{fd=NewFd, current_seq=NewSeq} = NewGroup}, - #group_state{ +handle_cast({compact_done, #group{fd=NewFd, current_seq=NewSeq} = NewGroup}, + #group_state{ group = #group{current_seq=OldSeq, sig=GroupSig} = Group, - init_args = {view, RootDir, DbName, _GroupId}, + init_args = {view, RootDir, DbName, _GroupId}, updater_pid = nil, ref_counter = RefCounter } = State) when NewSeq >= OldSeq -> @@ -183,7 +183,7 @@ CompactName = index_file_name(compact, RootDir, DbName, GroupSig), file:delete(FileName), ok = file:rename(CompactName, FileName), - + %% cleanup old group couch_ref_counter:drop(RefCounter), {ok, NewRefCounter} = couch_ref_counter:start([NewFd]), @@ -191,20 +191,20 @@ nil -> ok; Else -> couch_db:close(Else) end, - + erlang:send_after(1000, self(), delayed_commit), {noreply, State#group_state{ - group=NewGroup, + group=NewGroup, ref_counter=NewRefCounter, compactor_pid=nil }}; -handle_cast({compact_done, NewGroup}, #group_state{ +handle_cast({compact_done, NewGroup}, #group_state{ init_args={view, _RootDir, DbName, GroupId} } = State) -> ?LOG_INFO("View index compaction still behind main file", []), couch_db:close(NewGroup#group.db), {ok, Db} = couch_db:open(DbName, []), - Pid = spawn_link(fun() -> - {_,Ref} = erlang:spawn_monitor(fun() -> + Pid = spawn_link(fun() -> + {_,Ref} = erlang:spawn_monitor(fun() -> couch_view_updater:update(NewGroup#group{db = Db}) end), receive @@ -258,8 +258,8 @@ {noreply, State#group_state{waiting_commit=true, waiting_list=StillWaiting, group=Group2, updater_pid=Pid}} end; - -handle_info({'EXIT', FromPid, reset}, + +handle_info({'EXIT', FromPid, reset}, #group_state{ init_args=InitArgs, updater_pid=UpPid, @@ -274,10 +274,10 @@ Error -> {stop, normal, reply_all(State, Error)} end; - + handle_info({'EXIT', _FromPid, normal}, State) -> {noreply, State}; - + handle_info({'EXIT', FromPid, {{nocatch, Reason}, _Trace}}, State) -> ?LOG_DEBUG("Uncaught throw() in linked pid: ~p", [{FromPid, Reason}]), {stop, Reason, State}; @@ -285,7 +285,7 @@ handle_info({'EXIT', FromPid, Reason}, State) -> ?LOG_DEBUG("Exit from linked pid: ~p", [{FromPid, Reason}]), {stop, Reason, State}; - + handle_info({'DOWN',_,_,_,_}, State) -> ?LOG_INFO("Shutting down view group server, monitored db is closing.", []), {stop, normal, reply_all(State, shutdown)}. @@ -305,13 +305,13 @@ % reply_with_group/3 % for each item in the WaitingList {Pid, Seq} % if the Seq is =< GroupSeq, reply -reply_with_group(Group=#group{current_seq=GroupSeq}, [{Pid, Seq}|WaitList], +reply_with_group(Group=#group{current_seq=GroupSeq}, [{Pid, Seq}|WaitList], StillWaiting, RefCounter) when Seq =< GroupSeq -> gen_server:reply(Pid, {ok, Group, RefCounter}), reply_with_group(Group, WaitList, StillWaiting, RefCounter); % else -% put it in the continuing waiting list +% put it in the continuing waiting list reply_with_group(Group, [{Pid, Seq}|WaitList], StillWaiting, RefCounter) -> reply_with_group(Group, WaitList, [{Pid, Seq}|StillWaiting], RefCounter); @@ -351,7 +351,7 @@ Else end. -get_index_header_data(#group{current_seq=Seq, purge_seq=PurgeSeq, +get_index_header_data(#group{current_seq=Seq, purge_seq=PurgeSeq, id_btree=IdBtree,views=Views}) -> ViewStates = [couch_btree:get_state(Btree) || #view{btree=Btree} <- Views], #index_header{seq=Seq, @@ -364,7 +364,7 @@ design_root(RootDir, DbName) -> RootDir ++ "/." ++ ?b2l(DbName) ++ "_design/". - + index_file_name(RootDir, DbName, GroupSig) -> design_root(RootDir, DbName) ++ hex_sig(GroupSig) ++".view". @@ -390,17 +390,17 @@ reduce_funs= if RedSrc==[] -> []; true -> [{<<"_temp">>, RedSrc}] end}, {ok, Db, #group{ - name = <<"_temp">>, + name = <<"_temp">>, db=Db, - views=[View], - def_lang=Language, + views=[View], + def_lang=Language, design_options=DesignOptions, sig = erlang:md5(term_to_binary({[View], Language, DesignOptions})) }}; Error -> Error end. - + open_db_group(DbName, GroupId) -> case couch_db:open(DbName, []) of {ok, Db} -> @@ -425,7 +425,7 @@ {signature, ?l2b(hex_sig(GroupSig))}, {language, Lang}, {disk_size, Size}, - {compact_running, CompactorPid /= nil} + {compact_running, CompactorPid /= nil} ]. % maybe move to another module @@ -490,11 +490,11 @@ Views2 = lists:zipwith( fun(BtreeState, #view{reduce_funs=RedFuns}=View) -> FunSrcs = [FunSrc || {_Name, FunSrc} <- RedFuns], - ReduceFun = + ReduceFun = fun(reduce, KVs) -> KVs2 = couch_view:expand_dups(KVs,[]), KVs3 = couch_view:detuple_kvs(KVs2,[]), - {ok, Reduced} = couch_query_servers:reduce(Lang, FunSrcs, + {ok, Reduced} = couch_query_servers:reduce(Lang, FunSrcs, KVs3), {length(KVs3), Reduced}; (rereduce, Reds) -> Modified: couchdb/trunk/src/couchdb/couch_view_updater.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view_updater.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/couchdb/couch_view_updater.erl (original) +++ couchdb/trunk/src/couchdb/couch_view_updater.erl Mon Jul 6 00:33:50 2009 @@ -18,7 +18,7 @@ update(#group{db=#db{name=DbName}=Db,name=GroupName,current_seq=Seq,purge_seq=PurgeSeq}=Group) -> couch_task_status:add_task(<<"View Group Indexer">>, <>, <<"Starting index update">>), - + DbPurgeSeq = couch_db:get_purge_seq(Db), Group2 = if DbPurgeSeq == PurgeSeq -> @@ -30,7 +30,7 @@ couch_task_status:update(<<"Resetting view index due to lost purge entries.">>), exit(reset) end, - + ViewEmptyKVs = [{View, []} || View <- Group2#group.views], % compute on all docs modified since we last computed. TotalChanges = couch_db:count_changes_since(Db, Seq), @@ -95,9 +95,9 @@ % This fun computes once for each document #doc_info{id=DocId, revs=[#rev_info{deleted=Deleted}|_]} = DocInfo, - IncludeDesign = proplists:get_value(<<"include_design">>, + IncludeDesign = proplists:get_value(<<"include_design">>, DesignOptions, false), - LocalSeq = proplists:get_value(<<"local_seq">>, + LocalSeq = proplists:get_value(<<"local_seq">>, DesignOptions, false), DocOpts = case LocalSeq of true -> @@ -113,15 +113,15 @@ if Deleted -> {Docs, [{DocId, []} | DocIdViewIdKeys]}; true -> - {ok, Doc} = couch_db:open_doc_int(Db, DocInfo, + {ok, Doc} = couch_db:open_doc_int(Db, DocInfo, DocOpts), {[Doc | Docs], DocIdViewIdKeys} end, - + case couch_util:should_flush() of true -> {Group1, Results} = view_compute(Group, Docs2), - {ViewKVs3, DocIdViewIdKeys3} = view_insert_query_results(Docs2, + {ViewKVs3, DocIdViewIdKeys3} = view_insert_query_results(Docs2, Results, ViewKVs, DocIdViewIdKeys2), {ok, Group2} = write_changes(Group1, ViewKVs3, DocIdViewIdKeys3, DocInfo#doc_info.high_seq), @@ -159,7 +159,7 @@ [{Key,Value},{PrevKey,PrevVal}|AccRest] end; (KV, []) -> - [KV] + [KV] end, [], lists:sort(ResultKVs)), NewKVs = [{{Key, DocId}, Value} || {Key, Value} <- ResultKVs2], NewViewKVsAcc = [{View, NewKVs ++ KVs} | ViewKVsAcc], Modified: couchdb/trunk/src/couchdb/curlhelper.c URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/curlhelper.c?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/couchdb/curlhelper.c (original) +++ couchdb/trunk/src/couchdb/curlhelper.c Mon Jul 6 00:33:50 2009 @@ -38,7 +38,7 @@ } void free_Buffer(Buffer b) { - if(b == NULL) + if(b == NULL) return; if(b->data != NULL) free(b->data); @@ -186,7 +186,7 @@ } *(l->elements + pos) = ptr; - + return TRUE; } Modified: couchdb/trunk/src/ibrowse/ibrowse.app URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse.app?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/ibrowse/ibrowse.app (original) +++ couchdb/trunk/src/ibrowse/ibrowse.app Mon Jul 6 00:33:50 2009 @@ -1,10 +1,10 @@ {application, ibrowse, [{description, "HTTP client application"}, {vsn, "1.5.0"}, - {modules, [ ibrowse, - ibrowse_http_client, - ibrowse_app, - ibrowse_sup, + {modules, [ ibrowse, + ibrowse_http_client, + ibrowse_app, + ibrowse_sup, ibrowse_lib, ibrowse_lb ]}, {registered, []}, Modified: couchdb/trunk/src/ibrowse/ibrowse.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/ibrowse/ibrowse.erl (original) +++ couchdb/trunk/src/ibrowse/ibrowse.erl Mon Jul 6 00:33:50 2009 @@ -21,14 +21,14 @@ %%

Here are a few sample invocations.

%% %% -%% ibrowse:send_req("http://intranet/messenger/", [], get). +%% ibrowse:send_req("http://intranet/messenger/", [], get). %%

-%% -%% ibrowse:send_req("http://www.google.com/", [], get, [], +%% +%% ibrowse:send_req("http://www.google.com/", [], get, [], %% [{proxy_user, "XXXXX"}, %% {proxy_password, "XXXXX"}, %% {proxy_host, "proxy"}, -%% {proxy_port, 8080}], 1000). +%% {proxy_port, 8080}], 1000). %%

%% %%ibrowse:send_req("http://www.erlang.org/download/otp_src_R10B-3.tar.gz", [], get, [], @@ -48,7 +48,7 @@ %% ibrowse:send_req("http://www.bbc.co.uk", [], trace). %% %%

-%% ibrowse:send_req("http://www.google.com", [], get, [], +%% ibrowse:send_req("http://www.google.com", [], get, [], %% [{stream_to, self()}]). %%
%% @@ -110,7 +110,7 @@ get_value/3, do_trace/2 ]). - + -record(state, {trace = false}). -include("ibrowse.hrl"). @@ -158,7 +158,7 @@ send_req(Url, Headers, Method) -> send_req(Url, Headers, Method, [], []). -%% @doc Same as send_req/3. +%% @doc Same as send_req/3. %% If a list is specified for the body it has to be a flat list. The body can also be a fun/0 or a fun/1.
%% If fun/0, the connection handling process will repeatdely call the fun until it returns an error or eof.
Fun() = {ok, Data} | eof

%% If fun/1, the connection handling process will repeatedly call the fun with the supplied state until it returns an error or eof.
Fun(State) = {ok, Data} | {ok, Data, NewState} | eof
@@ -168,7 +168,7 @@ send_req(Url, Headers, Method, Body) -> send_req(Url, Headers, Method, Body, []). -%% @doc Same as send_req/4. +%% @doc Same as send_req/4. %% For a description of SSL Options, look in the ssl manpage. If the %% HTTP Version to use is not specified, the default is 1.1. %%
@@ -181,7 +181,7 @@ %% used to specify what should go in the Host header in %% the request.

%%
    -%%
  • When both the options save_response_to_file and stream_to +%%
  • When both the options save_response_to_file and stream_to %% are specified, the former takes precedence.
  • %% %%
  • For the save_response_to_file option, the response body is saved to @@ -211,21 +211,21 @@ %% ibrowse:send_req("http://www.example.com/cgi-bin/request", [], get, [], [{connect_timeout, 100}], 1000). %% %% In the above invocation, if the connection isn't established within -%% 100 milliseconds, the request will fail with +%% 100 milliseconds, the request will fail with %% {error, conn_failed}.
    %% If connection setup succeeds, the total time allowed for the %% request to complete will be 1000 milliseconds minus the time taken %% for connection setup. %%
  • %%
-%% +%% %% @spec send_req(Url::string(), Headers::headerList(), Method::method(), Body::body(), Options::optionList()) -> response() %% optionList() = [option()] %% option() = {max_sessions, integer()} | %% {response_format,response_format()}| %% {stream_chunk_size, integer()} | %% {max_pipeline_size, integer()} | -%% {trace, boolean()} | +%% {trace, boolean()} | %% {is_ssl, boolean()} | %% {ssl_options, [SSLOpt]} | %% {pool_name, atom()} | @@ -257,7 +257,7 @@ send_req(Url, Headers, Method, Body, Options) -> send_req(Url, Headers, Method, Body, Options, 30000). -%% @doc Same as send_req/5. +%% @doc Same as send_req/5. %% All timeout values are in milliseconds. %% @spec send_req(Url, Headers::headerList(), Method::method(), Body::body(), Options::optionList(), Timeout) -> response() %% Timeout = integer() | infinity @@ -282,7 +282,7 @@ true -> {get_value(ssl_options, Options_1, []), true} end, case ibrowse_lb:spawn_connection(Lb_pid, Parsed_url, - Max_sessions, + Max_sessions, Max_pipeline_size, {SSLOptions, IsSSL}) of {ok, Conn_Pid} -> @@ -333,7 +333,7 @@ exit({invalid_option, H}); set_dest(_, _, []) -> ok. - + %% @doc Set the maximum number of connections allowed to a specific Host:Port. %% @spec set_max_sessions(Host::string(), Port::integer(), Max::integer()) -> ok set_max_sessions(Host, Port, Max) when is_integer(Max), Max > 0 -> @@ -432,7 +432,7 @@ %% caller. Should be used in conjunction with the %% stream_to option %% @spec stream_next(Req_id :: req_id()) -> ok | {error, unknown_req_id} -stream_next(Req_id) -> +stream_next(Req_id) -> case ets:lookup(ibrowse_stream, {req_id_pid, Req_id}) of [] -> {error, unknown_req_id}; @@ -451,7 +451,7 @@ %% @doc Turn tracing on for all connections to the specified HTTP %% server. Host is whatever is specified as the domain name in the URL %% @spec trace_on(Host, Port) -> ok -%% Host = string() +%% Host = string() %% Port = integer() trace_on(Host, Port) -> ibrowse ! {trace, true, Host, Port}, @@ -554,7 +554,7 @@ case file:consult(Filename) of {ok, Terms} -> ets:delete_all_objects(ibrowse_conf), - Fun = fun({dest, Host, Port, MaxSess, MaxPipe, Options}) + Fun = fun({dest, Host, Port, MaxSess, MaxPipe, Options}) when is_list(Host), is_integer(Port), is_integer(MaxSess), MaxSess > 0, is_integer(MaxPipe), MaxPipe > 0, is_list(Options) -> @@ -564,7 +564,7 @@ lists:foreach( fun({X, Y}) -> ets:insert(ibrowse_conf, - #ibrowse_conf{key = X, + #ibrowse_conf{key = X, value = Y}) end, I); ({K, V}) -> @@ -663,7 +663,7 @@ ets:foldl(Fun, undefined, ibrowse_lb), ets:select_delete(ibrowse_conf, [{{ibrowse_conf,{trace,'$1','$2'},true},[],['true']}]), {noreply, State}; - + handle_info({trace, Bool}, State) -> put(my_trace_flag, Bool), {noreply, State}; @@ -680,7 +680,7 @@ ets:insert(ibrowse_conf, #ibrowse_conf{key = {trace, Host, Port}, value = Bool}), {noreply, State}; - + handle_info(_Info, State) -> {noreply, State}. Modified: couchdb/trunk/src/ibrowse/ibrowse_app.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse_app.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/ibrowse/ibrowse_app.erl (original) +++ couchdb/trunk/src/ibrowse/ibrowse_app.erl Mon Jul 6 00:33:50 2009 @@ -1,7 +1,7 @@ %%%------------------------------------------------------------------- %%% File : ibrowse_app.erl %%% Author : Chandrashekhar Mullaparthi -%%% Description : +%%% Description : %%% %%% Created : 15 Oct 2003 by Chandrashekhar Mullaparthi %%%------------------------------------------------------------------- @@ -42,11 +42,11 @@ %% Func: start/2 %% Returns: {ok, Pid} | %% {ok, Pid, State} | -%% {error, Reason} +%% {error, Reason} %%-------------------------------------------------------------------- start(_Type, _StartArgs) -> case ibrowse_sup:start_link() of - {ok, Pid} -> + {ok, Pid} -> {ok, Pid}; Error -> Error @@ -54,7 +54,7 @@ %%-------------------------------------------------------------------- %% Func: stop/1 -%% Returns: any +%% Returns: any %%-------------------------------------------------------------------- stop(_State) -> ok. Modified: couchdb/trunk/src/ibrowse/ibrowse_http_client.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse_http_client.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/ibrowse/ibrowse_http_client.erl (original) +++ couchdb/trunk/src/ibrowse/ibrowse_http_client.erl Mon Jul 6 00:33:50 2009 @@ -51,10 +51,10 @@ }). -record(request, {url, method, options, from, - stream_to, caller_controls_socket = false, + stream_to, caller_controls_socket = false, req_id, stream_chunk_size, - save_response_to_file = false, + save_response_to_file = false, tmp_file_name, tmp_file_fd, response_format}). @@ -338,7 +338,7 @@ State#state{reply_buffer = RepBuf_1}; _ when Caller_controls_socket == true -> do_interim_reply(StreamTo, Response_format, ReqId, RepBuf_1), - State#state{reply_buffer = <<>>, + State#state{reply_buffer = <<>>, streamed_size = Streamed_size + size(RepBuf_1)}; _ when New_data_size >= Stream_chunk_size -> {Stream_chunk, Rem_data} = split_binary(RepBuf_1, Stream_chunk_size), @@ -514,7 +514,7 @@ {Caller, once} when is_pid(Caller) or is_atom(Caller) -> Async_pid_rec = {{req_id_pid, ReqId}, self()}, - true = ets:insert(ibrowse_stream, Async_pid_rec), + true = ets:insert(ibrowse_stream, Async_pid_rec), {Caller, true}; undefined -> {undefined, false}; @@ -869,7 +869,7 @@ %% This clause determines the chunk size when given data from the beginning of the chunk parse_11_response(DataRecvd, - #state{transfer_encoding=chunked, + #state{transfer_encoding=chunked, chunk_size=chunk_start, chunk_size_buffer = Chunk_sz_buf } = State) -> @@ -899,7 +899,7 @@ %% This clause is to remove the CRLF between two chunks %% parse_11_response(DataRecvd, - #state{transfer_encoding = chunked, + #state{transfer_encoding = chunked, chunk_size = tbd, chunk_size_buffer = Buf}=State) -> case scan_crlf(Buf, DataRecvd) of @@ -916,7 +916,7 @@ %% This clause deals with the end of a chunked transfer parse_11_response(DataRecvd, - #state{transfer_encoding = chunked, chunk_size = 0, + #state{transfer_encoding = chunked, chunk_size = 0, cur_req = CurReq, deleted_crlf = DelCrlf, reply_buffer = Trailer, reqs = Reqs}=State) -> @@ -1449,7 +1449,7 @@ ?DEFAULT_STREAM_CHUNK_SIZE end. -get_inac_timeout(#state{cur_req = #request{options = Opts}}) -> +get_inac_timeout(#state{cur_req = #request{options = Opts}}) -> get_value(inactivity_timeout, Opts, infinity); get_inac_timeout(#state{cur_req = undefined}) -> infinity. Modified: couchdb/trunk/src/ibrowse/ibrowse_lb.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse_lb.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/ibrowse/ibrowse_lb.erl (original) +++ couchdb/trunk/src/ibrowse/ibrowse_lb.erl Mon Jul 6 00:33:50 2009 @@ -1,7 +1,7 @@ %%%------------------------------------------------------------------- %%% File : ibrowse_lb.erl %%% Author : chandru -%%% Description : +%%% Description : %%% %%% Created : 6 Mar 2008 by chandru %%%------------------------------------------------------------------- @@ -101,7 +101,7 @@ % #state{max_sessions = Max_sess, % ets_tid = Tid, % max_pipeline_size = Max_pipe_sz, -% num_cur_sessions = Num} = State) +% num_cur_sessions = Num} = State) % when Num >= Max -> % Reply = find_best_connection(Tid), % {reply, sorry_dude_reuse, State}; @@ -109,7 +109,7 @@ %% Update max_sessions in #state with supplied value handle_call({spawn_connection, _Url, Max_sess, Max_pipe, _}, _From, #state{ets_tid = Tid, - num_cur_sessions = Num} = State) + num_cur_sessions = Num} = State) when Num >= Max_sess -> Reply = find_best_connection(Tid, Max_pipe), {reply, Reply, State#state{max_sessions = Max_sess}}; Modified: couchdb/trunk/src/ibrowse/ibrowse_lib.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse_lib.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/ibrowse/ibrowse_lib.erl (original) +++ couchdb/trunk/src/ibrowse/ibrowse_lib.erl Mon Jul 6 00:33:50 2009 @@ -1,6 +1,6 @@ %%% File : ibrowse_lib.erl %%% Author : Chandrashekhar Mullaparthi -%%% Description : +%%% Description : %%% Created : 27 Feb 2004 by Chandrashekhar Mullaparthi %% @doc Module with a few useful functions @@ -110,7 +110,7 @@ month_int("Nov") -> 11; month_int("Dec") -> 12. -%% @doc Given a status code, returns an atom describing the status code. +%% @doc Given a status code, returns an atom describing the status code. %% @spec status_code(StatusCode::status_code()) -> StatusDescription %% status_code() = string() | integer() %% StatusDescription = atom() @@ -271,7 +271,7 @@ {invalid_uri_1, Url}; parse_url([$:, $/, $/ | T], get_protocol, Url, TmpAcc) -> Prot = list_to_atom(lists:reverse(TmpAcc)), - parse_url(T, get_username, + parse_url(T, get_username, Url#url{protocol = Prot}, []); parse_url([$/ | T], get_username, Url, TmpAcc) -> @@ -285,16 +285,16 @@ %% a username/password. If we encounter a '@' later on, there is a %% username/password indeed. If we encounter a '/', it was %% actually the hostname - parse_url(T, get_password, + parse_url(T, get_password, Url#url{username = lists:reverse(TmpAcc)}, []); parse_url([$@ | T], get_username, Url, TmpAcc) -> - parse_url(T, get_host, + parse_url(T, get_host, Url#url{username = lists:reverse(TmpAcc), password = ""}, []); parse_url([$@ | T], get_password, Url, TmpAcc) -> - parse_url(T, get_host, + parse_url(T, get_host, Url#url{password = lists:reverse(TmpAcc)}, []); parse_url([$/ | T], get_password, Url, TmpAcc) -> @@ -308,7 +308,7 @@ password = undefined, path = [$/ | T]}; parse_url([$: | T], get_host, #url{} = Url, TmpAcc) -> - parse_url(T, get_port, + parse_url(T, get_port, Url#url{host = lists:reverse(TmpAcc)}, []); parse_url([$/ | T], get_host, #url{protocol=Prot} = Url, TmpAcc) -> @@ -340,7 +340,7 @@ _ -> list_to_integer(lists:reverse(TmpAcc)) end, - Url#url{port = Port, + Url#url{port = Port, path = "/"}; parse_url([], get_password, Url, TmpAcc) -> %% Ok, what we thought was the username/password was the hostname @@ -387,12 +387,12 @@ -ifdef(DEBUG). do_trace(_, Fmt, Args) -> io:format("~s -- (~s) - "++Fmt, - [printable_date(), + [printable_date(), get(ibrowse_trace_token) | Args]). -else. do_trace(true, Fmt, Args) -> io:format("~s -- (~s) - "++Fmt, - [printable_date(), + [printable_date(), get(ibrowse_trace_token) | Args]); do_trace(_, _, _) -> ok. Modified: couchdb/trunk/src/ibrowse/ibrowse_sup.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse_sup.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/ibrowse/ibrowse_sup.erl (original) +++ couchdb/trunk/src/ibrowse/ibrowse_sup.erl Mon Jul 6 00:33:50 2009 @@ -1,7 +1,7 @@ %%%------------------------------------------------------------------- %%% File : ibrowse_sup.erl %%% Author : Chandrashekhar Mullaparthi -%%% Description : +%%% Description : %%% %%% Created : 15 Oct 2003 by Chandrashekhar Mullaparthi %%%------------------------------------------------------------------- @@ -53,7 +53,7 @@ %% Func: init/1 %% Returns: {ok, {SupFlags, [ChildSpec]}} | %% ignore | -%% {error, Reason} +%% {error, Reason} %%-------------------------------------------------------------------- init([]) -> AChild = {ibrowse,{ibrowse,start_link,[]}, Modified: couchdb/trunk/src/ibrowse/ibrowse_test.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/ibrowse/ibrowse_test.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/ibrowse/ibrowse_test.erl (original) +++ couchdb/trunk/src/ibrowse/ibrowse_test.erl Mon Jul 6 00:33:50 2009 @@ -225,7 +225,7 @@ unit_tests(Options) -> Options_1 = Options ++ [{connect_timeout, 5000}], {Pid, Ref} = erlang:spawn_monitor(?MODULE, unit_tests_1, [self(), Options_1]), - receive + receive {done, Pid} -> ok; {'DOWN', Ref, _, _, Info} -> @@ -292,7 +292,7 @@ do_async_req_list(Url, Method, Options) -> {Pid,_} = erlang:spawn_monitor(?MODULE, i_do_async_req_list, - [self(), Url, Method, + [self(), Url, Method, Options ++ [{stream_chunk_size, 1000}]]), io:format("Spawned process ~p~n", [Pid]), wait_for_resp(Pid). Modified: couchdb/trunk/src/mochiweb/mochijson.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/mochiweb/mochijson.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/mochiweb/mochijson.erl (original) +++ couchdb/trunk/src/mochiweb/mochijson.erl Mon Jul 6 00:33:50 2009 @@ -145,7 +145,7 @@ "{}"; json_encode_proplist(Props, State) -> F = fun ({K, V}, Acc) -> - KS = case K of + KS = case K of K when is_atom(K) -> json_encode_string_utf8(atom_to_list(K)); K when is_integer(K) -> @@ -320,12 +320,12 @@ % coalesce UTF-16 surrogate pair? C = dehex(C0) bor (dehex(C1) bsl 4) bor - (dehex(C2) bsl 8) bor + (dehex(C2) bsl 8) bor (dehex(C3) bsl 12), tokenize_string(Rest, ?ADV_COL(S, 6), [C | Acc]); tokenize_string([C | Rest], S, Acc) when C >= $\s; C < 16#10FFFF -> tokenize_string(Rest, ?ADV_COL(S, 1), [C | Acc]). - + tokenize_number(IoList=[C | _], Mode, S=#decoder{input_encoding=utf8}, Acc) when is_list(C); is_binary(C); C >= 16#7f -> List = xmerl_ucs:from_utf8(iolist_to_binary(IoList)), @@ -418,7 +418,7 @@ true; (_) -> false - end, + end, lists:all(F, Props). obj_from_list(Props) -> Modified: couchdb/trunk/src/mochiweb/mochijson2.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/mochiweb/mochijson2.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/mochiweb/mochijson2.erl (original) +++ couchdb/trunk/src/mochiweb/mochijson2.erl Mon Jul 6 00:33:50 2009 @@ -500,7 +500,7 @@ true; (_) -> false - end, + end, lists:all(F, Props). obj_from_list(Props) -> @@ -586,21 +586,21 @@ {[], "[]"}, {[[]], "[[]]"}, {[1, <<"foo">>], "[1,\"foo\"]"}, - + %% json array in a json object {obj_from_list([{<<"foo">>, [123]}]), "{\"foo\":[123]}"}, - + %% json object in a json object {obj_from_list([{<<"foo">>, obj_from_list([{<<"bar">>, true}])}]), "{\"foo\":{\"bar\":true}}"}, - + %% fold evaluation order {obj_from_list([{<<"foo">>, []}, {<<"bar">>, obj_from_list([{<<"baz">>, true}])}, {<<"alice">>, <<"bob">>}]), "{\"foo\":[],\"bar\":{\"baz\":true},\"alice\":\"bob\"}"}, - + %% json object in a json array {[-123, <<"foo">>, obj_from_list([{<<"bar">>, []}]), null], "[-123,\"foo\",{\"bar\":[]},null]"} Modified: couchdb/trunk/src/mochiweb/mochinum.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/mochiweb/mochinum.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/mochiweb/mochinum.erl (original) +++ couchdb/trunk/src/mochiweb/mochinum.erl Mon Jul 6 00:33:50 2009 @@ -40,7 +40,7 @@ _ -> R end. - + %% @spec frexp(F::float()) -> {Frac::float(), Exp::float()} %% @doc Return the fractional and exponent part of an IEEE 754 double, %% equivalent to the libc function of the same name. @@ -205,7 +205,7 @@ end end. -unpack(Float) -> +unpack(Float) -> <> = <>, {Sign, Exp, Frac}. @@ -243,7 +243,7 @@ -1 = int_ceil(-1.5), -2 = int_ceil(-2.0), ok. - + test_int_pow() -> 1 = int_pow(1, 1), 1 = int_pow(1, 0), @@ -252,7 +252,7 @@ 100 = int_pow(10, 2), 1000 = int_pow(10, 3), ok. - + test_digits() -> "0" = digits(0), "0.0" = digits(0.0), Modified: couchdb/trunk/src/mochiweb/mochiweb_charref.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/mochiweb/mochiweb_charref.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/mochiweb/mochiweb_charref.erl (original) +++ couchdb/trunk/src/mochiweb/mochiweb_charref.erl Mon Jul 6 00:33:50 2009 @@ -26,7 +26,7 @@ end; charref(L) -> entity(L). - + %% @spec test() -> ok %% @doc Run tests for mochiweb_charref. test() -> Modified: couchdb/trunk/src/mochiweb/mochiweb_cookies.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/mochiweb/mochiweb_cookies.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/mochiweb/mochiweb_cookies.erl (original) +++ couchdb/trunk/src/mochiweb/mochiweb_cookies.erl Mon Jul 6 00:33:50 2009 @@ -29,8 +29,8 @@ cookie(Key, Value) -> cookie(Key, Value, []). -%% @spec cookie(Key::string(), Value::string(), Options::[Option]) -> header() -%% where Option = {max_age, integer()} | {local_time, {date(), time()}} +%% @spec cookie(Key::string(), Value::string(), Options::[Option]) -> header() +%% where Option = {max_age, integer()} | {local_time, {date(), time()}} %% | {domain, string()} | {path, string()} %% | {secure, true | false} %% @@ -118,9 +118,9 @@ %% @spec parse_cookie(string()) -> [{K::string(), V::string()}] %% @doc Parse the contents of a Cookie header field, ignoring cookie %% attributes, and return a simple property list. -parse_cookie("") -> +parse_cookie("") -> []; -parse_cookie(Cookie) -> +parse_cookie(Cookie) -> parse_cookie(Cookie, []). %% @spec test() -> ok @@ -133,8 +133,8 @@ %% Internal API parse_cookie([], Acc) -> - lists:reverse(Acc); -parse_cookie(String, Acc) -> + lists:reverse(Acc); +parse_cookie(String, Acc) -> {{Token, Value}, Rest} = read_pair(String), Acc1 = case Token of "" -> @@ -173,7 +173,7 @@ read_quoted(Rest, [Any | Acc]); read_quoted([C | Rest], Acc) -> read_quoted(Rest, [C | Acc]). - + skip_whitespace(String) -> F = fun (C) -> ?IS_WHITESPACE(C) end, lists:dropwhile(F, String). @@ -182,7 +182,7 @@ F = fun (C) -> not ?IS_SEPARATOR(C) end, lists:splitwith(F, String). -skip_past_separator([]) -> +skip_past_separator([]) -> []; skip_past_separator([$; | Rest]) -> Rest; @@ -193,7 +193,7 @@ parse_cookie_test() -> %% RFC example - C1 = "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; + C1 = "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"; Shipping=\"FedEx\"; $Path=\"/acme\"", [ @@ -231,8 +231,8 @@ C1 = cookie(<<"Customer">>, <<"WILE_E_COYOTE">>, [{path, <<"/acme">>}]), {"Set-Cookie","=NoKey; Version=1"} = cookie("", "NoKey", []), - - LocalTime = calendar:universal_time_to_local_time({{2007, 5, 15}, {13, 45, 33}}), + + LocalTime = calendar:universal_time_to_local_time({{2007, 5, 15}, {13, 45, 33}}), C2 = {"Set-Cookie", "Customer=WILE_E_COYOTE; " "Version=1; " Modified: couchdb/trunk/src/mochiweb/mochiweb_echo.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/mochiweb/mochiweb_echo.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/mochiweb/mochiweb_echo.erl (original) +++ couchdb/trunk/src/mochiweb/mochiweb_echo.erl Mon Jul 6 00:33:50 2009 @@ -9,7 +9,7 @@ stop() -> mochiweb_socket_server:stop(?MODULE). - + start() -> mochiweb_socket_server:start([{name, ?MODULE}, {port, 6789}, Modified: couchdb/trunk/src/mochiweb/mochiweb_headers.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/mochiweb/mochiweb_headers.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/mochiweb/mochiweb_headers.erl (original) +++ couchdb/trunk/src/mochiweb/mochiweb_headers.erl Mon Jul 6 00:33:50 2009 @@ -19,7 +19,7 @@ %% @doc Run tests for this module. test() -> H = ?MODULE:make([{hdr, foo}, {"Hdr", "bar"}, {'Hdr', 2}]), - [{hdr, "foo, bar, 2"}] = ?MODULE:to_list(H), + [{hdr, "foo, bar, 2"}] = ?MODULE:to_list(H), H1 = ?MODULE:insert(taco, grande, H), [{hdr, "foo, bar, 2"}, {taco, "grande"}] = ?MODULE:to_list(H1), H2 = ?MODULE:make([{"Set-Cookie", "foo"}]), @@ -69,7 +69,7 @@ %% @spec to_list(headers()) -> [{key(), string()}] %% @doc Return the contents of the headers. The keys will be the exact key -%% that was first inserted (e.g. may be an atom or binary, case is +%% that was first inserted (e.g. may be an atom or binary, case is %% preserved). to_list(T) -> F = fun ({K, {array, L}}, Acc) -> Modified: couchdb/trunk/src/mochiweb/mochiweb_html.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/mochiweb/mochiweb_html.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/mochiweb/mochiweb_html.erl (original) +++ couchdb/trunk/src/mochiweb/mochiweb_html.erl Mon Jul 6 00:33:50 2009 @@ -540,7 +540,7 @@ tree(Rest, append_stack_child(T, S)); tree(L=[{data, _Data, _Whitespace} | _], S) -> case tree_data(L, true, []) of - {_, true, Rest} -> + {_, true, Rest} -> tree(Rest, S); {Data, false, Rest} -> tree(Rest, append_stack_child(Data, S)) Modified: couchdb/trunk/src/mochiweb/mochiweb_request.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/mochiweb/mochiweb_request.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/mochiweb/mochiweb_request.erl (original) +++ couchdb/trunk/src/mochiweb/mochiweb_request.erl Mon Jul 6 00:33:50 2009 @@ -173,13 +173,13 @@ recv_body(MaxBody) -> % we could use a sane constant for max chunk size Body = stream_body(?MAX_RECV_BODY, fun - ({0, _ChunkedFooter}, {_LengthAcc, BinAcc}) -> + ({0, _ChunkedFooter}, {_LengthAcc, BinAcc}) -> iolist_to_binary(lists:reverse(BinAcc)); ({Length, Bin}, {LengthAcc, BinAcc}) -> NewLength = Length + LengthAcc, if NewLength > MaxBody -> exit({body_too_large, chunked}); - true -> + true -> {NewLength, [Bin | BinAcc]} end end, {0, []}, MaxBody), @@ -188,7 +188,7 @@ stream_body(MaxChunkSize, ChunkFun, FunState) -> stream_body(MaxChunkSize, ChunkFun, FunState, undefined). - + stream_body(MaxChunkSize, ChunkFun, FunState, MaxBodyLength) -> case get_header_value("expect") of @@ -215,7 +215,7 @@ exit({body_too_large, content_length}); _ -> stream_unchunked_body(Length, MaxChunkSize, ChunkFun, FunState) - end; + end; Length -> exit({length_not_integer, Length}) end. @@ -510,7 +510,7 @@ read_sub_chunks(Length, _MaxChunkSize, Fun, FunState) -> Fun({Length, read_chunk(Length)}, FunState). - + %% @spec serve_file(Path, DocRoot) -> Response %% @doc Serve a file relative to DocRoot. serve_file(Path, DocRoot) -> @@ -723,19 +723,19 @@ %% valid, multiple range io:format("Testing parse_range_request with valid multiple ranges~n"), io:format("1"), - [{20, 30}, {50, 100}, {110, 200}] = + [{20, 30}, {50, 100}, {110, 200}] = parse_range_request("bytes=20-30,50-100,110-200"), io:format("2"), - [{20, none}, {50, 100}, {none, 200}] = + [{20, none}, {50, 100}, {none, 200}] = parse_range_request("bytes=20-,50-100,-200"), io:format(".. ok~n"), - + %% no ranges io:format("Testing out parse_range_request with no ranges~n"), io:format("1"), [] = parse_range_request("bytes="), io:format(".. ok~n"), - + Body = <<"012345678901234567890123456789012345678901234567890123456789">>, BodySize = size(Body), %% 60 BodySize = 60, @@ -751,7 +751,7 @@ io:format("4"), {30, 30} = range_skip_length({30, none}, BodySize), %% 30- io:format(".. ok ~n"), - + %% valid edge cases for range_skip_length io:format("Testing out range_skip_length on valid edge case ranges~n"), io:format("1"), @@ -787,4 +787,4 @@ invalid_range = range_skip_length({BodySize, none}, BodySize), io:format(".. ok ~n"), ok. - + Modified: couchdb/trunk/src/mochiweb/mochiweb_skel.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/mochiweb/mochiweb_skel.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/mochiweb/mochiweb_skel.erl (original) +++ couchdb/trunk/src/mochiweb/mochiweb_skel.erl Mon Jul 6 00:33:50 2009 @@ -7,7 +7,7 @@ skelcopy(DestDir, Name) -> ok = ensuredir(DestDir), - LDst = case length(filename:dirname(DestDir)) of + LDst = case length(filename:dirname(DestDir)) of 1 -> %% handle case when dirname returns "/" 0; N -> @@ -17,7 +17,7 @@ ok = file:make_symlink( filename:join(filename:dirname(code:which(?MODULE)), ".."), filename:join([DestDir, Name, "deps", "mochiweb-src"])). - + %% Internal API @@ -40,7 +40,7 @@ io:format("~s/~n", [EDst]), lists:foreach(fun ("." ++ _) -> ok; (F) -> - skelcopy(filename:join(Src, F), + skelcopy(filename:join(Src, F), Dir, Name, LDst) Modified: couchdb/trunk/src/mochiweb/mochiweb_socket_server.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/mochiweb/mochiweb_socket_server.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/mochiweb/mochiweb_socket_server.erl (original) +++ couchdb/trunk/src/mochiweb/mochiweb_socket_server.erl Mon Jul 6 00:33:50 2009 @@ -106,7 +106,7 @@ init(State=#mochiweb_socket_server{ip=Ip, port=Port, backlog=Backlog}) -> process_flag(trap_exit, true), - BaseOpts = [binary, + BaseOpts = [binary, {reuseaddr, true}, {packet, 0}, {backlog, Backlog}, @@ -126,7 +126,7 @@ end, case gen_tcp_listen(Port, Opts, State) of {stop, eacces} -> - case Port < 1024 of + case Port < 1024 of true -> case fdsrv:start() of {ok, _} -> @@ -150,7 +150,7 @@ case gen_tcp:listen(Port, Opts) of {ok, Listen} -> {ok, ListenPort} = inet:port(Listen), - {ok, new_acceptor(State#mochiweb_socket_server{listen=Listen, + {ok, new_acceptor(State#mochiweb_socket_server{listen=Listen, port=ListenPort})}; {error, Reason} -> {stop, Reason} @@ -183,11 +183,11 @@ lists:flatten(io_lib:format("~p", [Other]))]), exit({error, accept_failed}) end. - + do_get(port, #mochiweb_socket_server{port=Port}) -> Port. - + handle_call({get, Property}, _From, State) -> Res = do_get(Property, State), {reply, Res, State}; @@ -205,7 +205,7 @@ terminate(_Reason, #mochiweb_socket_server{listen=Listen, port=Port}) -> gen_tcp:close(Listen), - case Port < 1024 of + case Port < 1024 of true -> catch fdsrv:stop(), ok; @@ -228,7 +228,7 @@ {noreply, new_acceptor(State)}; handle_info({'EXIT', _LoopPid, Reason}, State=#mochiweb_socket_server{acceptor=Pid, max=Max}) -> - case Reason of + case Reason of normal -> ok; _ -> Modified: couchdb/trunk/src/mochiweb/mochiweb_util.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/mochiweb/mochiweb_util.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/src/mochiweb/mochiweb_util.erl (original) +++ couchdb/trunk/src/mochiweb/mochiweb_util.erl Mon Jul 6 00:33:50 2009 @@ -418,7 +418,7 @@ record_to_proplist(Record, Fields, '__record'). %% @spec record_to_proplist(Record, Fields, TypeKey) -> proplist() -%% @doc Return a proplist of the given Record with each field in the +%% @doc Return a proplist of the given Record with each field in the %% Fields list set as a key with the corresponding value in the Record. %% TypeKey is the key that is used to store the record type %% Fields should be obtained by calling record_info(fields, record_type) Modified: couchdb/trunk/test/couch_config_test.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/test/couch_config_test.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/couch_config_test.erl (original) +++ couchdb/trunk/test/couch_config_test.erl Mon Jul 6 00:33:50 2009 @@ -1,7 +1,7 @@ % couch_config module test suote % Set up test suite -% ?MODULE_test() returns a list of functions +% ?MODULE_test() returns a list of functions % that run the actual tests. couch_config_test() -> [ @@ -10,7 +10,7 @@ % test functions - + store_strings() -> Filename = "test.ini", file:write_file(Filename, ""), @@ -26,7 +26,7 @@ exit(Proc, kill), receive {'EXIT', Proc, _} -> ok end, - + % clean up file:delete(Filename), Modified: couchdb/trunk/test/couch_config_writer_test.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/test/couch_config_writer_test.erl?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/couch_config_writer_test.erl (original) +++ couchdb/trunk/test/couch_config_writer_test.erl Mon Jul 6 00:33:50 2009 @@ -1,7 +1,7 @@ % couch_config_writer module test suote % Set up test suite -% ?MODULE_test() returns a list of functions +% ?MODULE_test() returns a list of functions % that run the actual tests. % todo, fix replace_existing_variable2 (i.e. reordering) couch_config_writer_test() -> @@ -186,12 +186,12 @@ % call replace function [couch_config_writer:save_to_file(ConfigVar, Filename) || ConfigVar <- Config], - + % compare new file with expected file {ok, Result_} = file:read_file(Filename), Result = binary_to_list(Result_), % clean up % file:delete(Filename), - + Result = Expect. Modified: couchdb/trunk/test/etap/010-file-basics.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/010-file-basics.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/010-file-basics.t (original) +++ couchdb/trunk/test/etap/010-file-basics.t Mon Jul 6 00:33:50 2009 @@ -15,7 +15,7 @@ etap:bail() end, ok. - + test() -> etap:is({error, enoent}, couch_file:open("not a real file"), "Opening a non-existant file should return an enoent error."), @@ -29,7 +29,7 @@ {ok, Fd} = couch_file:open(filename() ++ ".0", [create, overwrite]), etap:ok(is_pid(Fd), "Returned file descriptor is a Pid"), - + etap:is({ok, 0}, couch_file:bytes(Fd), "Newly created files have 0 bytes."), @@ -39,16 +39,16 @@ {ok, Size} = couch_file:bytes(Fd), etap:is_greater(Size, 0, "Writing a term increased the file size."), - + etap:is({ok, Size}, couch_file:append_binary(Fd, <<"fancy!">>), "Appending a binary returns the current file size."), - + etap:is({ok, foo}, couch_file:pread_term(Fd, 0), "Reading the first term returns what we wrote: foo"), - + etap:is({ok, <<"fancy!">>}, couch_file:pread_binary(Fd, Size), "Reading back the binary returns what we wrote: <<\"fancy\">>."), - + etap:is({ok, <<131, 100, 0, 3, 102, 111, 111>>}, couch_file:pread_binary(Fd, 0), "Reading a binary at a term position returns the term as binary." @@ -75,7 +75,7 @@ % "Reading data that was truncated fails.") etap:skip(fun() -> ok end, "No idea how to test reading beyond EOF"), - + etap:is({ok, foo}, couch_file:pread_term(Fd, 0), "Truncating does not affect data located before the truncation mark."), Modified: couchdb/trunk/test/etap/011-file-headers.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/011-file-headers.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/011-file-headers.t (original) +++ couchdb/trunk/test/etap/011-file-headers.t Mon Jul 6 00:33:50 2009 @@ -19,39 +19,39 @@ etap:bail() end, ok. - + test() -> {ok, Fd} = couch_file:open(filename(), [create,overwrite]), - + etap:is({ok, 0}, couch_file:bytes(Fd), "File should be initialized to contain zero bytes."), - + etap:is(ok, couch_file:write_header(Fd, {<<"some_data">>, 32}), "Writing a header succeeds."), - + {ok, Size1} = couch_file:bytes(Fd), etap:is_greater(Size1, 0, "Writing a header allocates space in the file."), - + etap:is({ok, {<<"some_data">>, 32}}, couch_file:read_header(Fd), "Reading the header returns what we wrote."), - + etap:is(ok, couch_file:write_header(Fd, [foo, <<"more">>]), "Writing a second header succeeds."), - + {ok, Size2} = couch_file:bytes(Fd), etap:is_greater(Size2, Size1, "Writing a second header allocates more space."), - + etap:is({ok, [foo, <<"more">>]}, couch_file:read_header(Fd), "Reading the second header does not return the first header."), - + % Delete the second header. ok = couch_file:truncate(Fd, Size1), - + etap:is({ok, {<<"some_data">>, 32}}, couch_file:read_header(Fd), "Reading the header after a truncation returns a previous header."), - + couch_file:write_header(Fd, [foo, <<"more">>]), etap:is({ok, Size2}, couch_file:bytes(Fd), "Rewriting the same second header returns the same second size."), @@ -60,16 +60,16 @@ % Now for the fun stuff. Try corrupting the second header and see % if we recover properly. - + % Destroy the 0x1 byte that marks a header check_header_recovery(fun(CouchFd, RawFd, Expect, HeaderPos) -> etap:isnt(Expect, couch_file:read_header(CouchFd), "Should return a different header before corruption."), file:pwrite(RawFd, HeaderPos, <<0>>), etap:is(Expect, couch_file:read_header(CouchFd), - "Corrupting the byte marker should read the previous header.") + "Corrupting the byte marker should read the previous header.") end), - + % Corrupt the size. check_header_recovery(fun(CouchFd, RawFd, Expect, HeaderPos) -> etap:isnt(Expect, couch_file:read_header(CouchFd), @@ -79,7 +79,7 @@ etap:is(Expect, couch_file:read_header(CouchFd), "Corrupting the size should read the previous header.") end), - + % Corrupt the MD5 signature check_header_recovery(fun(CouchFd, RawFd, Expect, HeaderPos) -> etap:isnt(Expect, couch_file:read_header(CouchFd), @@ -89,7 +89,7 @@ etap:is(Expect, couch_file:read_header(CouchFd), "Corrupting the MD5 signature should read the previous header.") end), - + % Corrupt the data check_header_recovery(fun(CouchFd, RawFd, Expect, HeaderPos) -> etap:isnt(Expect, couch_file:read_header(CouchFd), @@ -99,7 +99,7 @@ etap:is(Expect, couch_file:read_header(CouchFd), "Corrupting the header data should read the previous header.") end), - + ok. check_header_recovery(CheckFun) -> @@ -112,9 +112,9 @@ {ok, HeaderPos} = write_random_data(Fd), ok = couch_file:write_header(Fd, {2342, <<"corruption! greed!">>}), - + CheckFun(Fd, RawFd, {ok, ExpectHeader}, HeaderPos), - + ok = file:close(RawFd), ok = couch_file:close(Fd), ok. @@ -131,4 +131,3 @@ {ok, _} = couch_file:append_term(Fd, Term), write_random_data(Fd, N-1). - \ No newline at end of file Modified: couchdb/trunk/test/etap/020-btree-basics.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/020-btree-basics.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/020-btree-basics.t (original) +++ couchdb/trunk/test/etap/020-btree-basics.t Mon Jul 6 00:33:50 2009 @@ -29,7 +29,7 @@ etap:ok(test_kvs(shuffle(Sorted)), "Testing shuffled keys."), ok. -test_kvs(KeyValues) -> +test_kvs(KeyValues) -> ReduceFun = fun (reduce, KVs) -> length(KVs); @@ -53,7 +53,7 @@ {ok, Btree2} = couch_btree:add_remove(Btree1, KeyValues, []), etap:ok(test_btree(Btree2, KeyValues), "Adding all keys at once returns a complete btree."), - + etap:fun_is( fun ({ok, {kp_node, _}}) -> true; @@ -98,7 +98,7 @@ etap:ok(test_add_remove(Btree6, Rem2Keys0, Rem2Keys1), "Add/Remove every other key."), - + etap:ok(test_add_remove(Btree6, Rem2Keys1, Rem2Keys0), "Add/Remove opposite every other key."), @@ -189,5 +189,5 @@ D = lists:map(fun(A) -> {random:uniform(), A} end, List), - {_, D1} = lists:unzip(lists:keysort(1, D)), + {_, D1} = lists:unzip(lists:keysort(1, D)), D1. Modified: couchdb/trunk/test/etap/021-btree-reductions.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/021-btree-reductions.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/021-btree-reductions.t (original) +++ couchdb/trunk/test/etap/021-btree-reductions.t Mon Jul 6 00:33:50 2009 @@ -22,10 +22,10 @@ (reduce, KVs) -> length(KVs); (rereduce, Reds) -> lists:sum(Reds) end, - + {ok, Fd} = couch_file:open(filename(), [create,overwrite]), {ok, Btree} = couch_btree:open(nil, Fd, [{reduce, ReduceFun}]), - + % Create a list, of {"even", Value} or {"odd", Value} pairs. {_, EvenOddKVs} = lists:foldl(fun(Idx, {Key, Acc}) -> case Key of @@ -50,7 +50,7 @@ true; (_) -> false - end, + end, couch_btree:fold_reduce(Btree2, nil, nil, GroupFun, FoldFun, []), "Reduction works with no specified direction, startkey, or endkey." ), @@ -76,7 +76,7 @@ couch_btree:fold_reduce(Btree2, rev, nil, nil, GroupFun, FoldFun, []), "Reducing backwards works with no startkey or endkey." ), - + etap:fun_is( fun ({ok, [{{"odd", _}, 500}, {{"even", _}, 500}]}) -> @@ -87,7 +87,7 @@ couch_btree:fold_reduce(Btree2, fwd, SK1, EK2, GroupFun, FoldFun, []), "Reducing works over the entire range with startkey and endkey set." ), - + etap:fun_is( fun ({ok, [{{"even", _}, 500}]}) -> true; @@ -114,7 +114,7 @@ couch_btree:fold_reduce(Btree2, rev, EK2, SK2, GroupFun, FoldFun, []), "Reducing in reverse works after swapping the startkey and endkey." ), - + etap:fun_is( fun ({ok, [{{"even", _}, 500}, {{"odd", _}, 500}]}) -> Modified: couchdb/trunk/test/etap/030-doc-from-json.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/030-doc-from-json.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/030-doc-from-json.t (original) +++ couchdb/trunk/test/etap/030-doc-from-json.t Mon Jul 6 00:33:50 2009 @@ -18,7 +18,7 @@ etap:bail() end, ok. - + test() -> ok = test_from_json_success(), ok = test_from_json_errors(), @@ -49,7 +49,7 @@ { {[{<<"_rev">>, <<"4-230234">>}]}, #doc{revs={4, [<<"230234">>]}}, - "_rev stored in revs." + "_rev stored in revs." }, { {[{<<"soap">>, 35}]}, @@ -105,7 +105,7 @@ { {[{<<"_local_seq">>, dropping}]}, #doc{}, - "Drops _local_seq." + "Drops _local_seq." }, { {[{<<"_conflicts">>, dropping}]}, @@ -118,7 +118,7 @@ "Drops _deleted_conflicts." } ], - + lists:foreach(fun({EJson, Expect, Mesg}) -> etap:is(couch_doc:from_json_obj(EJson), Expect, Mesg) end, Cases), @@ -193,7 +193,7 @@ "Underscore prefix fields are reserved." } ], - + lists:foreach(fun ({EJson, Expect, Mesg}) -> Error = (catch couch_doc:from_json_obj(EJson)), Modified: couchdb/trunk/test/etap/031-doc-to-json.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/031-doc-to-json.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/031-doc-to-json.t (original) +++ couchdb/trunk/test/etap/031-doc-to-json.t Mon Jul 6 00:33:50 2009 @@ -22,7 +22,7 @@ test() -> ok = test_to_json_success(), ok. - + test_to_json_success() -> Cases = [ { @@ -92,7 +92,7 @@ { #doc{meta=[{deleted_conflicts, [{10923, <<"big_cowboy_hat">>}]}]}, {[ - {<<"_id">>, <<>>}, + {<<"_id">>, <<>>}, {<<"_deleted_conflicts">>, [<<"10923-big_cowboy_hat">>]} ]}, "_deleted_conflicsts is added as an array of strings." Modified: couchdb/trunk/test/etap/040-util.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/040-util.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/040-util.t (original) +++ couchdb/trunk/test/etap/040-util.t Mon Jul 6 00:33:50 2009 @@ -19,13 +19,13 @@ % to_existing_atom etap:is(true, couch_util:to_existing_atom(true), "An atom is an atom."), etap:is(foo, couch_util:to_existing_atom(<<"foo">>), - "A binary foo is the atom foo."), + "A binary foo is the atom foo."), etap:is(foobarbaz, couch_util:to_existing_atom("foobarbaz"), "A list of atoms is one munged atom."), % terminate_linked Self = self(), - spawn(fun() -> + spawn(fun() -> ChildPid = spawn_link(fun() -> receive shutdown -> ok end end), couch_util:terminate_linked(normal), Self ! {pid, ChildPid} @@ -33,7 +33,7 @@ receive {pid, Pid} -> etap:ok(not is_process_alive(Pid), "why wont this work?") - end, + end, % new_uuid etap:isnt(couch_util:new_uuid(), couch_util:new_uuid(), @@ -68,5 +68,5 @@ etap:ok(not couch_util:should_flush(), "Checking to flush invokes GC."), - + ok. Modified: couchdb/trunk/test/etap/050-stream.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/050-stream.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/050-stream.t (original) +++ couchdb/trunk/test/etap/050-stream.t Mon Jul 6 00:33:50 2009 @@ -20,7 +20,7 @@ test() -> {ok, Fd} = couch_file:open("test/etap/temp.050", [create,overwrite]), {ok, Stream} = couch_stream:open(Fd), - + etap:is(ok, couch_stream:write(Stream, <<"food">>), "Writing to streams works."), @@ -43,16 +43,16 @@ "Successfully wrote 80 1 bits."), ZeroBits = <<0:(8*10)>>, - etap:is(ok, couch_stream:write(Stream2, ZeroBits), + etap:is(ok, couch_stream:write(Stream2, ZeroBits), "Successfully wrote 80 0 bits."), - + {Ptrs2, Length2} = couch_stream:close(Stream2), etap:is(Ptrs2, [ExpPtr], "Closing stream returns the file pointers."), etap:is(Length2, 20, "Length written is 160 bytes."), AllBits = iolist_to_binary([OneBits,ZeroBits]), etap:is(AllBits, read_all(Fd, Ptrs2), "Returned pointers are valid."), - + % Stream more the 4K chunk size. {ok, ExpPtr2} = couch_file:bytes(Fd), {ok, Stream3} = couch_stream:open(Fd), Modified: couchdb/trunk/test/etap/060-kt-merging.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/060-kt-merging.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/060-kt-merging.t (original) +++ couchdb/trunk/test/etap/060-kt-merging.t Mon Jul 6 00:33:50 2009 @@ -28,7 +28,7 @@ Stemmed1a = [{1, {"1a", "bar", [{"1aa", "bar", []}]}}], Stemmed1aa = [{2, {"1aa", "bar", []}}], Stemmed1bb = [{2, {"1bb", "boo", []}}], - + etap:is( {EmptyTree, no_conflicts}, couch_key_tree:merge(EmptyTree, EmptyTree), @@ -69,7 +69,7 @@ {TwoChildSibs, no_conflicts}, couch_key_tree:merge(TwoChildSibs, TwoChildSibs), "Merging a tree to itself is itself."), - + etap:is( {TwoChildSibs, no_conflicts}, couch_key_tree:merge(TwoChildSibs, Stemmed1b), @@ -87,7 +87,7 @@ couch_key_tree:merge(TwoChildSibs2, Stemmed1bb), "Merging a stem at a deeper level." ), - + etap:is( {TwoChildSibs2, no_conflicts}, couch_key_tree:merge(Stemmed1bb, TwoChildSibs2), @@ -118,11 +118,11 @@ couch_key_tree:merge(OneChild, Stemmed1aa), "Merging should create conflicts." ), - + etap:is( {TwoChild, no_conflicts}, couch_key_tree:merge(Expect1, TwoChild), "Merge should have no conflicts." ), - + ok. Modified: couchdb/trunk/test/etap/061-kt-missing-leaves.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/061-kt-missing-leaves.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/061-kt-missing-leaves.t (original) +++ couchdb/trunk/test/etap/061-kt-missing-leaves.t Mon Jul 6 00:33:50 2009 @@ -17,7 +17,7 @@ TwoChildSibs = [{0, {"1","foo", [{"1a", "bar", []}, {"1b", "bar", []}]}}], Stemmed1 = [{1, {"1a", "bar", [{"1aa", "bar", []}]}}], Stemmed2 = [{2, {"1aa", "bar", []}}], - + etap:is( [], couch_key_tree:find_missing(TwoChildSibs, [{0,"1"}, {1,"1a"}]), Modified: couchdb/trunk/test/etap/062-kt-remove-leaves.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/062-kt-remove-leaves.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/062-kt-remove-leaves.t (original) +++ couchdb/trunk/test/etap/062-kt-remove-leaves.t Mon Jul 6 00:33:50 2009 @@ -23,31 +23,31 @@ couch_key_tree:remove_leafs(TwoChildSibs, []), "Removing no leaves has no effect on the tree." ), - + etap:is( {TwoChildSibs, []}, couch_key_tree:remove_leafs(TwoChildSibs, [{0, "1"}]), "Removing a non-existant branch has no effect." ), - + etap:is( {OneChild, [{1, "1b"}]}, couch_key_tree:remove_leafs(TwoChildSibs, [{1, "1b"}]), "Removing a leaf removes the leaf." ), - + etap:is( {[], [{1, "1b"},{1, "1a"}]}, couch_key_tree:remove_leafs(TwoChildSibs, [{1, "1a"}, {1, "1b"}]), "Removing all leaves returns an empty tree." ), - + etap:is( {Stemmed, []}, couch_key_tree:remove_leafs(Stemmed, [{1, "1a"}]), "Removing a non-existant node has no effect." ), - + etap:is( {[], [{2, "1aa"}]}, couch_key_tree:remove_leafs(Stemmed, [{2, "1aa"}]), Modified: couchdb/trunk/test/etap/063-kt-get-leaves.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/063-kt-get-leaves.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/063-kt-get-leaves.t (original) +++ couchdb/trunk/test/etap/063-kt-get-leaves.t Mon Jul 6 00:33:50 2009 @@ -22,7 +22,7 @@ couch_key_tree:get(TwoChildSibs, [{0, "1"}]), "extract a subtree." ), - + etap:is( {[{"bar", {1, ["1a", "1"]}}],[]}, couch_key_tree:get(TwoChildSibs, [{1, "1a"}]), @@ -34,13 +34,13 @@ couch_key_tree:get_key_leafs(TwoChildSibs, [{0, "x"}]), "gather up the leaves." ), - + etap:is( {[{"bar", {1, ["1a","1"]}}],[]}, couch_key_tree:get_key_leafs(TwoChildSibs, [{1, "1a"}]), "gather up the leaves." ), - + etap:is( {[{"bar", {1, ["1a","1"]}},{"bar",{1, ["1b","1"]}}],[]}, couch_key_tree:get_key_leafs(TwoChildSibs, [{0, "1"}]), @@ -52,7 +52,7 @@ couch_key_tree:get_full_key_paths(TwoChildSibs, [{0, "1"}]), "retrieve full key paths." ), - + etap:is( {[{1,[{"1a", "bar"},{"1", "foo"}]}],[]}, couch_key_tree:get_full_key_paths(TwoChildSibs, [{1, "1a"}]), @@ -64,19 +64,19 @@ couch_key_tree:get_all_leafs_full(Stemmed), "retrieve all leaves." ), - + etap:is( [{1, [{"1a", "bar"},{"1", "foo"}]}, {1, [{"1b", "bar"},{"1", "foo"}]}], couch_key_tree:get_all_leafs_full(TwoChildSibs), "retrieve all the leaves." ), - + etap:is( [{"bar", {2, ["1aa","1a"]}}], couch_key_tree:get_all_leafs(Stemmed), "retrieve all leaves." ), - + etap:is( [{"bar", {1, ["1a", "1"]}}, {"bar", {1, ["1b","1"]}}], couch_key_tree:get_all_leafs(TwoChildSibs), Modified: couchdb/trunk/test/etap/064-kt-counting.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/064-kt-counting.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/064-kt-counting.t (original) +++ couchdb/trunk/test/etap/064-kt-counting.t Mon Jul 6 00:33:50 2009 @@ -18,7 +18,7 @@ One = [{0, {"1","foo",[]}}], TwoChildSibs = [{0, {"1","foo", [{"1a", "bar", []}, {"1b", "bar", []}]}}], Stemmed = [{2, {"1bb", "boo", []}}], - + etap:is(0, couch_key_tree:count_leafs(EmptyTree), "Empty trees have no leaves."), @@ -27,8 +27,8 @@ etap:is(2, couch_key_tree:count_leafs(TwoChildSibs), "Two children siblings counted as two leaves."), - + etap:is(1, couch_key_tree:count_leafs(Stemmed), "Stemming does not affect leaf counting."), - + ok. Modified: couchdb/trunk/test/etap/070-couch-db.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/070-couch-db.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/070-couch-db.t (original) +++ couchdb/trunk/test/etap/070-couch-db.t Mon Jul 6 00:33:50 2009 @@ -4,7 +4,7 @@ main(_) -> code:add_pathz("src/couchdb"), code:add_pathz("src/mochiweb"), - + etap:plan(4), case (catch test()) of ok -> @@ -16,7 +16,7 @@ ok. test() -> - + couch_server:start( ["etc/couchdb/default_dev.ini", "etc/couchdb/local_dev.ini"] ), @@ -48,7 +48,7 @@ Acc+1 end, 0, lists:seq(1, 200)), etap:is(200, NumCreated, "Created all databases."), - + lists:foreach(fun(Int) -> ok = couch_server:delete(MkDbName(Int), []) end, lists:seq(1, 200)), @@ -59,5 +59,5 @@ Acc+1 end, 0, lists:seq(1, 200)), etap:is(200, NumDeleted, "Deleted all databases."), - + ok. Modified: couchdb/trunk/test/etap/080-config-get-set.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/080-config-get-set.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/080-config-get-set.t (original) +++ couchdb/trunk/test/etap/080-config-get-set.t Mon Jul 6 00:33:50 2009 @@ -19,23 +19,23 @@ test() -> % start couch_config with default couch_config:start_link([default_config()]), - - + + % Check that we can get values - - + + etap:fun_is( fun(List) -> length(List) > 0 end, couch_config:all(), "Data was loaded from the INI file." ), - + etap:fun_is( fun(List) -> length(List) > 0 end, couch_config:get("daemons"), "There are settings in the [daemons] section of the INI file." ), - + etap:is( couch_config:get("httpd_design_handlers", "_view"), "{couch_httpd_view, handle_view_req}", @@ -47,13 +47,13 @@ "bar", "Returns the default when key doesn't exist in config." ), - + etap:is( couch_config:get("httpd", "foo"), undefined, "The default default is the atom 'undefined'." ), - + etap:is( couch_config:get("httpd", "port", "bar"), "5984", @@ -63,43 +63,43 @@ % Check that setting values works. - + ok = couch_config:set("log", "level", "severe", false), - + etap:is( couch_config:get("log", "level"), "severe", "Non persisted changes take effect." ), - + etap:is( couch_config:get("new_section", "bizzle"), undefined, "Section 'new_section' does not exist." ), - + ok = couch_config:set("new_section", "bizzle", "bang", false), - + etap:is( couch_config:get("new_section", "bizzle"), "bang", "New section 'new_section' was created for a new key/value pair." ), - - + + % Check that deleting works - - + + ok = couch_config:delete("new_section", "bizzle", false), etap:is( couch_config:get("new_section", "bizzle"), "", "Deleting sets the value to \"\"" ), - - + + % Check ge/set/delete binary strings - + ok = couch_config:set(<<"foo">>, <<"bar">>, <<"baz">>, false), etap:is( couch_config:get(<<"foo">>, <<"bar">>), @@ -112,5 +112,5 @@ "", "Deleting with binary section/key pairs sets the value to \"\"" ), - + ok. Modified: couchdb/trunk/test/etap/081-config-override.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/081-config-override.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/081-config-override.t (original) +++ couchdb/trunk/test/etap/081-config-override.t Mon Jul 6 00:33:50 2009 @@ -29,7 +29,7 @@ main(_) -> code:add_pathz("src/couchdb"), etap:plan(17), - + case (catch test()) of ok -> etap:end_tests(); @@ -50,42 +50,42 @@ "100", "{couchdb, max_dbs_open} is 100 by defualt." ), - + etap:is( couch_config:get("httpd","port"), "5984", "{httpd, port} is 5984 by default" ), - + etap:is( couch_config:get("fizbang", "unicode"), undefined, "{fizbang, unicode} is undefined by default" ) end, - + run_tests([default_config()], CheckDefaults), - - + + % Check that subsequent files override values appropriately - + CheckOverride = fun() -> etap:is( couch_config:get("couchdb", "max_dbs_open"), "10", "{couchdb, max_dbs_open} was overriden with the value 10" ), - + etap:is( couch_config:get("httpd", "port"), "4895", "{httpd, port} was overriden with the value 4895" ) end, - + run_tests([default_config(), local_config_1()], CheckOverride), - - + + % Check that overrides can create new sections CheckOverride2 = fun() -> @@ -94,19 +94,19 @@ "80", "{httpd, port} is overriden with the value 80" ), - + etap:is( couch_config:get("fizbang", "unicode"), "normalized", "{fizbang, unicode} was created by override INI file" ) end, - + run_tests([default_config(), local_config_2()], CheckOverride2), - - + + % Check that values can be overriden multiple times - + CheckOverride3 = fun() -> etap:is( couch_config:get("httpd", "port"), @@ -114,19 +114,19 @@ "{httpd, port} value was taken from the last specified INI file." ) end, - + run_tests( [default_config(), local_config_1(), local_config_2()], CheckOverride3 ), % Check persistence to last file. - + % Empty the file in case it exists. {ok, Fd} = file:open(local_config_write(), write), ok = file:truncate(Fd), ok = file:close(Fd), - + % Open and write a value CheckCanWrite = fun() -> etap:is( @@ -134,34 +134,34 @@ "5984", "{httpd, port} is still 5984 by default" ), - + etap:is( couch_config:set("httpd", "port", "8080"), ok, "Writing {httpd, port} is kosher." ), - + etap:is( couch_config:get("httpd", "port"), "8080", "{httpd, port} was updated to 8080 successfully." ), - + etap:is( couch_config:delete("httpd", "bind_address"), ok, "Deleting {httpd, bind_address} succeeds" ), - + etap:is( couch_config:get("httpd", "bind_address"), "", "{httpd, bind_address} was actually deleted." ) end, - + run_tests([default_config(), local_config_write()], CheckCanWrite), - + % Open and check where we don't expect persistence. CheckDidntWrite = fun() -> @@ -170,16 +170,16 @@ "5984", "{httpd, port} was not persisted to the primary INI file." ), - + etap:is( couch_config:get("httpd", "bind_address"), "127.0.0.1", "{httpd, bind_address} was not deleted form the primary INI file." ) end, - + run_tests([default_config()], CheckDidntWrite), - + % Open and check we have only the persistence we expect. CheckDidWrite = fun() -> etap:is( @@ -187,14 +187,14 @@ "8080", "{httpd, port} is still 8080 after reopening the config." ), - + etap:is( couch_config:get("httpd", "bind_address"), "", "{httpd, bind_address} is still \"\" after reopening." ) end, - + run_tests([local_config_write()], CheckDidWrite), - + ok. Modified: couchdb/trunk/test/etap/082-config-register.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/082-config-register.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/082-config-register.t (original) +++ couchdb/trunk/test/etap/082-config-register.t Mon Jul 6 00:33:50 2009 @@ -24,9 +24,9 @@ "5984", "{httpd, port} is 5984 by default." ), - + ok = couch_config:set("httpd", "port", "4895", false), - + etap:is( couch_config:get("httpd", "port"), "4895", @@ -46,9 +46,9 @@ end, SentinelPid ), - + ok = couch_config:set("httpd", "port", "8080", false), - + % Implicitly checking that we *don't* call the function etap:is( couch_config:get("httpd", "bind_address"), @@ -56,7 +56,7 @@ "{httpd, bind_address} is not '0.0.0.0'" ), ok = couch_config:set("httpd", "bind_address", "0.0.0.0", false), - + % Ping-Pong kill process SentinelPid ! {ping, self()}, receive @@ -71,5 +71,5 @@ "80", "Implicitly test that the function got de-registered" ), - + ok. Modified: couchdb/trunk/test/etap/083-config-no-files.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/083-config-no-files.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/083-config-no-files.t (original) +++ couchdb/trunk/test/etap/083-config-no-files.t Mon Jul 6 00:33:50 2009 @@ -24,9 +24,9 @@ couch_config:all(), "No INI files specified returns 0 key/value pairs." ), - + ok = couch_config:set("httpd", "port", "80", false), - + etap:is( couch_config:get("httpd", "port"), "80", Modified: couchdb/trunk/test/etap/090-task-status.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/090-task-status.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/090-task-status.t (original) +++ couchdb/trunk/test/etap/090-task-status.t Mon Jul 6 00:33:50 2009 @@ -59,11 +59,11 @@ {ok, Pid, Msg} -> Msg after 1000 -> throw(timeout_error) - end. + end. -test() -> +test() -> {ok, TaskStatusPid} = couch_task_status:start_link(), - + TaskUpdater = fun() -> loop() end, % create three updaters Pid1 = spawn(TaskUpdater), @@ -103,13 +103,13 @@ 2, "Started a second task." ), - + etap:is( check_status(Pid2, couch_task_status:all()), <<"init">>, "Second tasks's status was set to 'init'." ), - + call(Pid2, update, "running"), etap:is( check_status(Pid2, couch_task_status:all()), @@ -124,13 +124,13 @@ 3, "Registered a third task." ), - + etap:is( check_status(Pid3, couch_task_status:all()), <<"init">>, "Third tasks's status was set to 'init'." ), - + call(Pid3, update, "running"), etap:is( check_status(Pid3, couch_task_status:all()), @@ -169,14 +169,14 @@ 2, "First task finished." ), - + call(Pid2, done), etap:is( length(couch_task_status:all()), 1, "Second task finished." ), - + call(Pid3, done), etap:is( length(couch_task_status:all()), Modified: couchdb/trunk/test/etap/100-ref-counter.t URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/100-ref-counter.t?rev=791350&r1=791349&r2=791350&view=diff ============================================================================== --- couchdb/trunk/test/etap/100-ref-counter.t (original) +++ couchdb/trunk/test/etap/100-ref-counter.t Mon Jul 6 00:33:50 2009 @@ -26,9 +26,9 @@ after 1000 -> throw(timeout_error) - end. + end. -test() -> +test() -> {ok, RefCtr} = couch_ref_counter:start([]), etap:is( @@ -67,7 +67,7 @@ 2, "Droping the doubly added Pid only removes a ref, not a referer." ), - + couch_ref_counter:drop(RefCtr, ChildPid1), etap:is( couch_ref_counter:count(RefCtr), @@ -81,7 +81,7 @@ 2, "Sanity checking that the Pid was re-added." ), - + ChildPid1 ! {ping, self()}, wait(), etap:is(