diff options
| -rw-r--r-- | indra/llcommon/lldate.cpp | 9 | ||||
| -rw-r--r-- | indra/llcommon/lldate.h | 9 | ||||
| -rw-r--r-- | indra/llcommon/llsd.cpp | 190 | ||||
| -rw-r--r-- | indra/llcommon/llsd.h | 40 | ||||
| -rw-r--r-- | indra/llcommon/llsdutil.cpp | 21 | ||||
| -rw-r--r-- | indra/llmath/llvolume.cpp | 12 | ||||
| -rw-r--r-- | indra/llmessage/llcorehttputil.cpp | 2 | ||||
| -rw-r--r-- | indra/llmessage/lltemplatemessagedispatcher.cpp | 6 | ||||
| -rw-r--r-- | indra/llprimitive/llmaterialid.cpp | 2 | ||||
| -rw-r--r-- | indra/llui/llnotifications.cpp | 2 | 
10 files changed, 200 insertions, 93 deletions
diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index c63c7012d1..b38864688d 100644 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -41,20 +41,11 @@  #include "llstring.h"  #include "llfasttimer.h" -static const F64 DATE_EPOCH = 0.0; -  static const F64 LL_APR_USEC_PER_SEC = 1000000.0;      // should be APR_USEC_PER_SEC, but that relies on INT64_C which      // isn't defined in glib under our build set up for some reason -LLDate::LLDate() : mSecondsSinceEpoch(DATE_EPOCH) -{} - -LLDate::LLDate(const LLDate& date) : -    mSecondsSinceEpoch(date.mSecondsSinceEpoch) -{} -  LLDate::LLDate(F64SecondsImplicit seconds_since_epoch) :      mSecondsSinceEpoch(seconds_since_epoch.value())  {} diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h index 81f2dd0d1c..1a69a04232 100644 --- a/indra/llcommon/lldate.h +++ b/indra/llcommon/lldate.h @@ -43,16 +43,13 @@   */  class LL_COMMON_API LLDate  { +    static constexpr F64 DATE_EPOCH = 0.0;  public:      /**       * @brief Construct a date equal to epoch.       */ -    LLDate(); - -    /** -     * @brief Construct a date equal to the source date. -     */ -    LLDate(const LLDate& date); +    constexpr LLDate() : mSecondsSinceEpoch(DATE_EPOCH) +    {}      /**       * @brief Construct a date from a seconds since epoch value. diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index b36ff7d263..2bbe06e72f 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -106,6 +106,9 @@ public:      static void reset(Impl*& var, Impl* impl);          ///< safely set var to refer to the new impl (possibly shared) +    static void move(Impl*& var, Impl*& impl); +        ///< safely move impl from one object to another +      static       Impl& safe(      Impl*);      static const Impl& safe(const Impl*);          ///< since a NULL Impl* is used for undefined, this ensures there is @@ -123,11 +126,17 @@ public:      virtual void assign(Impl*& var, LLSD::Boolean);      virtual void assign(Impl*& var, LLSD::Integer);      virtual void assign(Impl*& var, LLSD::Real); +    virtual void assign(Impl*& var, const char*);      virtual void assign(Impl*& var, const LLSD::String&);      virtual void assign(Impl*& var, const LLSD::UUID&);      virtual void assign(Impl*& var, const LLSD::Date&);      virtual void assign(Impl*& var, const LLSD::URI&);      virtual void assign(Impl*& var, const LLSD::Binary&); +    virtual void assign(Impl*& var, LLSD::String&&); +    virtual void assign(Impl*& var, LLSD::UUID&&); +    virtual void assign(Impl*& var, LLSD::Date&&); +    virtual void assign(Impl*& var, LLSD::URI&&); +    virtual void assign(Impl*& var, LLSD::Binary&&);          ///< If the receiver is the right type and unshared, these are simple          //   data assignments, othewise the default implementation handless          //   constructing the proper Impl subclass @@ -145,11 +154,11 @@ public:      virtual String asXMLRPCValue() const { return "<nil/>"; } -    virtual bool has(const String&) const       { return false; } -    virtual LLSD get(const String&) const       { return LLSD(); } +    virtual bool has(std::string_view) const      { return false; } +    virtual LLSD get(std::string_view) const      { return LLSD(); }      virtual LLSD getKeys() const                { return LLSD::emptyArray(); }      virtual void erase(const String&)           { } -    virtual const LLSD& ref(const String&) const{ return undef(); } +    virtual const LLSD& ref(std::string_view) const{ return undef(); }      virtual size_t size() const                 { return 0; }      virtual LLSD get(size_t) const              { return LLSD(); } @@ -185,7 +194,7 @@ namespace LLSDUnnamedNamespace  namespace  #endif  { -    template<LLSD::Type T, class Data, class DataRef = Data> +    template<LLSD::Type T, class Data, class DataRef = Data, class DataMove = Data>      class ImplBase : public LLSD::Impl          ///< This class handles most of the work for a subclass of Impl          //   for a given simple data type.  Subclasses of this provide the @@ -198,6 +207,7 @@ namespace      public:          ImplBase(DataRef value) : mValue(value) { } +        ImplBase(DataMove value) : mValue(std::move(value)) { }          virtual LLSD::Type type() const { return T; } @@ -212,11 +222,21 @@ namespace                  mValue = value;              }          } +        virtual void assign(LLSD::Impl*& var, DataMove value) { +            if (shared()) +            { +                Impl::assign(var, std::move(value)); +            } +            else +            { +                mValue = std::move(value); +            } +        }      }; -    class ImplBoolean -        : public ImplBase<LLSD::TypeBoolean, LLSD::Boolean> +    class ImplBoolean final +        : public ImplBase<LLSD::TypeBoolean, LLSD::Boolean, LLSD::Boolean, LLSD::Boolean&&>      {      public:          ImplBoolean(LLSD::Boolean v) : Base(v) { } @@ -238,8 +258,8 @@ namespace          { return mValue ? "true" : ""; } -    class ImplInteger -        : public ImplBase<LLSD::TypeInteger, LLSD::Integer> +    class ImplInteger final +        : public ImplBase<LLSD::TypeInteger, LLSD::Integer, LLSD::Integer, LLSD::Integer&&>      {      public:          ImplInteger(LLSD::Integer v) : Base(v) { } @@ -256,8 +276,8 @@ namespace          { return llformat("%d", mValue); } -    class ImplReal -        : public ImplBase<LLSD::TypeReal, LLSD::Real> +    class ImplReal final +        : public ImplBase<LLSD::TypeReal, LLSD::Real, LLSD::Real, LLSD::Real&&>      {      public:          ImplReal(LLSD::Real v) : Base(v) { } @@ -280,11 +300,12 @@ namespace          { return llformat("%lg", mValue); } -    class ImplString -        : public ImplBase<LLSD::TypeString, LLSD::String, const LLSD::String&> +    class ImplString final +        : public ImplBase<LLSD::TypeString, LLSD::String, const LLSD::String&, LLSD::String&&>      {      public:          ImplString(const LLSD::String& v) : Base(v) { } +        ImplString(LLSD::String&& v) : Base(std::move(v)) {}          virtual LLSD::Boolean   asBoolean() const   { return !mValue.empty(); }          virtual LLSD::Integer   asInteger() const; @@ -297,6 +318,19 @@ namespace          virtual const LLSD::String& asStringRef() const { return mValue; }          virtual LLSD::String asXMLRPCValue() const { return "<string>" + LLStringFn::xml_encode(mValue) + "</string>"; } + +        using LLSD::Impl::assign; // Unhiding base class virtuals... +        virtual void assign(LLSD::Impl*& var, const char* value) +        { +            if (shared()) +            { +                Impl::assign(var, value); +            } +            else +            { +                mValue = value; +            } +        }      };      LLSD::Integer ImplString::asInteger() const @@ -326,11 +360,12 @@ namespace      } -    class ImplUUID -        : public ImplBase<LLSD::TypeUUID, LLSD::UUID, const LLSD::UUID&> +    class ImplUUID final +        : public ImplBase<LLSD::TypeUUID, LLSD::UUID, const LLSD::UUID&, LLSD::UUID&&>      {      public:          ImplUUID(const LLSD::UUID& v) : Base(v) { } +        ImplUUID(LLSD::UUID&& v) : Base(std::move(v)) { }          virtual LLSD::String    asString() const{ return mValue.asString(); }          virtual LLSD::UUID      asUUID() const  { return mValue; } @@ -339,14 +374,18 @@ namespace      }; -    class ImplDate -        : public ImplBase<LLSD::TypeDate, LLSD::Date, const LLSD::Date&> +    class ImplDate final +        : public ImplBase<LLSD::TypeDate, LLSD::Date, const LLSD::Date&, LLSD::Date&&>      {      public:          ImplDate(const LLSD::Date& v) -            : ImplBase<LLSD::TypeDate, LLSD::Date, const LLSD::Date&>(v) +            : ImplBase(v)              { } +        ImplDate(LLSD::Date&& v) +            : ImplBase(std::move(v)) +        { } +          virtual LLSD::Integer asInteger() const          {              return (LLSD::Integer)(mValue.secondsSinceEpoch()); @@ -362,11 +401,12 @@ namespace      }; -    class ImplURI -        : public ImplBase<LLSD::TypeURI, LLSD::URI, const LLSD::URI&> +    class ImplURI final +        : public ImplBase<LLSD::TypeURI, LLSD::URI, const LLSD::URI&, LLSD::URI&&>      {      public:          ImplURI(const LLSD::URI& v) : Base(v) { } +        ImplURI(LLSD::URI&& v) : Base(std::move(v)) { }          virtual LLSD::String    asString() const{ return mValue.asString(); }          virtual LLSD::URI       asURI() const   { return mValue; } @@ -375,11 +415,12 @@ namespace      }; -    class ImplBinary -        : public ImplBase<LLSD::TypeBinary, LLSD::Binary, const LLSD::Binary&> +    class ImplBinary final +        : public ImplBase<LLSD::TypeBinary, LLSD::Binary, const LLSD::Binary&, LLSD::Binary&&>      {      public:          ImplBinary(const LLSD::Binary& v) : Base(v) { } +        ImplBinary(LLSD::Binary&& v) : Base(std::move(v)) { }          virtual const LLSD::Binary& asBinary() const{ return mValue; } @@ -387,10 +428,10 @@ namespace      }; -    class ImplMap : public LLSD::Impl +    class ImplMap final : public LLSD::Impl      {      private: -        typedef std::map<LLSD::String, LLSD> DataMap; +        typedef std::map<LLSD::String, LLSD, std::less<>> DataMap;          DataMap mData; @@ -419,17 +460,17 @@ namespace              return os.str();          } -        virtual bool has(const LLSD::String&) const; +        virtual bool has(std::string_view) const;          using LLSD::Impl::get; // Unhiding get(size_t)          using LLSD::Impl::erase; // Unhiding erase(size_t)          using LLSD::Impl::ref; // Unhiding ref(size_t) -        virtual LLSD get(const LLSD::String&) const; +        virtual LLSD get(std::string_view) const;          virtual LLSD getKeys() const; -                void insert(const LLSD::String& k, const LLSD& v); +        void insert(std::string_view k, const LLSD& v);          virtual void erase(const LLSD::String&); -                      LLSD& ref(const LLSD::String&); -        virtual const LLSD& ref(const LLSD::String&) const; +                      LLSD& ref(std::string_view); +        virtual const LLSD& ref(std::string_view) const;          virtual size_t size() const { return mData.size(); } @@ -457,14 +498,14 @@ namespace          }      } -    bool ImplMap::has(const LLSD::String& k) const +    bool ImplMap::has(const std::string_view k) const      {          LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD;          DataMap::const_iterator i = mData.find(k);          return i != mData.end();      } -    LLSD ImplMap::get(const LLSD::String& k) const +    LLSD ImplMap::get(const std::string_view k) const      {          LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD;          DataMap::const_iterator i = mData.find(k); @@ -484,10 +525,10 @@ namespace          return keys;      } -    void ImplMap::insert(const LLSD::String& k, const LLSD& v) +    void ImplMap::insert(std::string_view k, const LLSD& v)      {          LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD; -        mData.insert(DataMap::value_type(k, v)); +        mData.emplace(k, v);      }      void ImplMap::erase(const LLSD::String& k) @@ -496,15 +537,21 @@ namespace          mData.erase(k);      } -    LLSD& ImplMap::ref(const LLSD::String& k) +    LLSD& ImplMap::ref(std::string_view k)      { -        return mData[k]; +        DataMap::iterator i = mData.lower_bound(k); +        if (i == mData.end() || mData.key_comp()(k, i->first)) +        { +            return mData.emplace_hint(i, std::make_pair(k, LLSD()))->second; +        } + +        return i->second;      } -    const LLSD& ImplMap::ref(const LLSD::String& k) const +    const LLSD& ImplMap::ref(std::string_view k) const      {          DataMap::const_iterator i = mData.lower_bound(k); -        if (i == mData.end()  ||  mData.key_comp()(k, i->first)) +        if (i == mData.end() || mData.key_comp()(k, i->first))          {              return undef();          } @@ -532,7 +579,7 @@ namespace          {              //std::cout << "  " << (*iter).first << ": " << (*iter).second << std::endl;              Impl::calcStats((*iter).second, type_counts, share_counts); -            iter++; +            ++iter;          }          // Add in the values for this map @@ -691,7 +738,7 @@ namespace          while (iter != endArray())          {   // Add values for all items held in the array              Impl::calcStats((*iter), type_counts, share_counts); -            iter++; +            ++iter;          }          // Add in the values for this array @@ -729,6 +776,16 @@ void LLSD::Impl::reset(Impl*& var, Impl* impl)      var = impl;  } +void LLSD::Impl::move(Impl*& var, Impl*& impl) +{ +    if (var && var->mUseCount != STATIC_USAGE_COUNT && --var->mUseCount == 0) +    { +        delete var; // destroy var if usage falls to 0 and not static +    } +    var = impl; // Steal impl to var without incrementing use since this is a move +    impl = nullptr; // null out old-impl pointer +} +  LLSD::Impl& LLSD::Impl::safe(Impl* impl)  {      static Impl theUndefined(STATIC_USAGE_COUNT); @@ -782,6 +839,11 @@ void LLSD::Impl::assign(Impl*& var, LLSD::Real v)      reset(var, new ImplReal(v));  } +void LLSD::Impl::assign(Impl*& var, const char* v) +{ +    reset(var, new ImplString(v)); +} +  void LLSD::Impl::assign(Impl*& var, const LLSD::String& v)  {      reset(var, new ImplString(v)); @@ -807,6 +869,31 @@ void LLSD::Impl::assign(Impl*& var, const LLSD::Binary& v)      reset(var, new ImplBinary(v));  } +void LLSD::Impl::assign(Impl*& var, LLSD::String&& v) +{ +    reset(var, new ImplString(std::move(v))); +} + +void LLSD::Impl::assign(Impl*& var, LLSD::UUID&& v) +{ +    reset(var, new ImplUUID(std::move(v))); +} + +void LLSD::Impl::assign(Impl*& var, LLSD::Date&& v) +{ +    reset(var, new ImplDate(std::move(v))); +} + +void LLSD::Impl::assign(Impl*& var, LLSD::URI&& v) +{ +    reset(var, new ImplURI(std::move(v))); +} + +void LLSD::Impl::assign(Impl*& var, LLSD::Binary&& v) +{ +    reset(var, new ImplBinary(std::move(v))); +} +  const LLSD& LLSD::Impl::undef()  { @@ -879,6 +966,9 @@ LLSD::~LLSD()                           { FREE_LLSD_OBJECT; Impl::reset(impl, 0)  LLSD::LLSD(const LLSD& other) : impl(0) { ALLOC_LLSD_OBJECT;  assign(other); }  void LLSD::assign(const LLSD& other)    { Impl::assign(impl, other.impl); } +LLSD::LLSD(LLSD&& other) noexcept : impl(nullptr) { ALLOC_LLSD_OBJECT;  Impl::move(impl, other.impl); } +void  LLSD::assign(LLSD&& other) { Impl::move(impl, other.impl); } +LLSD& LLSD::operator=(LLSD&& other) noexcept { Impl::move(impl, other.impl); return *this; }  void LLSD::clear()                      { Impl::assignUndefined(impl); } @@ -893,6 +983,11 @@ LLSD::LLSD(const String& v) : impl(0)   { ALLOC_LLSD_OBJECT;    assign(v); }  LLSD::LLSD(const Date& v) : impl(0)     { ALLOC_LLSD_OBJECT;    assign(v); }  LLSD::LLSD(const URI& v) : impl(0)      { ALLOC_LLSD_OBJECT;    assign(v); }  LLSD::LLSD(const Binary& v) : impl(0)   { ALLOC_LLSD_OBJECT;    assign(v); } +LLSD::LLSD(UUID&& v) : impl(0)          { ALLOC_LLSD_OBJECT;    assign(std::move(v)); } +LLSD::LLSD(String&& v) : impl(0)        { ALLOC_LLSD_OBJECT;    assign(std::move(v)); } +LLSD::LLSD(Date&& v) : impl(0)          { ALLOC_LLSD_OBJECT;    assign(std::move(v)); } +LLSD::LLSD(URI&& v) : impl(0)           { ALLOC_LLSD_OBJECT;    assign(std::move(v)); } +LLSD::LLSD(Binary&& v) : impl(0)        { ALLOC_LLSD_OBJECT;    assign(std::move(v)); }  // Scalar Assignment  void LLSD::assign(Boolean v)            { safe(impl).assign(impl, v); } @@ -903,6 +998,11 @@ void LLSD::assign(const UUID& v)        { safe(impl).assign(impl, v); }  void LLSD::assign(const Date& v)        { safe(impl).assign(impl, v); }  void LLSD::assign(const URI& v)         { safe(impl).assign(impl, v); }  void LLSD::assign(const Binary& v)      { safe(impl).assign(impl, v); } +void LLSD::assign(String&& v)           { safe(impl).assign(impl, std::move(v)); } +void LLSD::assign(UUID&& v)             { safe(impl).assign(impl, std::move(v)); } +void LLSD::assign(Date&& v)             { safe(impl).assign(impl, std::move(v)); } +void LLSD::assign(URI&& v)              { safe(impl).assign(impl, std::move(v)); } +void LLSD::assign(Binary&& v)           { safe(impl).assign(impl, std::move(v)); }  // Scalar Accessors  LLSD::Boolean   LLSD::asBoolean() const { return safe(impl).asBoolean(); } @@ -1069,7 +1169,7 @@ bool LLSD::fromXMLRPCValue(TreeNode* node)  LLSD::LLSD(const char* v) : impl(0)     { ALLOC_LLSD_OBJECT;    assign(v); }  void LLSD::assign(const char* v)  { -    if(v) assign(std::string(v)); +    if(v) safe(impl).assign(impl, v);      else assign(std::string());  } @@ -1081,24 +1181,24 @@ LLSD LLSD::emptyMap()      return v;  } -bool LLSD::has(const String& k) const   { return safe(impl).has(k); } -LLSD LLSD::get(const String& k) const   { return safe(impl).get(k); } +bool LLSD::has(const std::string_view k) const  { return safe(impl).has(k); } +LLSD LLSD::get(const std::string_view k) const  { return safe(impl).get(k); }  LLSD LLSD::getKeys() const              { return safe(impl).getKeys(); } -void LLSD::insert(const String& k, const LLSD& v) { makeMap(impl).insert(k, v); } +void LLSD::insert(std::string_view k, const LLSD& v) { makeMap(impl).insert(k, v); } -LLSD& LLSD::with(const String& k, const LLSD& v) +LLSD& LLSD::with(std::string_view k, const LLSD& v)                                          {                                              makeMap(impl).insert(k, v);                                              return *this;                                          }  void LLSD::erase(const String& k)       { makeMap(impl).erase(k); } -LLSD& LLSD::operator[](const String& k) +LLSD& LLSD::operator[](const std::string_view k)  {      LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD;      return makeMap(impl).ref(k);  } -const LLSD& LLSD::operator[](const String& k) const +const LLSD& LLSD::operator[](const std::string_view k) const  {      LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD;      return safe(impl).ref(k); diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index 5532decfc3..781e8d58e9 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -161,6 +161,13 @@ public:      //@} +    /** @name Movable */ +    //@{ +        LLSD(LLSD&& other) noexcept; +        void  assign(LLSD&& other); +        LLSD& operator=(LLSD&& other) noexcept; +    //@} +      void clear();   ///< resets to Undefined @@ -188,6 +195,11 @@ public:          LLSD(const Date&);          LLSD(const URI&);          LLSD(const Binary&); +        LLSD(String&&); +        LLSD(UUID&&); +        LLSD(Date&&); +        LLSD(URI&&); +        LLSD(Binary&&);      //@}      /** @name Convenience Constructors */ @@ -215,6 +227,11 @@ public:          void assign(const Date&);          void assign(const URI&);          void assign(const Binary&); +        void assign(String&&); +        void assign(UUID&&); +        void assign(Date&&); +        void assign(URI&&); +        void assign(Binary&&);          LLSD& operator=(Boolean v)          { assign(v); return *this; }          LLSD& operator=(Integer v)          { assign(v); return *this; } @@ -224,6 +241,11 @@ public:          LLSD& operator=(const Date& v)      { assign(v); return *this; }          LLSD& operator=(const URI& v)       { assign(v); return *this; }          LLSD& operator=(const Binary& v)    { assign(v); return *this; } +        LLSD& operator=(String&& v)         { assign(std::move(v)); return *this; } +        LLSD& operator=(UUID&& v)               { assign(std::move(v)); return *this; } +        LLSD& operator=(Date&& v)               { assign(std::move(v)); return *this; } +        LLSD& operator=(URI&& v)                { assign(std::move(v)); return *this; } +        LLSD& operator=(Binary&& v)         { assign(std::move(v)); return *this; }      //@}      /** @@ -306,24 +328,22 @@ public:      //@{          static LLSD emptyMap(); -        bool has(const String&) const; -        LLSD get(const String&) const; +        bool has(const std::string_view) const; +        LLSD get(const std::string_view) const;          LLSD getKeys() const;               // Return an LLSD array with keys as strings -        void insert(const String&, const LLSD&); +        void insert(std::string_view, const LLSD&);          void erase(const String&); -        LLSD& with(const String&, const LLSD&); +        LLSD& with(std::string_view, const LLSD&); -        LLSD& operator[](const String&); +        LLSD& operator[](const std::string_view);          LLSD& operator[](const char* c)          { -            LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD; -            return (*this)[String(c)]; +            return c ? (*this)[std::string_view(c)] : *this;          } -        const LLSD& operator[](const String&) const; +        const LLSD& operator[](const std::string_view) const;          const LLSD& operator[](const char* c) const          { -            LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD; -            return (*this)[String(c)]; +            return c ? (*this)[std::string_view(c)] : *this;          }      //@} diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index dd3a58c26d..34aa0bc070 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -51,7 +51,7 @@  // U32  LLSD ll_sd_from_U32(const U32 val)  { -    std::vector<U8> v; +    LLSD::Binary v;      U32 net_order = htonl(val);      v.resize(4); @@ -63,7 +63,7 @@ LLSD ll_sd_from_U32(const U32 val)  U32 ll_U32_from_sd(const LLSD& sd)  {      U32 ret; -    std::vector<U8> v = sd.asBinary(); +    const LLSD::Binary& v = sd.asBinary();      if (v.size() < 4)      {          return 0; @@ -76,7 +76,7 @@ U32 ll_U32_from_sd(const LLSD& sd)  //U64  LLSD ll_sd_from_U64(const U64 val)  { -    std::vector<U8> v; +    LLSD::Binary v;      U32 high, low;      high = (U32)(val >> 32); @@ -94,7 +94,7 @@ LLSD ll_sd_from_U64(const U64 val)  U64 ll_U64_from_sd(const LLSD& sd)  {      U32 high, low; -    std::vector<U8> v = sd.asBinary(); +    const LLSD::Binary& v = sd.asBinary();      if (v.size() < 8)      { @@ -112,7 +112,7 @@ U64 ll_U64_from_sd(const LLSD& sd)  // 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; +    LLSD::Binary v;      v.resize(4);      memcpy(&(v[0]), &val, 4);       /* Flawfinder: ignore */ @@ -123,7 +123,7 @@ LLSD ll_sd_from_ipaddr(const U32 val)  U32 ll_ipaddr_from_sd(const LLSD& sd)  {      U32 ret; -    std::vector<U8> v = sd.asBinary(); +    const LLSD::Binary& v = sd.asBinary();      if (v.size() < 4)      {          return 0; @@ -135,17 +135,17 @@ U32 ll_ipaddr_from_sd(const LLSD& sd)  // Converts an LLSD binary to an LLSD string  LLSD ll_string_from_binary(const LLSD& sd)  { -    std::vector<U8> value = sd.asBinary(); +    const LLSD::Binary& value = sd.asBinary();      std::string str;      str.resize(value.size()); -    memcpy(&str[0], &value[0], value.size()); +    memcpy(&str[0], value.data(), value.size());      return str;  }  // Converts an LLSD string to an LLSD binary  LLSD ll_binary_from_string(const LLSD& sd)  { -    std::vector<U8> binary_value; +    LLSD::Binary binary_value;      std::string string_value = sd.asString();      for (const U8 c : string_value) @@ -990,8 +990,7 @@ LLSD llsd_clone(LLSD value, LLSD filter)      case LLSD::TypeBinary:      { -        LLSD::Binary bin(value.asBinary().begin(), value.asBinary().end()); -        clone = LLSD::Binary(bin); +        clone = LLSD::Binary(value.asBinary().begin(), value.asBinary().end());          break;      }      default: diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index f3db9424d9..b56ecc9075 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2345,11 +2345,11 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)                  continue;              } -            LLSD::Binary pos = mdl[i]["Position"]; -            LLSD::Binary norm = mdl[i]["Normal"]; -            LLSD::Binary tangent = mdl[i]["Tangent"]; -            LLSD::Binary tc = mdl[i]["TexCoord0"]; -            LLSD::Binary idx = mdl[i]["TriangleList"]; +            const LLSD::Binary& pos = mdl[i]["Position"].asBinary(); +            const LLSD::Binary& norm = mdl[i]["Normal"].asBinary(); +            const LLSD::Binary& tangent = mdl[i]["Tangent"].asBinary(); +            const LLSD::Binary& tc = mdl[i]["TexCoord0"].asBinary(); +            const LLSD::Binary& idx = mdl[i]["TriangleList"].asBinary();              //copy out indices              auto num_indices = idx.size() / 2; @@ -2538,7 +2538,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)                      continue;                  } -                LLSD::Binary weights = mdl[i]["Weights"]; +                const LLSD::Binary& weights = mdl[i]["Weights"].asBinary();                  U32 idx = 0; diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index 684e96883f..3fdc691141 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -523,7 +523,7 @@ LLSD HttpCoroRawHandler::handleSuccess(LLCore::HttpResponse * response, LLCore::      bas >> std::noskipws;      data.assign(std::istream_iterator<U8>(bas), std::istream_iterator<U8>()); -    result[HttpCoroutineAdapter::HTTP_RESULTS_RAW] = data; +    result[HttpCoroutineAdapter::HTTP_RESULTS_RAW] = std::move(data);  #else      // This is disabled because it's dangerous.  See the other case for an diff --git a/indra/llmessage/lltemplatemessagedispatcher.cpp b/indra/llmessage/lltemplatemessagedispatcher.cpp index 0e709d6c75..edbeb4acc1 100644 --- a/indra/llmessage/lltemplatemessagedispatcher.cpp +++ b/indra/llmessage/lltemplatemessagedispatcher.cpp @@ -43,7 +43,7 @@ void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name,                                             const LLSD& message,                                             LLHTTPNode::ResponsePtr responsep)  { -    std::vector<U8> data = message["body"]["binary-template-data"].asBinary(); +    const LLSD::Binary& data = message["body"]["binary-template-data"].asBinary();      auto size = data.size();      if(size == 0)      { @@ -53,11 +53,11 @@ void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name,      LLHost host;      host = gMessageSystem->getSender(); -    bool validate_message = mTemplateMessageReader.validateMessage(&(data[0]), static_cast<S32>(size), host, true); +    bool validate_message = mTemplateMessageReader.validateMessage(data.data(), static_cast<S32>(size), host, true);      if (validate_message)      { -        mTemplateMessageReader.readMessage(&(data[0]),host); +        mTemplateMessageReader.readMessage(data.data(),host);      }      else      { diff --git a/indra/llprimitive/llmaterialid.cpp b/indra/llprimitive/llmaterialid.cpp index 847824d770..4992b282f3 100644 --- a/indra/llprimitive/llmaterialid.cpp +++ b/indra/llprimitive/llmaterialid.cpp @@ -136,7 +136,7 @@ LLSD LLMaterialID::asLLSD() const      materialIDBinary.resize(MATERIAL_ID_SIZE * sizeof(U8));      memcpy(materialIDBinary.data(), mID, MATERIAL_ID_SIZE * sizeof(U8)); -    LLSD materialID = materialIDBinary; +    LLSD materialID = std::move(materialIDBinary);      return materialID;  } diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 8a73148631..cd80e7f63f 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -861,7 +861,7 @@ void LLNotification::init(const std::string& template_name, const LLSD& form_ele      for (LLStringUtil::format_map_t::const_iterator iter = default_args.begin();           iter != default_args.end(); ++iter)      { -        mSubstitutions[iter->first] = iter->second; +        mSubstitutions[std::string(iter->first)] = iter->second;      }      mSubstitutions["_URL"] = getURL();      mSubstitutions["_NAME"] = template_name;  | 
