diff options
author | Melanie | 2009-10-05 10:17:23 +0100 |
---|---|---|
committer | Melanie | 2009-10-05 10:17:23 +0100 |
commit | 0744292b479446eb1ebec828afafacc0189709ca (patch) | |
tree | 3c43b5f425aff61d3625b75b7aef35ce5062ae56 /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' into vehicles (diff) | |
parent | Make the asset connector async Get overload return false if the asset (diff) | |
download | opensim-SC_OLD-0744292b479446eb1ebec828afafacc0189709ca.zip opensim-SC_OLD-0744292b479446eb1ebec828afafacc0189709ca.tar.gz opensim-SC_OLD-0744292b479446eb1ebec828afafacc0189709ca.tar.bz2 opensim-SC_OLD-0744292b479446eb1ebec828afafacc0189709ca.tar.xz |
Merge branch 'master' into vehicles
Diffstat (limited to '')
5 files changed, 39 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index a0f359b..7456e8c 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -257,7 +257,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
257 | stringResult.AppendFormat("{0}|{1}|{2}{3}", Layers[i].Start, Layers[i].End, Layers[i].End - Layers[i].Start, strEnd); | 257 | stringResult.AppendFormat("{0}|{1}|{2}{3}", Layers[i].Start, Layers[i].End, Layers[i].End - Layers[i].Start, strEnd); |
258 | } | 258 | } |
259 | 259 | ||
260 | layerDecodeAsset.Data = Encoding.UTF8.GetBytes(stringResult.ToString()); | 260 | layerDecodeAsset.Data = Util.UTF8.GetBytes(stringResult.ToString()); |
261 | 261 | ||
262 | #endregion Serialize Layer Data | 262 | #endregion Serialize Layer Data |
263 | 263 | ||
@@ -280,7 +280,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
280 | { | 280 | { |
281 | #region Deserialize Layer Data | 281 | #region Deserialize Layer Data |
282 | 282 | ||
283 | string readResult = Encoding.UTF8.GetString(layerDecodeAsset.Data); | 283 | string readResult = Util.UTF8.GetString(layerDecodeAsset.Data); |
284 | string[] lines = readResult.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); | 284 | string[] lines = readResult.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); |
285 | 285 | ||
286 | if (lines.Length == 0) | 286 | if (lines.Length == 0) |
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 817e0d4..c0bb70c 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -323,13 +323,13 @@ namespace Flotsam.RegionModules.AssetCache | |||
323 | string filename = GetFileName(id); | 323 | string filename = GetFileName(id); |
324 | if (File.Exists(filename)) | 324 | if (File.Exists(filename)) |
325 | { | 325 | { |
326 | FileStream stream = null; | ||
326 | try | 327 | try |
327 | { | 328 | { |
328 | FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read); | 329 | stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read); |
329 | BinaryFormatter bformatter = new BinaryFormatter(); | 330 | BinaryFormatter bformatter = new BinaryFormatter(); |
330 | 331 | ||
331 | asset = (AssetBase)bformatter.Deserialize(stream); | 332 | asset = (AssetBase)bformatter.Deserialize(stream); |
332 | stream.Close(); | ||
333 | 333 | ||
334 | UpdateMemoryCache(id, asset); | 334 | UpdateMemoryCache(id, asset); |
335 | 335 | ||
@@ -349,6 +349,11 @@ namespace Flotsam.RegionModules.AssetCache | |||
349 | { | 349 | { |
350 | LogException(e); | 350 | LogException(e); |
351 | } | 351 | } |
352 | finally | ||
353 | { | ||
354 | if (stream != null) | ||
355 | stream.Close(); | ||
356 | } | ||
352 | } | 357 | } |
353 | 358 | ||
354 | 359 | ||
@@ -493,19 +498,20 @@ namespace Flotsam.RegionModules.AssetCache | |||
493 | 498 | ||
494 | private void WriteFileCache(string filename, AssetBase asset) | 499 | private void WriteFileCache(string filename, AssetBase asset) |
495 | { | 500 | { |
501 | Stream stream = null; | ||
502 | // Make sure the target cache directory exists | ||
503 | string directory = Path.GetDirectoryName(filename); | ||
504 | // Write file first to a temp name, so that it doesn't look | ||
505 | // like it's already cached while it's still writing. | ||
506 | string tempname = Path.Combine(directory, Path.GetRandomFileName()); | ||
496 | try | 507 | try |
497 | { | 508 | { |
498 | // Make sure the target cache directory exists | ||
499 | string directory = Path.GetDirectoryName(filename); | ||
500 | if (!Directory.Exists(directory)) | 509 | if (!Directory.Exists(directory)) |
501 | { | 510 | { |
502 | Directory.CreateDirectory(directory); | 511 | Directory.CreateDirectory(directory); |
503 | } | 512 | } |
504 | 513 | ||
505 | // Write file first to a temp name, so that it doesn't look | 514 | stream = File.Open(tempname, FileMode.Create); |
506 | // like it's already cached while it's still writing. | ||
507 | string tempname = Path.Combine(directory, Path.GetRandomFileName()); | ||
508 | Stream stream = File.Open(tempname, FileMode.Create); | ||
509 | BinaryFormatter bformatter = new BinaryFormatter(); | 515 | BinaryFormatter bformatter = new BinaryFormatter(); |
510 | bformatter.Serialize(stream, asset); | 516 | bformatter.Serialize(stream, asset); |
511 | stream.Close(); | 517 | stream.Close(); |
@@ -522,6 +528,9 @@ namespace Flotsam.RegionModules.AssetCache | |||
522 | } | 528 | } |
523 | finally | 529 | finally |
524 | { | 530 | { |
531 | if (stream != null) | ||
532 | stream.Close(); | ||
533 | |||
525 | // Even if the write fails with an exception, we need to make sure | 534 | // Even if the write fails with an exception, we need to make sure |
526 | // that we release the lock on that file, otherwise it'll never get | 535 | // that we release the lock on that file, otherwise it'll never get |
527 | // cached | 536 | // cached |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 50d7c97..45e724d 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -367,7 +367,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
367 | // Encode outbound data | 367 | // Encode outbound data |
368 | if (OutboundBody.Length > 0) | 368 | if (OutboundBody.Length > 0) |
369 | { | 369 | { |
370 | byte[] data = Encoding.UTF8.GetBytes(OutboundBody); | 370 | byte[] data = Util.UTF8.GetBytes(OutboundBody); |
371 | 371 | ||
372 | Request.ContentLength = data.Length; | 372 | Request.ContentLength = data.Length; |
373 | Stream bstream = Request.GetRequestStream(); | 373 | Stream bstream = Request.GetRequestStream(); |
@@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
390 | if (count != 0) | 390 | if (count != 0) |
391 | { | 391 | { |
392 | // translate from bytes to ASCII text | 392 | // translate from bytes to ASCII text |
393 | tempString = Encoding.UTF8.GetString(buf, 0, count); | 393 | tempString = Util.UTF8.GetString(buf, 0, count); |
394 | 394 | ||
395 | // continue building the string | 395 | // continue building the string |
396 | sb.Append(tempString); | 396 | sb.Append(tempString); |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 040d0a3..901144a 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -397,10 +397,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
397 | // with the powers requested (powers = 0 for no powers check) | 397 | // with the powers requested (powers = 0 for no powers check) |
398 | protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) | 398 | protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) |
399 | { | 399 | { |
400 | IClientAPI client = m_scene.GetScenePresence(userID).ControllingClient; | 400 | ScenePresence sp = m_scene.GetScenePresence(userID); |
401 | 401 | if (sp != null) | |
402 | return ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) && | 402 | { |
403 | ((powers == 0) || ((client.ActiveGroupPowers & powers) == powers))); | 403 | IClientAPI client = sp.ControllingClient; |
404 | |||
405 | return ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) && | ||
406 | ((powers == 0) || ((client.ActiveGroupPowers & powers) == powers))); | ||
407 | } | ||
408 | return false; | ||
404 | } | 409 | } |
405 | 410 | ||
406 | /// <summary> | 411 | /// <summary> |
@@ -576,9 +581,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
576 | return objectOwnerMask; | 581 | return objectOwnerMask; |
577 | } | 582 | } |
578 | 583 | ||
584 | if ((objectOwnerMask & (uint)PermissionMask.Transfer) != 0 && task.ObjectSaleType != 0) | ||
585 | objectEveryoneMask |= (uint)PrimFlags.ObjectTransfer; | ||
586 | |||
579 | // Group permissions | 587 | // Group permissions |
580 | if ((task.GroupID != UUID.Zero) && IsGroupMember(task.GroupID, user, 0)) | 588 | if ((task.GroupID != UUID.Zero) && IsGroupMember(task.GroupID, user, 0)) |
581 | return objectGroupMask; | 589 | return objectGroupMask | objectEveryoneMask; |
582 | 590 | ||
583 | return objectEveryoneMask; | 591 | return objectEveryoneMask; |
584 | } | 592 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs index 3eb7cd2..a70ef13 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/LLRAW.cs | |||
@@ -36,10 +36,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
36 | { | 36 | { |
37 | public struct HeightmapLookupValue : IComparable<HeightmapLookupValue> | 37 | public struct HeightmapLookupValue : IComparable<HeightmapLookupValue> |
38 | { | 38 | { |
39 | public int Index; | 39 | public ushort Index; |
40 | public double Value; | 40 | public float Value; |
41 | 41 | ||
42 | public HeightmapLookupValue(int index, double value) | 42 | public HeightmapLookupValue(ushort index, float value) |
43 | { | 43 | { |
44 | Index = index; | 44 | Index = index; |
45 | Value = value; | 45 | Value = value; |
@@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
62 | { | 62 | { |
63 | for (int j = 0; j < 256; j++) | 63 | for (int j = 0; j < 256; j++) |
64 | { | 64 | { |
65 | LookupHeightTable[i + (j * 256)] = new HeightmapLookupValue(i + (j * 256), ((double)i * ((double)j / 128.0d))); | 65 | LookupHeightTable[i + (j * 256)] = new HeightmapLookupValue((ushort)(i + (j * 256)), (float)((double)i * ((double)j / 128.0d))); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | Array.Sort<HeightmapLookupValue>(LookupHeightTable); | 68 | Array.Sort<HeightmapLookupValue>(LookupHeightTable); |
@@ -196,7 +196,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
196 | 196 | ||
197 | // The lookup table is pre-sorted, so we either find an exact match or | 197 | // The lookup table is pre-sorted, so we either find an exact match or |
198 | // the next closest (smaller) match with a binary search | 198 | // the next closest (smaller) match with a binary search |
199 | index = Array.BinarySearch<HeightmapLookupValue>(LookupHeightTable, new HeightmapLookupValue(0, t)); | 199 | index = Array.BinarySearch<HeightmapLookupValue>(LookupHeightTable, new HeightmapLookupValue(0, (float)t)); |
200 | if (index < 0) | 200 | if (index < 0) |
201 | index = ~index - 1; | 201 | index = ~index - 1; |
202 | 202 | ||