From: VMware, Inc <> Date: Tue, 29 Mar 2011 18:55:17 +0000 (-0700) Subject: Internal branch sync. Included in this change: X-Git-Tag: 2011.03.28-387002~73 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3390a550564af844ddbd310c8bd6f233ed101b88;p=thirdparty%2Fopen-vm-tools.git Internal branch sync. Included in this change: . DnD: avoid crashing when clipboard doesn't have UTF-8 data. . changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/include/vm_version.h b/open-vm-tools/lib/include/vm_version.h index d33028663..87372256f 100644 --- a/open-vm-tools/lib/include/vm_version.h +++ b/open-vm-tools/lib/include/vm_version.h @@ -83,7 +83,7 @@ * hard-coded value for every other product. */ #if defined(VMX86_DESKTOP) - #define PRODUCT_VERSION 7,0,0,PRODUCT_BUILD_NUMBER_NUMERIC /* WORKSTATION_VERSION_NUMBER below has to match this */ + #define PRODUCT_VERSION 8,0,0,PRODUCT_BUILD_NUMBER_NUMERIC /* WORKSTATION_VERSION_NUMBER below has to match this */ #elif defined(VMX86_TOOLS) #define PRODUCT_VERSION TOOLS_VERSION_EXT_CURRENT_CSV #elif defined(VMX86_VCB) @@ -94,7 +94,7 @@ /* this should be kept in sync with the corresponding vpx branch. */ #define PRODUCT_VERSION 5,0,0,PRODUCT_BUILD_NUMBER_NUMERIC #else - #define PRODUCT_VERSION 3,1,0,PRODUCT_BUILD_NUMBER_NUMERIC /* PLAYER_VERSION_NUMBER below has to match this */ + #define PRODUCT_VERSION 4,0,0,PRODUCT_BUILD_NUMBER_NUMERIC /* PLAYER_VERSION_NUMBER below has to match this */ #endif /* @@ -197,7 +197,7 @@ #define ESX_RELEASE ESX_RELEASE_UPDATE "." ESX_RELEASE_PATCH #define GSX_VERSION "e.x.p" #define VMSERVER_VERSION "e.x.p" -#define WORKSTATION_VERSION_NUMBER "7.1.0" /* this version number should always match real WS version number */ +#define WORKSTATION_VERSION_NUMBER "8.0.0" /* this version number should always match real WS version number */ #define WORKSTATION_VERSION "e.x.p" #define WORKSTATION_ENTERPRISE_VERSION "e.x.p" #define ACE_MANAGEMENT_SERVER_VERSION "e.x.p" @@ -205,7 +205,7 @@ #define CONSOLE_VERSION "4.1.0" #define P2V_VERSION "e.x.p" #define P2V_FILE_VERSION 3,0,0,0 -#define PLAYER_VERSION_NUMBER "3.1.0" /* this version number should always match real Player version number */ +#define PLAYER_VERSION_NUMBER "4.0.0" /* this version number should always match real Player version number */ #define PLAYER_VERSION "e.x.p" #define V2V_VERSION "e.x.p" #define V2V_FILE_VERSION 1,0,0,0 @@ -277,8 +277,8 @@ #define TOOLS_VERSION TOOLS_VERSION_CURRENT_STR #define USB_ARBITRATOR_VERSION_MAJOR 8 -#define USB_ARBITRATOR_VERSION_MINOR 2 -#define USB_ARBITRATOR_VERSION_Z 23 +#define USB_ARBITRATOR_VERSION_MINOR 3 +#define USB_ARBITRATOR_VERSION_Z 13 #define USB_ARBITRATOR_VERSION_BASE USB_ARBITRATOR_VERSION_MAJOR.\ USB_ARBITRATOR_VERSION_MINOR @@ -294,7 +294,7 @@ * USB Arbitrator Component version. This version is used by the linux * installer. See USB_ARBITRATOR_COMPONENT_VERSION_NUMBER in mk/defs-onetime.mk */ -#define USB_ARBITRATOR_COMPONENT_VERSION_NUMBER "8.2.23" +#define USB_ARBITRATOR_COMPONENT_VERSION_NUMBER "8.3.13" #ifdef VMX86_VPX #define VIM_API_TYPE "VirtualCenter" diff --git a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp index 97fbe95c0..82cd6790f 100644 --- a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp +++ b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.cpp @@ -499,13 +499,13 @@ CopyPasteUIX11::LocalGetTextOrRTFRequestCB(Gtk::SelectionData& sd, // IN/OUT if (target == TARGET_NAME_APPLICATION_RTF || target == TARGET_NAME_TEXT_RICHTEXT) { - if (0 == mHGRTFData.bytes()) { + if (0 == mHGRTFData.size()) { g_debug("%s: Can not get valid RTF data\n", __FUNCTION__); return; } g_debug("%s: providing RTF data, size %"FMTSZ"u\n", - __FUNCTION__, mHGRTFData.bytes()); + __FUNCTION__, mHGRTFData.size()); sd.set(target.c_str(), mHGRTFData.c_str()); } @@ -1129,6 +1129,22 @@ CopyPasteUIX11::GetRemoteClipboardCB(const CPClipboard *clip) // IN CPClipboard_ItemExists(clip, CPFORMAT_RTF)) { std::list targets; + /* + * rtf should be first in the target list otherwise OpenOffice may not + * accept paste. + */ + if (CPClipboard_GetItem(clip, CPFORMAT_RTF, &buf, &sz)) { + g_debug("%s: RTF data, size %"FMTSZ"u.\n", __FUNCTION__, sz); + Gtk::TargetEntry appRtf(TARGET_NAME_APPLICATION_RTF); + Gtk::TargetEntry textRtf(TARGET_NAME_TEXT_RICHTEXT); + Gtk::TargetEntry vmware(VMWARE_TARGET); + + targets.push_back(appRtf); + targets.push_back(textRtf); + targets.push_back(vmware); + mHGRTFData = std::string((const char *)buf); + } + if (CPClipboard_GetItem(clip, CPFORMAT_TEXT, &buf, &sz)) { Gtk::TargetEntry stringText(TARGET_NAME_STRING); Gtk::TargetEntry plainText(TARGET_NAME_TEXT_PLAIN); @@ -1146,18 +1162,6 @@ CopyPasteUIX11::GetRemoteClipboardCB(const CPClipboard *clip) // IN STRING_ENCODING_UTF8); } - if (CPClipboard_GetItem(clip, CPFORMAT_RTF, &buf, &sz)) { - g_debug("%s: RTF data, size %"FMTSZ"u.\n", __FUNCTION__, sz); - Gtk::TargetEntry appRtf(TARGET_NAME_APPLICATION_RTF); - Gtk::TargetEntry textRtf(TARGET_NAME_TEXT_RICHTEXT); - Gtk::TargetEntry vmware(VMWARE_TARGET); - - targets.push_back(appRtf); - targets.push_back(textRtf); - targets.push_back(vmware); - mHGRTFData = utf::string((const char *)buf); - } - refClipboard->set(targets, sigc::mem_fun(this, &CopyPasteUIX11::LocalGetTextOrRTFRequestCB), sigc::mem_fun(this, &CopyPasteUIX11::LocalClearClipboardCB)); diff --git a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.h b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.h index 98e6250be..a64a0d9fe 100644 --- a/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.h +++ b/open-vm-tools/services/plugins/dndcp/copyPasteUIX11.h @@ -111,7 +111,7 @@ private: utf::string mHGCopiedUriList; utf::utf8string mHGFCPData; utf::string mHGTextData; - utf::string mHGRTFData; + std::string mHGRTFData; std::vector mHGFileContentsList; bool mFileTransferDone; bool mBlockAdded; diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dndClipboard.c b/open-vm-tools/services/plugins/dndcp/dnd/dndClipboard.c index 113ceb64e..9940362a7 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dndClipboard.c +++ b/open-vm-tools/services/plugins/dndcp/dnd/dndClipboard.c @@ -31,7 +31,7 @@ #include "dndClipboard.h" #include "dndInt.h" #include "dndCPMsgV4.h" - +#include "unicode.h" #define CPFormatToIndex(x) ((unsigned int)(x) - 1) @@ -270,6 +270,15 @@ CPClipboard_SetItem(CPClipboard *clip, // IN/OUT: the clipboard item = &clip->items[CPFormatToIndex(fmt)]; if (clipitem) { + /* It has to be valid utf8 for plain text format. */ + if (CPFORMAT_TEXT == fmt) { + char *str = (char *)clipitem; + if (!Unicode_IsBufferValid(str, + strlen(str), + STRING_ENCODING_UTF8)) { + return FALSE; + } + } newBuf = malloc(size); if (!newBuf) { return FALSE; @@ -368,6 +377,8 @@ CPClipboard_GetItem(const CPClipboard *clip, // IN: the clipboard if (clip->items[CPFormatToIndex(fmt)].exists) { *buf = clip->items[CPFormatToIndex(fmt)].buf; *size = clip->items[CPFormatToIndex(fmt)].size; + ASSERT(*buf); + ASSERT((*size > 0) && (*size < CPCLIPITEM_MAX_SIZE_V3)); return TRUE; } else { ASSERT(!clip->items[CPFormatToIndex(fmt)].size); diff --git a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp index 0dff137ce..d9525cb99 100644 --- a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp +++ b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp @@ -759,7 +759,10 @@ DnDUIX11::GtkDestDragMotionCB(const Glib::RefPtr &dc, m_GHDnDInProgress = true; /* only begin drag enter after we get the data */ /* Need to grab all of the data. */ - ASSERT(RequestData(dc, timeValue)); + if (!RequestData(dc, timeValue)) { + g_debug("%s: RequestData failed.\n", __FUNCTION__); + return false; + } } else { g_debug("%s: Multiple drag motions before gh data has been received.\n", __FUNCTION__); @@ -1234,12 +1237,12 @@ DnDUIX11::SetCPClipboardFromGtk(const Gtk::SelectionData& sd) // IN target == TARGET_NAME_TEXT_PLAIN || target == TARGET_NAME_UTF8_STRING || target == TARGET_NAME_COMPOUND_TEXT)) { - utf::string source = sd.get_data_as_string().c_str(); - if (source.bytes() > 0 && - source.bytes() < DNDMSG_MAX_ARGSZ && + std::string source = sd.get_data_as_string(); + if (source.size() > 0 && + source.size() < DNDMSG_MAX_ARGSZ && CPClipboard_SetItem(&m_clipboard, CPFORMAT_TEXT, source.c_str(), - source.bytes() + 1)) { - g_debug("%s: Got text, size %"FMTSZ"u\n", __FUNCTION__, source.bytes()); + source.size() + 1)) { + g_debug("%s: Got text, size %"FMTSZ"u\n", __FUNCTION__, source.size()); } else { g_debug("%s: Failed to get text\n", __FUNCTION__); return false; @@ -1251,12 +1254,12 @@ DnDUIX11::SetCPClipboardFromGtk(const Gtk::SelectionData& sd) // IN if (m_DnD->CheckCapability(DND_CP_CAP_RTF_DND) && ( target == TARGET_NAME_APPLICATION_RTF || target == TARGET_NAME_TEXT_RICHTEXT)) { - utf::string source = sd.get_data_as_string().c_str(); - if (source.bytes() > 0 && - source.bytes() < DNDMSG_MAX_ARGSZ && + std::string source = sd.get_data_as_string(); + if (source.size() > 0 && + source.size() < DNDMSG_MAX_ARGSZ && CPClipboard_SetItem(&m_clipboard, CPFORMAT_RTF, source.c_str(), - source.bytes() + 1)) { - g_debug("%s: Got RTF, size %"FMTSZ"u\n", __FUNCTION__, source.bytes()); + source.size() + 1)) { + g_debug("%s: Got RTF, size %"FMTSZ"u\n", __FUNCTION__, source.size()); return true; } else { g_debug("%s: Failed to get text\n", __FUNCTION__ ); @@ -1301,9 +1304,9 @@ DnDUIX11::RequestData(const Glib::RefPtr &dc, } /* Then check plain text. */ + targets->add(Glib::ustring(TARGET_NAME_UTF8_STRING)); targets->add(Glib::ustring(TARGET_NAME_STRING)); targets->add(Glib::ustring(TARGET_NAME_TEXT_PLAIN)); - targets->add(Glib::ustring(TARGET_NAME_UTF8_STRING)); targets->add(Glib::ustring(TARGET_NAME_COMPOUND_TEXT)); target = m_detWnd->drag_dest_find_target(dc, targets); targets->remove(Glib::ustring(TARGET_NAME_STRING));