cvs: php4(PHP_4_3) /ext/sybase php_sybase_db.c
| From: | Stefan Esser | Date: | Tue, 10 Dec 2002 15:41:38 +0000 |
| Subject: | cvs: php4(PHP_4_3) /ext/sybase php_sybase_db.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-17061@lists.php.net to get a copy of this message | ||
sesser Tue Dec 10 10:41:38 2002 EDT
Modified files: (Branch: PHP_4_3)
/php4/ext/sybase php_sybase_db.c
Log:
MFH
Index: php4/ext/sybase/php_sybase_db.c
diff -u php4/ext/sybase/php_sybase_db.c:1.38 php4/ext/sybase/php_sybase_db.c:1.38.2.1
--- php4/ext/sybase/php_sybase_db.c:1.38 Wed Oct 9 09:29:04 2002
+++ php4/ext/sybase/php_sybase_db.c Tue Dec 10 10:41:38 2002
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sybase_db.c,v 1.38 2002/10/09 13:29:04 iliaa Exp $ */
+/* $Id: php_sybase_db.c,v 1.38.2.1 2002/12/10 15:41:38 sesser Exp $ */
#ifdef HAVE_CONFIG_H
@@ -720,11 +720,14 @@
if (dbwillconvert(coltype(offset),SYBCHAR)) {
char *res_buf;
int res_length = dbdatlen(sybase_ptr->link,offset);
+ int src_length = res_length;
register char *p;
switch (coltype(offset)) {
case SYBBINARY:
case SYBVARBINARY:
+ res_length *= 2;
+ break;
case SYBCHAR:
case SYBVARCHAR:
case SYBTEXT:
@@ -740,15 +743,16 @@
memset(res_buf,' ',res_length+1); /* XXX i'm sure there's a better way
but i don't have sybase here to test
991105 thies@thieso.net */
- dbconvert(NULL,coltype(offset),dbdata(sybase_ptr->link,offset),
res_length,SYBCHAR,res_buf,-1);
+ dbconvert(NULL,coltype(offset),dbdata(sybase_ptr->link,offset),
res_length,SYBCHAR,res_buf,res_length);
/* get rid of trailing spaces */
p = res_buf + res_length;
- while (*p == ' ') {
+ while (p >= res_buf && *p == ' ') {
p--;
- res_length--;
}
*(++p) = 0; /* put a trailing NULL */
+ res_length = p - res_buf;
+
Z_STRLEN_P(result) = res_length;
Z_STRVAL_P(result) = res_buf;