Skip to content

Assign skip to the right variable type #2572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AZero13
Copy link
Contributor

@AZero13 AZero13 commented Apr 10, 2025

This is for consistency with file_skip in both implementations.

Furthermore, just calculate skip_bits in the branch where the calculation is used. Chances are, the compiler may have done this anyway, but it is good just in case.

This is for consistency with file_skip in both implementations.

Furthermore, just calculate skip_bits in the branch where the calculation is used. Chances are, the compiler may have done this anyway, but it is good just in case.
@@ -131,15 +131,22 @@ static int64_t
file_skip(struct archive *a, void *client_data, int64_t request)
{
struct read_fd_data *mine = (struct read_fd_data *)client_data;
#if HAVE__FSEEKI64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't needed here. This module works with a file descriptor, so lseek() is appropriate on all platforms. This logic is only needed in archive_read_open_file.c because it works with a FILE handle and those APIs do vary across platforms.


if (!mine->use_lseek)
return (0);

/* Reduce a request that would overflow the 'skip' variable. */
if (sizeof(request) > sizeof(skip)) {
const int skip_bits = sizeof(skip) * 8 - 1; /* off_t is a signed type. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this definition closer to where it's used is a nice change.

@kientzle
Copy link
Contributor

Please remove the unnecessary change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants