mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Revert whitespace fixes to third_party (#501)
This commit is contained in:
parent
d4000bb8f7
commit
9de3d8f1e6
365 changed files with 39190 additions and 39211 deletions
66
third_party/sqlite3/zipfile.c
vendored
66
third_party/sqlite3/zipfile.c
vendored
|
@ -58,7 +58,7 @@ typedef unsigned long u32;
|
|||
# define NEVER(X) (X)
|
||||
#endif
|
||||
|
||||
static const char ZIPFILE_SCHEMA[] =
|
||||
static const char ZIPFILE_SCHEMA[] =
|
||||
"CREATE TABLE y("
|
||||
"name PRIMARY KEY," /* 0: Name of file in zip archive */
|
||||
"mode," /* 1: POSIX mode for file */
|
||||
|
@ -79,8 +79,8 @@ static const char ZIPFILE_SCHEMA[] =
|
|||
**
|
||||
** ZIPFILE_NEWENTRY_MADEBY:
|
||||
** Use this value for the "version-made-by" field in new zip file
|
||||
** entries. The upper byte indicates "unix", and the lower byte
|
||||
** indicates that the zip file matches pkzip specification 3.0.
|
||||
** entries. The upper byte indicates "unix", and the lower byte
|
||||
** indicates that the zip file matches pkzip specification 3.0.
|
||||
** This is what info-zip seems to do.
|
||||
**
|
||||
** ZIPFILE_NEWENTRY_REQUIRED:
|
||||
|
@ -109,7 +109,7 @@ static const char ZIPFILE_SCHEMA[] =
|
|||
#define ZIPFILE_SIGNATURE_EOCD 0x06054b50
|
||||
|
||||
/*
|
||||
** The sizes of the fixed-size part of each of the three main data
|
||||
** The sizes of the fixed-size part of each of the three main data
|
||||
** structures in a zip archive.
|
||||
*/
|
||||
#define ZIPFILE_LFH_FIXED_SZ 30
|
||||
|
@ -202,7 +202,7 @@ struct ZipfileCDS {
|
|||
*** uncompressed size 4 bytes
|
||||
*** file name length 2 bytes
|
||||
*** extra field length 2 bytes
|
||||
***
|
||||
***
|
||||
*/
|
||||
typedef struct ZipfileLFH ZipfileLFH;
|
||||
struct ZipfileLFH {
|
||||
|
@ -228,7 +228,7 @@ struct ZipfileEntry {
|
|||
ZipfileEntry *pNext; /* Next element in in-memory CDS */
|
||||
};
|
||||
|
||||
/*
|
||||
/*
|
||||
** Cursor type for zipfile tables.
|
||||
*/
|
||||
typedef struct ZipfileCsr ZipfileCsr;
|
||||
|
@ -301,7 +301,7 @@ static void zipfileDequote(char *zIn){
|
|||
|
||||
/*
|
||||
** Construct a new ZipfileTab virtual table object.
|
||||
**
|
||||
**
|
||||
** argv[0] -> module name ("zipfile")
|
||||
** argv[1] -> database name
|
||||
** argv[2] -> table name
|
||||
|
@ -369,7 +369,7 @@ static void zipfileEntryFree(ZipfileEntry *p){
|
|||
}
|
||||
|
||||
/*
|
||||
** Release resources that should be freed at the end of a write
|
||||
** Release resources that should be freed at the end of a write
|
||||
** transaction.
|
||||
*/
|
||||
static void zipfileCleanupTransaction(ZipfileTab *pTab){
|
||||
|
@ -479,7 +479,7 @@ static void zipfileCursorErr(ZipfileCsr *pCsr, const char *zFmt, ...){
|
|||
/*
|
||||
** Read nRead bytes of data from offset iOff of file pFile into buffer
|
||||
** aRead[]. Return SQLITE_OK if successful, or an SQLite error code
|
||||
** otherwise.
|
||||
** otherwise.
|
||||
**
|
||||
** If an error does occur, output variable (*pzErrmsg) may be set to point
|
||||
** to an English language error message. It is the responsibility of the
|
||||
|
@ -686,7 +686,7 @@ static int zipfileScanExtra(u8 *aExtra, int nExtra, u32 *pmTime){
|
|||
** File modification date:
|
||||
** Bits 00-04: day
|
||||
** Bits 05-08: month (1-12)
|
||||
** Bits 09-15: years from 1980
|
||||
** Bits 09-15: years from 1980
|
||||
**
|
||||
** https://msdn.microsoft.com/en-us/library/9kkf9tah.aspx
|
||||
*/
|
||||
|
@ -756,9 +756,9 @@ static void zipfileMtimeToDos(ZipfileCDS *pCds, u32 mUnixTime){
|
|||
pCds->mDate = pCds->mTime = 0;
|
||||
}
|
||||
|
||||
assert( mUnixTime<315507600
|
||||
|| mUnixTime==zipfileMtime(pCds)
|
||||
|| ((mUnixTime % 2) && mUnixTime-1==zipfileMtime(pCds))
|
||||
assert( mUnixTime<315507600
|
||||
|| mUnixTime==zipfileMtime(pCds)
|
||||
|| ((mUnixTime % 2) && mUnixTime-1==zipfileMtime(pCds))
|
||||
/* || (mUnixTime % 2) */
|
||||
);
|
||||
}
|
||||
|
@ -825,7 +825,7 @@ static int zipfileGetEntry(
|
|||
|
||||
if( rc==SQLITE_OK ){
|
||||
u32 *pt = &pNew->mUnixTime;
|
||||
pNew->cds.zFile = sqlite3_mprintf("%.*s", nFile, aRead);
|
||||
pNew->cds.zFile = sqlite3_mprintf("%.*s", nFile, aRead);
|
||||
pNew->aExtra = (u8*)&pNew[1];
|
||||
memcpy(pNew->aExtra, &aRead[nFile], nExtra);
|
||||
if( pNew->cds.zFile==0 ){
|
||||
|
@ -853,7 +853,7 @@ static int zipfileGetEntry(
|
|||
memcpy(pNew->aData, &aBlob[pNew->iDataOff], pNew->cds.szCompressed);
|
||||
}
|
||||
}else{
|
||||
*pzErr = sqlite3_mprintf("failed to read LFH at offset %d",
|
||||
*pzErr = sqlite3_mprintf("failed to read LFH at offset %d",
|
||||
(int)pNew->cds.iOffset
|
||||
);
|
||||
}
|
||||
|
@ -905,8 +905,8 @@ static int zipfileNext(sqlite3_vtab_cursor *cur){
|
|||
return rc;
|
||||
}
|
||||
|
||||
static void zipfileFree(void *p) {
|
||||
sqlite3_free(p);
|
||||
static void zipfileFree(void *p) {
|
||||
sqlite3_free(p);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -956,7 +956,7 @@ static void zipfileInflate(
|
|||
** Buffer aIn (size nIn bytes) contains uncompressed data. This function
|
||||
** compresses it and sets (*ppOut) to point to a buffer containing the
|
||||
** compressed data. The caller is responsible for eventually calling
|
||||
** sqlite3_free() to release buffer (*ppOut). Before returning, (*pnOut)
|
||||
** sqlite3_free() to release buffer (*ppOut). Before returning, (*pnOut)
|
||||
** is set to the size of buffer (*ppOut) in bytes.
|
||||
**
|
||||
** If no error occurs, SQLITE_OK is returned. Otherwise, an SQLite error
|
||||
|
@ -1142,8 +1142,8 @@ static int zipfileReadEOCD(
|
|||
|
||||
/* Scan backwards looking for the signature bytes */
|
||||
for(i=nRead-20; i>=0; i--){
|
||||
if( aRead[i]==0x50 && aRead[i+1]==0x4b
|
||||
&& aRead[i+2]==0x05 && aRead[i+3]==0x06
|
||||
if( aRead[i]==0x50 && aRead[i+1]==0x4b
|
||||
&& aRead[i+2]==0x05 && aRead[i+3]==0x06
|
||||
){
|
||||
break;
|
||||
}
|
||||
|
@ -1168,14 +1168,14 @@ static int zipfileReadEOCD(
|
|||
}
|
||||
|
||||
/*
|
||||
** Add object pNew to the linked list that begins at ZipfileTab.pFirstEntry
|
||||
** Add object pNew to the linked list that begins at ZipfileTab.pFirstEntry
|
||||
** and ends with pLastEntry. If argument pBefore is NULL, then pNew is added
|
||||
** to the end of the list. Otherwise, it is added to the list immediately
|
||||
** before pBefore (which is guaranteed to be a part of said list).
|
||||
*/
|
||||
static void zipfileAddEntry(
|
||||
ZipfileTab *pTab,
|
||||
ZipfileEntry *pBefore,
|
||||
ZipfileTab *pTab,
|
||||
ZipfileEntry *pBefore,
|
||||
ZipfileEntry *pNew
|
||||
){
|
||||
assert( (pTab->pFirstEntry==0)==(pTab->pLastEntry==0) );
|
||||
|
@ -1221,7 +1221,7 @@ static int zipfileLoadDirectory(ZipfileTab *pTab, const u8 *aBlob, int nBlob){
|
|||
** xFilter callback.
|
||||
*/
|
||||
static int zipfileFilter(
|
||||
sqlite3_vtab_cursor *cur,
|
||||
sqlite3_vtab_cursor *cur,
|
||||
int idxNum, const char *idxStr,
|
||||
int argc, sqlite3_value **argv
|
||||
){
|
||||
|
@ -1375,7 +1375,7 @@ static int zipfileAppendEntry(
|
|||
}
|
||||
|
||||
static int zipfileGetMode(
|
||||
sqlite3_value *pVal,
|
||||
sqlite3_value *pVal,
|
||||
int bIsDir, /* If true, default to directory */
|
||||
u32 *pMode, /* OUT: Mode value */
|
||||
char **pzErr /* OUT: Error message */
|
||||
|
@ -1438,7 +1438,7 @@ static int zipfileBegin(sqlite3_vtab *pVtab){
|
|||
}
|
||||
|
||||
/* Open a write fd on the file. Also load the entire central directory
|
||||
** structure into memory. During the transaction any new file data is
|
||||
** structure into memory. During the transaction any new file data is
|
||||
** appended to the archive file, but the central directory is accumulated
|
||||
** in main-memory until the transaction is committed. */
|
||||
pTab->pWriteFd = fopen(pTab->zFile, "ab+");
|
||||
|
@ -1510,9 +1510,9 @@ static void zipfileRemoveEntryFromList(ZipfileTab *pTab, ZipfileEntry *pOld){
|
|||
** xUpdate method.
|
||||
*/
|
||||
static int zipfileUpdate(
|
||||
sqlite3_vtab *pVtab,
|
||||
int nVal,
|
||||
sqlite3_value **apVal,
|
||||
sqlite3_vtab *pVtab,
|
||||
int nVal,
|
||||
sqlite3_value **apVal,
|
||||
sqlite_int64 *pRowid
|
||||
){
|
||||
ZipfileTab *pTab = (ZipfileTab*)pVtab;
|
||||
|
@ -1565,7 +1565,7 @@ static int zipfileUpdate(
|
|||
rc = SQLITE_CONSTRAINT;
|
||||
}
|
||||
if( sqlite3_value_type(apVal[6])!=SQLITE_NULL ){
|
||||
zipfileTableErr(pTab, "rawdata must be NULL");
|
||||
zipfileTableErr(pTab, "rawdata must be NULL");
|
||||
rc = SQLITE_CONSTRAINT;
|
||||
}
|
||||
|
||||
|
@ -2151,7 +2151,7 @@ static int zipfileRegister(sqlite3 *db){
|
|||
int rc = sqlite3_create_module(db, "zipfile" , &zipfileModule, 0);
|
||||
if( rc==SQLITE_OK ) rc = sqlite3_overload_function(db, "zipfile_cds", -1);
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3_create_function(db, "zipfile", -1, SQLITE_UTF8, 0, 0,
|
||||
rc = sqlite3_create_function(db, "zipfile", -1, SQLITE_UTF8, 0, 0,
|
||||
zipfileStep, zipfileFinal
|
||||
);
|
||||
}
|
||||
|
@ -2162,8 +2162,8 @@ static int zipfileRegister(sqlite3 *db){
|
|||
#endif
|
||||
|
||||
int sqlite3_zipfile_init(
|
||||
sqlite3 *db,
|
||||
char **pzErrMsg,
|
||||
sqlite3 *db,
|
||||
char **pzErrMsg,
|
||||
const sqlite3_api_routines *pApi
|
||||
){
|
||||
SQLITE_EXTENSION_INIT2(pApi);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue