cvs: php4 /ext/mssql php_mssql.c
| From: | Andi Gutmans | Date: | Tue, 01 May 2001 18:13:59 +0000 |
| Subject: | cvs: php4 /ext/mssql php_mssql.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-5436@lists.php.net to get a copy of this message | ||
andi Tue May 1 11:13:59 2001 EDT
Modified files:
/php4/ext/mssql php_mssql.c
Log:
- Optimizer the previous patch a bit by nuking memset()
Index: php4/ext/mssql/php_mssql.c
diff -u php4/ext/mssql/php_mssql.c:1.41 php4/ext/mssql/php_mssql.c:1.42
--- php4/ext/mssql/php_mssql.c:1.41 Tue May 1 11:01:08 2001
+++ php4/ext/mssql/php_mssql.c Tue May 1 11:13:59 2001
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mssql.c,v 1.41 2001/05/01 18:01:08 fmk Exp $ */
+/* $Id: php_mssql.c,v 1.42 2001/05/01 18:13:59 andi Exp $ */
#ifdef COMPILE_DL_MSSQL
#define HAVE_MSSQL 1
@@ -734,12 +734,12 @@
case SQLIMAGE: {
DBBINARY *bin;
unsigned char *res_buf;
- int res_length = dbdatlen(mssql_ptr->link,offset);
+ int res_length = dbdatlen(mssql_ptr->link, offset);
res_buf = (unsigned char *) emalloc(res_length);
- memset(res_buf, 0, res_length);
- bin = ((DBBINARY *)dbdata(mssql_ptr->link,offset));
+ bin = ((DBBINARY *)dbdata(mssql_ptr->link, offset));
memcpy(res_buf,bin,res_length);
+ res_buf[res_length] = '\0';
result->value.str.len = res_length;
result->value.str.val = res_buf;
result->type = IS_STRING;
@@ -780,12 +780,12 @@
column_type == SQLIMAGE) {
DBBINARY *bin;
unsigned char *res_buf;
- int res_length = dbdatlen(mssql_ptr->link,offset);
+ int res_length = dbdatlen(mssql_ptr->link, offset);
res_buf = (unsigned char *) emalloc(res_length);
- memset(res_buf, 0, res_length);
- bin = ((DBBINARY *)dbdata(mssql_ptr->link,offset));
- memcpy(res_buf,bin,res_length);
+ bin = ((DBBINARY *)dbdata(mssql_ptr->link, offset));
+ memcpy(res_buf, bin, res_length);
+ res_buf[res_length] = '\0';
result->value.str.len = res_length;
result->value.str.val = res_buf;
result->type = IS_STRING;