diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs index aacae95..b199d5f 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Text; | ||
31 | using log4net; | 32 | using log4net; |
32 | 33 | ||
33 | namespace OpenSim.Region.Environment.Modules.World.Archiver | 34 | namespace OpenSim.Region.Environment.Modules.World.Archiver |
@@ -39,13 +40,18 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
39 | { | 40 | { |
40 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
41 | 42 | ||
42 | protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); | 43 | protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); |
43 | 44 | ||
44 | /// <summary> | 45 | /// <summary> |
45 | /// Binary reader for the underlying stream | 46 | /// Binary reader for the underlying stream |
46 | /// </summary> | 47 | /// </summary> |
47 | protected BinaryReader m_br; | 48 | protected BinaryReader m_br; |
48 | 49 | ||
50 | /// <summary> | ||
51 | /// Used to trim off null chars | ||
52 | /// </summary> | ||
53 | protected char[] m_nullCharArray = new char[] { '\0' }; | ||
54 | |||
49 | public TarArchiveReader(string archivePath) | 55 | public TarArchiveReader(string archivePath) |
50 | { | 56 | { |
51 | m_br = new BinaryReader(new FileStream(archivePath, FileMode.Open)); | 57 | m_br = new BinaryReader(new FileStream(archivePath, FileMode.Open)); |
@@ -109,6 +115,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
109 | byte[] header = m_br.ReadBytes(512); | 115 | byte[] header = m_br.ReadBytes(512); |
110 | 116 | ||
111 | tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100); | 117 | tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100); |
118 | tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray); | ||
112 | tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11); | 119 | tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11); |
113 | 120 | ||
114 | return tarHeader; | 121 | return tarHeader; |