Closed Bug 1186779 Opened 10 years ago Closed 10 years ago

Make const_casts with AllocateAudioBlock() safer

Categories

(Core :: Web Audio, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: karlt, Unassigned)

References

Details

Attachments

(2 files)

+++ 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+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: