diff options
| author | Paul Joseph Davis <davisp@apache.org> | 2009-07-23 13:01:26 +0000 | 
|---|---|---|
| committer | Paul Joseph Davis <davisp@apache.org> | 2009-07-23 13:01:26 +0000 | 
| commit | b1243f897fe4ac5d0719bec464c14d00b72875d9 (patch) | |
| tree | 772c218a8761e6705678629b51be26381ca8aca0 /src | |
| parent | f578c9de2911ae1a84a1da4b5d68c9d4baf01f0c (diff) | |
Fixes etap tests for recent updates.
Thanks Bob Dionne
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@797053 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
| -rw-r--r-- | src/couchdb/couch_file.erl | 25 | 
1 files changed, 11 insertions, 14 deletions
| diff --git a/src/couchdb/couch_file.erl b/src/couchdb/couch_file.erl index e8b37aa5..2dfc5403 100644 --- a/src/couchdb/couch_file.erl +++ b/src/couchdb/couch_file.erl @@ -116,26 +116,23 @@ pread_binary(Fd, Pos) ->      {ok, L} = pread_iolist(Fd, Pos),      {ok, iolist_to_binary(L)}. +  pread_iolist(Fd, Pos) -> -    {ok, LenIolist, NextPos} =read_raw_iolist(Fd, Pos, 20), +    {ok, LenIolist, NextPos} = read_raw_iolist(Fd, Pos, 4),      case iolist_to_binary(LenIolist) of -    <<1:1/integer,Len:31/integer,Md5/binary>> -> -        {ok, Iolist, _} = read_raw_iolist(Fd, NextPos, Len), -        case erlang:md5(Iolist) of +    <<1:1/integer,Len:31/integer>> -> +        {ok, Md5List, ValPos} = read_raw_iolist(Fd, NextPos, 16), +        Md5 = iolist_to_binary(Md5List), +        {ok, IoList, _} = read_raw_iolist(Fd,ValPos,Len), +        case erlang:md5(IoList) of          Md5 -> ok;          _ ->  throw(file_corruption)          end,  -        {ok, Iolist}; -    <<0:1/integer,Len:31/integer,First16Bytes/binary>> -> -        if Len =< 16 -> -            <<Final:Len/binary,_/binary>> = First16Bytes, -            {ok, Final}; -        true -> -            {ok, Iolist, _} = read_raw_iolist(Fd, NextPos, Len - 16), -            {ok, [First16Bytes, Iolist]} -        end +        {ok, IoList}; +    <<0:1/integer,Len:31/integer>> -> +        {ok, Iolist, _} = read_raw_iolist(Fd, NextPos, Len), +        {ok, Iolist}       end. -              read_raw_iolist(Fd, Pos, Len) -> | 
