aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorMic Bowman2013-02-08 15:46:42 -0800
committerMic Bowman2013-02-08 15:46:42 -0800
commit6d825d7ea22f5accd1324a4ef8800eddb8dc86da (patch)
treee0b6fa5252bbb0b06e23ca8bb7a50cedd5218c14 /OpenSim/Region/OptionalModules
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-6d825d7ea22f5accd1324a4ef8800eddb8dc86da.zip
opensim-SC_OLD-6d825d7ea22f5accd1324a4ef8800eddb8dc86da.tar.gz
opensim-SC_OLD-6d825d7ea22f5accd1324a4ef8800eddb8dc86da.tar.bz2
opensim-SC_OLD-6d825d7ea22f5accd1324a4ef8800eddb8dc86da.tar.xz
Broaden the internal OSD type checks to parse JSON that has
non string values.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs31
1 files changed, 29 insertions, 2 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
index 088d0cd..5c89717 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
@@ -145,7 +145,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
145 if (result == null) 145 if (result == null)
146 return false; 146 return false;
147 147
148 if (useJson || result.Type == OSDType.String) 148 if (useJson || OSDBaseType(result.Type))
149 return true; 149 return true;
150 150
151 return false; 151 return false;
@@ -531,7 +531,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
531 return true; 531 return true;
532 } 532 }
533 533
534 if (result.Type == OSDType.String) 534 if (OSDBaseType(result.Type))
535 { 535 {
536 value = result.AsString(); 536 value = result.AsString();
537 return true; 537 return true;
@@ -562,6 +562,33 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
562 /// 562 ///
563 /// </summary> 563 /// </summary>
564 // ----------------------------------------------------------------- 564 // -----------------------------------------------------------------
565 protected static bool OSDBaseType(OSDType type)
566 {
567 // Should be the list of base types for which AsString() returns
568 // something useful
569 if (type == OSDType.Boolean)
570 return true;
571 if (type == OSDType.Integer)
572 return true;
573 if (type == OSDType.Real)
574 return true;
575 if (type == OSDType.String)
576 return true;
577 if (type == OSDType.UUID)
578 return true;
579 if (type == OSDType.Date)
580 return true;
581 if (type == OSDType.URI)
582 return true;
583
584 return false;
585 }
586
587 // -----------------------------------------------------------------
588 /// <summary>
589 ///
590 /// </summary>
591 // -----------------------------------------------------------------
565 protected static int ComputeSizeOf(OSD value) 592 protected static int ComputeSizeOf(OSD value)
566 { 593 {
567 string sval; 594 string sval;