From 93a9ed2a6d5f6005ae213e2e91f1c79e2fd7f775 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 22 Apr 2014 12:04:06 +0300 Subject: Changed the maximum asset name and description lengths to constants. Also, pre-truncate the description of dynamic textures. --- OpenSim/Data/MSSQL/MSSQLAssetData.cs | 8 ++++---- OpenSim/Data/MySQL/MySQLAssetData.cs | 8 ++++---- OpenSim/Data/MySQL/MySQLXAssetData.cs | 8 ++++---- OpenSim/Data/PGSQL/PGSQLAssetData.cs | 8 ++++---- OpenSim/Data/SQLite/SQLiteAssetData.cs | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index ce70396..f94375d 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs @@ -160,18 +160,18 @@ namespace OpenSim.Data.MSSQL @temporary, @create_time, @access_time, @creatorid, @asset_flags, @data)"; string assetName = asset.Name; - if (asset.Name.Length > 64) + if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) { - assetName = asset.Name.Substring(0, 64); + assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); m_log.WarnFormat( "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Name, asset.ID, asset.Name.Length, assetName.Length); } string assetDescription = asset.Description; - if (asset.Description.Length > 64) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - assetDescription = asset.Description.Substring(0, 64); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); m_log.WarnFormat( "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index c96139d..f03e322 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -171,18 +171,18 @@ namespace OpenSim.Data.MySQL dbcon)) { string assetName = asset.Name; - if (asset.Name.Length > 64) + if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) { - assetName = asset.Name.Substring(0, 64); + assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); m_log.WarnFormat( "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Name, asset.ID, asset.Name.Length, assetName.Length); } string assetDescription = asset.Description; - if (asset.Description.Length > 64) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - assetDescription = asset.Description.Substring(0, 64); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); m_log.WarnFormat( "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 1bf6a9a..430bb9f 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -210,18 +210,18 @@ namespace OpenSim.Data.MySQL using (MySqlTransaction transaction = dbcon.BeginTransaction()) { string assetName = asset.Name; - if (asset.Name.Length > 64) + if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) { - assetName = asset.Name.Substring(0, 64); + assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); m_log.WarnFormat( "[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Name, asset.ID, asset.Name.Length, assetName.Length); } string assetDescription = asset.Description; - if (asset.Description.Length > 64) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - assetDescription = asset.Description.Substring(0, 64); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); m_log.WarnFormat( "[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); diff --git a/OpenSim/Data/PGSQL/PGSQLAssetData.cs b/OpenSim/Data/PGSQL/PGSQLAssetData.cs index ca18dc9..5d8b0a2 100644 --- a/OpenSim/Data/PGSQL/PGSQLAssetData.cs +++ b/OpenSim/Data/PGSQL/PGSQLAssetData.cs @@ -166,18 +166,18 @@ namespace OpenSim.Data.PGSQL "; string assetName = asset.Name; - if (asset.Name.Length > 64) + if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) { - assetName = asset.Name.Substring(0, 64); + assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); m_log.WarnFormat( "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Name, asset.ID, asset.Name.Length, assetName.Length); } string assetDescription = asset.Description; - if (asset.Description.Length > 64) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - assetDescription = asset.Description.Substring(0, 64); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); m_log.WarnFormat( "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 2834bcf..f0dda64 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -134,18 +134,18 @@ namespace OpenSim.Data.SQLite override public void StoreAsset(AssetBase asset) { string assetName = asset.Name; - if (asset.Name.Length > 64) + if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) { - assetName = asset.Name.Substring(0, 64); + assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); m_log.WarnFormat( "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Name, asset.ID, asset.Name.Length, assetName.Length); } string assetDescription = asset.Description; - if (asset.Description.Length > 64) + if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) { - assetDescription = asset.Description.Substring(0, 64); + assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); m_log.WarnFormat( "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); -- cgit v1.1