From 347aa01617585e89149414a9763175a19d2dc651 Mon Sep 17 00:00:00 2001 From: Ondřej Surý Date: Fri, 20 Feb 2015 10:01:00 +0100 Subject: New upstream version 5.6.6+dfsg --- ext/dba/libflatfile/flatfile.c | 30 +++++------------------------- ext/dba/libflatfile/flatfile.h | 2 +- 2 files changed, 6 insertions(+), 26 deletions(-) (limited to 'ext/dba/libflatfile') diff --git a/ext/dba/libflatfile/flatfile.c b/ext/dba/libflatfile/flatfile.c index a1fce218a..e194608f4 100644 --- a/ext/dba/libflatfile/flatfile.c +++ b/ext/dba/libflatfile/flatfile.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2014 The PHP Group | + | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -126,9 +126,6 @@ int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC) { /* read in the key name */ num = php_stream_read(dba->fp, buf, num); - if (num < 0) { - break; - } if (size == num && !memcmp(buf, key, size)) { php_stream_seek(dba->fp, pos, SEEK_SET); @@ -150,9 +147,6 @@ int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC) { } /* read in the value */ num = php_stream_read(dba->fp, buf, num); - if (num < 0) { - break; - } } efree(buf); return FAILURE; @@ -180,9 +174,7 @@ int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC) { buf = erealloc(buf, buf_size); } num = php_stream_read(dba->fp, buf, num); - if (num < 0) { - break; - } + if (size == num) { if (!memcmp(buf, key, size)) { ret = 1; @@ -198,9 +190,6 @@ int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC) { buf = erealloc(buf, buf_size); } num = php_stream_read(dba->fp, buf, num); - if (num < 0) { - break; - } } efree(buf); return ret; @@ -226,9 +215,7 @@ datum flatfile_firstkey(flatfile *dba TSRMLS_DC) { buf = erealloc(buf, buf_size); } num = php_stream_read(dba->fp, buf, num); - if (num < 0) { - break; - } + if (*(buf) != 0) { dba->CurrentFlatFilePos = php_stream_tell(dba->fp); res.dptr = buf; @@ -244,9 +231,6 @@ datum flatfile_firstkey(flatfile *dba TSRMLS_DC) { buf = erealloc(buf, buf_size); } num = php_stream_read(dba->fp, buf, num); - if (num < 0) { - break; - } } efree(buf); res.dptr = NULL; @@ -274,9 +258,7 @@ datum flatfile_nextkey(flatfile *dba TSRMLS_DC) { buf = erealloc(buf, buf_size); } num = php_stream_read(dba->fp, buf, num); - if (num < 0) { - break; - } + if (!php_stream_gets(dba->fp, buf, 15)) { break; } @@ -286,9 +268,7 @@ datum flatfile_nextkey(flatfile *dba TSRMLS_DC) { buf = erealloc(buf, buf_size); } num = php_stream_read(dba->fp, buf, num); - if (num < 0) { - break; - } + if (*(buf)!=0) { dba->CurrentFlatFilePos = php_stream_tell(dba->fp); res.dptr = buf; diff --git a/ext/dba/libflatfile/flatfile.h b/ext/dba/libflatfile/flatfile.h index 7e9b1796c..30fe1a9c7 100644 --- a/ext/dba/libflatfile/flatfile.h +++ b/ext/dba/libflatfile/flatfile.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2014 The PHP Group | + | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | -- cgit v1.2.3