aboutsummaryrefslogtreecommitdiffstats
path: root/al/source.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-02-14 02:18:53 -0800
committerChris Robinson <[email protected]>2022-02-14 02:18:53 -0800
commit677ea00fa38b3c55372f49a99a65da5905c9ea72 (patch)
tree0c60c85d8008c3c2cb7567cd2d88d52d9ce3b756 /al/source.cpp
parent2654b3bbdc192cbab4161712a51b412cec1b7ee3 (diff)
Avoid some messy type-punning
Diffstat (limited to 'al/source.cpp')
-rw-r--r--al/source.cpp40
1 files changed, 11 insertions, 29 deletions
diff --git a/al/source.cpp b/al/source.cpp
index 9e3f715e..30676dfc 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -5785,13 +5785,9 @@ void ALsource::eax_api_get_source_all(
void ALsource::eax_api_get_source_all_obstruction(
const EaxEaxCall& eax_call)
{
- static_assert(
- offsetof(EAXOBSTRUCTIONPROPERTIES, flObstructionLFRatio) - offsetof(EAXOBSTRUCTIONPROPERTIES, lObstruction) ==
- offsetof(EAX30SOURCEPROPERTIES, flObstructionLFRatio) - offsetof(EAX30SOURCEPROPERTIES, lObstruction),
- "Type size."
- );
-
- const auto eax_obstruction_all = *reinterpret_cast<const EAXOBSTRUCTIONPROPERTIES*>(&eax_.source.lObstruction);
+ auto eax_obstruction_all = EAXOBSTRUCTIONPROPERTIES{};
+ eax_obstruction_all.lObstruction = eax_.source.lObstruction;
+ eax_obstruction_all.flObstructionLFRatio = eax_.source.flObstructionLFRatio;
eax_call.set_value<EaxSourceException>(eax_obstruction_all);
}
@@ -5799,20 +5795,11 @@ void ALsource::eax_api_get_source_all_obstruction(
void ALsource::eax_api_get_source_all_occlusion(
const EaxEaxCall& eax_call)
{
- static_assert(
- offsetof(EAXOCCLUSIONPROPERTIES, flOcclusionLFRatio) - offsetof(EAXOCCLUSIONPROPERTIES, lOcclusion) ==
- offsetof(EAX30SOURCEPROPERTIES, flOcclusionLFRatio) - offsetof(EAX30SOURCEPROPERTIES, lOcclusion) &&
-
- offsetof(EAXOCCLUSIONPROPERTIES, flOcclusionRoomRatio) - offsetof(EAXOCCLUSIONPROPERTIES, lOcclusion) ==
- offsetof(EAX30SOURCEPROPERTIES, flOcclusionRoomRatio) - offsetof(EAX30SOURCEPROPERTIES, lOcclusion) &&
-
- offsetof(EAXOCCLUSIONPROPERTIES, flOcclusionDirectRatio) - offsetof(EAXOCCLUSIONPROPERTIES, lOcclusion) ==
- offsetof(EAX30SOURCEPROPERTIES, flOcclusionDirectRatio) - offsetof(EAX30SOURCEPROPERTIES, lOcclusion),
-
- "Type size."
- );
-
- const auto eax_occlusion_all = *reinterpret_cast<const EAXOCCLUSIONPROPERTIES*>(&eax_.source.lOcclusion);
+ auto eax_occlusion_all = EAXOCCLUSIONPROPERTIES{};
+ eax_occlusion_all.lOcclusion = eax_.source.lOcclusion;
+ eax_occlusion_all.flOcclusionLFRatio = eax_.source.flOcclusionLFRatio;
+ eax_occlusion_all.flOcclusionRoomRatio = eax_.source.flOcclusionRoomRatio;
+ eax_occlusion_all.flOcclusionDirectRatio = eax_.source.flOcclusionDirectRatio;
eax_call.set_value<EaxSourceException>(eax_occlusion_all);
}
@@ -5820,14 +5807,9 @@ void ALsource::eax_api_get_source_all_occlusion(
void ALsource::eax_api_get_source_all_exclusion(
const EaxEaxCall& eax_call)
{
- static_assert(
- offsetof(EAXEXCLUSIONPROPERTIES, flExclusionLFRatio) - offsetof(EAXEXCLUSIONPROPERTIES, lExclusion) ==
- offsetof(EAX30SOURCEPROPERTIES, flExclusionLFRatio) - offsetof(EAX30SOURCEPROPERTIES, lExclusion),
-
- "Type size."
- );
-
- const auto eax_exclusion_all = *reinterpret_cast<const EAXEXCLUSIONPROPERTIES*>(&eax_.source.lExclusion);
+ auto eax_exclusion_all = EAXEXCLUSIONPROPERTIES{};
+ eax_exclusion_all.lExclusion = eax_.source.lExclusion;
+ eax_exclusion_all.flExclusionLFRatio = eax_.source.flExclusionLFRatio;
eax_call.set_value<EaxSourceException>(eax_exclusion_all);
}