mkxp-z/subprojects/packagefiles/fluidsynth-no-exceptions.patch

106 lines
2.8 KiB
Diff

# Allows FluidSynth to compile with C++ exceptions disabled.
--- a/src/midi/fluid_seq_queue.cpp
+++ b/src/midi/fluid_seq_queue.cpp
@@ -23,7 +23,7 @@
#include <deque>
#include <algorithm>
#include <limits>
-
+#include "../../../src/mkxp-polyfill.h"
/*
* This is an implementation of an event queue, sorted according to their timestamp.
*
@@ -119,7 +119,7 @@ int event_compare_for_test(const fluid_event_t* left, const fluid_event_t* right
void* new_fluid_seq_queue(int nb_events)
{
- try
+ MKXPZ_TRY
{
// As workaround for a missing deque::reserve(), allocate a deque with a size of nb_events
seq_queue_t* queue = new seq_queue_t(nb_events);
@@ -130,7 +130,7 @@ void* new_fluid_seq_queue(int nb_events)
return queue;
}
- catch(...)
+ MKXPZ_CATCH(...)
{
return 0;
}
@@ -143,7 +143,7 @@ void delete_fluid_seq_queue(void *que)
int fluid_seq_queue_push(void *que, const fluid_event_t *evt)
{
- try
+ MKXPZ_TRY
{
seq_queue_t& queue = *static_cast<seq_queue_t*>(que);
@@ -152,7 +152,7 @@ int fluid_seq_queue_push(void *que, const fluid_event_t *evt)
return FLUID_OK;
}
- catch(...)
+ MKXPZ_CATCH(...)
{
return FLUID_FAILED;
}
--- a/src/midi/fluid_seqbind_notes.cpp
+++ b/src/midi/fluid_seqbind_notes.cpp
@@ -21,7 +21,7 @@
#include "fluid_seqbind_notes.h"
#include <set>
-
+#include "../../../src/mkxp-polyfill.h"
/*
* This is a hash container allows us to detect overlapping notes, by storing a bunch of unique integers,
* that allow us to track noteOn events.
@@ -63,12 +63,12 @@ fluid_note_id_t fluid_note_compute_id(int chan, short key)
void* new_fluid_note_container()
{
- try
+ MKXPZ_TRY
{
note_container_t* cont = new note_container_t;
return cont;
}
- catch(...)
+ MKXPZ_CATCH(...)
{
return 0;
}
@@ -83,14 +83,14 @@ void delete_fluid_note_container(void *cont)
// FLUID_FAILED in case of error.
int fluid_note_container_insert(void* cont, fluid_note_id_t id)
{
- try
+ MKXPZ_TRY
{
std::pair<note_container_t::iterator, bool> res = static_cast<note_container_t*>(cont)->insert(id);
// res.second tells us whether the element was inserted
// by inverting it, we know whether it contained the element previously
return !res.second;
}
- catch(...)
+ MKXPZ_CATCH(...)
{
return FLUID_FAILED;
}
@@ -98,11 +98,11 @@ int fluid_note_container_insert(void* cont, fluid_note_id_t id)
void fluid_note_container_remove(void* cont, fluid_note_id_t id)
{
- try
+ MKXPZ_TRY
{
static_cast<note_container_t*>(cont)->erase(id);
}
- catch(...)
+ MKXPZ_CATCH(...)
{
// should never happen
}