mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
implement feof for native stream
This commit is contained in:
parent
aaf2c049fd
commit
fcb7aa6a55
2 changed files with 27 additions and 1 deletions
|
|
@ -25,6 +25,11 @@ class NativeStream implements File {
|
|||
*/
|
||||
private $handle;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $eof = false;
|
||||
|
||||
/**
|
||||
* Wrap a stream from libsmbclient-php into a regular php stream
|
||||
*
|
||||
|
|
@ -51,6 +56,7 @@ class NativeStream implements File {
|
|||
}
|
||||
|
||||
public function stream_eof() {
|
||||
return $this->eof;
|
||||
}
|
||||
|
||||
public function stream_flush() {
|
||||
|
|
@ -65,10 +71,15 @@ class NativeStream implements File {
|
|||
}
|
||||
|
||||
public function stream_read($count) {
|
||||
return $this->state->read($this->handle, $count);
|
||||
$result = $this->state->read($this->handle, $count);
|
||||
if (strlen($result) < $count) {
|
||||
$this->eof = true;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function stream_seek($offset, $whence = SEEK_SET) {
|
||||
$this->eof = false;
|
||||
return $this->state->lseek($this->handle, $offset, $whence);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue