Closed Bug 799892 Opened 8 years ago Closed 8 years ago

DataChannelConnection::SendBlob can return nsresult instead of int32_t

Categories

(Core :: WebRTC: Networking, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: ayg, Assigned: ayg)

References

Details

(Whiteboard: [qa-])

Attachments

(1 file)

Bug 729512 added netwerk/sctp/datachannel/DataChannel.cpp, which contains DataChannelConnection::SendBlob, which has return type int32_t.  It contains the following:

  nsresult rv = NS_ReadInputStreamToString(aBlob, *temp, len);

  NS_ENSURE_SUCCESS(rv, rv);

This is an error -- it will return rv, which is an nsresult.  I don't see any docs at a quick glance, but I'm guessing the return type is meant to be the number of bytes sent, so 0 is the right thing to return in case of error.  An error nsresult winds up being negative when converted silently to int32_t, which probably isn't intended.

This doesn't compile when nsresult is converted to enum class (bug 779473).
Attached patch PatchSplinter Review
Given that we've been asked to cut back on try runs to conserve resources for the time being, I don't think this needs a try push.  Let me know if you'd like one (or if you'd like the patch done differently).
Attachment #669913 - Flags: review?(mcmanus)
Attachment #669913 - Flags: review?(mcmanus) → review+
Comment on attachment 669913 [details] [diff] [review]
Patch

Thanks, Aryeh.  Cut-and-paste error when copying code from WebSockets, where it was used in a slightly different context.
https://hg.mozilla.org/mozilla-central/rev/4c1bf0890354
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.