summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorJosh Bell <josh@lindenlab.com>2007-01-15 19:49:52 +0000
committerJosh Bell <josh@lindenlab.com>2007-01-15 19:49:52 +0000
commitfc664e93e62645fc6e9659664351e77f3c4b374f (patch)
treebd6396d91d95d4e670e32b88a8f7df713e574d56 /indra
parentaeb6d0c93c1122c1320f99c1a652a5e2f1d60d52 (diff)
Port fix for SL-32157 "PowerPC Mac crashes when crossing regions or teleporting with capabilities turned on" from Branch 1-13-2 r56710 via partial merge of release-candidate -r 56743:56744
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llsdutil.cpp23
-rw-r--r--indra/llcommon/llsdutil.h4
2 files changed, 27 insertions, 0 deletions
diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp
index 8fe43736e4..7cd0ed4c08 100644
--- a/indra/llcommon/llsdutil.cpp
+++ b/indra/llcommon/llsdutil.cpp
@@ -180,3 +180,26 @@ U64 ll_U64_from_sd(const LLSD& sd)
return ((U64)high) << 32 | low;
}
+
+// IP Address (stored in net order in a U32, so don't need swizzling)
+LLSD ll_sd_from_ipaddr(const U32 val)
+{
+ std::vector<U8> v;
+
+ v.resize(4);
+ memcpy(&(v[0]), &val, 4); /* Flawfinder: ignore */
+
+ return LLSD(v);
+}
+
+U32 ll_ipaddr_from_sd(const LLSD& sd)
+{
+ U32 ret;
+ std::vector<U8> v = sd.asBinary();
+ if (v.size() < 4)
+ {
+ return 0;
+ }
+ memcpy(&ret, &(v[0]), 4); /* Flawfinder: ignore */
+ return ret;
+}
diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h
index 9369f1a39f..79961c5311 100644
--- a/indra/llcommon/llsdutil.h
+++ b/indra/llcommon/llsdutil.h
@@ -47,4 +47,8 @@ U32 ll_U32_from_sd(const LLSD& sd);
LLSD ll_sd_from_U64(const U64);
U64 ll_U64_from_sd(const LLSD& sd);
+// IP Address
+LLSD ll_sd_from_ipaddr(const U32);
+U32 ll_ipaddr_from_sd(const LLSD& sd);
+
#endif // LL_LLSDUTIL_H