@@ -507,8 +507,7 @@ backup_data_file(pgFile *file, const char *from_fullpath, const char *to_fullpat
507507 * NOTE This is a normal situation, if the file size has changed
508508 * since the moment we computed it.
509509 */
510- file -> n_blocks = (typeof (file -> n_blocks ))(file -> size /BLCKSZ );
511- Assert ((int64_t )file -> n_blocks * BLCKSZ == file -> size );
510+ file -> n_blocks = ft_div_i64u32_to_i32 (file -> size , BLCKSZ );
512511
513512 /*
514513 * Skip unchanged file only if it exists in previous backup.
@@ -618,8 +617,7 @@ backup_data_file(pgFile *file, const char *from_fullpath, const char *to_fullpat
618617 if (backup_mode == BACKUP_MODE_FULL ||
619618 backup_mode == BACKUP_MODE_DIFF_DELTA )
620619 {
621- file -> n_blocks = (typeof (file -> n_blocks ))(file -> read_size / BLCKSZ );
622- Assert ((int64_t )file -> n_blocks * BLCKSZ == file -> read_size );
620+ file -> n_blocks = ft_div_i64u32_to_i32 (file -> read_size , BLCKSZ );
623621 }
624622
625623 /* Determine that file didn`t changed in case of incremental backup */
@@ -666,7 +664,7 @@ catchup_data_file(pgFile *file, const char *from_fullpath, const char *to_fullpa
666664 * NOTE This is a normal situation, if the file size has changed
667665 * since the moment we computed it.
668666 */
669- file -> n_blocks = file -> size / BLCKSZ ;
667+ file -> n_blocks = ft_div_i64u32_to_i32 ( file -> size , BLCKSZ ) ;
670668
671669 /*
672670 * Skip unchanged file only if it exists in destination directory.
@@ -1599,8 +1597,7 @@ check_data_file(ConnectionArgs *arguments, pgFile *file,
15991597 * NOTE This is a normal situation, if the file size has changed
16001598 * since the moment we computed it.
16011599 */
1602- nblocks = (typeof (nblocks ))(file -> size /BLCKSZ );
1603- Assert ((int64_t )nblocks * BLCKSZ == file -> size );
1600+ nblocks = ft_div_i64u32_to_i32 (file -> size , BLCKSZ );
16041601
16051602 for (blknum = 0 ; blknum < nblocks ; blknum ++ )
16061603 {
0 commit comments