Corrected string escape calculation.

This commit is contained in:
Ilia Alshanetsky 2004-03-07 21:57:50 +00:00
parent 0dd2280102
commit 0eb7000b0a
2 changed files with 3 additions and 3 deletions

View file

@ -142,7 +142,7 @@ PS_WRITE_FUNC(sqlite)
t = time(NULL);
binary = emalloc(1 + 5 + vallen * (256 / 253));
binary = emalloc(1 + 5 + vallen * ((float) 256 / (float) 253));
binlen = sqlite_encode_binary((const unsigned char*)val, vallen, binary);
rv = sqlite_exec_printf(db, "REPLACE INTO session_data VALUES('%q', '%q', %d)", NULL, NULL, &error, key, binary, t);

View file

@ -2611,7 +2611,7 @@ PHP_FUNCTION(sqlite_escape_string)
/* binary string */
int enclen;
ret = emalloc( 1 + 5 + stringlen * (256 / 253) );
ret = emalloc( 1 + 5 + stringlen * ((float) 256 / (float) 253) );
ret[0] = '\x01';
enclen = php_sqlite_encode_binary(string, stringlen, ret+1);
RETVAL_STRINGL(ret, enclen+1, 0);
@ -2841,7 +2841,7 @@ PHP_FUNCTION(sqlite_udf_encode_binary)
int enclen;
char *ret;
ret = emalloc( 1 + 5 + datalen * (256 / 253) );
ret = emalloc( 1 + 5 + datalen * ((float) 256 / (float) 253) );
ret[0] = '\x01';
enclen = php_sqlite_encode_binary(data, datalen, ret+1);
RETVAL_STRINGL(ret, enclen+1, 0);