[libbluray-devel] commit: Changed sound_free argument to SOUND_DATA **p Set SOUND_DATA pointer to NULL in sound_free () (hpi1 )
git at videolan.org
git at videolan.org
Sun Sep 12 15:28:27 CEST 2010
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Sep 12 14:38:40 2010 +0300| [16c8a21e443dc882409ec5f27af760cdbaa0da8d] | committer: hpi1
Changed sound_free argument to SOUND_DATA **p Set SOUND_DATA pointer to NULL in sound_free()
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=16c8a21e443dc882409ec5f27af760cdbaa0da8d
---
src/examples/sound_dump.c | 2 +-
src/libbluray/bdnav/sound_parse.c | 14 +++++++-------
src/libbluray/bdnav/sound_parse.h | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/examples/sound_dump.c b/src/examples/sound_dump.c
index ff62bbe..b89e14a 100644
--- a/src/examples/sound_dump.c
+++ b/src/examples/sound_dump.c
@@ -93,7 +93,7 @@ int main(int argc, const char *argv[])
_sound_print(data);
}
- sound_free(data);
+ sound_free(&data);
}
return 0;
diff --git a/src/libbluray/bdnav/sound_parse.c b/src/libbluray/bdnav/sound_parse.c
index fbd3893..4f3e3bd 100644
--- a/src/libbluray/bdnav/sound_parse.c
+++ b/src/libbluray/bdnav/sound_parse.c
@@ -105,16 +105,16 @@ static int _sound_read_samples(BITSTREAM *bs, SOUND_OBJECT *obj)
return 1;
}
-void sound_free(SOUND_DATA *sounds)
+void sound_free(SOUND_DATA **p)
{
- if (sounds) {
+ if (p && *p) {
- int i;
- for (i = 0 ; i < sounds->num_sounds; i++) {
- X_FREE(sounds->sounds[i].samples);
+ unsigned i;
+ for (i = 0 ; i < (*p)->num_sounds; i++) {
+ X_FREE((*p)->sounds[i].samples);
}
- X_FREE(sounds);
+ X_FREE(*p);
}
}
@@ -184,7 +184,7 @@ SOUND_DATA *sound_parse(const char *file_name)
return data;
error:
- sound_free(data);
+ sound_free(&data);
X_FREE(data_offsets);
file_close(fp);
return NULL;
diff --git a/src/libbluray/bdnav/sound_parse.h b/src/libbluray/bdnav/sound_parse.h
index d8e36bc..912bb2e 100644
--- a/src/libbluray/bdnav/sound_parse.h
+++ b/src/libbluray/bdnav/sound_parse.h
@@ -40,6 +40,6 @@ typedef struct {
BD_PRIVATE SOUND_DATA* sound_parse(const char *path); /* parse sound.bdmv */
-BD_PRIVATE void sound_free(SOUND_DATA *sound);
+BD_PRIVATE void sound_free(SOUND_DATA **sound);
#endif // _MOBJ_PARSE_H_
More information about the libbluray-devel
mailing list