initializing some variables + update size after writing the headers

This commit is contained in:
Thomas Müller 2015-03-30 17:13:42 +02:00
parent 4441835d18
commit d185761d31
1 changed files with 3 additions and 3 deletions

View File

@ -271,8 +271,7 @@ class Encryption extends Wrapper {
public function stream_write($data) { public function stream_write($data) {
if ($this->position === 0) { if ($this->position === 0) {
$this->writeHeader(); $this->size+=$this->writeHeader();
$this->size+=$this->util->getBlockSize();
} }
$length = 0; $length = 0;
@ -411,11 +410,12 @@ class Encryption extends Wrapper {
/** /**
* write header at beginning of encrypted file * write header at beginning of encrypted file
* *
* @return integer
* @throws EncryptionHeaderKeyExistsException if header key is already in use * @throws EncryptionHeaderKeyExistsException if header key is already in use
*/ */
private function writeHeader() { private function writeHeader() {
$header = $this->util->createHeader($this->newHeader, $this->encryptionModule); $header = $this->util->createHeader($this->newHeader, $this->encryptionModule);
parent::stream_write($header); return parent::stream_write($header);
} }
} }