cvs: php4 /ext/dbase dbase.c

From: Date: Thu, 20 Jul 2000 02:48:44 +0000
Subject: cvs: php4 /ext/dbase dbase.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-819@lists.php.net to get a copy of this message
sterling Wed Jul 19 19:48:44 2000 EDT Modified files: /php4/ext/dbase dbase.c Log: Fix dbase_create() for real. Index: php4/ext/dbase/dbase.c diff -u php4/ext/dbase/dbase.c:1.28 php4/ext/dbase/dbase.c:1.29 --- php4/ext/dbase/dbase.c:1.28 Fri Jun 30 15:44:20 2000 +++ php4/ext/dbase/dbase.c Wed Jul 19 19:48:44 2000 @@ -563,7 +563,7 @@ /* {{{ proto bool dbase_create(string filename, array fields) Creates a new dBase-format database file */ PHP_FUNCTION(dbase_create) { - pval *filename, *fields, *field, **value; + pval *filename, *fields, **field, **value; int fd; dbhead_t *dbh; @@ -633,20 +633,20 @@ for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) { /* look up the first field */ - if (zend_hash_index_find(fields->value.ht, i, (void **)&value) == FAILURE) { + if (zend_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) { php_error(E_WARNING, "unable to find field %d", i); free_dbf_head(dbh); RETURN_FALSE; } - if (field->type != IS_ARRAY) { + if (Z_TYPE_PP (field) != IS_ARRAY) { php_error(E_WARNING, "second parameter must be array of arrays"); free_dbf_head(dbh); RETURN_FALSE; } /* field name */ - if (zend_hash_index_find(field->value.ht, 0, (void **)&value) == FAILURE) { + if (zend_hash_index_find(Z_ARRVAL_PP(field), 0, (void **)&value) == FAILURE) { php_error(E_WARNING, "expected field name as first element of list in field %d", i); free_dbf_head(dbh); RETURN_FALSE; @@ -660,7 +660,7 @@ copy_crimp(cur_f->db_fname, (*value)->value.str.val, (*value)->value.str.len); /* field type */ - if (zend_hash_index_find(field->value.ht,1,(void **)&value) == FAILURE) { + if (zend_hash_index_find(Z_ARRVAL_PP (field), 1,(void **)&value) == FAILURE) { php_error(E_WARNING, "expected field type as sececond element of list in field %d", i); RETURN_FALSE; } @@ -685,7 +685,7 @@ case 'N': case 'C': /* field length */ - if (zend_hash_index_find(field->value.ht,2,(void **)&value) == FAILURE) { + if (zend_hash_index_find(Z_ARRVAL_PP (field), 2,(void **)&value) == FAILURE) { php_error(E_WARNING, "expected field length as third element of list in field %d", i); free_dbf_head(dbh); RETURN_FALSE; @@ -694,7 +694,7 @@ cur_f->db_flen = (*value)->value.lval; if (cur_f->db_type == 'N') { - if (zend_hash_index_find(field->value.ht,3,(void **)&value) == FAILURE) { + if (zend_hash_index_find(Z_ARRVAL_PP (field), 3, (void **)&value) == FAILURE) { php_error(E_WARNING, "expected field precision as fourth element of list in field %d", i); free_dbf_head(dbh); RETURN_FALSE;

« previous php.cvs (#819) next »