]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Prototypes for sqlite_encode_binary() and sqlite_decode_binary() added
authordrh <drh@noemail.net>
Sun, 14 Mar 2004 22:12:34 +0000 (22:12 +0000)
committerdrh <drh@noemail.net>
Sun, 14 Mar 2004 22:12:34 +0000 (22:12 +0000)
to sqlite.h. (CVS 1296)

FossilOrigin-Name: 359f0e787ff2d4d10fd23059e2ce99670e93f66a

manifest
manifest.uuid
src/sqlite.h.in

index 3e768c03bfca485da0d465c6550d8a8cf6af0418..e5144303135ac2f915e684a8c61c877ee9dcc5c4 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Make\ssqlite_encode_binary()\sand\ssqlite_decode_binary()\san\sofficial\spart\sof\nthe\slibrary.\s(CVS\s1295)
-D 2004-03-14T22:12:00
+C Prototypes\sfor\ssqlite_encode_binary()\sand\ssqlite_decode_binary()\sadded\nto\ssqlite.h.\s(CVS\s1296)
+D 2004-03-14T22:12:35
 F Makefile.in 46788b65500865e3fd965f7617d41697da8a11a1
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -48,7 +48,7 @@ F src/printf.c 8c58b7b6d4069eec6ebe2d46bdbc3a89a367bf95
 F src/random.c 775913e0b7fbd6295d21f12a7bd35b46387c44b2
 F src/select.c 3833e2b64cc6d249385ee44e13bf49c9ae5b903d
 F src/shell.c 01fdfff666631cfe7f8047cfe9a8a62e56b37b50
-F src/sqlite.h.in 01a7009223517d151da9780b0bb7b748777015dd
+F src/sqlite.h.in 35bec264dfb4965bbfeb7e75221f8658f210c30d
 F src/sqliteInt.h 235ce244b62bb26cc9ab394fb7a0724dd4e65c83
 F src/table.c d845cb101b5afc1f7fea083c99e3d2fa7998d895
 F src/tclsqlite.c 819d92d305756c4ea57de023c387d2fa8a256aff
@@ -188,7 +188,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
 F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P c661cc81b6981c536c107f40525ad9783b11ea82
-R 53b6160aa94d763507d1d66642e02dba
+P 786fe545560ec6c42bb0e344345031f425bf177a
+R d729397c0158d66009dcf358bf1f1b23
 U drh
-Z 751dfdf95f809133e2f24efbf8215847
+Z f444412b61c00a5e3edfa94afd51e12b
index f4677ec2cbce537e95eba7189afc76fe64980fa9..54f965560fd2c895f867c52f1870ffa56fc0f515 100644 (file)
@@ -1 +1 @@
-786fe545560ec6c42bb0e344345031f425bf177a
\ No newline at end of file
+359f0e787ff2d4d10fd23059e2ce99670e93f66a
\ No newline at end of file
index fa45d7d9790347282d7eca08340a52235005d01c..06f6bf78ec7ab5efdc38da55788d7bfbe0360e80 100644 (file)
@@ -12,7 +12,7 @@
 ** This header file defines the interface that the SQLite library
 ** presents to client programs.
 **
-** @(#) $Id: sqlite.h.in,v 1.59 2004/02/25 22:51:06 rdc Exp $
+** @(#) $Id: sqlite.h.in,v 1.60 2004/03/14 22:12:35 drh Exp $
 */
 #ifndef _SQLITE_H_
 #define _SQLITE_H_
@@ -827,6 +827,40 @@ int sqlite_rekey(
   const void *pKey, int nKey     /* The new key */
 );
 
+/*
+** Encode a binary buffer "in" of size n bytes so that it contains
+** no instances of characters '\'' or '\000'.  The output is 
+** null-terminated and can be used as a string value in an INSERT
+** or UPDATE statement.  Use sqlite_decode_binary() to convert the
+** string back into its original binary.
+**
+** The result is written into a preallocated output buffer "out".
+** "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 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.
+**
+** If out==NULL then no output is generated but the routine still returns
+** the number of characters that would have been generated if out had
+** not been NULL.
+*/
+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 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.
+**
+** The "in" and "out" parameters may point to the same buffer in order
+** to decode a string in place.
+*/
+int sqlite_decode_binary(const unsigned char *in, unsigned char *out);
+
 #ifdef __cplusplus
 }  /* End of the 'extern "C"' block */
 #endif