From ad2f0a1290b9260393a27291fdd8a1592222c368 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 26 Nov 2009 18:04:58 +0000
Subject: Remove OS version crap from about dialog
---
OpenSim/Framework/Util.cs | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 87ba5a8..c052745 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -990,19 +990,19 @@ namespace OpenSim.Framework
{
string os = String.Empty;
- if (Environment.OSVersion.Platform != PlatformID.Unix)
- {
- os = Environment.OSVersion.ToString();
- }
- else
- {
- os = ReadEtcIssue();
- }
-
- if (os.Length > 45)
- {
- os = os.Substring(0, 45);
- }
+// if (Environment.OSVersion.Platform != PlatformID.Unix)
+// {
+// os = Environment.OSVersion.ToString();
+// }
+// else
+// {
+// os = ReadEtcIssue();
+// }
+//
+// if (os.Length > 45)
+// {
+// os = os.Substring(0, 45);
+// }
return os;
}
--
cgit v1.1
From c554de75010a442753cce29ee06d2b60d7b4701a Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sat, 7 Aug 2010 05:45:52 +0200
Subject: Correct display of landmark about info. Also correct region maturity
rating in LM info. Maturity is NOT the parcel's setting, that is only for the
image and text. Parcel maturity is governed by region maturity.
---
OpenSim/Framework/Util.cs | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index c39fb6f..af5a0ce 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1171,6 +1171,16 @@ namespace OpenSim.Framework
}
+ public static uint ConvertAccessLevelToMaturity(byte maturity)
+ {
+ if (maturity <= 13)
+ return 0;
+ else if (maturity <= 21)
+ return 1;
+ else
+ return 2;
+ }
+
///
/// Produces an OSDMap from its string representation on a stream
///
@@ -1486,4 +1496,4 @@ namespace OpenSim.Framework
}
}
-}
\ No newline at end of file
+}
--
cgit v1.1
From 63dcd44e8727a4e264feaf2d981c70bbfa209811 Mon Sep 17 00:00:00 2001
From: Tom
Date: Wed, 26 Jan 2011 12:47:43 -0800
Subject: Provide an SL compatible llMD5String function across all platforms
---
OpenSim/Framework/Util.cs | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index cef756c..9227708 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -409,19 +409,25 @@ namespace OpenSim.Framework
///
///
///
+
public static string Md5Hash(string data)
{
- byte[] dataMd5 = ComputeMD5Hash(data);
+ return Md5Hash(data, Encoding.Default);
+ }
+
+ public static string Md5Hash(string data, Encoding encoding)
+ {
+ byte[] dataMd5 = ComputeMD5Hash(data, encoding);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < dataMd5.Length; i++)
sb.AppendFormat("{0:x2}", dataMd5[i]);
return sb.ToString();
}
- private static byte[] ComputeMD5Hash(string data)
+ private static byte[] ComputeMD5Hash(string data, Encoding encoding)
{
MD5 md5 = MD5.Create();
- return md5.ComputeHash(Encoding.Default.GetBytes(data));
+ return md5.ComputeHash(encoding.GetBytes(data));
}
///
@@ -1161,7 +1167,7 @@ namespace OpenSim.Framework
public static Guid GetHashGuid(string data, string salt)
{
- byte[] hash = ComputeMD5Hash(data + salt);
+ byte[] hash = ComputeMD5Hash(data + salt, Encoding.Default);
//string s = BitConverter.ToString(hash);
--
cgit v1.1
From 04c62c4959d99ed3a8d350464db64aac6db1ec5f Mon Sep 17 00:00:00 2001
From: Tom
Date: Wed, 26 Jan 2011 12:54:12 -0800
Subject: Revert my previous SHA1 commit in favour of a better implementation
---
OpenSim/Framework/Util.cs | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 9227708..96292ff 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -435,16 +435,22 @@ namespace OpenSim.Framework
///
///
///
+
public static string SHA1Hash(string data)
{
- byte[] hash = ComputeSHA1Hash(data);
+ return SHA1Hash(data, Encoding.Default);
+ }
+
+ public static string SHA1Hash(string data, Encoding encoding)
+ {
+ byte[] hash = ComputeSHA1Hash(data, encoding);
return BitConverter.ToString(hash).Replace("-", String.Empty);
}
- private static byte[] ComputeSHA1Hash(string src)
+ private static byte[] ComputeSHA1Hash(string src, Encoding encoding)
{
SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider();
- return SHA1.ComputeHash(Encoding.Default.GetBytes(src));
+ return SHA1.ComputeHash(encoding.GetBytes(src));
}
public static int fast_distance2d(int x, int y)
--
cgit v1.1
From 598f891d703593bde4b96472b5d1b1ce6aaf4c74 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Wed, 6 Feb 2013 04:03:32 +0100
Subject: Move SoubleQueu to Util. Change HTTP inv to prioritize COF. Determine
COF for SP
---
OpenSim/Framework/Util.cs | 108 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index e76a37b..48f3f8b 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2097,4 +2097,112 @@ namespace OpenSim.Framework
}
#endregion
}
+
+ public class DoubleQueue where T:class
+ {
+ private Queue m_lowQueue = new Queue();
+ private Queue m_highQueue = new Queue();
+
+ private object m_syncRoot = new object();
+ private Semaphore m_s = new Semaphore(0, 1);
+
+ public DoubleQueue()
+ {
+ }
+
+ public virtual int Count
+ {
+ get { return m_highQueue.Count + m_lowQueue.Count; }
+ }
+
+ public virtual void Enqueue(T data)
+ {
+ Enqueue(m_lowQueue, data);
+ }
+
+ public virtual void EnqueueLow(T data)
+ {
+ Enqueue(m_lowQueue, data);
+ }
+
+ public virtual void EnqueueHigh(T data)
+ {
+ Enqueue(m_highQueue, data);
+ }
+
+ private void Enqueue(Queue q, T data)
+ {
+ lock (m_syncRoot)
+ {
+ m_lowQueue.Enqueue(data);
+ m_s.WaitOne(0);
+ m_s.Release();
+ }
+ }
+
+ public virtual T Dequeue()
+ {
+ return Dequeue(Timeout.Infinite);
+ }
+
+ public virtual T Dequeue(int tmo)
+ {
+ return Dequeue(TimeSpan.FromMilliseconds(tmo));
+ }
+
+ public virtual T Dequeue(TimeSpan wait)
+ {
+ T res = null;
+
+ if (!Dequeue(wait, ref res))
+ return null;
+
+ return res;
+ }
+
+ public bool Dequeue(int timeout, ref T res)
+ {
+ return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res);
+ }
+
+ public bool Dequeue(TimeSpan wait, ref T res)
+ {
+ if (!m_s.WaitOne(wait))
+ return false;
+
+ lock (m_syncRoot)
+ {
+ if (m_highQueue.Count > 0)
+ res = m_highQueue.Dequeue();
+ else
+ res = m_lowQueue.Dequeue();
+
+ if (m_highQueue.Count == 0 && m_lowQueue.Count == 0)
+ return true;
+
+ try
+ {
+ m_s.Release();
+ }
+ catch
+ {
+ }
+
+ return true;
+ }
+ }
+
+ public virtual void Clear()
+ {
+
+ lock (m_syncRoot)
+ {
+ // Make sure sem count is 0
+ m_s.WaitOne(0);
+
+ m_lowQueue.Clear();
+ m_highQueue.Clear();
+ }
+ }
+ }
}
--
cgit v1.1
From c341664c1b8ccf3bd7b81795b900b971a15ff318 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sun, 24 Mar 2013 18:56:28 +0100
Subject: Phase 1 of implementing a transfer permission. Overwrite libOMV's
PermissionMask with our own and add export permissions as well as a new
definition for "All" as meaning "all conventional permissions" rather than
"all possible permissions"
---
OpenSim/Framework/Util.cs | 15 +++++++++++++++
1 file changed, 15 insertions(+)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index e4d7e19..557f38e 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -54,6 +54,21 @@ using Amib.Threading;
namespace OpenSim.Framework
{
+ [Flags]
+ public enum PermissionMask : uint
+ {
+ None = 0,
+ Transfer = 1 << 13,
+ Modify = 1 << 14,
+ Copy = 1 << 15,
+ Export = 1 << 16,
+ Move = 1 << 19,
+ Damage = 1 << 20,
+ // All does not contain Export, which is special and must be
+ // explicitly given
+ All = (1 << 13) | (1 << 14) | (1 << 15) | (1 << 19)
+ }
+
///
/// The method used by Util.FireAndForget for asynchronously firing events
///
--
cgit v1.1
From 3e7f475e58500fc51025c6ccbd521ad581687a9f Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Tue, 12 Aug 2014 21:08:01 +0100
Subject: fix the damm thing
---
OpenSim/Framework/Util.cs | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 1775fef..b8b78fa 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -58,6 +58,15 @@ namespace OpenSim.Framework
public enum PermissionMask : uint
{
None = 0,
+
+ // folded perms
+ foldedTransfer = 1,
+ foldedModify = 1 << 1,
+ foldedCopy = 1 << 2,
+
+ foldedMask = 0x07,
+
+ //
Transfer = 1 << 13,
Modify = 1 << 14,
Copy = 1 << 15,
@@ -243,14 +252,12 @@ namespace OpenSim.Framework
///
/// A 3d vector
/// A new vector which is normalized form of the vector
- /// The vector paramater cannot be <0,0,0>
+
public static Vector3 GetNormalizedVector(Vector3 a)
{
- if (IsZeroVector(a))
- throw new ArgumentException("Vector paramater cannot be a zero vector.");
-
- float Mag = (float) GetMagnitude(a);
- return new Vector3(a.X / Mag, a.Y / Mag, a.Z / Mag);
+ Vector3 v = new Vector3(a.X, a.Y, a.Z);
+ v.Normalize();
+ return v;
}
///
--
cgit v1.1
From a301bad8ad047f4acf122d5b47be8d81c371c3c3 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 13 Oct 2014 12:10:13 +0100
Subject: on util thread pool reduce the min number of threads, increase the
maximum and increase the idle time before release to OS
---
OpenSim/Framework/Util.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index b8b78fa..d807e2a 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1850,7 +1850,7 @@ namespace OpenSim.Framework
STPStartInfo startInfo = new STPStartInfo();
startInfo.ThreadPoolName = "Util";
- startInfo.IdleTimeout = 2000;
+ startInfo.IdleTimeout = 20000;
startInfo.MaxWorkerThreads = maxThreads;
startInfo.MinWorkerThreads = minThreads;
--
cgit v1.1
From 0edffae7e42c0705303e015036fa85687508ecf0 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sun, 30 Aug 2015 19:17:35 +0100
Subject: more on tps and crossings
---
OpenSim/Framework/Util.cs | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Framework/Util.cs')
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index d807e2a..5f4ab06 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -675,17 +675,26 @@ namespace OpenSim.Framework
/// Old region y-coord
/// New region y-coord
///
- public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy)
+ public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy,
+ int oldsizex, int oldsizey, int newsizex, int newsizey)
{
- int dd = (int)((drawdist + Constants.RegionSize - 1) / Constants.RegionSize);
+ // we still need to make sure we see new region 1stNeighbors
- int startX = (int)oldx - dd;
- int startY = (int)oldy - dd;
+ oldx *= Constants.RegionSize;
+ newx *= Constants.RegionSize;
+ if (oldx + oldsizex + drawdist < newx)
+ return true;
+ if (newx + newsizex + drawdist < oldx)
+ return true;
- int endX = (int)oldx + dd;
- int endY = (int)oldy + dd;
+ oldy *= Constants.RegionSize;
+ newy *= Constants.RegionSize;
+ if (oldy + oldsizey + drawdist < newy)
+ return true;
+ if (newy + newsizey + drawdist< oldy)
+ return true;
- return (newx < startX || endX < newx || newy < startY || endY < newy);
+ return false;
}
public static string FieldToString(byte[] bytes)
--
cgit v1.1