Mail Archives: djgpp-workers/2000/12/11/07:41:03
On Mon, 11 Dec 2000, Eli Zaretskii wrote:
> Please change the new variable's name to error_message_printed,
> initialize it to zero, and set to 1 after the message is printed.
> Double negation such as this:
>
> error_message_not_printed = 0; /* Yes, we have printed it. */
>
> confuses programmers and is a source of many programmatic errors
> (althought your code is correct).
OK. Done.
Regards,
Guerrero, Juan Manuel
diff -acprNC5 djgpp.orig/src/utils/djtar/untar.c djgpp/src/utils/djtar/untar.c
*** djgpp.orig/src/utils/djtar/untar.c Tue Nov 28 21:20:44 2000
--- djgpp/src/utils/djtar/untar.c Sun Dec 10 18:37:16 2000
*************** typedef struct {
*** 42,51 ****
--- 42,52 ----
char flags[1];
char filler[355];
} TARREC;
static TARREC header;
+ static int error_message_printed;
static int looking_for_header;
static char *changed_name;
static int first_block = 1;
static File_type file_type = DOS_BINARY;
static long perm, uid, gid, size;
*************** tarread(char *buf, long buf_size)
*** 121,131 ****
head_csum -= j;
}
if (head_csum && !ignore_csum)
{
/* Probably corrupted archive. Bail out. */
! fprintf(log_out, "--- !!Directory checksum error!! ---\n");
bytes_out += buf_size;
return EOF;
}
changed_name = get_new_name(header.name, &should_be_written);
--- 122,140 ----
head_csum -= j;
}
if (head_csum && !ignore_csum)
{
/* Probably corrupted archive. Bail out. */
! if (!error_message_printed)
! {
! error_message_printed = 1;
! fprintf(log_out, "--- !!Directory checksum error!! ---\n");
! }
! /* We have still not found a valid tar header in this buf[],
! so we MUST continue looking for a header next time that
! tarread() is called with a new buf[]. */
! looking_for_header = 1;
bytes_out += buf_size;
return EOF;
}
changed_name = get_new_name(header.name, &should_be_written);
*************** tar_gz_read(char *fname)
*** 342,351 ****
--- 351,361 ----
fname,
method > MAX_METHODS ? "corrupted (?)" : zip_description[method],
method == DEFLATED ? (pkzip ? "PKZip" : "GZip") : "");
bytes_out = 0;
+ error_message_printed = 0;
looking_for_header = 1;
posn = 0;
if ((*decompressor)(f) != OK)
{
- Raw text -