mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
cosmetics
This commit is contained in:
@@ -1316,8 +1316,8 @@ namespace OpenSim.Framework
|
||||
public static UUID ComputeSHA1UUID(byte[] src)
|
||||
{
|
||||
byte[] ret;
|
||||
using (SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider())
|
||||
ret = SHA1.ComputeHash(src);
|
||||
using (SHA1 sha = SHA1.Create())
|
||||
ret = sha.ComputeHash(src);
|
||||
return new UUID(ret, 2);
|
||||
}
|
||||
|
||||
@@ -1380,6 +1380,12 @@ namespace OpenSim.Framework
|
||||
return FieldToString(bytes, String.Empty);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string FieldToASCIIString(byte[] bytes, int limit)
|
||||
{
|
||||
return CleanString(Encoding.ASCII.GetString(bytes, 0, limit < bytes.Length ? limit : bytes.Length));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a variable length field (byte array) to a string, with a
|
||||
/// field name prepended to each line of the output
|
||||
@@ -2052,13 +2058,10 @@ namespace OpenSim.Framework
|
||||
|
||||
public static string CleanString(string input)
|
||||
{
|
||||
if (input.Length > 0)
|
||||
for (int i = 0; i < input.Length; i++)
|
||||
{
|
||||
for (int i = 0; i < input.Length; i++)
|
||||
{
|
||||
if (input[i] == '\0' || input[i] == '\r' || input[i] == '\n')
|
||||
return input.Substring(0, i);
|
||||
}
|
||||
if (input[i] == '\0' || input[i] == '\r' || input[i] == '\n')
|
||||
return input.Substring(0, i);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user