]> granicus.if.org Git - php/commitdiff
Corrected string escape calculation.
authorIlia Alshanetsky <iliaa@php.net>
Sun, 7 Mar 2004 21:57:50 +0000 (21:57 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 7 Mar 2004 21:57:50 +0000 (21:57 +0000)
ext/sqlite/sess_sqlite.c
ext/sqlite/sqlite.c

index 8c4ea7da4bc048d7ab8838e5ddc1039c38508b13..c9616bc07d7bad97f47db78a63a83a7620fdcad2 100644 (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);
index 4af4001ea5fc70e3c6bf2d56e2f3ec4e936d0c2f..89235687cf2a2bc660a530f3cd0ba1c7588381e6 100644 (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);