Problem with SerialUSB.write on the Due

The type change is unnecessary.
The crucial change is

data += n;

which is there: github.com/arduino/ArduinoCore-sam/.../USBCore.cpp#L204