@@ -962,7 +962,7 @@ static int store_object(
962962 struct object_entry * e ;
963963 unsigned char hdr [96 ];
964964 struct object_id oid ;
965- unsigned long hdrlen , deltalen ;
965+ size_t hdrlen , deltalen ;
966966 struct git_hash_ctx c ;
967967 git_zstream s ;
968968 struct repo_config_values * cfg = repo_config_values (the_repository );
@@ -998,13 +998,10 @@ static int store_object(
998998
999999 if (last && last -> data .len && last -> data .buf && last -> depth < max_depth
10001000 && dat -> len > the_hash_algo -> rawsz ) {
1001- size_t deltalen_st = 0 ;
1002-
10031001 delta_count_attempts_by_type [type ]++ ;
10041002 delta = diff_delta (last -> data .buf , last -> data .len ,
10051003 dat -> buf , dat -> len ,
1006- & deltalen_st , dat -> len - the_hash_algo -> rawsz );
1007- deltalen = cast_size_t_to_ulong (deltalen_st );
1004+ & deltalen , dat -> len - the_hash_algo -> rawsz );
10081005 } else
10091006 delta = NULL ;
10101007
@@ -1240,10 +1237,9 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
12401237 */
12411238static void * gfi_unpack_entry (
12421239 struct object_entry * oe ,
1243- unsigned long * sizep )
1240+ size_t * sizep )
12441241{
12451242 enum object_type type ;
1246- size_t size_st = 0 ;
12471243 void * data ;
12481244 struct packed_git * p = all_packs [oe -> pack_id ];
12491245 if (p == pack_data && p -> pack_size < (pack_size + the_hash_algo -> rawsz )) {
@@ -1266,9 +1262,7 @@ static void *gfi_unpack_entry(
12661262 */
12671263 p -> pack_size = pack_size + the_hash_algo -> rawsz ;
12681264 }
1269- data = unpack_entry (the_repository , p , oe -> idx .offset , & type , & size_st );
1270- if (sizep )
1271- * sizep = cast_size_t_to_ulong (size_st );
1265+ data = unpack_entry (the_repository , p , oe -> idx .offset , & type , sizep );
12721266 return data ;
12731267}
12741268
@@ -1277,7 +1271,7 @@ static void load_tree(struct tree_entry *root)
12771271 struct object_id * oid = & root -> versions [1 ].oid ;
12781272 struct object_entry * myoe ;
12791273 struct tree_content * t ;
1280- unsigned long size ;
1274+ size_t size ;
12811275 char * buf ;
12821276 const char * c ;
12831277
@@ -1295,10 +1289,8 @@ static void load_tree(struct tree_entry *root)
12951289 die (_ ("can't load tree %s" ), oid_to_hex (oid ));
12961290 } else {
12971291 enum object_type type ;
1298- size_t size_st = 0 ;
12991292 buf = odb_read_object (the_repository -> objects , oid , & type ,
1300- & size_st );
1301- size = cast_size_t_to_ulong (size_st );
1293+ & size );
13021294 if (!buf || type != OBJ_TREE )
13031295 die (_ ("can't load tree %s" ), oid_to_hex (oid ));
13041296 }
@@ -2616,7 +2608,7 @@ static void file_change_deleteall(struct branch *b)
26162608 b -> num_notes = 0 ;
26172609}
26182610
2619- static void parse_from_commit (struct branch * b , char * buf , unsigned long size )
2611+ static void parse_from_commit (struct branch * b , char * buf , size_t size )
26202612{
26212613 if (!buf || size < the_hash_algo -> hexsz + 6 )
26222614 die (_ ("not a valid commit: %s" ), oid_to_hex (& b -> oid ));
@@ -2633,13 +2625,11 @@ static void parse_from_existing(struct branch *b)
26332625 oidclr (& b -> branch_tree .versions [0 ].oid , the_repository -> hash_algo );
26342626 oidclr (& b -> branch_tree .versions [1 ].oid , the_repository -> hash_algo );
26352627 } else {
2636- unsigned long size ;
2637- size_t size_st = 0 ;
2628+ size_t size ;
26382629 char * buf ;
26392630
26402631 buf = odb_read_object_peeled (the_repository -> objects , & b -> oid ,
2641- OBJ_COMMIT , & size_st , & b -> oid );
2642- size = cast_size_t_to_ulong (size_st );
2632+ OBJ_COMMIT , & size , & b -> oid );
26432633 parse_from_commit (b , buf , size );
26442634 free (buf );
26452635 }
@@ -2668,7 +2658,7 @@ static int parse_objectish(struct branch *b, const char *objectish)
26682658 if (!oideq (& b -> oid , & oe -> idx .oid )) {
26692659 oidcpy (& b -> oid , & oe -> idx .oid );
26702660 if (oe -> pack_id != MAX_PACK_ID ) {
2671- unsigned long size ;
2661+ size_t size ;
26722662 char * buf = gfi_unpack_entry (oe , & size );
26732663 parse_from_commit (b , buf , size );
26742664 free (buf );
@@ -3334,15 +3324,13 @@ static void cat_blob_write(const char *buf, unsigned long size)
33343324static void cat_blob (struct object_entry * oe , struct object_id * oid )
33353325{
33363326 struct strbuf line = STRBUF_INIT ;
3337- unsigned long size ;
3327+ size_t size ;
33383328 enum object_type type = 0 ;
33393329 char * buf ;
33403330
33413331 if (!oe || oe -> pack_id == MAX_PACK_ID ) {
3342- size_t size_st = 0 ;
33433332 buf = odb_read_object (the_repository -> objects , oid , & type ,
3344- & size_st );
3345- size = cast_size_t_to_ulong (size_st );
3333+ & size );
33463334 } else {
33473335 type = oe -> type ;
33483336 buf = gfi_unpack_entry (oe , & size );
@@ -3421,7 +3409,7 @@ static void parse_cat_blob(const char *p)
34213409static struct object_entry * dereference (struct object_entry * oe ,
34223410 struct object_id * oid )
34233411{
3424- unsigned long size ;
3412+ size_t size ;
34253413 char * buf = NULL ;
34263414 const unsigned hexsz = the_hash_algo -> hexsz ;
34273415
@@ -3450,10 +3438,8 @@ static struct object_entry *dereference(struct object_entry *oe,
34503438 buf = gfi_unpack_entry (oe , & size );
34513439 } else {
34523440 enum object_type unused ;
3453- size_t size_st = 0 ;
34543441 buf = odb_read_object (the_repository -> objects , oid ,
3455- & unused , & size_st );
3456- size = cast_size_t_to_ulong (size_st );
3442+ & unused , & size );
34573443 }
34583444 if (!buf )
34593445 die (_ ("can't load object %s" ), oid_to_hex (oid ));
0 commit comments