From e30ea5206ffca9c109265f35d05ce5f769826ac4 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Thu, 4 Oct 2012 21:11:35 +0200 Subject: [PATCH] Fix Linux compile: "free" needs stdlib.h. Also move to .cxx file to avoid another include dependency in the header. --- simgear/sound/sample_openal.cxx | 7 +++++-- simgear/sound/sample_openal.hxx | 6 ++---- simgear/sound/soundmgr_openal.hxx | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/simgear/sound/sample_openal.cxx b/simgear/sound/sample_openal.cxx index 827e5247..fb72566c 100644 --- a/simgear/sound/sample_openal.cxx +++ b/simgear/sound/sample_openal.cxx @@ -26,7 +26,7 @@ # include #endif -#include // rand() +#include // rand(), free() #include #include @@ -232,4 +232,7 @@ SGPath SGSoundSample::file_path() const return SGPath(_refname); } - +void SGSoundSample::free_data() +{ + if ( _data != NULL ) free( _data ); _data = NULL; +} diff --git a/simgear/sound/sample_openal.hxx b/simgear/sound/sample_openal.hxx index 706fa8d0..aa9c893d 100644 --- a/simgear/sound/sample_openal.hxx +++ b/simgear/sound/sample_openal.hxx @@ -68,7 +68,7 @@ public: * Constructor. * @param data Pointer to a memory buffer containing this audio sample data The application may free the data by calling free_data(), otherwise it - will be resident untill the class is destroyed. This pointer will be + will be resident until the class is destroyed. This pointer will be set to NULL after calling this function. * @param len Byte length of array * @param freq Frequency of the provided data (bytes per second) @@ -188,9 +188,7 @@ public: /** * Free the data associated with this audio sample */ - void free_data() { - if ( _data != NULL ) free( _data ); _data = NULL; - } + void free_data(); /** * Set the source id of this source diff --git a/simgear/sound/soundmgr_openal.hxx b/simgear/sound/soundmgr_openal.hxx index d60294dd..d8c2c19a 100644 --- a/simgear/sound/soundmgr_openal.hxx +++ b/simgear/sound/soundmgr_openal.hxx @@ -203,7 +203,7 @@ public: /** * Get a free OpenAL buffer-id - * The buffer-id will be asigned to the sample by calling this function. + * The buffer-id will be assigned to the sample by calling this function. * @param sample Pointer to an audio sample to assign the buffer-id to * @return NO_BUFFER if loading of the buffer failed. */