From acd6fdee98ba573ab1e3be9a7f6dd4eeb4a213c8 Mon Sep 17 00:00:00 2001 From: drh Date: Sun, 7 Jan 2018 19:52:28 +0000 Subject: [PATCH] Improved comments on the sqlar.c and compress.c extensions that describe the differences between the "zlib format" used by SQLAR, the raw deflate format used by ZIP, and the custom format used by compress.c. No changes to code. FossilOrigin-Name: c13415c5caf06eaa73086c500907451dfcdfd1354ac4a9ab63edb7255edbfa1b --- ext/misc/compress.c | 15 +++++++++++++++ ext/misc/sqlar.c | 8 ++++++++ manifest | 14 +++++++------- manifest.uuid | 2 +- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/ext/misc/compress.c b/ext/misc/compress.c index bf38d4c93c..6e7d8b6148 100644 --- a/ext/misc/compress.c +++ b/ext/misc/compress.c @@ -27,6 +27,21 @@ SQLITE_EXTENSION_INIT1 ** seven bits per integer stored in the lower seven bits of each byte. ** More significant bits occur first. The most significant bit (0x80) ** is a flag to indicate the end of the integer. +** +** This function, SQLAR, and ZIP all use the same "deflate" compression +** algorithm, but each is subtly different: +** +** * ZIP uses raw deflate. +** +** * SQLAR uses the "zlib format" which is raw deflate with a two-byte +** algorithm-identification header and a four-byte checksum at the end. +** +** * This utility uses the "zlib format" like SQLAR, but adds the variable- +** length integer uncompressed size value at the beginning. +** +** This function might be extended in the future to support compression +** formats other than deflate, by providing a different algorithm-id +** mark following the variable-length integer size parameter. */ static void compressFunc( sqlite3_context *context, diff --git a/ext/misc/sqlar.c b/ext/misc/sqlar.c index 17d0875938..e812d70c99 100644 --- a/ext/misc/sqlar.c +++ b/ext/misc/sqlar.c @@ -24,6 +24,14 @@ SQLITE_EXTENSION_INIT1 ** If the type of X is SQLITE_BLOB, and compressing that blob using ** zlib utility function compress() yields a smaller blob, return the ** compressed blob. Otherwise, return a copy of X. +** +** SQLar uses the "zlib format" for compressed content. The zlib format +** contains a two-byte identification header and a four-byte checksum at +** the end. This is different from ZIP which uses the raw deflate format. +** +** Future enhancements to SQLar might add support for new compression formats. +** If so, those new formats will be identified by alternative headers in the +** compressed data. */ static void sqlarCompressFunc( sqlite3_context *context, diff --git a/manifest b/manifest index 83bebcd068..88ec153d89 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\sshell\sdetects\sand\sopens\sZIP\sarchives\susing\sthe\szipfile\sextension. -D 2018-01-06T21:46:01.434 +C Improved\scomments\son\sthe\ssqlar.c\sand\scompress.c\sextensions\sthat\sdescribe\nthe\sdifferences\sbetween\sthe\s"zlib\sformat"\sused\sby\sSQLAR,\sthe\sraw\sdeflate\nformat\sused\sby\sZIP,\sand\sthe\scustom\sformat\sused\sby\scompress.c.\s\sNo\schanges\nto\scode. +D 2018-01-07T19:52:28.395 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 9536f61ce33172d4868707ecc10844a0abef9e2e775ad2434245a60406fd7e38 @@ -273,7 +273,7 @@ F ext/misc/btreeinfo.c d7fd9a2fe2fa33ba28488e2fce703ebecc759219ea9e0bb3b25478486 F ext/misc/carray.c ed96c218ea940b85c9a274c4d9c59fe9491c299147a38a8bba537687bd6c6005 F ext/misc/closure.c 0d2a038df8fbae7f19de42e7c7d71f2e4dc88704 F ext/misc/completion.c 52c3f01523e3e387eb321b4739a89d1fe47cbe6025aa1f2d8d3685e9e365df0f -F ext/misc/compress.c 122faa92d25033d6c3f07c39231de074ab3d2e83 +F ext/misc/compress.c dd4f8a6d0baccff3c694757db5b430f3bbd821d8686d1fc24df55cf9f035b189 F ext/misc/csv.c 1a009b93650732e22334edc92459c4630b9fa703397cbb3c8ca279921a36ca11 F ext/misc/dbdump.c 3509fa6b8932d04e932d6b6b827b6a82ca362781b8e8f3c77336f416793e215e F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2 @@ -294,7 +294,7 @@ F ext/misc/sha1.c 0b9e9b855354910d3ca467bf39099d570e73db56 F ext/misc/shathree.c 9e960ba50483214c6a7a4b1517f8d8cef799e9db381195178c3fd3ad207e10c0 F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52 F ext/misc/spellfix.c 41cf26c6b89fcaa8798ae10ae64d39c1f1d9d6995152e545bd491c13058b8fac -F ext/misc/sqlar.c d355cd8b6e7280d2f61d4737672922acb512a2ab1cee52399ffb88980476e31c +F ext/misc/sqlar.c 57d5bc45cd5492208e451f697404be88f8612527d64c9d42f96b325b64983d74 F ext/misc/stmt.c 6f16443abb3551e3f5813bb13ba19a30e7032830015b0f92fe0c0453045c0a11 F ext/misc/totype.c 4a167594e791abeed95e0a8db028822b5e8fe512 F ext/misc/unionvtab.c 2aa94902ea646e1aaf6c05eac944a14276cddd67735b2ad856030ffffbb6626c @@ -1697,7 +1697,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 366469f5603367fabcadfc9ffe8cd1e23c649fea49a560178ca0858a16a7e4d1 -R 0f23134ec1d9b30706dc56d4edcd4f2b +P 05c99eb8cefbb3366b6d4ae91e10aa0c82bdf5ea361f4b3375413783af9167ac +R 1813bb08dedce0701d741a99a479782e U drh -Z bf2fee513f6949a58534392bd37a9abf +Z e662d2fceaa8f576c7d1d1fef9cf3ce7 diff --git a/manifest.uuid b/manifest.uuid index 95d424063b..348cdf03c2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -05c99eb8cefbb3366b6d4ae91e10aa0c82bdf5ea361f4b3375413783af9167ac \ No newline at end of file +c13415c5caf06eaa73086c500907451dfcdfd1354ac4a9ab63edb7255edbfa1b \ No newline at end of file