couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject couchdb-couch-epi git commit: Restore R14 compatibility
Date Wed, 22 Jul 2015 09:46:04 GMT
Repository: couchdb-couch-epi
Updated Branches:
  refs/heads/master 822f3a265 -> fe02b2971


Restore R14 compatibility

CouchDB 2.0 will be compatible with R14. Support for R14 to be dropped
after.

closes COUCHDB-2755


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

Branch: refs/heads/master
Commit: fe02b297131849f9d6ccbf7ac735c09f63ec5c32
Parents: 822f3a2
Author: Robert Newson <rnewson@apache.org>
Authored: Wed Jul 22 08:36:32 2015 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Wed Jul 22 08:36:32 2015 +0100

----------------------------------------------------------------------
 src/couch_epi_data_source.erl |  2 +-
 src/couch_epi_util.erl        | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/blob/fe02b297/src/couch_epi_data_source.erl
----------------------------------------------------------------------
diff --git a/src/couch_epi_data_source.erl b/src/couch_epi_data_source.erl
index 68b4aab..bbeed70 100644
--- a/src/couch_epi_data_source.erl
+++ b/src/couch_epi_data_source.erl
@@ -178,7 +178,7 @@ read({file, FilePath}) ->
 
 hash_of_file(FilePath) ->
     {ok, Data} = file:read_file(FilePath),
-    crypto:hash(md5, Data).
+    couch_epi_util:md5(Data).
 
 current(Handle, Subscriber) ->
     try

http://git-wip-us.apache.org/repos/asf/couchdb-couch-epi/blob/fe02b297/src/couch_epi_util.erl
----------------------------------------------------------------------
diff --git a/src/couch_epi_util.erl b/src/couch_epi_util.erl
index 1c39aa5..62b7a85 100644
--- a/src/couch_epi_util.erl
+++ b/src/couch_epi_util.erl
@@ -12,7 +12,7 @@
 
 -module(couch_epi_util).
 
--export([module_version/1, hash/1]).
+-export([module_version/1, hash/1, md5/1]).
 
 module_version(Module) ->
     Attributes = Module:module_info(attributes),
@@ -20,5 +20,13 @@ module_version(Module) ->
     VSNs.
 
 hash(Term) ->
-    <<SigInt:128/integer>> = crypto:hash(md5, term_to_binary(Term)),
+    <<SigInt:128/integer>> = md5(term_to_binary(Term)),
     io_lib:format("\"~.36B\"",[SigInt]).
+
+md5(Data) ->
+    case erlang:function_exported(crypto, hash, 2) of
+	true ->
+	    crypto:hash(md5, Data);
+	false ->
+	    crypto:md5(Data)
+    end.


Mime
View raw message