. 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 <mvanzin@vmware.com>
* 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)
/* 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
/*
#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"
#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
#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
* 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"
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());
}
CPClipboard_ItemExists(clip, CPFORMAT_RTF)) {
std::list<Gtk::TargetEntry> 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);
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));
utf::string mHGCopiedUriList;
utf::utf8string mHGFCPData;
utf::string mHGTextData;
- utf::string mHGRTFData;
+ std::string mHGRTFData;
std::vector<utf::string> mHGFileContentsList;
bool mFileTransferDone;
bool mBlockAdded;
#include "dndClipboard.h"
#include "dndInt.h"
#include "dndCPMsgV4.h"
-
+#include "unicode.h"
#define CPFormatToIndex(x) ((unsigned int)(x) - 1)
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;
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);
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__);
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;
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__ );
}
/* 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));