cosmetics

0.9.1.0-post-fixes
UbitUmarov 2019-01-29 21:16:28 +00:00
parent 6479eb9022
commit dc633ee768
3 changed files with 34 additions and 22 deletions

View File

@ -477,30 +477,48 @@ namespace OpenSim.Framework
public TValue[] GetArray() public TValue[] GetArray()
{ {
TValue[] ret = new TValue[0]; bool gotupLock = false;
bool gotLock = false;
try try
{ {
try { } try { }
finally finally
{ {
rwLock.EnterWriteLock(); rwLock.EnterUpgradeableReadLock();
gotLock = true; gotupLock = true;
}
if (m_array == null) if (m_array == null)
{
bool gotwritelock = false;
try
{ {
try { }
finally
{
rwLock.EnterWriteLock();
gotwritelock = true;
}
m_array = new TValue[Dictionary1.Count]; m_array = new TValue[Dictionary1.Count];
Dictionary1.Values.CopyTo(m_array, 0); Dictionary1.Values.CopyTo(m_array, 0);
} }
ret = m_array; finally
{
if (gotwritelock)
rwLock.ExitWriteLock();
}
} }
return m_array;
}
catch
{
return new TValue[0];
} }
finally finally
{ {
if (gotLock) if (gotupLock)
rwLock.ExitWriteLock(); rwLock.ExitUpgradeableReadLock();
} }
return ret;
} }
} }
} }

View File

@ -1939,7 +1939,7 @@ namespace OpenSim.Region.CoreModules.World.Land
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID); m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID);
} }
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); return LLSDxmlEncode.LLSDEmpty;
} }
// we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
// "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to.

View File

@ -1145,9 +1145,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) public bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add)
{ {
if (bitmap_base.GetLength(0) != bitmap_add.GetLength(0) if (bitmap_base.GetLength(0) != bitmap_add.GetLength(0)
|| bitmap_base.GetLength(1) != bitmap_add.GetLength(1) || bitmap_base.GetLength(1) != bitmap_add.GetLength(1))
|| bitmap_add.Rank != 2
|| bitmap_base.Rank != 2)
{ {
throw new Exception( throw new Exception(
String.Format("{0} MergeLandBitmaps. merging maps not same size. baseSizeXY=<{1},{2}>, addSizeXY=<{3},{4}>", String.Format("{0} MergeLandBitmaps. merging maps not same size. baseSizeXY=<{1},{2}>, addSizeXY=<{3},{4}>",
@ -1155,15 +1153,11 @@ namespace OpenSim.Region.CoreModules.World.Land
); );
} }
int x, y; for (int x = 0; x < bitmap_add.GetLength(0); x++)
for (y = 0; y < bitmap_base.GetLength(1); y++)
{ {
for (x = 0; x < bitmap_add.GetLength(0); x++) for (int y = 0; y < bitmap_base.GetLength(1); y++)
{ {
if (bitmap_add[x, y]) bitmap_base[x, y] |= bitmap_add[x, y];
{
bitmap_base[x, y] = true;
}
} }
} }
return bitmap_base; return bitmap_base;
@ -1357,9 +1351,9 @@ namespace OpenSim.Region.CoreModules.World.Land
int maxX = 0; int maxX = 0;
int maxY = 0; int maxY = 0;
for (int y = 0; y < baseY; y++) for (int x = 0; x < baseX; x++)
{ {
for (int x = 0; x < baseX; x++) for (int y = 0; y < baseY; y++)
{ {
if (bitmap_new[x, y]) bitmap_base[x, y] = false; if (bitmap_new[x, y]) bitmap_base[x, y] = false;
if (bitmap_base[x, y]) if (bitmap_base[x, y])