Fix size inconsistencies in QBluetoothSocketPrivateDarwin::writeData()
The reserve() call truncated the passed qint64 to int, but later
std::copy() was passing the unmodified qint64 value to determine the
end of the data to copy. That could lead to writing past the end of
the allocated buffer if the user tried to write more than INT_MAX bytes
to the socket.
Fix by introducing a temporary variable that truncates the qint64 value
to int, and use it consistently (and also as a return value).
Not using qsizetype, because all other code here truncates to int.
Changing to qsizetype should be done consistently in a separate commit.
Amends c1286c3a344593c79feced5c782ff85bca80bfff.
Pick-to: 6.9 6.8 6.5
Change-Id: I38a6dee1707b124d662b815938f33a39e1badb00
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>