From d1baa3e0c3b1783a68061980ffd8b9693c5a474a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 9 Nov 2016 22:39:52 +0000 Subject: fix some invalid string.format arguments --- .../Groups/Remote/GroupsServiceRobustConnector.cs | 2 +- OpenSim/Data/MySQL/MySQLXInventoryData.cs | 9 ++- OpenSim/Data/PGSQL/PGSQLXInventoryData.cs | 11 ++- .../Framework/Scenes/Scene.PacketHandlers.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneBase.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 89 +++++++++++++++++++++- .../Connectors/Estate/EstateDataConnector.cs | 2 +- 7 files changed, 108 insertions(+), 9 deletions(-) diff --git a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs index 26e844e..d79e4fa 100644 --- a/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs +++ b/OpenSim/Addons/Groups/Remote/GroupsServiceRobustConnector.cs @@ -286,7 +286,7 @@ namespace OpenSim.Groups string requestingAgentID = request["RequestingAgentID"].ToString(); if (!m_GroupsService.RemoveAgentFromGroup(requestingAgentID, agentID, groupID)) - NullResult(result, string.Format("Insufficient permissions.", agentID)); + NullResult(result, string.Format("Insufficient permissions. {0}", agentID)); else result["RESULT"] = "true"; } diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index c74033e..9a0044e 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs @@ -193,7 +193,9 @@ namespace OpenSim.Data.MySQL { using (MySqlCommand cmd = new MySqlCommand()) { - cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm); +// cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm); + + cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1"); cmd.Parameters.AddWithValue("?uuid", principalID.ToString()); cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); @@ -212,7 +214,10 @@ namespace OpenSim.Data.MySQL { cmd.Connection = dbcon; - cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm); +// cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm); + + cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID"); + cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString()); cmd.Parameters.AddWithValue("?AssetID", assetID.ToString()); diff --git a/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs b/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs index a22b882..c34a8dc 100644 --- a/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs +++ b/OpenSim/Data/PGSQL/PGSQLXInventoryData.cs @@ -174,7 +174,9 @@ namespace OpenSim.Data.PGSQL { using (NpgsqlCommand cmd = new NpgsqlCommand()) { - cmd.CommandText = String.Format(@"select * from inventoryitems where ""avatarID"" = :uuid and ""assetType"" = :type and ""flags"" = 1", m_Realm); +// cmd.CommandText = String.Format(@"select * from inventoryitems where ""avatarID"" = :uuid and ""assetType"" = :type and ""flags"" = 1", m_Realm); + + cmd.CommandText = String.Format(@"select * from inventoryitems where ""avatarID"" = :uuid and ""assetType"" = :type and ""flags"" = 1"); UUID princID = UUID.Zero; UUID.TryParse(principalID, out princID); @@ -194,11 +196,18 @@ namespace OpenSim.Data.PGSQL { using (NpgsqlCommand cmd = new NpgsqlCommand()) { +/* cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions"" from inventoryitems where ""avatarID"" = :PrincipalID and ""assetID"" = :AssetID group by ""assetID"" ", m_Realm); +*/ + cmd.CommandText = String.Format(@"select bit_or(""inventoryCurrentPermissions"") as ""inventoryCurrentPermissions"" + from inventoryitems + where ""avatarID"" = :PrincipalID + and ""assetID"" = :AssetID + group by ""assetID"" "); cmd.Parameters.Add(m_database.CreateParameter("PrincipalID", principalID)); cmd.Parameters.Add(m_database.CreateParameter("AssetID", assetID)); diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index a5abe76..3f48372 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -614,7 +614,7 @@ namespace OpenSim.Region.Framework.Scenes { m_log.Error( string.Format( - "[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e)); + "[AGENT INVENTORY]: Error in SendInventoryAsync() for {0} with folder ID {1}. Exception ", e, folderID)); } Thread.Sleep(20); } diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 1de55ec..d406625 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -287,7 +287,7 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception ", e)); + m_log.Error(string.Format("[SCENE]: SceneBase.cs: Close() - Failed with exception {0}", e)); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1a73c3e..bafee28 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -14358,6 +14358,91 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return contacts.ToArray(); } + private ContactResult? GroundIntersection2(Vector3 rayStart, Vector3 rayEnd) + { + // get work copies + float sx = rayStart.X; + float ex = rayEnd.X; + float sy = rayStart.Y; + float ey = rayEnd.Y; + + float dx = ex - sx; + float dy = ey - sy; + + // region size info + float rsx = World.RegionInfo.RegionSizeX; + + float tmp; + + // region bounds + if(sx < 0) + { + if(ex < 0) // totally outside + return null; + if(dx <= 0) // out and going away + return null; + else if(ex >= rsx) + ex = rsx - 0.001f; + tmp = -sx / dx; + sy += dy * dx; + sx = 0; + } + else if(sx >= rsx) + { + if(ex >= rsx) // totally outside + return null; + if(dx >= 0) // out and going away + return null; + else if(ex < 0) + ex = 0; + tmp = (rsx - sx) / dx; + sy += dy * dx; + sx = rsx - 0.001f; + } + + float rsy = World.RegionInfo.RegionSizeY; + if(sy < 0) + { + if(dy <= 0) // out and going away + return null; + else if(ey >= rsy) + ey = rsy - 0.001f; + tmp = -sy / dy; + sx += dy * dx; + sy = 0; + } + else if(sy >= rsy) + { + if(dy >= 0) // out and going away + return null; + else if(ey < 0) + ey = 0; + tmp = (rsy - sy) / dy; + sx += dy * dx; + sy = rsy - 0.001f; + } + + if(sx < 0 || sx >= rsx) + return null; + + float sz = rayStart.Z; + float ez = rayEnd.Z; + float dz = ez - sz; + + float dist = dx * dx + dy * dy + dz * dz; + if(dist < 0.001) + return null; + dist = (float)Math.Sqrt(dist); + tmp = 1.0f / dist; + Vector3 rayn = new Vector3(dx * tmp, dy * tmp, dz * tmp); + + ContactResult? result = null; + + + + return result; + } + private ContactResult? GroundIntersection(Vector3 rayStart, Vector3 rayEnd) { double[,] heightfield = World.Heightmap.GetDoubles(); @@ -16024,8 +16109,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api catch (InvalidCastException e) { Error(originFunc,string.Format( - " error running rule #{1}: arg #{2} ", - rulesParsed, idx - idxStart) + e.Message); + " error running rule #{0}: arg #{1} {2}", + rulesParsed, idx - idxStart, e.Message)); } finally { diff --git a/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs index 74935f3..b9a6281 100644 --- a/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs +++ b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs @@ -323,7 +323,7 @@ namespace OpenSim.Services.Connectors } else m_log.Error(string.Format( - "[ESTATE CONNECTOR]: WebException for {0} {1} {2} ", + "[ESTATE CONNECTOR]: WebException for {0} {1} {2} {3}", verb, uri, formdata, e)); } } -- cgit v1.1