77#include " mozilla/ArrayUtils.h"
88#include " mozilla/BasicEvents.h"
99#include " mozilla/CheckedInt.h"
10- #include " mozilla/Span.h"
1110
1211#include " DataTransfer.h"
1312
@@ -1105,12 +1104,8 @@ already_AddRefed<nsITransferable> DataTransfer::GetTransferable(
11051104 totalCustomLength = 0 ;
11061105 continue ;
11071106 }
1108- MOZ_ASSERT (formatLength.isValid () &&
1109- formatLength.value () ==
1110- type.Length () * sizeof (nsString::char_type),
1111- " Why is formatLength off?" );
1112- rv = stream->WriteBytes (
1113- AsBytes (MakeSpan (type.get (), type.Length ())));
1107+ rv = stream->WriteBytes ((const char *)type.get (),
1108+ formatLength.value ());
11141109 if (NS_WARN_IF (NS_FAILED (rv))) {
11151110 totalCustomLength = 0 ;
11161111 continue ;
@@ -1120,13 +1115,7 @@ already_AddRefed<nsITransferable> DataTransfer::GetTransferable(
11201115 totalCustomLength = 0 ;
11211116 continue ;
11221117 }
1123- // XXXbz it's not obvious to me that lengthInBytes is the actual
1124- // length of "data" if the variant contained an nsISupportsString
1125- // as VTYPE_INTERFACE, say. We used lengthInBytes above for
1126- // sizing, so just keep doing that.
1127- rv = stream->WriteBytes (MakeSpan (
1128- reinterpret_cast <const uint8_t *>(data.get ()), lengthInBytes));
1129- ;
1118+ rv = stream->WriteBytes ((const char *)data.get (), lengthInBytes);
11301119 if (NS_WARN_IF (NS_FAILED (rv))) {
11311120 totalCustomLength = 0 ;
11321121 continue ;
0 commit comments