Mercurial > projects > doodle
comparison doodle/utils/prog/dupes.d @ 132:bc5baa585b32
Updated to dmd 2.060
author | David Bryant <bagnose@gmail.com> |
---|---|
date | Thu, 02 Aug 2012 15:32:43 +0930 |
parents | 1da160a2c373 |
children |
comparison
equal
deleted
inserted
replaced
130:1bc3475624d3 | 132:bc5baa585b32 |
---|---|
64 static ubyte[16] compute_md5(in string filename, in ulong max_bytes) { | 64 static ubyte[16] compute_md5(in string filename, in ulong max_bytes) { |
65 size_t chunk_size = min(max_bytes, 4096 * 1024); | 65 size_t chunk_size = min(max_bytes, 4096 * 1024); |
66 ubyte[16] digest; | 66 ubyte[16] digest; |
67 | 67 |
68 auto file = File(filename, "r"); | 68 auto file = File(filename, "r"); |
69 scope(exit) file.close; | 69 scope(exit) file.close(); |
70 | 70 |
71 MD5_CTX context; | 71 MD5_CTX context; |
72 context.start(); | 72 context.start(); |
73 ulong byte_count = 0; | 73 ulong byte_count = 0; |
74 foreach (ubyte[] buffer; chunks(file, chunk_size)) { | 74 foreach (ubyte[] buffer; chunks(file, chunk_size)) { |