]> source.dussan.org Git - nextcloud-server.git/commitdiff
implement ftell stream wrapper and fix return value from fseek stream wrapper
authorBjoern Schiessle <schiessle@owncloud.com>
Wed, 18 Dec 2013 14:40:43 +0000 (15:40 +0100)
committerBjoern Schiessle <schiessle@owncloud.com>
Wed, 18 Dec 2013 14:41:40 +0000 (15:41 +0100)
apps/files_encryption/lib/stream.php

index 7a37d2200a4f18d779bcad5a9cd656321334565d..c3cbdd54f564a9d9bea8d9fdb8f9fdb82506c783 100644 (file)
@@ -163,15 +163,26 @@ class Stream {
 
        }
 
+       /**
+        * @brief Returns the current position of the file pointer
+        * @return int  position of the file pointer
+        */
+       public function stream_tell() {
+               return ftell($this->handle);
+       }
+
        /**
         * @param $offset
         * @param int $whence
+        * @return bool true if fseek was successful, otherwise false
         */
        public function stream_seek($offset, $whence = SEEK_SET) {
 
                $this->flush();
 
-               fseek($this->handle, $offset, $whence);
+               // this wrapper needs to return "true" for success.
+               // the fseek call itself returns 0 on succeess
+               return !fseek($this->handle, $offset, $whence);
 
        }