From f9dd6009be3ed32415edf1e89d1bc38380ecb95d Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Thu, 26 Mar 2026 17:27:50 -0700 Subject: Clean up comment formatting in minizip's zip.c and unzip.c. --- contrib/minizip/unzip.c | 16 +++++------ contrib/minizip/zip.c | 70 ++++++++++++++++++++++++------------------------- 2 files changed, 42 insertions(+), 44 deletions(-) diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c index d7ff21cb..827c23a1 100644 --- a/contrib/minizip/unzip.c +++ b/contrib/minizip/unzip.c @@ -1167,13 +1167,12 @@ extern int ZEXPORT unzLocateFile(unzFile file, const char *szFileName, int iCase /* -/////////////////////////////////////////// -// Contributed by Ryan Haksi (mailto://cryogen@infoserve.net) -// I need random access -// -// Further optimization could be realized by adding an ability -// to cache the directory in memory. The goal being a single -// comprehensive file read to put the file I need in a memory. + Contributed by Ryan Haksi (mailto://cryogen@infoserve.net) + I need random access + + Further optimization could be realized by adding an ability + to cache the directory in memory. The goal being a single + comprehensive file read to put the file I need in a memory. */ /* @@ -1242,8 +1241,7 @@ extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos* file_pos) { } /* -// Unzip Helper Functions - should be here? -/////////////////////////////////////////// + Unzip Helper Functions - should be here? */ /* diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c index 03424ab0..0bbdf77e 100644 --- a/contrib/minizip/zip.c +++ b/contrib/minizip/zip.c @@ -128,7 +128,7 @@ typedef struct linkedlist_data_s /* zipAlreadyThere() set functions for a set of zero-terminated strings, and -// a block_t type for reading the central directory datablocks. */ + a block_t type for reading the central directory datablocks. */ #define SKIPSET_EXPORT static typedef char *set_key_t; #define set_cmp(a, b) strcmp(a, b) @@ -287,18 +287,18 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) } /* zipAlreadyThere() operations. "set" in the zip internal structure keeps the -// set of names that are in the under-construction central directory so far. A -// skipset provides ~O(log n) time insertion and searching. Central directory -// records, stored in a linked list of allocated memory datablocks, is read -// through "block" in the zip internal structure. - -// The block_*() functions support extracting the central directory file names -// from the datablocks. They are designed to support a growing directory by -// automatically continuing once more data has been appended to the linked -// datablocks. - -// Initialize *block to the head of list. This should only be called once the -// list has at least some data in it, i.e. list->first_block is not NULL. */ + set of names that are in the under-construction central directory so far. A + skipset provides ~O(log n) time insertion and searching. Central directory + records, stored in a linked list of allocated memory datablocks, is read + through "block" in the zip internal structure. + + The block_*() functions support extracting the central directory file names + from the datablocks. They are designed to support a growing directory by + automatically continuing once more data has been appended to the linked + datablocks. + + Initialize *block to the head of list. This should only be called once the + list has at least some data in it, i.e. list->first_block is not NULL. */ local void block_init(block_t *block, linkedlist_data *list) { block->node = list->first_block; block->next = block->node->data; @@ -306,8 +306,8 @@ local void block_init(block_t *block, linkedlist_data *list) { } /* Mark *block as bad, with all subsequent reads returning end, even if more -// data is added to the datablocks. This is invoked if the central directory is -// invalid, so there is no longer any point in attempting to interpret it. */ + data is added to the datablocks. This is invoked if the central directory is + invalid, so there is no longer any point in attempting to interpret it. */ local void block_stop(block_t *block) { block->left = 0; block->next = NULL; @@ -358,7 +358,7 @@ local int block_get(block_t *block) { } /* Return a 16-bit unsigned little-endian value from block, or a negative value -// if the end is reached. */ + if the end is reached. */ local long block_get2(block_t *block) { int low = block_get(block); int high = block_get(block); @@ -391,7 +391,7 @@ local size_t block_read(block_t *block, unsigned char *buf, size_t len) { } /* Skip n bytes in block. Return 0 on success or -1 if there are less than n -// bytes to the end. */ + bytes to the end. */ local int block_skip(block_t *block, size_t n) { while (n > block->left) { n -= block->left; @@ -407,8 +407,8 @@ local int block_skip(block_t *block, size_t n) { } /* Process the next central directory record at *block. Return the allocated, -// zero-terminated file name, or NULL for end of input or invalid data. If -// invalid, *block is marked bad. This uses *set for the allocation of memory. */ + zero-terminated file name, or NULL for end of input or invalid data. If + invalid, *block is marked bad. This uses *set for the allocation of memory. */ local char *block_central_name(block_t *block, set_t *set) { unsigned flen, xlen, clen; char *name = NULL; @@ -424,7 +424,7 @@ local char *block_central_name(block_t *block, set_t *set) { break; /* Go through the remaining fixed-length portion of the record, - // extracting the lengths of the three variable-length fields. */ + extracting the lengths of the three variable-length fields. */ block_skip(block, 24); flen = (unsigned)block_get2(block); /* file name length */ xlen = (unsigned)block_get2(block); /* extra length */ @@ -443,9 +443,9 @@ local char *block_central_name(block_t *block, set_t *set) { /* Check for embedded nuls in the name. */ if (memchr(name, 0, flen) != NULL) { /* This name can never match the zero-terminated name provided to - // zipAlreadyThere(), so we discard it and go back to get another - // name. (Who the heck is putting nuls inside their zip file entry - // names anyway?) */ + zipAlreadyThere(), so we discard it and go back to get another + name. (Who the heck is putting nuls inside their zip file entry + names anyway?) */ set_free(set, name); continue; } @@ -456,15 +456,15 @@ local char *block_central_name(block_t *block, set_t *set) { } /* Invalid signature or premature end of the central directory record. - // Abandon trying to process the central directory. */ + Abandon trying to process the central directory. */ set_free(set, name); block_stop(block); return NULL; } /* Return 0 if name is not in the central directory so far, 1 if it is, -1 if -// the central directory is invalid, -2 if out of memory, or ZIP_PARAMERROR if -// file is NULL. */ + the central directory is invalid, -2 if out of memory, or ZIP_PARAMERROR if + file is NULL. */ extern int ZEXPORT zipAlreadyThere(zipFile file, char const *name) { size_t len; char *copy; @@ -482,14 +482,14 @@ extern int ZEXPORT zipAlreadyThere(zipFile file, char const *name) { } if (!set_ok(&zip->set)) { /* This is the first time here with some central directory content. We - // construct this set of names only on demand. Prepare set and block. */ + construct this set of names only on demand. Prepare set and block. */ set_start(&zip->set); block_init(&zip->block, &zip->central_dir); } /* Update the set of names from the current central directory contents. - // This reads any new central directory records since the last time we were - // here. */ + This reads any new central directory records since the last time we were + here. */ for (;;) { char *there = block_central_name(&zip->block, &zip->set); if (there == NULL) { @@ -502,7 +502,7 @@ extern int ZEXPORT zipAlreadyThere(zipFile file, char const *name) { /* Add there to the set. */ if (set_insert(&zip->set, there)) /* There's already a duplicate in the central directory! We'll just - // let this be and carry on. */ + let this be and carry on. */ set_free(&zip->set, there); } @@ -945,7 +945,7 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit) { err=ZIP_ERRNO; /* TODO.. - // read the comment from the standard central header. */ + read the comment from the standard central header. */ size_comment = 0; } else @@ -1340,8 +1340,8 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c if ((comment!=NULL) && (strlen(comment)>0xffff)) return ZIP_PARAMERROR; /* The extra field length must fit in 16 bits. If the member also requires - // a Zip64 extra block, that will also need to fit within that 16-bit - // length, but that will be checked for later. */ + a Zip64 extra block, that will also need to fit within that 16-bit + length, but that will be checked for later. */ if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff)) return ZIP_PARAMERROR; @@ -1933,8 +1933,8 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_si } /* Update how much extra free space we got in the memory buffer - // and increase the centralheader size so the new ZIP64 fields are included - // ( 4 below is the size of HeaderID and DataSize field ) */ + and increase the centralheader size so the new ZIP64 fields are included + ( 4 below is the size of HeaderID and DataSize field ) */ zi->ci.size_centralExtraFree -= datasize + 4; zi->ci.size_centralheader += datasize + 4; -- cgit v1.2.3-55-g6feb