Open Bug 711408 Opened 13 years ago Updated 2 years ago

nsIBinaryInputStream and nsIBinaryOutputStream should be able to read/write signed values

Categories

(Core :: XPCOM, defect)

x86
macOS
defect

Tracking

()

REOPENED

People

(Reporter: asaf, Unassigned)

Details

read8/16/32/64 methods in nsIBinaryInputStream all return the bytes as unsigned integers. Signed versions are needed. Thankfully, xpconnect provides us with bug 711404, fixing my case.
I don't understand this bug. The writing code writes unsigned integers. The reading code reads unsigned integers. What's the issue?
I used it to read a file (third-party file) in a binary format that contains signed integers - that file was never written our output-binary stream implementation. If you imply that we should fix either both interfaces, or nothing, I tend to agree. __ Meanwhile, I switched to using domfiles and readAsArrayBuffer, as there are signed-int views for ArrayBuffer, and as it seems to better fit my use case in general. However, I think it's a valid use case for binary-stream as well.
I think we can close this.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INCOMPLETE
If a class is using nsIBinaryOuputStream/nsIBinaryInputStream to serialize its data and it has signed integer members, it shouldn't have to handle signed/unsigned conversions - that should be the job of nsIBinaryOutputStream/nsIBinaryInputStream.
Status: RESOLVED → REOPENED
Resolution: INCOMPLETE → ---
Summary: nsIBinaryInputStream lacks signed-integers getterrs → nsIBinaryInputStream and nsIBinaryOutputStream should be able to read/write signed values
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.