diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-07-22 13:10:00 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-07-22 13:10:51 +0300 |
commit | 6665726a0799e9acc5a7e07eb4dd83b1e4973bb9 (patch) | |
tree | f61910800a04e3ed09f820cef27f5f8e3a79dafe /src | |
parent | c2ab4fa57c12446986447d849b3defc888cc2c6f (diff) | |
download | cpio-6665726a0799e9acc5a7e07eb4dd83b1e4973bb9.tar.gz cpio-6665726a0799e9acc5a7e07eb4dd83b1e4973bb9.tar.bz2 |
Minor fixes.
* src/copyout.c (count_defered_links_to_dev_ino): Return size_t.
(last_link): Do not use superfluous local variable.
* src/util.c (copy_files_disk_to_tape)
(copy_files_disk_to_disk): Shut down gcc warnings.
Diffstat (limited to 'src')
-rw-r--r-- | src/copyout.c | 30 | ||||
-rw-r--r-- | src/util.c | 8 |
2 files changed, 14 insertions, 24 deletions
diff --git a/src/copyout.c b/src/copyout.c index e9849ff..ab6a243 100644 --- a/src/copyout.c +++ b/src/copyout.c @@ -106,22 +106,20 @@ struct deferment *deferouts = NULL; /* Count the number of other (hard) links to this file that have already been defered. */ -static int +static size_t count_defered_links_to_dev_ino (struct cpio_file_stat *file_hdr) { struct deferment *d; - ino_t ino; - int maj; - int min; - int count; - ino = file_hdr->c_ino; - maj = file_hdr->c_dev_maj; - min = file_hdr->c_dev_min; - count = 0; + ino_t ino = file_hdr->c_ino; + long maj = file_hdr->c_dev_maj; + long min = file_hdr->c_dev_min; + size_t count = 0; + for (d = deferouts; d != NULL; d = d->next) { - if ( (d->header.c_ino == ino) && (d->header.c_dev_maj == maj) - && (d->header.c_dev_min == min) ) + if (d->header.c_ino == ino + && d->header.c_dev_maj == maj + && d->header.c_dev_min == min) ++count; } return count; @@ -133,17 +131,9 @@ count_defered_links_to_dev_ino (struct cpio_file_stat *file_hdr) static int last_link (struct cpio_file_stat *file_hdr) { - int other_files_sofar; - - other_files_sofar = count_defered_links_to_dev_ino (file_hdr); - if (file_hdr->c_nlink == (other_files_sofar + 1) ) - { - return 1; - } - return 0; + return file_hdr->c_nlink == count_defered_links_to_dev_ino (file_hdr) + 1; } - /* Add the file header for a link that is being defered to the deferouts list. */ @@ -484,9 +484,9 @@ copy_files_disk_to_tape (int in_des, int out_des, off_t num_bytes, while (num_bytes > 0) { if (input_size == 0) - if (rc = disk_fill_input_buffer (in_des, - num_bytes < DISK_IO_BLOCK_SIZE ? - num_bytes : DISK_IO_BLOCK_SIZE)) + if ((rc = disk_fill_input_buffer (in_des, + num_bytes < DISK_IO_BLOCK_SIZE ? + num_bytes : DISK_IO_BLOCK_SIZE))) { if (rc > 0) { @@ -536,7 +536,7 @@ copy_files_disk_to_disk (int in_des, int out_des, off_t num_bytes, while (num_bytes > 0) { if (input_size == 0) - if (rc = disk_fill_input_buffer (in_des, num_bytes)) + if ((rc = disk_fill_input_buffer (in_des, num_bytes))) { if (rc > 0) { |