libidav/resource.c

changeset 558
1a9e6a5c1e79
parent 555
c9ada14ee90e
child 587
3c917df041b8
equal deleted inserted replaced
557:90ad7324bbbc 558:1a9e6a5c1e79
688 } 688 }
689 689
690 static int dav_seek_h(void *stream, long offset, int whence) { 690 static int dav_seek_h(void *stream, long offset, int whence) {
691 HashStream *s = stream; 691 HashStream *s = stream;
692 if(offset == 0 && whence == SEEK_SET) { 692 if(offset == 0 && whence == SEEK_SET) {
693 char buf[DAV_SHA256_DIGEST_LENGTH]; 693 unsigned char buf[DAV_SHA256_DIGEST_LENGTH];
694 dav_hash_final(s->sha, buf); 694 dav_hash_final(s->sha, buf);
695 s->sha = NULL; 695 s->sha = NULL;
696 } else { 696 } else {
697 s->error = 1; 697 s->error = 1;
698 } 698 }
787 (dav_seek_func)dav_seek_h, 787 (dav_seek_func)dav_seek_h,
788 data->length); 788 data->length);
789 789
790 if(hstr.sha) { 790 if(hstr.sha) {
791 dav_hash_final(hstr.sha, (unsigned char*)data->hash); 791 dav_hash_final(hstr.sha, (unsigned char*)data->hash);
792 char *hash = util_hexstr(data->hash, 32); 792 char *hash = util_hexstr((unsigned char*)data->hash, 32);
793 dav_set_string_property_ns(res, DAV_NS, "content-hash", hash); 793 dav_set_string_property_ns(res, DAV_NS, "content-hash", hash);
794 free(hash); 794 free(hash);
795 } 795 }
796 } else { 796 } else {
797 ret = do_put_request( 797 ret = do_put_request(

mercurial