From 1954be2f85730765819a4b2b21c00ce5cab0058b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 5 Apr 2026 23:56:24 +0100 Subject: [PATCH] cosmetics --- .../Archiver/InventoryArchiveReadRequest.cs | 29 +++++++++---------- .../Region/PhysicsModules/ubOde/ODEPrim.cs | 2 +- .../PhysicsModules/ubOde/ODESitAvatar.cs | 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index f368050247..c599ad7221 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// The maximum major version of archive that we can read. Minor versions shouldn't need a max number since version /// bumps here should be compatible. /// - public static int MAX_MAJOR_VERSION = 1; + public static readonly int MAX_MAJOR_VERSION = 1; protected TarArchiveReader archive; @@ -207,13 +207,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_rootDestinationFolder = folderCandidates[0]; archive = new TarArchiveReader(m_loadStream); byte[] data; - TarArchiveReader.TarEntryType entryType; - while ((data = archive.ReadEntry(out filePath, out entryType)) != null) + while ((data = archive.ReadEntry(out filePath, out TarArchiveReader.TarEntryType entryType)) != null) { if (filePath == ArchiveConstants.CONTROL_FILE_PATH) { - LoadControlFile(filePath, data); + LoadControlFile(data); } else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) { @@ -233,16 +232,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_successfulAssetRestores, m_failedAssetRestores); //Alicia: When this is called by LibraryModule or Tests, m_module will be null as event is not required - if(m_module != null) - m_module.TriggerInventoryArchiveLoaded(m_id, true, m_userInfo, m_invPath, m_loadStream, reportedException, m_successfulItemRestores); + m_module?.TriggerInventoryArchiveLoaded(m_id, true, m_userInfo, m_invPath, m_loadStream, reportedException, m_successfulItemRestores); return m_loadedNodes; } catch(Exception Ex) { // Trigger saved event with failed result and exception data - if (m_module != null) - m_module.TriggerInventoryArchiveLoaded(m_id, false, m_userInfo, m_invPath, m_loadStream, Ex, 0); + m_module?.TriggerInventoryArchiveLoaded(m_id, false, m_userInfo, m_invPath, m_loadStream, Ex, 0); return m_loadedNodes; } @@ -352,7 +349,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver } // Don't include the last slash so find the penultimate one - int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2); + int penultimateSlashIndex = archivePath.LastIndexOf('/', archivePath.Length - 2); if (penultimateSlashIndex >= 0) { @@ -398,7 +395,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver Dictionary resolvedFolders, Dictionary loadedNodes) { - string[] rawDirsToCreate = iarPathToReplicate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + string[] rawDirsToCreate = iarPathToReplicate.Split('/', StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < rawDirsToCreate.Length; i++) { @@ -449,7 +446,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_itemIDs[oldID] = item.ID; UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_UserAccountService); - if (UUID.Zero != ospResolvedId) // The user exists in this grid + if (ospResolvedId.IsNotZero()) // The user exists in this grid { // m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId); @@ -523,7 +520,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver return false; } - string rawUuid = filename.Remove(indx); + string rawUuid = filename[..indx]; if (!UUID.TryParse(rawUuid, out UUID assetId)) return false; @@ -563,8 +560,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); - AssetBase asset = new AssetBase(assetId, "From IAR", assetType, UUID.Zero.ToString()); - asset.Data = data; + AssetBase asset = new(assetId, "From IAR", assetType, UUID.ZeroString) + { + Data = data + }; m_AssetService.Store(asset); @@ -576,7 +575,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver /// /// /// - public void LoadControlFile(string path, byte[] data) + public void LoadControlFile(byte[] data) { XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); XElement archiveElement = doc.Element("archive"); diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index dcd24d58e4..617c416648 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs @@ -1982,7 +1982,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if(noInertiaOverride) { UBOdeNative.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body - Quaternion mr = Quaternion.Conjugate(m_orientation); + Quaternion mr = Quaternion.Conjugate(in m_orientation); UBOdeNative.RfromQ(ref mymat, ref mr); UBOdeNative.MassRotate(ref objdmass, ref mymat); diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs b/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs index 37f46bd72e..9d81b9b49d 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs @@ -77,7 +77,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde //Vector3 geopos = actor.Position; //Quaternion geomOri = actor.Orientation; - Quaternion geomInvOri = Quaternion.Conjugate(geomOri); + Quaternion geomInvOri = Quaternion.Conjugate(in geomOri); Quaternion ori = Quaternion.Identity; Vector3 rayDir = geopos + offset - avCameraPosition;