[libbluray-devel] return value of bd_get_meta() should not be free()'d

hpi1 git at videolan.org
Wed Dec 28 19:14:26 CET 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Dec 28 20:11:02 2011 +0200| [28d96f77ab8a774c8e2ef5b88a6ebced84794608] | committer: hpi1

return value of bd_get_meta() should not be free()'d

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=28d96f77ab8a774c8e2ef5b88a6ebced84794608
---

 src/libbluray/bdnav/meta_parse.c |    2 +-
 src/libbluray/bdnav/meta_parse.h |    2 +-
 src/libbluray/bluray.c           |    6 +++---
 src/libbluray/bluray.h           |    4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/libbluray/bdnav/meta_parse.c b/src/libbluray/bdnav/meta_parse.c
index 24b4219..86c9a8f 100644
--- a/src/libbluray/bdnav/meta_parse.c
+++ b/src/libbluray/bdnav/meta_parse.c
@@ -180,7 +180,7 @@ META_ROOT *meta_parse(const char *device_path)
 #endif
 }
 
-META_DL *meta_get(META_ROOT *meta_root, const char *language_code)
+const META_DL *meta_get(const META_ROOT *meta_root, const char *language_code)
 {
     unsigned i;
 
diff --git a/src/libbluray/bdnav/meta_parse.h b/src/libbluray/bdnav/meta_parse.h
index 232f513..19a5efb 100644
--- a/src/libbluray/bdnav/meta_parse.h
+++ b/src/libbluray/bdnav/meta_parse.h
@@ -24,7 +24,7 @@
 
 BD_PRIVATE META_ROOT* meta_parse(const char *device_path);
 BD_PRIVATE void       meta_free(META_ROOT **index);
-BD_PRIVATE META_DL*   meta_get(META_ROOT *meta_root, const char *language_code);
+BD_PRIVATE const META_DL* meta_get(const META_ROOT *meta_root, const char *language_code);
 
 #endif // _META_PARSE_H_
 
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 506b98d..0954544 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -855,8 +855,8 @@ static int _index_open(BLURAY *bd)
 
 static int _meta_open(BLURAY *bd)
 {
-    if (!bd->meta){
-      bd->meta = meta_parse(bd->device_path);
+    if (!bd->meta) {
+        bd->meta = meta_parse(bd->device_path);
     }
 
     return !!bd->meta;
@@ -2361,7 +2361,7 @@ int bd_get_sound_effect(BLURAY *bd, unsigned sound_id, BLURAY_SOUND_EFFECT *effe
  *
  */
 
-struct meta_dl *bd_get_meta(BLURAY *bd)
+const struct meta_dl *bd_get_meta(BLURAY *bd)
 {
     if (!bd) {
         return NULL;
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index f639565..aa527c8 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -659,9 +659,9 @@ struct meta_dl;
  *  Get meta information about the bluray disc.
  *
  * @param bd  BLURAY object
- * @return allocated META_DL (disclib) object, NULL on error
+ * @return META_DL (disclib) object, NULL on error
  */
-struct meta_dl *bd_get_meta(BLURAY *bd);
+const struct meta_dl *bd_get_meta(BLURAY *bd);
 
 
 struct clpi_cl;



More information about the libbluray-devel mailing list