]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Internal branch sync. Included in this change:
authorVMware, Inc <>
Mon, 21 May 2012 22:23:35 +0000 (15:23 -0700)
committerDmitry Torokhov <dtor@vmware.com>
Tue, 22 May 2012 18:57:12 +0000 (11:57 -0700)
. another fix for File_PathJoin

. remove the utf::string _variant_t/uvariant_t constructors

. changes in shared code that don't affect open-vm-tools functionality

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
open-vm-tools/lib/file/fileStandAlone.c
open-vm-tools/lib/include/vm_product.h
open-vm-tools/lib/include/vm_version.h
open-vm-tools/services/plugins/dndcp/stringxx/string.cc
open-vm-tools/services/plugins/dndcp/stringxx/string.hh

index 6b01532d0620a2962f26d43be38c5854f3a57d31..50b2c3e79ffe70702b08b7120aa7ad25ad387c55 100644 (file)
@@ -323,19 +323,23 @@ File_SplitName(ConstUnicode pathName,  // IN:
  *      Join the dirName and baseName together to create a (full) path.
  *
  *      This code concatenates two strings together and omits a redundant
- *      directory separator between the two. It does not treat a fully qualified
- *      baseName the way one would expect:
+ *      directory separator between the two.
  *
+ *      On Windows, the 'baseName' argument may not be a fully qualified path.
+ *      That is, it may not be an absolute path containing a drive letter nor
+ *      may it be a UNC path.
+ *
+ * Examples:
  *      File_PathJoin("", "b")            -> "/b"
  *      File_PathJoin("/", "b")           -> "/b"
  *      File_PathJoin("a", "b")           -> "a/b"
  *      File_PathJoin("a/", "b")          -> "a/b"
  *      File_PathJoin("a/////", "b")      -> "a/b"
  *      File_PathJoin("a", "")            -> "a/"
- *      File_PathJoin("a", "/")           -> "a/"  (only posix)
- *      File_PathJoin("a", "/b")          -> "a/b" (only posix)
+ *      File_PathJoin("a", "/")           -> "a/"
+ *      File_PathJoin("a", "/b")          -> "a/b"
  *      File_PathJoin("a", "/////b")      -> "a/b" (only posix)
- *      File_PathJoin("a/", "/b")         -> "a/b" (only posix)
+ *      File_PathJoin("a/", "/b")         -> "a/b"
  *      File_PathJoin("a/////", "/////b") -> "a/b" (only posix)
  *
  * Results:
@@ -349,7 +353,7 @@ File_SplitName(ConstUnicode pathName,  // IN:
 
 Unicode
 File_PathJoin(ConstUnicode dirName,   // IN:
-              ConstUnicode baseName)  // IN:
+              ConstUnicode baseName)  // IN: See above.
 {
    Unicode result;
    Unicode newDir = NULL;
@@ -357,17 +361,31 @@ File_PathJoin(ConstUnicode dirName,   // IN:
    ASSERT(dirName);
    ASSERT(baseName);
 
-#if defined(_WIN32)
-   ASSERT(!Unicode_StartsWith(baseName, DIRSEPS));
-   ASSERT(!Unicode_StartsWith(baseName, "/"));
-   ASSERT(Unicode_LengthInCodePoints(baseName) < 2 ||
-          Unicode_FindSubstrInRange(baseName, 1, 1, ":", 0, 1) ==
-          UNICODE_INDEX_NOT_FOUND);
-#else
    /*
     * Remove ALL directory separators from baseName begin.
     */
-   while(Unicode_StartsWith(baseName, DIRSEPS)) {
+#if defined(_WIN32)
+   {
+      ConstUnicode oldBaseName = baseName;
+
+      /*
+       * Reject drive letters in baseName.
+       */
+      ASSERT(Unicode_LengthInCodePoints(baseName) < 2 ||
+             Unicode_FindSubstrInRange(baseName, 1, 1, ":", 0, 1) ==
+             UNICODE_INDEX_NOT_FOUND);
+
+      while (*baseName == '/' || *baseName == '\\') {
+         baseName++;
+      }
+
+      /*
+       * Reject UNC paths for baseName.
+       */
+      ASSERT(baseName - oldBaseName < 2);
+   }
+#else
+   while (*baseName == '/') {
       baseName++;
    }
 #endif
index b75525a7514bddddd6e7c415c45d68aec80dbf5e..03da1fd2c3953256d44b6e08bdb2756262254e2f 100644 (file)
  *
  * VMRC is versioned x.y.z - ProgID is intentionally built using only x.y
  */
-#define PRODUCT_VMRC_PLUGIN_GUID_EMBEDDED      6FB1850B-AC2A-4AEA-9847-EBCE6AB2A62E
-#define PRODUCT_VMRC_PLUGIN_GUID_TYPELIB       EF9A6976-4861-49B5-AFED-05281B5887C5
+#define PRODUCT_VMRC_PLUGIN_GUID_EMBEDDED      4AEA1010-0A0C-405E-9B74-767FC8A998CB
+#define PRODUCT_VMRC_PLUGIN_GUID_TYPELIB       E82F3B76-A628-4486-B197-03780F86063A
 #define PRODUCT_VMRC_PLUGIN_PROGID_EMBEDDED_BASE "VMware.RemoteConsole"
 #define PRODUCT_VMRC_PLUGIN_PROGID_EMBEDDED    PRODUCT_VMRC_PLUGIN_PROGID_EMBEDDED_BASE "." \
                                                XSTR(VMRC_PLUGIN_VERSION_BASE)
 #endif
 
 #define PRODUCT_VMRC_PLUGIN_CURRENT_MIMETYPE \
-   "application/x-vmware-remote-console"
-
-/*
- * legacy plugin mimetypes (currently unused but here for reference)
- */
-#define PRODUCT_VMRC_PLUGIN_LEGACY_MIMETYPES \
-   "application/x-vmware-vmrc;version=2.5.0.199067" PRODUCT_VMRC_MIMETYPE_SEPARATOR \
-   "application/x-vmware-vmrc;version=2.5.0.158248" PRODUCT_VMRC_MIMETYPE_SEPARATOR \
-   "application/x-vmware-vmrc;version=2.5.0.116460" PRODUCT_VMRC_MIMETYPE_SEPARATOR \
-   "application/x-vmware-vmrc;version=2.5.0.0" PRODUCT_VMRC_MIMETYPE_SEPARATOR \
-   "application/x-vmware-mks;version=2.1.0.0" PRODUCT_VMRC_MIMETYPE_SEPARATOR \
-   "application/x-vmware-mks;version=2.0.1.0" PRODUCT_VMRC_MIMETYPE_SEPARATOR \
-   "application/x-vmware-mks;version=2.0.0.0" PRODUCT_VMRC_MIMETYPE_SEPARATOR
+   "application/x-vmware-remote-console-2012"
 
 /*
  * All supported plugin mimetypes
index c89c5fba479789e7b74095ba714c3fb348479a82..57c956a0400c42f30d8460f4c926055886c4cf11 100644 (file)
 // See the VMRC_PLUGIN_VERSION section in /mk/defs-onetime.mk
 
 #define VMRC_PLUGIN_VERSION_MAJOR 5
-#define VMRC_PLUGIN_VERSION_MINOR 0
+#define VMRC_PLUGIN_VERSION_MINOR 1
 #define VMRC_PLUGIN_VERSION_Z     0
 
 /*
  * #define VMRC_PLUGIN_VERSION_NUMBER       \
  *         XSTR(VMRC_PLUGIN_VERSION_MAJOR) "." XSTR(VMRC_PLUGIN_VERSION_MINOR) "." XSTR(VMRC_PLUGIN_VERSION_Z)
  */
-#define VMRC_PLUGIN_VERSION_NUMBER "5.0.0"
+#define VMRC_PLUGIN_VERSION_NUMBER "5.1.0"
 
 /* this version number should always match real VMRC & plugin version number */
 #define VMRC_VERSION VMRC_PLUGIN_VERSION_NUMBER
index a8540ca5d1ea31d3f9e5dba6b67d1dd0959b27b1..ce7030dd9c6c40da37698bc27989a2bc48398ef0 100644 (file)
@@ -96,50 +96,6 @@ string::string(ConstUnicode s) // IN
 
 
 #ifdef _WIN32
-
-/*
- *-----------------------------------------------------------------------------
- *
- * utf::string::init_bstr_t --
- *
- *      Utility function to construct from a _bstr_t object.
- *      Copies the UTF-16 representation of the _bstr_t.
- *
- * Results:
- *      None.
- *
- * Side effects:
- *      Makes a copy of the _bstr_t data and frees that data when
- *      the utf::string is destroyed.
- *
- * Note:
- *      WIN32 only call
- *
- *-----------------------------------------------------------------------------
- */
-
-void
-string::init_bstr_t(const _bstr_t &s) // IN
-{
-   // If the input is empty, then there's nothing to do.
-   if (s.length() == 0) {
-      return;
-   }
-
-   Unicode utf8 = Unicode_AllocWithUTF16(static_cast<const utf16_t *>(s));
-
-   try {
-      mUstr = utf8;
-      Unicode_Free(utf8);
-   } catch (...) {
-      Unicode_Free(utf8);
-      throw;
-   }
-
-   ASSERT(Validate(mUstr));
-}
-
-
 /*
  *-----------------------------------------------------------------------------
  *
@@ -202,93 +158,23 @@ string::string(const _bstr_t &s) // IN
      mUtf16Cache(NULL),
      mUtf16Length(npos)
 {
-   init_bstr_t(s);
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * utf::string::string --
- *
- *      Constructor from a uvariant_t object. Copies the UTF-16 representation
- *      of the ubstr_t interface.
- *
- * Results:
- *      None.
- *
- * Side effects:
- *      Makes a copy of the uvariant_t data and frees that data when the
- *      utf::string is destroyed.
- *
- * Note:
- *      WIN32 only call
- *
- *-----------------------------------------------------------------------------
- */
-
-string::string(const uvariant_t &v) // IN
-   : mUstr(),
-     mUtf16Cache(NULL),
-     mUtf16Length(npos)
-{
-   ubstr_t s;
-
-   try {
-      s = v;
-   } catch (...) {
-      Warning("Invalid uvariant_t to ubstr_t conversion.\n");
-      throw;
-   }
-
    // If the input is empty, then there's nothing to do.
    if (s.length() == 0) {
       return;
    }
 
-   mUstr = static_cast<const char *>(s);
-   ASSERT(Validate(mUstr));
-}
-
-
-/*
- *-----------------------------------------------------------------------------
- *
- * utf::string::string --
- *
- *      Constructor from a _variant_t object. Copies the UTF-16 representation
- *      of the _variant_t.
- *
- * Results:
- *      None.
- *
- * Side effects:
- *      Makes a copy of the _variant_t data and frees that data when
- *      the utf::string is destroyed.
- *
- * Note:
- *      WIN32 only call
- *
- *-----------------------------------------------------------------------------
- */
-
-string::string(const _variant_t &v) // IN
-   : mUstr(),
-     mUtf16Cache(NULL),
-     mUtf16Length(npos)
-{
-   _bstr_t s;
+   Unicode utf8 = Unicode_AllocWithUTF16(static_cast<const utf16_t *>(s));
 
    try {
-      s = v;
+      mUstr = utf8;
+      Unicode_Free(utf8);
    } catch (...) {
-      Warning("Invalid _variant_t to _bstr_t conversion.\n");
+      Unicode_Free(utf8);
       throw;
    }
 
-   init_bstr_t(s);
+   ASSERT(Validate(mUstr));
 }
-
 #endif
 
 
index 81d79915089caca06c437ca84d72564ba63b87bc..9136f838c5680f9660032d644d0c186f063de425 100644 (file)
@@ -103,8 +103,6 @@ public:
 #ifdef _WIN32
    string(const ubstr_t &s);
    explicit string(const _bstr_t &s);
-   string(const uvariant_t &v);
-   explicit string(const _variant_t &v);
 #endif
 
    string(const utf16string &s);
@@ -220,11 +218,6 @@ private:
    // Cache accessors
    const utf16_t *GetUtf16Cache() const;
 
-#ifdef _WIN32
-   // Private utility constructor.
-   void init_bstr_t(const _bstr_t &s);
-#endif
-
    // utf::string is internally backed by Glib::ustring.
    Glib::ustring mUstr;