diff --git a/sources/OpenMcdf/CompoundFile.cs b/sources/OpenMcdf/CompoundFile.cs index 5773576..3f5c6bf 100644 --- a/sources/OpenMcdf/CompoundFile.cs +++ b/sources/OpenMcdf/CompoundFile.cs @@ -1418,7 +1418,6 @@ List result break; Sector ms = new Sector(Sector.MINISECTOR_SIZE, sourceStream); - byte[] temp = new byte[Sector.MINISECTOR_SIZE]; ms.Id = nextSecID; ms.Type = SectorType.Mini; @@ -2630,7 +2629,7 @@ private static void DoCompression(CFStorage currSrcStorage, CFStorage currDstSto { CFStorage itemAsStorage = item as CFStorage; CFStorage strg = currDstStorage.AddStorage(itemAsStorage.Name); - strg.CLSID = new Guid(itemAsStorage.CLSID.ToByteArray()); + strg.CLSID = itemAsStorage.CLSID; DoCompression(itemAsStorage, strg); // recursion, one level deeper } }; diff --git a/sources/OpenMcdf/DirectoryEntry.cs b/sources/OpenMcdf/DirectoryEntry.cs index 947c23c..01ba62e 100644 --- a/sources/OpenMcdf/DirectoryEntry.cs +++ b/sources/OpenMcdf/DirectoryEntry.cs @@ -437,20 +437,14 @@ public override string ToString() public void AssignValueTo(RedBlackTree.IRBNode other) { DirectoryEntry d = other as DirectoryEntry; - d.SetEntryName(GetEntryName()); - - d.CreationDate = new byte[CreationDate.Length]; CreationDate.CopyTo(d.CreationDate, 0); - - d.ModifyDate = new byte[ModifyDate.Length]; ModifyDate.CopyTo(d.ModifyDate, 0); - d.Size = Size; d.StartSect = StartSect; d.StateBits = StateBits; d.StgType = StgType; - d.storageCLSID = new Guid(storageCLSID.ToByteArray()); + d.storageCLSID = storageCLSID; d.Child = Child; } diff --git a/sources/OpenMcdf/Sector.cs b/sources/OpenMcdf/Sector.cs index b789809..a904d7b 100644 --- a/sources/OpenMcdf/Sector.cs +++ b/sources/OpenMcdf/Sector.cs @@ -98,14 +98,16 @@ public byte[] GetData() public void ZeroData() { - data = new byte[Size]; + if (data is null) + data = new byte[Size]; + else + Array.Clear(data, 0, data.Length); DirtyFlag = true; } public void InitFATData() { - data = new byte[Size]; - + data ??= new byte[Size]; for (int i = 0; i < Size; i++) data[i] = 0xFF;