diff options
author | Julien Pauli <jpauli@php.net> | 2015-01-20 15:09:34 +0100 |
---|---|---|
committer | Julien Pauli <jpauli@php.net> | 2015-01-20 15:09:34 +0100 |
commit | 157508d87dc6ac5f94dbe415601a02a9ad71bbfc (patch) | |
tree | 8a0fda10bea4d72c34fceca635c43c7102797f48 | |
parent | 6f2f2ce5cf142ba1ec9e1b3d2365ec1665908b64 (diff) | |
parent | a40e004553f68fce94dcdcb924d8693e0008e7d5 (diff) | |
download | php-git-157508d87dc6ac5f94dbe415601a02a9ad71bbfc.tar.gz |
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
Updated NEWS
Fix bug #68711 Remove useless checks. 'num' is unsigned and cannot be <0.
-rw-r--r-- | ext/dba/libflatfile/flatfile.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/ext/dba/libflatfile/flatfile.c b/ext/dba/libflatfile/flatfile.c index 8fd4205e07..e194608f41 100644 --- a/ext/dba/libflatfile/flatfile.c +++ b/ext/dba/libflatfile/flatfile.c @@ -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; |