aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjplyon <jplyon@noemail.net>2003-06-15 10:35:04 +0000
committerjplyon <jplyon@noemail.net>2003-06-15 10:35:04 +0000
commit3ca691106b72a2934dfa30abc5456cb30a3b241e (patch)
tree758a227dc77ed720a4b144a9bf48fc9feb3877d3
parent1420010fa449aea3a08c68f19b7458373b65c980 (diff)
downloadsqlite-3ca691106b72a2934dfa30abc5456cb30a3b241e.tar.gz
sqlite-3ca691106b72a2934dfa30abc5456cb30a3b241e.zip
Updated sqlite_encode_binary() comments with tighter bounds on output length. (CVS 1023)
FossilOrigin-Name: 826aab43d5967ece2a272c49ce62021fa4a2ceb3
-rw-r--r--manifest12
-rw-r--r--manifest.uuid2
-rw-r--r--src/encode.c14
3 files changed, 14 insertions, 14 deletions
diff --git a/manifest b/manifest
index 3b042fd2d..c0db1a90d 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Documented\sinteger\svalues\sused\sby\sPRAGMAs.\nFixed\smissing\send\stags\sin\sgenerated\sanchors.\s(CVS\s1022)
-D 2003-06-15T10:29:25
+C Updated\ssqlite_encode_binary()\scomments\swith\stighter\sbounds\son\soutput\slength.\s(CVS\s1023)
+D 2003-06-15T10:35:05
F Makefile.in 9ad23ed4ca97f9670c4496432e3fbd4b3760ebde
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -27,7 +27,7 @@ F src/btree_rb.c a0dd64f840417b13637160599bd2740c8a340366
F src/build.c 936d10b33b326546280690bee7f20efaf19a6fe8
F src/copy.c 9e47975ea96751c658bcf1a0c4f0bb7c6ee61e73
F src/delete.c 0f81e6799c089487615d38e042a2de4d2d6192bc
-F src/encode.c ed720e54ec4ef4d4de651592f1dd1c74d422bbd2
+F src/encode.c a5fc03201e34b0015817202e9286bacf89e72048
F src/expr.c ebdb0f3ee039c8030de25935ce2df030966540a6
F src/func.c 33bbce6acaf9578ac99aa1f689968ccaf2ce43a2
F src/hash.c 058f077c1f36f266581aa16f907a3903abf64aa3
@@ -165,7 +165,7 @@ F www/speed.tcl 296cc5632d069b56d3ef5409ca0df90f486c10fb
F www/sqlite.tcl 4bd1729e320f5fa9125f0022b281fbe839192125
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 14fdcc7fe8a60a6ba8584903636db8dc37eef26a
-P e13e8b05b4d146aa4ca9ed06e414e0c6a4fba4e4
-R 025a97aa1a8710d9abd04f450fb59b7a
+P 6c24dfbae56a16dd736de5297c1796818773df80
+R 58e24d713b97f4ba7b875ae8dce7497f
U jplyon
-Z f0f06ece626e6fed7f80c90c5644e695
+Z fb46334e21926a895547abc49f262bff
diff --git a/manifest.uuid b/manifest.uuid
index 06d976cea..617cb0330 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-6c24dfbae56a16dd736de5297c1796818773df80 \ No newline at end of file
+826aab43d5967ece2a272c49ce62021fa4a2ceb3 \ No newline at end of file
diff --git a/src/encode.c b/src/encode.c
index b313d4f82..b18564cb6 100644
--- a/src/encode.c
+++ b/src/encode.c
@@ -15,7 +15,7 @@
** data in an SQLite database. The code in this file is not used by any other
** part of the SQLite library.
**
-** $Id: encode.c,v 1.6 2003/05/10 03:36:54 drh Exp $
+** $Id: encode.c,v 1.7 2003/06/15 10:35:05 jplyon Exp $
*/
#include <string.h>
@@ -44,7 +44,7 @@
** this.
**
** To minimize the encoding size, we first add a fixed offset value to each
-** byte in the sequence. The addition is module 256. (That is to say, if
+** byte in the sequence. The addition is modulo 256. (That is to say, if
** the sum of the original character value and the offset exceeds 256, then
** the higher order bits are truncated.) The offset is chosen to minimize
** the number of characters in the string that need to be escaped. For
@@ -86,7 +86,7 @@
** the encoded buffer from all characters in the output buffer.
**
** The only tricky part is step (1) - how to compute an offset value to
-** minimize the size of the output buffer. This is accomplished to testing
+** minimize the size of the output buffer. This is accomplished by testing
** all offset values and picking the one that results in the fewest number
** of escapes. To do that, we first scan the entire input and count the
** number of occurances of each character value in the input. Suppose
@@ -107,10 +107,10 @@
** string back into its original binary.
**
** The result is written into a preallocated output buffer "out".
-** "out" must be able to hold at least (256*n + 1262)/253 bytes.
+** "out" must be able to hold at least 2 +(257*n)/254 bytes.
** In other words, the output will be expanded by as much as 3
-** bytes for every 253 bytes of input plus 2 bytes of fixed overhead.
-** (This is approximately 2 + 1.019*n or about a 2% size increase.)
+** bytes for every 254 bytes of input plus 2 bytes of fixed overhead.
+** (This is approximately 2 + 1.0118*n or about a 1.2% size increase.)
**
** The return value is the number of characters in the encoded
** string, excluding the "\000" terminator.
@@ -159,7 +159,7 @@ int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out){
/*
** Decode the string "in" into binary data and write it into "out".
-** This routine reverses the encoded created by sqlite_encode_binary().
+** This routine reverses the encoding created by sqlite_encode_binary().
** The output will always be a few bytes less than the input. The number
** of bytes of output is returned. If the input is not a well-formed
** encoding, -1 is returned.