@@ -566,9 +566,9 @@ int loose_object_info(struct repository *r,
566566}
567567
568568static void hash_object_body (const struct git_hash_algo * algo , struct git_hash_ctx * c ,
569- const void * buf , unsigned long len ,
569+ const void * buf , size_t len ,
570570 struct object_id * oid ,
571- char * hdr , int * hdrlen )
571+ char * hdr , size_t * hdrlen )
572572{
573573 algo -> init_fn (c );
574574 git_hash_update (c , hdr , * hdrlen );
@@ -577,23 +577,23 @@ static void hash_object_body(const struct git_hash_algo *algo, struct git_hash_c
577577}
578578
579579static void write_object_file_prepare (const struct git_hash_algo * algo ,
580- const void * buf , unsigned long len ,
580+ const void * buf , size_t len ,
581581 enum object_type type , struct object_id * oid ,
582- char * hdr , int * hdrlen )
582+ char * hdr , size_t * hdrlen )
583583{
584584 struct git_hash_ctx c ;
585585
586586 /* Generate the header */
587587 * hdrlen = format_object_header (hdr , * hdrlen , type , len );
588588
589- /* Sha1.. */
589+ /* Hash (function pointers) computation */
590590 hash_object_body (algo , & c , buf , len , oid , hdr , hdrlen );
591591}
592592
593593static void write_object_file_prepare_literally (const struct git_hash_algo * algo ,
594- const void * buf , unsigned long len ,
594+ const void * buf , size_t len ,
595595 const char * type , struct object_id * oid ,
596- char * hdr , int * hdrlen )
596+ char * hdr , size_t * hdrlen )
597597{
598598 struct git_hash_ctx c ;
599599
@@ -731,17 +731,17 @@ int finalize_object_file_flags(const char *tmpfile, const char *filename,
731731}
732732
733733static void hash_object_file_literally (const struct git_hash_algo * algo ,
734- const void * buf , unsigned long len ,
734+ const void * buf , size_t len ,
735735 const char * type , struct object_id * oid )
736736{
737737 char hdr [MAX_HEADER_LEN ];
738- int hdrlen = sizeof (hdr );
738+ size_t hdrlen = sizeof (hdr );
739739
740740 write_object_file_prepare_literally (algo , buf , len , type , oid , hdr , & hdrlen );
741741}
742742
743743void hash_object_file (const struct git_hash_algo * algo , const void * buf ,
744- unsigned long len , enum object_type type ,
744+ size_t len , enum object_type type ,
745745 struct object_id * oid )
746746{
747747 hash_object_file_literally (algo , buf , len , type_name (type ), oid );
@@ -1106,7 +1106,7 @@ int stream_loose_object(struct input_stream *in_stream, size_t len,
11061106 return err ;
11071107}
11081108
1109- int write_object_file_flags (const void * buf , unsigned long len ,
1109+ int write_object_file_flags (const void * buf , size_t len ,
11101110 enum object_type type , struct object_id * oid ,
11111111 struct object_id * compat_oid_in , unsigned flags )
11121112{
@@ -1115,7 +1115,7 @@ int write_object_file_flags(const void *buf, unsigned long len,
11151115 const struct git_hash_algo * compat = repo -> compat_hash_algo ;
11161116 struct object_id compat_oid ;
11171117 char hdr [MAX_HEADER_LEN ];
1118- int hdrlen = sizeof (hdr );
1118+ size_t hdrlen = sizeof (hdr );
11191119
11201120 /* Generate compat_oid */
11211121 if (compat ) {
@@ -1146,7 +1146,7 @@ int write_object_file_flags(const void *buf, unsigned long len,
11461146 return 0 ;
11471147}
11481148
1149- int write_object_file_literally (const void * buf , unsigned long len ,
1149+ int write_object_file_literally (const void * buf , size_t len ,
11501150 const char * type , struct object_id * oid ,
11511151 unsigned flags )
11521152{
@@ -1155,8 +1155,8 @@ int write_object_file_literally(const void *buf, unsigned long len,
11551155 const struct git_hash_algo * algo = repo -> hash_algo ;
11561156 const struct git_hash_algo * compat = repo -> compat_hash_algo ;
11571157 struct object_id compat_oid ;
1158- int hdrlen , status = 0 ;
1159- int compat_type = -1 ;
1158+ size_t hdrlen ;
1159+ int status = 0 , compat_type = -1 ;
11601160
11611161 if (compat ) {
11621162 compat_type = type_from_string_gently (type , -1 , 1 );
0 commit comments