cosmetics

This commit is contained in:
UbitUmarov
2026-04-05 23:56:24 +01:00
parent 575abd6d42
commit 1954be2f85
3 changed files with 16 additions and 17 deletions

View File

@@ -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.
/// </summary>
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 <string, InventoryFolderBase> resolvedFolders,
Dictionary<UUID, InventoryNodeBase> 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
/// </summary>
/// <param name="path"></param>
/// <param name="data"></param>
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");

View File

@@ -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);

View File

@@ -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;