cvs: pear /File_Archive/Archive/Writer Ar.php
| From: | Pablo Fischer | Date: | Mon, 23 May 2005 17:47:55 +0000 |
| Subject: | cvs: pear /File_Archive/Archive/Writer Ar.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-32083@lists.php.net to get a copy of this message | ||
pfischer Mon May 23 13:47:55 2005 EDT
Modified files:
/pear/File_Archive/Archive/Writer Ar.php
Log:
Small fixes
http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer/Ar.php?r1=1.1&r2=1.2&ty=u
Index: pear/File_Archive/Archive/Writer/Ar.php
diff -u pear/File_Archive/Archive/Writer/Ar.php:1.1 pear/File_Archive/Archive/Writer/Ar.php:1.2
--- pear/File_Archive/Archive/Writer/Ar.php:1.1 Mon May 23 13:05:47 2005
+++ pear/File_Archive/Archive/Writer/Ar.php Mon May 23 13:47:54 2005
@@ -39,13 +39,13 @@
* @var string Current data of the file.
* @access private
*/
- var $_buffer;
+ var $_buffer = "";
/**
* @var string Filename of the current filename
* @access private
*/
- var $_currentFilename;
+ var $_currentFilename = null;
/**
* @var boolean Flag: use buffer or not.
@@ -57,8 +57,8 @@
* @var array Stats of the current filename
* @access private
*/
- var $_currentStat;
-
+ var $_currentStat = array ();
+
/**
* Flush the memory we have in the ar.
*
@@ -96,7 +96,7 @@
$this->innerWriter->writeData($this->_buffer);
if ($currentSize % 2 == 1) {
- $this->innerWriter->writeData($this->_buffer);
+ $this->innerWriter->writeData("\n");
}
}
}
@@ -111,6 +111,11 @@
$mime = "application/octet-stream")
{
$this->flush();
+
+ //Are we at the beginning of the archive?
+ if (is_null($this->_currentFilename)) {
+ $this->innerWriter->writeData("!<arch>\n");
+ }
/**
* If the file is empty, there's no reason to have a buffer
* or use memory
@@ -125,8 +130,6 @@
*/
function close()
{
- //Ok, lets add the <arch> stuff
- $this->innerWriter->writeData("!<arch>\n");
$this->flush();
parent::close();
}