0

Take 2 at fixing image corruption on drag and drop.

Fix a unittest that needs to specify the size when reading
char* data.
Review URL: http://codereview.chromium.org/7441

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3478 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
tc@google.com
2008-10-16 20:11:06 +00:00
parent dde6e35f3f
commit 49ca701d82
3 changed files with 4 additions and 5 deletions

@ -356,8 +356,7 @@ bool ClipboardUtil::GetFileContents(IDataObject* data_object,
if (SUCCEEDED(data_object->GetData(GetFileContentFormatZero(), &content))) {
if (TYMED_HGLOBAL == content.tymed) {
ScopedHGlobal<char> data(content.hGlobal);
// The size includes the trailing NULL byte. We don't want it.
file_contents->assign(data.get(), data.Size() - 1);
file_contents->assign(data.get(), data.Size());
}
ReleaseStgMedium(&content);
}

@ -330,7 +330,7 @@ void OSExchangeData::SetFileContents(const std::wstring& filename,
ClipboardUtil::GetFileDescriptorFormat()->cfFormat, storage));
// Add CFSTR_FILECONTENTS
storage = GetStorageForString(file_contents);
storage = GetStorageForBytes(file_contents.data(), file_contents.length());
contents_.push_back(new StoredDataInfo(
ClipboardUtil::GetFileContentFormatZero()->cfFormat, storage));
}

@ -265,8 +265,8 @@ TEST(OSExchangeDataTest, TestURLExchangeFormats) {
STGMEDIUM medium;
EXPECT_EQ(S_OK, com_data->GetData(&format_etc, &medium));
std::string output =
ScopedHGlobal<char>(medium.hGlobal).get();
ScopedHGlobal<char> glob(medium.hGlobal);
std::string output(glob.get(), glob.Size());
std::string file_contents = "[InternetShortcut]\r\nURL=" + url_spec + "\r\n";
EXPECT_EQ(file_contents, output);
ReleaseStgMedium(&medium);