Make const_casts with AllocateAudioBlock() safer

RESOLVED FIXED in Firefox 42

Status

()

defect
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: karlt, Unassigned)

Tracking

Trunk
mozilla42
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox42 fixed)

Details

Attachments

(2 attachments)

+++ This bug was initially created as a clone of Bug #1184801 +++

AllocateAudioBlock() expects const_cast to be used to write data for its new
chunk.
I first looked into returning float[WEBAUDIO_BLOCK_SIZE]* from
AllocateAudioBlock in order to provide compile-time constraints on usage.
That's probably possible, but would lose the feature of having all buffer
info on the AudioChunk, so requires handling the buffers through two different
objects and loses some run time channel count checking.  It would also require
a re-org in code like AudioBufferSourceNode, which makes late decisions on
allocation.

This approach is simple, keeps everything in one place, and provides run-time
checking.
Attachment #8637723 - Flags: review?(padenot)
Attachment #8637723 - Flags: review?(padenot) → review+
Attachment #8637724 - Flags: review?(padenot) → review+
https://hg.mozilla.org/mozilla-central/rev/eb35e2460913
https://hg.mozilla.org/mozilla-central/rev/44b77af83570
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.