helly Wed Nov 13 11:28:45 2002 EDT Modified files: /php4/ext/dba/libflatfile flatfile.c flatfile.h Log: -use size_t -recheckin header as unix file Index: php4/ext/dba/libflatfile/flatfile.c diff -u php4/ext/dba/libflatfile/flatfile.c:1.4 php4/ext/dba/libflatfile/flatfile.c:1.5 --- php4/ext/dba/libflatfile/flatfile.c:1.4 Mon Nov 11 06:57:25 2002 +++ php4/ext/dba/libflatfile/flatfile.c Wed Nov 13 11:28:43 2002 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: flatfile.c,v 1.4 2002/11/11 11:57:25 helly Exp $ */ +/* $Id: flatfile.c,v 1.5 2002/11/13 16:28:43 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -80,7 +80,8 @@ */ PHPAPI datum flatfile_fetch(flatfile *dba, datum key_datum TSRMLS_DC) { datum value_datum = {NULL, 0}; - int num=0, buf_size=1024; + size_t num=0; + size_t buf_size = 1024; char *buf; if (flatfile_findkey(dba, key_datum TSRMLS_CC)) { @@ -108,11 +109,12 @@ */ PHPAPI int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC) { char *key = key_datum.dptr; - int size = key_datum.dsize; + size_t size = key_datum.dsize; char *buf; - int num, buf_size = 1024; - long pos; + size_t num; + size_t buf_size = 1024; + size_t pos; php_stream_rewind(dba->fp); @@ -167,11 +169,11 @@ */ PHPAPI int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC) { char *buf = NULL; - int num; - int buf_size=1024; + size_t num; + size_t buf_size = 1024; int ret=0; void *key = key_datum.dptr; - int size = key_datum.dsize; + size_t size = key_datum.dsize; php_stream_rewind(dba->fp); buf = emalloc((buf_size+1)*sizeof(char)); @@ -214,8 +216,8 @@ */ PHPAPI datum flatfile_firstkey(flatfile *dba TSRMLS_DC) { datum buf; - int num; - int buf_size=1024; + size_t num; + size_t buf_size = 1024; php_stream_rewind(dba->fp); buf.dptr = emalloc((buf_size+1)*sizeof(char)); @@ -255,8 +257,8 @@ */ PHPAPI datum flatfile_nextkey(flatfile *dba TSRMLS_DC) { datum buf; - int num; - int buf_size=1024; + size_t num; + size_t buf_size = 1024; php_stream_seek(dba->fp, dba->CurrentFlatFilePos, SEEK_SET); buf.dptr = emalloc((buf_size+1)*sizeof(char)); Index: php4/ext/dba/libflatfile/flatfile.h diff -u php4/ext/dba/libflatfile/flatfile.h:1.3 php4/ext/dba/libflatfile/flatfile.h:1.4 --- php4/ext/dba/libflatfile/flatfile.h:1.3 Thu Nov 7 18:03:16 2002 +++ php4/ext/dba/libflatfile/flatfile.h Wed Nov 13 11:28:44 2002 @@ -1,47 +1,47 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2002 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | [EMAIL PROTECTED] so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Marcus Boerger <[EMAIL PROTECTED]> | - +----------------------------------------------------------------------+ - */ - -/* $Id: flatfile.h,v 1.3 2002/11/07 23:03:16 helly Exp $ */ - -#ifndef PHP_LIBDBM_H -#define PHP_LIBDBM_H - -typedef struct { - char *dptr; - int dsize; -} datum; - -typedef struct { - char *lockfn; - int lockfd; - php_stream *fp; - long CurrentFlatFilePos; - datum nextkey; -} flatfile; - -#define FLATFILE_INSERT 1 -#define FLATFILE_REPLACE 0 - -PHPAPI int flatfile_store(flatfile *dba, datum key_datum, datum value_datum, int mode TSRMLS_DC); -PHPAPI datum flatfile_fetch(flatfile *dba, datum key_datum TSRMLS_DC); -PHPAPI int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC); -PHPAPI int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC); -PHPAPI datum flatfile_firstkey(flatfile *dba TSRMLS_DC); -PHPAPI datum flatfile_nextkey(flatfile *dba TSRMLS_DC); - -#endif +/* + +----------------------------------------------------------------------+ + | PHP Version 4 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2002 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.02 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available at through the world-wide-web at | + | http://www.php.net/license/2_02.txt. | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | [EMAIL PROTECTED] so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Marcus Boerger <[EMAIL PROTECTED]> | + +----------------------------------------------------------------------+ + */ + +/* $Id: flatfile.h,v 1.4 2002/11/13 16:28:44 helly Exp $ */ + +#ifndef PHP_LIBDBM_H +#define PHP_LIBDBM_H + +typedef struct { + char *dptr; + size_t dsize; +} datum; + +typedef struct { + char *lockfn; + int lockfd; + php_stream *fp; + size_t CurrentFlatFilePos; + datum nextkey; +} flatfile; + +#define FLATFILE_INSERT 1 +#define FLATFILE_REPLACE 0 + +PHPAPI int flatfile_store(flatfile *dba, datum key_datum, datum value_datum, int mode +TSRMLS_DC); +PHPAPI datum flatfile_fetch(flatfile *dba, datum key_datum TSRMLS_DC); +PHPAPI int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC); +PHPAPI int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC); +PHPAPI datum flatfile_firstkey(flatfile *dba TSRMLS_DC); +PHPAPI datum flatfile_nextkey(flatfile *dba TSRMLS_DC); + +#endif
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php