aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorOren Hurvitz2014-04-22 12:04:06 +0300
committerOren Hurvitz2014-04-22 12:18:54 +0300
commit93a9ed2a6d5f6005ae213e2e91f1c79e2fd7f775 (patch)
tree10f801c88be06ec81cd0b8725947d7729ea39c45 /OpenSim
parentFixed: when a user logged-in, sometimes he didn't get notified of the Online ... (diff)
downloadopensim-SC_OLD-93a9ed2a6d5f6005ae213e2e91f1c79e2fd7f775.zip
opensim-SC_OLD-93a9ed2a6d5f6005ae213e2e91f1c79e2fd7f775.tar.gz
opensim-SC_OLD-93a9ed2a6d5f6005ae213e2e91f1c79e2fd7f775.tar.bz2
opensim-SC_OLD-93a9ed2a6d5f6005ae213e2e91f1c79e2fd7f775.tar.xz
Changed the maximum asset name and description lengths to constants. Also, pre-truncate the description of dynamic textures.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLAssetData.cs8
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs8
-rw-r--r--OpenSim/Data/MySQL/MySQLXAssetData.cs8
-rw-r--r--OpenSim/Data/PGSQL/PGSQLAssetData.cs8
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs8
-rw-r--r--OpenSim/Framework/AssetBase.cs3
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs2
7 files changed, 25 insertions, 20 deletions
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
160 @temporary, @create_time, @access_time, @creatorid, @asset_flags, @data)"; 160 @temporary, @create_time, @access_time, @creatorid, @asset_flags, @data)";
161 161
162 string assetName = asset.Name; 162 string assetName = asset.Name;
163 if (asset.Name.Length > 64) 163 if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
164 { 164 {
165 assetName = asset.Name.Substring(0, 64); 165 assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
166 m_log.WarnFormat( 166 m_log.WarnFormat(
167 "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", 167 "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
168 asset.Name, asset.ID, asset.Name.Length, assetName.Length); 168 asset.Name, asset.ID, asset.Name.Length, assetName.Length);
169 } 169 }
170 170
171 string assetDescription = asset.Description; 171 string assetDescription = asset.Description;
172 if (asset.Description.Length > 64) 172 if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
173 { 173 {
174 assetDescription = asset.Description.Substring(0, 64); 174 assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
175 m_log.WarnFormat( 175 m_log.WarnFormat(
176 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", 176 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
177 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); 177 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
171 dbcon)) 171 dbcon))
172 { 172 {
173 string assetName = asset.Name; 173 string assetName = asset.Name;
174 if (asset.Name.Length > 64) 174 if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
175 { 175 {
176 assetName = asset.Name.Substring(0, 64); 176 assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
177 m_log.WarnFormat( 177 m_log.WarnFormat(
178 "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", 178 "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
179 asset.Name, asset.ID, asset.Name.Length, assetName.Length); 179 asset.Name, asset.ID, asset.Name.Length, assetName.Length);
180 } 180 }
181 181
182 string assetDescription = asset.Description; 182 string assetDescription = asset.Description;
183 if (asset.Description.Length > 64) 183 if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
184 { 184 {
185 assetDescription = asset.Description.Substring(0, 64); 185 assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
186 m_log.WarnFormat( 186 m_log.WarnFormat(
187 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", 187 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
188 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); 188 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
210 using (MySqlTransaction transaction = dbcon.BeginTransaction()) 210 using (MySqlTransaction transaction = dbcon.BeginTransaction())
211 { 211 {
212 string assetName = asset.Name; 212 string assetName = asset.Name;
213 if (asset.Name.Length > 64) 213 if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
214 { 214 {
215 assetName = asset.Name.Substring(0, 64); 215 assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
216 m_log.WarnFormat( 216 m_log.WarnFormat(
217 "[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", 217 "[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
218 asset.Name, asset.ID, asset.Name.Length, assetName.Length); 218 asset.Name, asset.ID, asset.Name.Length, assetName.Length);
219 } 219 }
220 220
221 string assetDescription = asset.Description; 221 string assetDescription = asset.Description;
222 if (asset.Description.Length > 64) 222 if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
223 { 223 {
224 assetDescription = asset.Description.Substring(0, 64); 224 assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
225 m_log.WarnFormat( 225 m_log.WarnFormat(
226 "[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", 226 "[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
227 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); 227 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
166 "; 166 ";
167 167
168 string assetName = asset.Name; 168 string assetName = asset.Name;
169 if (asset.Name.Length > 64) 169 if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
170 { 170 {
171 assetName = asset.Name.Substring(0, 64); 171 assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
172 m_log.WarnFormat( 172 m_log.WarnFormat(
173 "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", 173 "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
174 asset.Name, asset.ID, asset.Name.Length, assetName.Length); 174 asset.Name, asset.ID, asset.Name.Length, assetName.Length);
175 } 175 }
176 176
177 string assetDescription = asset.Description; 177 string assetDescription = asset.Description;
178 if (asset.Description.Length > 64) 178 if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
179 { 179 {
180 assetDescription = asset.Description.Substring(0, 64); 180 assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
181 m_log.WarnFormat( 181 m_log.WarnFormat(
182 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", 182 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
183 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); 183 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
134 override public void StoreAsset(AssetBase asset) 134 override public void StoreAsset(AssetBase asset)
135 { 135 {
136 string assetName = asset.Name; 136 string assetName = asset.Name;
137 if (asset.Name.Length > 64) 137 if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
138 { 138 {
139 assetName = asset.Name.Substring(0, 64); 139 assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME);
140 m_log.WarnFormat( 140 m_log.WarnFormat(
141 "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", 141 "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
142 asset.Name, asset.ID, asset.Name.Length, assetName.Length); 142 asset.Name, asset.ID, asset.Name.Length, assetName.Length);
143 } 143 }
144 144
145 string assetDescription = asset.Description; 145 string assetDescription = asset.Description;
146 if (asset.Description.Length > 64) 146 if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
147 { 147 {
148 assetDescription = asset.Description.Substring(0, 64); 148 assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
149 m_log.WarnFormat( 149 m_log.WarnFormat(
150 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", 150 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
151 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); 151 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs
index d2c6c57..153a1d0 100644
--- a/OpenSim/Framework/AssetBase.cs
+++ b/OpenSim/Framework/AssetBase.cs
@@ -50,6 +50,9 @@ namespace OpenSim.Framework
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 public static readonly int MAX_ASSET_NAME = 64;
54 public static readonly int MAX_ASSET_DESC = 64;
55
53 /// <summary> 56 /// <summary>
54 /// Data of the Asset 57 /// Data of the Asset
55 /// </summary> 58 /// </summary>
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
index 9d77b19..4bced54 100644
--- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -514,6 +514,8 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
514 scene.RegionInfo.RegionID.ToString()); 514 scene.RegionInfo.RegionID.ToString());
515 asset.Data = assetData; 515 asset.Data = assetData;
516 asset.Description = String.Format("URL image : {0}", Url); 516 asset.Description = String.Format("URL image : {0}", Url);
517 if (asset.Description.Length > AssetBase.MAX_ASSET_DESC)
518 asset.Description = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC);
517 asset.Local = false; 519 asset.Local = false;
518 asset.Temporary = ((Disp & DISP_TEMP) != 0); 520 asset.Temporary = ((Disp & DISP_TEMP) != 0);
519 scene.AssetService.Store(asset); 521 scene.AssetService.Store(asset);