Skip to content
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

list archive contents: lzop #230

Closed
wants to merge 9 commits into from
10 changes: 6 additions & 4 deletions src/fr-command-cfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ get_uncompressed_name_from_archive (FrCommand *comm,
char buffer[10];

if (g_input_stream_read (stream, buffer, 10, NULL, NULL) >= 0) {
unsigned char flag = buffer[3];
stokito marked this conversation as resolved.
Show resolved Hide resolved
/* Check whether the FLG.FNAME is set */
if (((unsigned char)(buffer[3]) & 0x08) != 0x08)
if ((flag & 0x08) != 0x08)
filename_present = FALSE;

/* Check whether the FLG.FEXTRA is set */
if (((unsigned char)(buffer[3]) & 0x04) == 0x04)
if ((flag & 0x04) == 0x04)
filename_present = FALSE;
}

Expand Down Expand Up @@ -110,8 +111,9 @@ list__process_line_gzip(char *line,
fdata = file_data_new ();

fields = split_line (line, 2);
if (strcmp (fields[1], "-1") != 0)
fdata->size = g_ascii_strtoull (fields[1], NULL, 10);
const char *field_uncompressed = fields[1]; // e.g. "3454395"
if (strcmp (field_uncompressed, "-1") != 0)
fdata->size = g_ascii_strtoull (field_uncompressed, NULL, 10);
g_strfreev (fields);

if (fdata->size == 0)
Expand Down
7 changes: 6 additions & 1 deletion src/glib-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,12 @@ eat_void_chars (const char *line)
return line;
}


/**
* Parse the line and return array of columns separated by space symbol and size of n_fields
* @param line
* @param n_fields how many colums/fields to parse
* @return NULL terminated array of fields with size of n_fields
*/
char **
split_line (const char *line,
int n_fields)
Expand Down