LMMS
Loading...
Searching...
No Matches
process.c File Reference
#include "unzip.h"
#include "crc32.h"
#include "unzipfx/appDetails.h"

Macros

#define UNZIP_INTERNAL

Functions

static int do_seekable OF ((__GPRO__ int lastchance))
static int rec_find OF ((__GPRO__ zoff_t, char *, int))
static int find_ecrec64 OF ((__GPRO__ zoff_t searchlen))
static int process_zip_cmmnt OF ((__GPRO))
int process_zipfiles (__G)
void free_G_buffers (__G)
static int do_seekable (__G__ lastchance) __GDEF int lastchance
 if (SSTAT(G.zipfn, &G.statbuf)||(error=S_ISDIR(G.statbuf.st_mode)) !=0)
 if (open_input_file(__G))
 if ((uO.zflag > 0) &&!uO.zipinfo_mode)
 if (uO.zipinfo_mode &&G.ecrec.number_this_disk !=G.ecrec.num_disk_start_cdir)
 if (!too_weird_to_continue)
 CLOSE_INFILE ()
static int rec_find (__G__ searchlen, signature, rec_size) __GDEF zoff_t searchlen
 if ((tail_len=G.ziplen % INBUFSIZ) > rec_size)
 for (i=1;!found &&(i<=numblks);++i)
 return (found ? 0 :1)
static int find_ecrec64 (__G__ searchlen) __GDEF zoff_t searchlen
 if (ecloc64_start_offset< 0) return PK_COOL
 if ((G.incnt=read(G.zipfd,(char *) byterecL, ECLOC64_SIZE+4)) !=(ECLOC64_SIZE+4))
 if (memcmp((char *) byterecL, end_centloc64_sig, 4))
 if ((G.ecrec.number_this_disk !=0xFFFF) &&(G.ecrec.number_this_disk !=ecloc64_total_disks - 1))
 if (ecrec64_start_offset >(zusz_t) ecloc64_start_offset)
 if ((G.incnt=read(G.zipfd,(char *) byterec, ECREC64_SIZE+4)) !=(ECREC64_SIZE+4))
 if (memcmp((char *) byterec, end_central64_sig, 4))
 if ((zuvl_t) makelong &[]NUMBER_THIS_DSK_REC64 !=ecrec64_start_disk)
 if (G.ecrec.num_disk_start_cdir==0xFFFF)
static int find_ecrec (__G__ searchlen) __GDEF zoff_t searchlen
 if (G.ziplen<=INBUFSIZ)
 if (readbuf(__G__(char *) byterec, ECREC_SIZE+4)==0)
 if (uO.zipinfo_mode)
static int process_zip_cmmnt (__G)
int process_cdir_file_hdr (__G)
static int get_cdir_ent (__G)
int process_local_file_hdr (__G)
int getZip64Data (__G__ ef_buf, ef_len) __GDEF ZCONST uch *ef_buf
 if (ef_len==0||ef_buf==NULL)

Variables

static ZCONST char Far CannotAllocateBuffers []
static ZCONST char Far CannotFindWildcardMatch []
static ZCONST char Far FilesProcessOK []
static ZCONST char Far ArchiveWarning []
static ZCONST char Far ArchiveFatalError []
static ZCONST char Far FileHadNoZipfileDir []
static ZCONST char Far ZipfileWasDir [] = "1 \"zipfile\" was a directory.\n"
static ZCONST char Far ManyZipfilesWereDir []
static ZCONST char Far NoZipfileFound [] = "No zipfiles found.\n"
static ZCONST char Far CannotFindZipfileDirMsg []
static ZCONST char Far CannotFindEitherZipfile []
ZCONST char Far Zipnfo []
static ZCONST char Far Unzip [] = "unzip"
static ZCONST char Far MaybeExe []
static ZCONST char Far CentDirNotInZipMsg []
static ZCONST char Far EndCentDirBogus []
static ZCONST char Far MaybePakBug []
static ZCONST char Far ExtraBytesAtStart []
static ZCONST char Far LogInitline [] = "Archive: %s\n"
static ZCONST char Far MissingBytes []
static ZCONST char Far NullCentDirOffset []
static ZCONST char Far ZipfileEmpty [] = "warning [%s]: zipfile is empty\n"
static ZCONST char Far CentDirStartNotFound []
static ZCONST char Far Cent64EndSigSearchErr []
static ZCONST char Far Cent64EndSigSearchOff []
static ZCONST char Far CentDirTooLong []
static ZCONST char Far CentDirEndSigNotFound []
static ZCONST char Far ZipfileCommTrunc1 []
static ZCONST char Far NoZipfileComment []
static ZCONST char Far ZipfileCommentDesc []
static ZCONST char Far ZipfileCommBegin []
static ZCONST char Far ZipfileCommEnd []
static ZCONST char Far ZipfileCommTrunc2 []
int too_weird_to_continue =FALSE
int error =0
int error_in_archive
G ziplen = G.statbuf.st_size
char * signature
int rec_size
zoff_t tail_len
else G cur_zipfile_bufstart = G.ziplen - tail_len
 numblks = (int)((searchlen - tail_len + (INBUFSIZ-1)) / INBUFSIZ)
ec_byte_loc64 byterecL
zoff_t ecloc64_start_offset = G.real_ecrec_offset - (ECLOC64_SIZE+4)
zusz_t ecrec64_start_offset = (zusz_t)makeint64(&byterecL[OFFSET_START_EOCDR64])
zuvl_t ecrec64_start_disk = (zuvl_t)makelong(&byterecL[NUM_DISK_START_EOCDR64])
zuvl_t ecloc64_total_disks = (zuvl_t)makelong(&byterecL[NUM_THIS_DISK_LOC64])
zuvl_t ecrec64_disk_cdstart
zucn_t ecrec64_this_entries
zucn_t ecrec64_tot_entries
zusz_t ecrec64_cdirsize
zusz_t ecrec64_offs_cdstart
return PK_COOL
int result
ec_byte_rec byterec
 else
G real_ecrec_offset = G.cur_zipfile_bufstart + (G.inptr-G.inbuf)
G expect_ecrec_offset
unsigned ef_len
unsigned eb_len

Macro Definition Documentation

◆ UNZIP_INTERNAL

#define UNZIP_INTERNAL

Function Documentation

◆ CLOSE_INFILE()

CLOSE_INFILE ( )

◆ do_seekable()

int do_seekable ( __G__ lastchance)
static

◆ find_ecrec()

int find_ecrec ( __G__ searchlen)
static

◆ find_ecrec64()

int find_ecrec64 ( __G__ searchlen)
static

◆ for()

for ( i = 1; !found && (i <= numblks); ++i)

◆ free_G_buffers()

void free_G_buffers ( __G )

◆ get_cdir_ent()

int get_cdir_ent ( __G )
static

◆ getZip64Data()

int getZip64Data ( __G__ ef_buf,
ef_len  )

◆ if() [1/19]

if ( ! too_weird_to_continue)

◆ if() [2/19]

if ( (G.ecrec.number_this_disk !=0xFFFF) &&(G.ecrec.number_this_disk !=ecloc64_total_disks - 1) )

◆ if() [3/19]

if ( (G.incnt=read(G.zipfd,(char *) byterec, ECREC64_SIZE+4)) ! = (ECREC64_SIZE+4))

◆ if() [4/19]

if ( (G.incnt=read(G.zipfd,(char *) byterecL, ECLOC64_SIZE+4)) ! = (ECLOC64_SIZE+4))

◆ if() [5/19]

◆ if() [6/19]

if ( (uO.zflag > 0) &&!uO. zipinfo_mode)

◆ if() [7/19]

◆ if() [8/19]

if ( )

◆ if() [9/19]

if ( ecrec64_start_offset ,
(zusz_t) ecloc64_start_offset )

◆ if() [10/19]

if ( ef_len = = 0 || ef_buf == NULL)

◆ if() [11/19]

if ( G.ecrec. num_disk_start_cdir = = 0xFFFF)

◆ if() [12/19]

if ( G.ziplen<= INBUFSIZ)

◆ if() [13/19]

if ( memcmp((char *) byterec, end_central64_sig, 4) )

◆ if() [14/19]

if ( memcmp((char *) byterecL, end_centloc64_sig, 4) )

◆ if() [15/19]

◆ if() [16/19]

if ( readbuf(__G__(char *) byterec, ECREC_SIZE+4) = = 0)

◆ if() [17/19]

if ( SSTAT(G.zipfn, &G.statbuf)||(error=S_ISDIR(G.statbuf.st_mode)) ! = 0)

◆ if() [18/19]

if ( uO.zipinfo_mode &&G.ecrec.number_this_disk ! = G.ecrec.num_disk_start_cdir)

◆ if() [19/19]

if ( uO. zipinfo_mode)

◆ OF() [1/4]

int process_zip_cmmnt OF ( (__GPRO) )
static

◆ OF() [2/4]

int do_seekable OF ( (__GPRO__ int lastchance) )
static

◆ OF() [3/4]

int find_ecrec64 OF ( (__GPRO__ zoff_t searchlen) )
static

◆ OF() [4/4]

int rec_find OF ( (__GPRO__ zoff_t, char *, int) )
static

◆ process_cdir_file_hdr()

int process_cdir_file_hdr ( __G )

◆ process_local_file_hdr()

int process_local_file_hdr ( __G )

◆ process_zip_cmmnt()

int process_zip_cmmnt ( __G )
static

◆ process_zipfiles()

int process_zipfiles ( __G )

◆ rec_find()

int rec_find ( __G__ searchlen,
signature ,
rec_size  )
static

◆ return()

return ( found ? 0 :1 )

Variable Documentation

◆ ArchiveFatalError

ZCONST char Far ArchiveFatalError[]
static
Initial value:
=
"%d archive%s had fatal errors.\n"

◆ ArchiveWarning

ZCONST char Far ArchiveWarning[]
static
Initial value:
=
"%d archive%s had warnings but no fatal errors.\n"

◆ byterec

ec_byte_rec byterec

◆ byterecL

ec_byte_loc64 byterecL
Initial value:
{
ec_byte_rec byterec
Definition process.c:1456
uch ec_byte_rec64[ECREC64_SIZE+4]
Definition unzpriv.h:2126

◆ CannotAllocateBuffers

ZCONST char Far CannotAllocateBuffers[]
static
Initial value:
=
"error: cannot allocate unzip buffers\n"

◆ CannotFindEitherZipfile

ZCONST char Far CannotFindEitherZipfile[]
static
Initial value:
=
"%s: cannot find either %s or %s.\n"

◆ CannotFindWildcardMatch

ZCONST char Far CannotFindWildcardMatch[]
static
Initial value:
=
"%s: cannot find any matches for wildcard specification \"%s\".\n"

◆ CannotFindZipfileDirMsg

ZCONST char Far CannotFindZipfileDirMsg[]
static
Initial value:
=
"%s: cannot find zipfile directory in %s,\n\
%sand cannot find %s, period.\n"

◆ Cent64EndSigSearchErr

ZCONST char Far Cent64EndSigSearchErr[]
static
Initial value:
=
"fatal error: read failure while seeking for End-of-centdir-64 signature.\n\
This zipfile is corrupt.\n"

◆ Cent64EndSigSearchOff

ZCONST char Far Cent64EndSigSearchOff[]
static
Initial value:
=
"error: End-of-centdir-64 signature not where expected (prepended bytes?)\n\
(attempting to process anyway)\n"

◆ CentDirEndSigNotFound

ZCONST char Far CentDirEndSigNotFound[]
static
Initial value:
= "\
End-of-central-directory signature not found. Either this file is not\n\
a zipfile, or it constitutes one disk of a multi-part archive. In the\n\
latter case the central directory and zipfile comment will be found on\n\
the last disk(s) of this archive.\n"

◆ CentDirNotInZipMsg

ZCONST char Far CentDirNotInZipMsg[]
static
Initial value:
= "\n\
[%s]:\n\
Zipfile is disk %lu of a multi-disk archive, and this is not the disk on\n\
which the central zipfile directory begins (disk %lu).\n"

◆ CentDirStartNotFound

ZCONST char Far CentDirStartNotFound[]
static
Initial value:
=
"error [%s]: start of central directory not found;\n\
zipfile corrupt.\n%s"

◆ CentDirTooLong

ZCONST char Far CentDirTooLong[]
static
Initial value:
=
"error [%s]: reported length of central directory is\n\
%s bytes too long (Atari STZip zipfile? J.H.Holm ZIPSPLIT 1.1\n\
zipfile?). Compensating...\n"

◆ cur_zipfile_bufstart

G cur_zipfile_bufstart = G.ziplen - tail_len

◆ eb_len

unsigned eb_len
Initial value:
{
unsigned eb_id

◆ ecloc64_start_offset

ecloc64_start_offset = G.real_ecrec_offset - (ECLOC64_SIZE+4)

◆ ecloc64_total_disks

ecloc64_total_disks = (zuvl_t)makelong(&byterecL[NUM_THIS_DISK_LOC64])

◆ ecrec64_cdirsize

zusz_t ecrec64_cdirsize

◆ ecrec64_disk_cdstart

zuvl_t ecrec64_disk_cdstart

◆ ecrec64_offs_cdstart

zusz_t ecrec64_offs_cdstart

◆ ecrec64_start_disk

ecrec64_start_disk = (zuvl_t)makelong(&byterecL[NUM_DISK_START_EOCDR64])

◆ ecrec64_start_offset

ecrec64_start_offset = (zusz_t)makeint64(&byterecL[OFFSET_START_EOCDR64])

◆ ecrec64_this_entries

zucn_t ecrec64_this_entries

◆ ecrec64_tot_entries

zucn_t ecrec64_tot_entries

◆ ef_len

unsigned ef_len

◆ else

else
Initial value:
{
found =
? TRUE : FALSE)
#define __G__
Definition crypt.h:76
char end_central_sig[4]
Definition globals.c:32
static int rec_find(__G__ searchlen, signature, rec_size) __GDEF zoff_t searchlen
#define ECREC_SIZE
Definition unzpriv.h:1835
#define TRUE
Definition unzpriv.h:1295
#define FALSE
Definition unzpriv.h:1298

◆ EndCentDirBogus

ZCONST char Far EndCentDirBogus[]
static
Initial value:
=
"\nwarning [%s]: end-of-central-directory record claims this\n\
is disk %lu but that the central directory starts on disk %lu; this is a\n\
contradiction. Attempting to process anyway.\n"

◆ error

error =0

◆ error_in_archive

return error_in_archive
Initial value:
{
int found = FALSE

◆ expect_ecrec_offset

G expect_ecrec_offset
Initial value:
= G.ecrec.offset_start_central_directory +
G.ecrec.size_central_directory
Uz_Globs G
Definition globals.c:42

◆ ExtraBytesAtStart

ZCONST char Far ExtraBytesAtStart[]
static
Initial value:
=
"warning [%s]: %s extra byte%s at beginning or within zipfile\n\
(attempting to process anyway)\n"

◆ FileHadNoZipfileDir

ZCONST char Far FileHadNoZipfileDir[]
static
Initial value:
=
"%d file%s had no zipfile directory.\n"

◆ FilesProcessOK

ZCONST char Far FilesProcessOK[]
static
Initial value:
=
"%d archive%s successfully processed.\n"

◆ LogInitline

ZCONST char Far LogInitline[] = "Archive: %s\n"
static

◆ ManyZipfilesWereDir

ZCONST char Far ManyZipfilesWereDir[]
static
Initial value:
=
"%d \"zipfiles\" were directories.\n"

◆ MaybeExe

ZCONST char Far MaybeExe[]
static
Initial value:
=
"note: %s may be a plain executable, not an archive\n"

◆ MaybePakBug

ZCONST char Far MaybePakBug[]
static
Initial value:
= "warning [%s]:\
zipfile claims to be last disk of a multi-part archive;\n\
attempting to process anyway, assuming all parts have been concatenated\n\
together in order. Expect \"errors\" and warnings...true multi-part support\
\n doesn't exist yet (coming soon).\n"

◆ MissingBytes

ZCONST char Far MissingBytes[]
static
Initial value:
=
"error [%s]: missing %s bytes in zipfile\n\
(attempting to process anyway)\n"

◆ NoZipfileComment

ZCONST char Far NoZipfileComment[]
static
Initial value:
=
"There is no zipfile comment.\n"

◆ NoZipfileFound

ZCONST char Far NoZipfileFound[] = "No zipfiles found.\n"
static

◆ NullCentDirOffset

ZCONST char Far NullCentDirOffset[]
static
Initial value:
=
"error [%s]: NULL central directory offset\n\
(attempting to process anyway)\n"

◆ numblks

numblks = (int)((searchlen - tail_len + (INBUFSIZ-1)) / INBUFSIZ)

◆ PK_COOL

return PK_COOL

◆ real_ecrec_offset

G real_ecrec_offset = G.cur_zipfile_bufstart + (G.inptr-G.inbuf)

◆ rec_size

int rec_size

◆ result

int result

◆ signature

char* signature

◆ tail_len

zoff_t tail_len
Initial value:
{
int i, numblks, found=FALSE
register unsigned i
Definition inflate.c:1575
numblks
Definition process.c:1170

◆ too_weird_to_continue

int too_weird_to_continue =FALSE

◆ Unzip

ZCONST char Far Unzip[] = "unzip"
static

◆ ZipfileCommBegin

ZCONST char Far ZipfileCommBegin[]
static
Initial value:
=
"======================== zipfile comment begins\
==========================\n"

◆ ZipfileCommEnd

ZCONST char Far ZipfileCommEnd[]
static
Initial value:
=
"========================= zipfile comment ends\
===========================\n"

◆ ZipfileCommentDesc

ZCONST char Far ZipfileCommentDesc[]
static
Initial value:
=
"The zipfile comment is %u bytes long and contains the following text:\n"

◆ ZipfileCommTrunc1

ZCONST char Far ZipfileCommTrunc1[]
static
Initial value:
=
"\ncaution: zipfile comment truncated\n"

◆ ZipfileCommTrunc2

ZCONST char Far ZipfileCommTrunc2[]
static
Initial value:
=
"\n The zipfile comment is truncated.\n"

◆ ZipfileEmpty

ZCONST char Far ZipfileEmpty[] = "warning [%s]: zipfile is empty\n"
static

◆ ZipfileWasDir

ZCONST char Far ZipfileWasDir[] = "1 \"zipfile\" was a directory.\n"
static

◆ ziplen

G ziplen = G.statbuf.st_size

◆ Zipnfo

ZCONST char Far Zipnfo[]
extern