# HG changeset patch # User truelight # Date 1189870689 0 # Node ID 08e4689e05b39bd3f20ed6e5e074d8c2a19ec159 # Parent f989c4d1126954e57e3fe071e21867e5dd7087a7 (svn r11117) -Add: add support for 7z .tar files, which are in the 'old' (deprecated) format diff -r f989c4d11269 -r 08e4689e05b3 src/fileio.cpp --- a/src/fileio.cpp Sat Sep 15 15:21:17 2007 +0000 +++ b/src/fileio.cpp Sat Sep 15 15:38:09 2007 +0000 @@ -349,7 +349,8 @@ while (!feof(f)) { /* Read the header and make sure it is a valid one */ fread(&th, 1, 512, f); - if (strncmp(th.magic, "ustar", 5) != 0) return NULL; + /* 'ustar' is the new format, '\0' is the old format */ + if (th.magic[0] != '\0' && strncmp(th.magic, "ustar", 5) != 0) return NULL; name[0] = '\0'; int len = 0; @@ -372,6 +373,9 @@ buf[sizeof(th.size)] = '\0'; int skip = strtol(buf, &end, 8); + /* 0 byte sized files can be skipped (dirs, symlinks, ..) */ + if (skip == 0) continue; + /* Check in the callback if this is the file we want */ if (callback(name, skip, userdata)) { if (filesize != NULL) *filesize = skip;