1
1
#define USE_THE_REPOSITORY_VARIABLE
2
- #define DISABLE_SIGN_COMPARE_WARNINGS
3
2
4
3
#include "git-compat-util.h"
5
4
#include "config.h"
@@ -570,7 +569,7 @@ static void validate_mixed_bloom_settings(struct commit_graph *g)
570
569
static int add_graph_to_chain (struct commit_graph * g ,
571
570
struct commit_graph * chain ,
572
571
struct object_id * oids ,
573
- int n )
572
+ size_t n )
574
573
{
575
574
struct commit_graph * cur_g = chain ;
576
575
@@ -623,7 +622,7 @@ int open_commit_graph_chain(const char *chain_file,
623
622
close (* fd );
624
623
return 0 ;
625
624
}
626
- if (st -> st_size < the_hash_algo -> hexsz ) {
625
+ if (st -> st_size < ( ssize_t ) the_hash_algo -> hexsz ) {
627
626
close (* fd );
628
627
if (!st -> st_size ) {
629
628
/* treat empty files the same as missing */
@@ -644,15 +643,16 @@ struct commit_graph *load_commit_graph_chain_fd_st(struct repository *r,
644
643
struct commit_graph * graph_chain = NULL ;
645
644
struct strbuf line = STRBUF_INIT ;
646
645
struct object_id * oids ;
647
- int i = 0 , valid = 1 , count ;
646
+ int valid = 1 ;
648
647
FILE * fp = xfdopen (fd , "r" );
648
+ size_t count ;
649
649
650
650
count = st -> st_size / (the_hash_algo -> hexsz + 1 );
651
651
CALLOC_ARRAY (oids , count );
652
652
653
653
odb_prepare_alternates (r -> objects );
654
654
655
- for (i = 0 ; i < count ; i ++ ) {
655
+ for (size_t i = 0 ; i < count ; i ++ ) {
656
656
struct odb_source * source ;
657
657
658
658
if (strbuf_getline_lf (& line , fp ) == EOF )
@@ -1146,12 +1146,12 @@ struct write_commit_graph_context {
1146
1146
int num_generation_data_overflows ;
1147
1147
unsigned long approx_nr_objects ;
1148
1148
struct progress * progress ;
1149
- int progress_done ;
1149
+ uint64_t progress_done ;
1150
1150
uint64_t progress_cnt ;
1151
1151
1152
1152
char * base_graph_name ;
1153
- int num_commit_graphs_before ;
1154
- int num_commit_graphs_after ;
1153
+ uint32_t num_commit_graphs_before ;
1154
+ uint32_t num_commit_graphs_after ;
1155
1155
char * * commit_graph_filenames_before ;
1156
1156
char * * commit_graph_filenames_after ;
1157
1157
char * * commit_graph_hash_after ;
@@ -1182,7 +1182,7 @@ static int write_graph_chunk_fanout(struct hashfile *f,
1182
1182
void * data )
1183
1183
{
1184
1184
struct write_commit_graph_context * ctx = data ;
1185
- int i , count = 0 ;
1185
+ size_t i , count = 0 ;
1186
1186
struct commit * * list = ctx -> commits .list ;
1187
1187
1188
1188
/*
@@ -1210,7 +1210,8 @@ static int write_graph_chunk_oids(struct hashfile *f,
1210
1210
{
1211
1211
struct write_commit_graph_context * ctx = data ;
1212
1212
struct commit * * list = ctx -> commits .list ;
1213
- int count ;
1213
+ size_t count ;
1214
+
1214
1215
for (count = 0 ; count < ctx -> commits .nr ; count ++ , list ++ ) {
1215
1216
display_progress (ctx -> progress , ++ ctx -> progress_cnt );
1216
1217
hashwrite (f , (* list )-> object .oid .hash , the_hash_algo -> rawsz );
@@ -1332,9 +1333,9 @@ static int write_graph_chunk_generation_data(struct hashfile *f,
1332
1333
void * data )
1333
1334
{
1334
1335
struct write_commit_graph_context * ctx = data ;
1335
- int i , num_generation_data_overflows = 0 ;
1336
+ int num_generation_data_overflows = 0 ;
1336
1337
1337
- for (i = 0 ; i < ctx -> commits .nr ; i ++ ) {
1338
+ for (size_t i = 0 ; i < ctx -> commits .nr ; i ++ ) {
1338
1339
struct commit * c = ctx -> commits .list [i ];
1339
1340
timestamp_t offset ;
1340
1341
repo_parse_commit (ctx -> r , c );
@@ -1356,8 +1357,8 @@ static int write_graph_chunk_generation_data_overflow(struct hashfile *f,
1356
1357
void * data )
1357
1358
{
1358
1359
struct write_commit_graph_context * ctx = data ;
1359
- int i ;
1360
- for (i = 0 ; i < ctx -> commits .nr ; i ++ ) {
1360
+
1361
+ for (size_t i = 0 ; i < ctx -> commits .nr ; i ++ ) {
1361
1362
struct commit * c = ctx -> commits .list [i ];
1362
1363
timestamp_t offset = commit_graph_data_at (c )-> generation - c -> date ;
1363
1364
display_progress (ctx -> progress , ++ ctx -> progress_cnt );
@@ -1527,7 +1528,7 @@ static void add_missing_parents(struct write_commit_graph_context *ctx, struct c
1527
1528
1528
1529
static void close_reachable (struct write_commit_graph_context * ctx )
1529
1530
{
1530
- int i ;
1531
+ size_t i ;
1531
1532
struct commit * commit ;
1532
1533
enum commit_graph_split_flags flags = ctx -> opts ?
1533
1534
ctx -> opts -> split_flags : COMMIT_GRAPH_SPLIT_UNSPECIFIED ;
@@ -1621,10 +1622,9 @@ static void compute_reachable_generation_numbers(
1621
1622
struct compute_generation_info * info ,
1622
1623
int generation_version )
1623
1624
{
1624
- int i ;
1625
1625
struct commit_list * list = NULL ;
1626
1626
1627
- for (i = 0 ; i < info -> commits -> nr ; i ++ ) {
1627
+ for (size_t i = 0 ; i < info -> commits -> nr ; i ++ ) {
1628
1628
struct commit * c = info -> commits -> list [i ];
1629
1629
timestamp_t gen ;
1630
1630
repo_parse_commit (info -> r , c );
@@ -1715,7 +1715,7 @@ static void set_generation_v2(struct commit *c, timestamp_t t,
1715
1715
1716
1716
static void compute_generation_numbers (struct write_commit_graph_context * ctx )
1717
1717
{
1718
- int i ;
1718
+ size_t i ;
1719
1719
struct compute_generation_info info = {
1720
1720
.r = ctx -> r ,
1721
1721
.commits = & ctx -> commits ,
@@ -1794,10 +1794,10 @@ static void trace2_bloom_filter_write_statistics(struct write_commit_graph_conte
1794
1794
1795
1795
static void compute_bloom_filters (struct write_commit_graph_context * ctx )
1796
1796
{
1797
- int i ;
1797
+ size_t i ;
1798
1798
struct progress * progress = NULL ;
1799
1799
struct commit * * sorted_commits ;
1800
- int max_new_filters ;
1800
+ size_t max_new_filters ;
1801
1801
1802
1802
init_bloom_filters ();
1803
1803
@@ -1815,7 +1815,7 @@ static void compute_bloom_filters(struct write_commit_graph_context *ctx)
1815
1815
QSORT (sorted_commits , ctx -> commits .nr , commit_gen_cmp );
1816
1816
1817
1817
max_new_filters = ctx -> opts && ctx -> opts -> max_new_filters >= 0 ?
1818
- ctx -> opts -> max_new_filters : ctx -> commits .nr ;
1818
+ ( size_t ) ctx -> opts -> max_new_filters : ctx -> commits .nr ;
1819
1819
1820
1820
for (i = 0 ; i < ctx -> commits .nr ; i ++ ) {
1821
1821
enum bloom_filter_computed computed = 0 ;
@@ -2018,10 +2018,10 @@ static void copy_oids_to_commits(struct write_commit_graph_context *ctx)
2018
2018
stop_progress (& ctx -> progress );
2019
2019
}
2020
2020
2021
- static int write_graph_chunk_base_1 (struct hashfile * f ,
2022
- struct commit_graph * g )
2021
+ static size_t write_graph_chunk_base_1 (struct hashfile * f ,
2022
+ struct commit_graph * g )
2023
2023
{
2024
- int num = 0 ;
2024
+ size_t num = 0 ;
2025
2025
2026
2026
if (!g )
2027
2027
return 0 ;
@@ -2035,7 +2035,7 @@ static int write_graph_chunk_base(struct hashfile *f,
2035
2035
void * data )
2036
2036
{
2037
2037
struct write_commit_graph_context * ctx = data ;
2038
- int num = write_graph_chunk_base_1 (f , ctx -> new_base_graph );
2038
+ size_t num = write_graph_chunk_base_1 (f , ctx -> new_base_graph );
2039
2039
2040
2040
if (num != ctx -> num_commit_graphs_after - 1 ) {
2041
2041
error (_ ("failed to write correct number of base graph ids" ));
@@ -2481,7 +2481,7 @@ static void expire_commit_graphs(struct write_commit_graph_context *ctx)
2481
2481
if (stat (path .buf , & st ) < 0 )
2482
2482
continue ;
2483
2483
2484
- if (st .st_mtime > expire_time )
2484
+ if (( unsigned ) st .st_mtime > expire_time )
2485
2485
continue ;
2486
2486
if (path .len < 6 || strcmp (path .buf + path .len - 6 , ".graph" ))
2487
2487
continue ;
@@ -2577,7 +2577,7 @@ int write_commit_graph(struct odb_source *source,
2577
2577
ctx .changed_paths = 1 ;
2578
2578
2579
2579
/* don't propagate the hash_version unless unspecified */
2580
- if (bloom_settings .hash_version == -1 )
2580
+ if (bloom_settings .hash_version == ( unsigned ) -1 )
2581
2581
bloom_settings .hash_version = g -> bloom_filter_settings -> hash_version ;
2582
2582
bloom_settings .bits_per_entry = g -> bloom_filter_settings -> bits_per_entry ;
2583
2583
bloom_settings .num_hashes = g -> bloom_filter_settings -> num_hashes ;
0 commit comments