[libbluray-devel] Simplify: removed dest_cl parameter from clpi_copy()

hpi1 git at videolan.org
Wed Oct 19 13:34:30 CEST 2011


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Jul  5 12:02:14 2011 +0300| [c29d1db62891225d346653b2b47247bf8768f9e7] | committer: hpi1

Simplify: removed dest_cl parameter from clpi_copy()

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

 src/libbluray/bdnav/clpi_parse.c |   13 ++++++++-----
 src/libbluray/bdnav/clpi_parse.h |    2 +-
 src/libbluray/bluray.c           |    7 ++-----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/libbluray/bdnav/clpi_parse.c b/src/libbluray/bdnav/clpi_parse.c
index 906f26e..df17ae2 100644
--- a/src/libbluray/bdnav/clpi_parse.c
+++ b/src/libbluray/bdnav/clpi_parse.c
@@ -627,10 +627,14 @@ clpi_parse(char *path, int verbose)
 }
 
 CLPI_CL*
-clpi_copy(CLPI_CL* dest_cl, CLPI_CL* src_cl)
+clpi_copy(CLPI_CL* src_cl)
 {
+    CLPI_CL* dest_cl = NULL;
     int ii, jj;
-    if (dest_cl && src_cl) {
+
+    if (src_cl) {
+        dest_cl = (CLPI_CL*) calloc(1, sizeof(CLPI_CL));
+
         dest_cl->clip.clip_stream_type = src_cl->clip.clip_stream_type;
         dest_cl->clip.application_type = src_cl->clip.application_type;
         dest_cl->clip.is_atc_delta = src_cl->clip.is_atc_delta;
@@ -703,8 +707,7 @@ clpi_copy(CLPI_CL* dest_cl, CLPI_CL* src_cl)
                 dest_cl->cpi.entry[ii].fine[jj].spn_ep = src_cl->cpi.entry[ii].fine[jj].spn_ep;
             }
         }
-        return dest_cl;
     }
-    clpi_free(dest_cl);
-    return NULL;
+
+    return dest_cl;
 }
diff --git a/src/libbluray/bdnav/clpi_parse.h b/src/libbluray/bdnav/clpi_parse.h
index 97b7e48..ba74764 100644
--- a/src/libbluray/bdnav/clpi_parse.h
+++ b/src/libbluray/bdnav/clpi_parse.h
@@ -28,7 +28,7 @@
 BD_PRIVATE uint32_t clpi_lookup_spn(CLPI_CL *cl, uint32_t timestamp, int before, uint8_t stc_id);
 BD_PRIVATE uint32_t clpi_access_point(CLPI_CL *cl, uint32_t pkt, int next, int angle_change, uint32_t *time);
 BD_PRIVATE CLPI_CL* clpi_parse(char *path, int verbose);
-BD_PRIVATE CLPI_CL* clpi_copy(CLPI_CL* dest_cl, CLPI_CL* src_cl);
+BD_PRIVATE CLPI_CL* clpi_copy(CLPI_CL* src_cl);
 BD_PRIVATE void clpi_free(CLPI_CL *cl);
 
 #endif // _CLPI_PARSE_H_
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index fd69c62..7b0252c 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -2284,12 +2284,9 @@ struct meta_dl *bd_get_meta(BLURAY *bd)
 
 struct clpi_cl *bd_get_clpi(BLURAY *bd, unsigned clip_ref)
 {
-    NAV_CLIP *clip;
-
     if (bd->title && clip_ref < bd->title->clip_list.count) {
-      clip = &bd->title->clip_list.clip[clip_ref];
-      CLPI_CL *cl = (CLPI_CL*) calloc(1, sizeof(CLPI_CL));
-      return clpi_copy(cl, clip->cl);
+      NAV_CLIP *clip = &bd->title->clip_list.clip[clip_ref];
+      return clpi_copy(clip->cl);
     }
     return NULL;
 }



More information about the libbluray-devel mailing list