]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common source files not applicable to open-vm-tools.
authorKruti Pendharkar <kp025370@broadcom.com>
Mon, 1 Dec 2025 06:48:33 +0000 (22:48 -0800)
committerKruti Pendharkar <kp025370@broadcom.com>
Mon, 1 Dec 2025 06:48:33 +0000 (22:48 -0800)
open-vm-tools/services/plugins/dndcp/stringxx/string.cc
open-vm-tools/services/plugins/dndcp/stringxx/string.hh
open-vm-tools/services/plugins/dndcp/stringxx/ubstr_t.hh

index 33e1d925143feda6886cdffa301a6d4c9edb1d33..7a0579a0784f413a963172cf76616de5a94074bf 100644 (file)
@@ -327,6 +327,31 @@ string::string(const string& s) // IN
 }
 
 
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * utf::string::string --
+ *
+ *      Move constructor.
+ *
+ * Results:
+ *      None.
+ *
+ * Side effects:
+ *      None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+string::string(string&& s) // IN/OUT
+   : mUstr(),
+     mUtf16Cache(nullptr),
+     mUtf16Length(npos)
+{
+   swap(s);
+}
+
+
 /*
  *-----------------------------------------------------------------------------
  *
@@ -434,7 +459,7 @@ string::t_str() const
  *
  * utf::string::operator= --
  *
- *      Assignment operator.
+ *      Unifying (copy and move) assignment operator.
  *
  * Results:
  *      A reference to this string.
index 480974f3b09f3aa74368fe6e1fa83444fad515ec..fd90cb3d8567b00c4ad3d9bb983904ee5b2f099d 100644 (file)
@@ -154,6 +154,8 @@ public:
    string(const Glib::ustring &s);
    string(const string &s);
 
+   string(string&& s);
+
    ~string();
 
    // Implicit conversions
index e5ef0de950458f22aa77f93f106b2c0fe5982f6b..f2825f0f1423802ed11899808f55596a308df541 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (c) 2008-2024 Broadcom. All Rights Reserved.
+ * Copyright (c) 2008-2025 Broadcom. All Rights Reserved.
  * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -781,7 +781,10 @@ ubstr_t::operator _variant_t()
 inline void
 ubstr_t::swap(ubstr_t& s) // IN/OUT
 {
-   std::swap(mBstr, s.mBstr);
+   // `_bstr_t` reference-counts its internal `BSTR`, so using `std::swap`
+   // should be cheap.
+   using std::swap;
+   swap(mBstr, s.mBstr);
    mUTF8.swap(s.mUTF8);
 }