diff options
author | Teravus Ovares | 2007-12-28 23:19:03 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-12-28 23:19:03 +0000 |
commit | 0631151e08174fffbc5bf3f646ef32e16e2c5145 (patch) | |
tree | cd5c03148d599fbe9c9929ff98b5894c5a4cdd43 | |
parent | Add System.Xml back into AssetServer and into AssetLoader for the first time.... (diff) | |
download | opensim-SC-0631151e08174fffbc5bf3f646ef32e16e2c5145.zip opensim-SC-0631151e08174fffbc5bf3f646ef32e16e2c5145.tar.gz opensim-SC-0631151e08174fffbc5bf3f646ef32e16e2c5145.tar.bz2 opensim-SC-0631151e08174fffbc5bf3f646ef32e16e2c5145.tar.xz |
* Patch from Melanie provides Util.CleanString and uses it on the prim name and description. Thanks Melanie.
-rw-r--r-- | OpenSim/Framework/Util.cs | 33 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 1 |
3 files changed, 30 insertions, 8 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index e6512c2..08b3a9d 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -222,10 +222,7 @@ namespace OpenSim.Framework | |||
222 | output.Append(": "); | 222 | output.Append(": "); |
223 | } | 223 | } |
224 | 224 | ||
225 | if (bytes[bytes.Length - 1] == 0x00) | 225 | output.Append(CleanString(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1))); |
226 | output.Append(UTF8Encoding.UTF8.GetString(bytes, 0, bytes.Length - 1)); | ||
227 | else | ||
228 | output.Append(UTF8Encoding.UTF8.GetString(bytes)); | ||
229 | } | 226 | } |
230 | else | 227 | else |
231 | { | 228 | { |
@@ -406,5 +403,31 @@ namespace OpenSim.Framework | |||
406 | { | 403 | { |
407 | return lluuid.UUID.ToString("n"); | 404 | return lluuid.UUID.ToString("n"); |
408 | } | 405 | } |
406 | |||
407 | public static string CleanString(string input) | ||
408 | { | ||
409 | if(input.Length == 0) | ||
410 | return input; | ||
411 | |||
412 | int clip=input.Length; | ||
413 | |||
414 | // Test for ++ string terminator | ||
415 | int pos=input.IndexOf("\0"); | ||
416 | if(pos != -1 && pos < clip) | ||
417 | clip=pos; | ||
418 | |||
419 | // Test for CR | ||
420 | pos=input.IndexOf("\r"); | ||
421 | if(pos != -1 && pos < clip) | ||
422 | clip=pos; | ||
423 | |||
424 | // Test for LF | ||
425 | pos=input.IndexOf("\n"); | ||
426 | if(pos != -1 && pos < clip) | ||
427 | clip=pos; | ||
428 | |||
429 | // Truncate string before first end-of-line character found | ||
430 | return input.Substring(0, clip); | ||
431 | } | ||
409 | } | 432 | } |
410 | } \ No newline at end of file | 433 | } |
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 5ad5646..794cdae 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -749,7 +749,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
749 | { | 749 | { |
750 | if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) | 750 | if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) |
751 | { | 751 | { |
752 | group.SetPartName(name, primLocalID); | 752 | group.SetPartName(Util.CleanString(name), primLocalID); |
753 | } | 753 | } |
754 | } | 754 | } |
755 | } | 755 | } |
@@ -766,7 +766,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
766 | { | 766 | { |
767 | if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) | 767 | if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) |
768 | { | 768 | { |
769 | group.SetPartDescription(description.Replace("\0",""), primLocalID); | 769 | group.SetPartDescription(Util.CleanString(description), primLocalID); |
770 | } | 770 | } |
771 | } | 771 | } |
772 | } | 772 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index d3f5454..0f8ce0b 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1086,7 +1086,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1086 | /// <param name="name"></param> | 1086 | /// <param name="name"></param> |
1087 | public void SetPartName(string name, uint localID) | 1087 | public void SetPartName(string name, uint localID) |
1088 | { | 1088 | { |
1089 | name = name.Remove(name.Length - 1, 1); | ||
1090 | SceneObjectPart part = GetChildPart(localID); | 1089 | SceneObjectPart part = GetChildPart(localID); |
1091 | if (part != null) | 1090 | if (part != null) |
1092 | { | 1091 | { |