libidav/resource.c

changeset 872
d24de29ad1fe
parent 869
cece9ef3547f
child 881
64989511f6c3
child 888
af685cc9d623
equal deleted inserted replaced
871:2ecddc5e93f1 872:d24de29ad1fe
833 833
834 static int dav_seek_h(void *stream, long offset, int whence) { 834 static int dav_seek_h(void *stream, long offset, int whence) {
835 HashStream *s = stream; 835 HashStream *s = stream;
836 if(offset == 0 && whence == SEEK_SET) { 836 if(offset == 0 && whence == SEEK_SET) {
837 unsigned char buf[DAV_SHA256_DIGEST_LENGTH]; 837 unsigned char buf[DAV_SHA256_DIGEST_LENGTH];
838 dav_sha256_final(s->sha, buf); 838 dav_sha256_final_free(s->sha, buf);
839 s->sha = NULL; 839 s->sha = NULL;
840 } else { 840 } else {
841 s->error = 1; 841 s->error = 1;
842 } 842 }
843 return s->seek(s->stream, offset, whence); 843 return s->seek(s->stream, offset, whence);
936 dav_read_h, 936 dav_read_h,
937 (dav_seek_func)dav_seek_h, 937 (dav_seek_func)dav_seek_h,
938 data->length); 938 data->length);
939 939
940 if(hstr.sha) { 940 if(hstr.sha) {
941 dav_sha256_final(hstr.sha, (unsigned char*)data->hash); 941 dav_sha256_final_free(hstr.sha, (unsigned char*)data->hash);
942 char *hash = util_hexstr((unsigned char*)data->hash, 32); 942 char *hash = util_hexstr((unsigned char*)data->hash, 32);
943 dav_set_string_property_ns(res, DAV_NS, "content-hash", hash); 943 dav_set_string_property_ns(res, DAV_NS, "content-hash", hash);
944 free(hash); 944 free(hash);
945 } 945 }
946 } else { 946 } else {

mercurial