Method for LiteralData normalization

This commit is contained in:
Stephen Paul Weber 2010-04-01 09:20:13 -05:00
parent eb7aaf490e
commit fe7121efe3

View File

@ -981,6 +981,12 @@ class OpenPGP_LiteralDataPacket extends OpenPGP_Packet {
$this->timestamp = $opt['timestamp'] ? $opt['timestamp'] : time(); $this->timestamp = $opt['timestamp'] ? $opt['timestamp'] : time();
} }
function normalize() {
if($opt['format'] == 'u' || $opt['format'] == 't') { // Normalize line endings
$this->data = str_replace("\n", "\r\n", str_replace("\r", "\n", str_replace("\r\n", "\n", $this->data)));
}
}
function read() { function read() {
$this->size = $this->length - 1 - 4; $this->size = $this->length - 1 - 4;
$this->format = $this->read_byte(); $this->format = $this->read_byte();