Bug 1503577 - Change CreateDataFromPrimitive aDataLen to out parameter with size of string in bytes. r=mstange

Right now CreateDataFromPrimitive doesn't use the aDataLen parameter, and after this change the out
value should be the same as the value passed in, as long as we are dealing with strings.

Differential Revision: https://phabricator.services.mozilla.com/D10718
This commit is contained in:
Tom Schuster
2018-11-09 13:24:28 +00:00
parent e2a19e1580
commit d3ca356650
6 changed files with 19 additions and 14 deletions

View File

@@ -1675,14 +1675,12 @@ nsDragService::SourceDataGet(GtkWidget *aWidget,
} else {
actualFlavor = mimeFlavor.get();
}
uint32_t tmpDataLen = 0;
void *tmpData = nullptr;
nsresult rv;
nsCOMPtr<nsISupports> data;
uint32_t len;
rv = item->GetTransferData(actualFlavor,
getter_AddRefs(data),
&tmpDataLen);
&len);
if (strcmp(actualFlavor, kFilePromiseMime) == 0) {
if (NS_SUCCEEDED(rv)) {
@@ -1694,8 +1692,10 @@ nsDragService::SourceDataGet(GtkWidget *aWidget,
}
if (NS_SUCCEEDED(rv)) {
void *tmpData = nullptr;
uint32_t tmpDataLen = 0;
nsPrimitiveHelpers::CreateDataFromPrimitive(
nsDependentCString(actualFlavor), data, &tmpData, tmpDataLen);
nsDependentCString(actualFlavor), data, &tmpData, &tmpDataLen);
// if required, do the extra work to convert unicode to plain
// text and replace the output values with the plain text.
if (needToDoConversionToPlainText) {