summaryrefslogtreecommitdiff
path: root/ext/dba/libflatfile
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2015-02-20 22:25:42 +0300
committerIgor Pashev <pashev.igor@gmail.com>2015-02-20 22:25:42 +0300
commit71d41ca6bb3a9d888b39f34a30f994ac1cf88873 (patch)
tree3a11365b77b332c078440204fb82549d34237a35 /ext/dba/libflatfile
parent2d50280dd013556e51b6f275ca965fe7b530029b (diff)
parent1ceec3a053647865493ab417d3ce401b9bc42450 (diff)
downloadphp-71d41ca6bb3a9d888b39f34a30f994ac1cf88873.tar.gz
Merge branch 'master-5.6' of git://anonscm.debian.org/pkg-php/php
Conflicts: debian/changelog debian/patches/series
Diffstat (limited to 'ext/dba/libflatfile')
-rw-r--r--ext/dba/libflatfile/flatfile.c30
-rw-r--r--ext/dba/libflatfile/flatfile.h2
2 files changed, 6 insertions, 26 deletions
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 |