mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Fix data length issues with CF_HTML. It's utf8, so don't treat it like
unicode when computing the length. r=brade/sr=kin, bug 69566.
This commit is contained in:
parent
d9e2699e22
commit
49098d56df
@ -485,7 +485,16 @@ nsresult nsClipboard::GetNativeDataOffClipboard(IDataObject * aDataObject, UINT
|
||||
// may become an incorrect assumption. Stay tuned.
|
||||
PRUint32 allocLen = 0;
|
||||
if ( NS_SUCCEEDED(GetGlobalData(stm.hGlobal, aData, &allocLen)) ) {
|
||||
*aLen = nsCRT::strlen(NS_REINTERPRET_CAST(PRUnichar*, *aData)) * 2;
|
||||
if ( fe.cfFormat == CF_HTML ) {
|
||||
// CF_HTML is actually UTF8, not unicode, so disregard the assumption
|
||||
// above. We have to keep the null termination because of bugs in
|
||||
// nsDependentCString (141866). The string will be stripped of its null by
|
||||
// conversion to unicode in GetDataFromDataObject(), so it'll all
|
||||
// end up well.
|
||||
*aLen = strlen ( NS_REINTERPRET_CAST(char*, *aData) ) + sizeof(char);
|
||||
}
|
||||
else
|
||||
*aLen = nsCRT::strlen(NS_REINTERPRET_CAST(PRUnichar*, *aData)) * sizeof(PRUnichar);
|
||||
result = NS_OK;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user