couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [14/25] couch commit: updated refs/heads/master to 92598cd
Date Thu, 15 Oct 2015 16:35:48 GMT
Remove unnecessary branching


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/13d8e42c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/13d8e42c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/13d8e42c

Branch: refs/heads/master
Commit: 13d8e42c2a1530d7eed6afd02560cc317d7ec75f
Parents: f99d3ba
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Fri Nov 28 11:07:03 2014 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Wed May 6 06:55:58 2015 -0700

----------------------------------------------------------------------
 src/couch_doc.erl | 37 ++++++++++++++++---------------------
 1 file changed, 16 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/13d8e42c/src/couch_doc.erl
----------------------------------------------------------------------
diff --git a/src/couch_doc.erl b/src/couch_doc.erl
index c43d6a1..40412ad 100644
--- a/src/couch_doc.erl
+++ b/src/couch_doc.erl
@@ -427,28 +427,23 @@ atts_to_mp([], _Boundary, WriteFun, _AttFun) ->
     WriteFun(<<"--">>);
 atts_to_mp([{Att, Name, LengthBin, Type, Encoding} | RestAtts], Boundary, WriteFun,
     AttFun)  ->
-    case couch_att:is_stub(Att) of
-        true ->
-            unreacheable = atts_to_mp(RestAtts, Boundary, WriteFun, AttFun);
-        false ->
-            % write headers
-            WriteFun(<<"\r\nContent-Disposition: attachment; filename=\"", Name/binary,
"\"">>),
-            WriteFun(<<"\r\nContent-Type: ", Type/binary>>),
-            WriteFun(<<"\r\nContent-Length: ", LengthBin/binary>>),
-            case Encoding of
-                identity ->
-                    ok;
-                _ ->
-                    EncodingBin = atom_to_binary(Encoding, latin1),
-                    WriteFun(<<"\r\nContent-Encoding: ", EncodingBin/binary>>)
-            end,
+    % write headers
+    WriteFun(<<"\r\nContent-Disposition: attachment; filename=\"", Name/binary, "\"">>),
+    WriteFun(<<"\r\nContent-Type: ", Type/binary>>),
+    WriteFun(<<"\r\nContent-Length: ", LengthBin/binary>>),
+    case Encoding of
+        identity ->
+            ok;
+        _ ->
+            EncodingBin = atom_to_binary(Encoding, latin1),
+            WriteFun(<<"\r\nContent-Encoding: ", EncodingBin/binary>>)
+    end,
 
-            % write data
-            WriteFun(<<"\r\n\r\n">>),
-            AttFun(Att, fun(Data, _) -> WriteFun(Data) end, ok),
-            WriteFun(<<"\r\n--", Boundary/binary>>),
-            atts_to_mp(RestAtts, Boundary, WriteFun, AttFun)
-    end.
+    % write data
+    WriteFun(<<"\r\n\r\n">>),
+    AttFun(Att, fun(Data, _) -> WriteFun(Data) end, ok),
+    WriteFun(<<"\r\n--", Boundary/binary>>),
+    atts_to_mp(RestAtts, Boundary, WriteFun, AttFun).
 
 encode_multipart_stream(_Boundary, JsonBytes, [], WriteFun, _AttFun) ->
     WriteFun(JsonBytes);


Mime
View raw message