[libbluray-devel] Cosmetics

hpi1 git at videolan.org
Fri May 12 13:51:16 CEST 2017


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri May 12 13:55:16 2017 +0300| [48bdfbaae07b74d373c8777796140d4c74300424] | committer: hpi1

Cosmetics

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

 src/libbluray/disc/disc.c | 58 ++++++++++++++++++++++++-----------------------
 1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/src/libbluray/disc/disc.c b/src/libbluray/disc/disc.c
index 2906a0bd..e5485c20 100644
--- a/src/libbluray/disc/disc.c
+++ b/src/libbluray/disc/disc.c
@@ -303,41 +303,43 @@ BD_DISC *disc_open(const char *device_path,
 {
     BD_DISC *p = _disc_init();
 
-    if (p) {
-        if (p_fs && p_fs->open_dir) {
-            p->fs_handle          = p_fs->fs_handle;
-            p->pf_file_open_bdrom = p_fs->open_file;
-            p->pf_dir_open_bdrom  = p_fs->open_dir;
-        }
-
-        _set_paths(p, device_path);
+    if (!p) {
+        return NULL;
+    }
 
-        /* check if disc root directory can be opened. If not, treat it as device/image file. */
-        BD_DIR_H *dp_img = device_path ? dir_open(device_path) : NULL;
-        if (!dp_img) {
-            void *udf = udf_image_open(device_path, p_fs ? p_fs->fs_handle : NULL, p_fs ? p_fs->read_blocks : NULL);
-            if (!udf) {
-                BD_DEBUG(DBG_FILE | DBG_CRIT, "failed opening UDF image %s\n", device_path);
-            } else {
-                p->fs_handle          = udf;
-                p->pf_fs_close        = udf_image_close;
-                p->pf_file_open_bdrom = udf_file_open;
-                p->pf_dir_open_bdrom  = udf_dir_open;
+    if (p_fs && p_fs->open_dir) {
+        p->fs_handle          = p_fs->fs_handle;
+        p->pf_file_open_bdrom = p_fs->open_file;
+        p->pf_dir_open_bdrom  = p_fs->open_dir;
+    }
 
-                p->udf_volid = udf_volume_id(udf);
+    _set_paths(p, device_path);
 
-                /* root not accessible with stdio */
-                X_FREE(p->disc_root);
-            }
+    /* check if disc root directory can be opened. If not, treat it as device/image file. */
+    BD_DIR_H *dp_img = device_path ? dir_open(device_path) : NULL;
+    if (!dp_img) {
+        void *udf = udf_image_open(device_path, p_fs ? p_fs->fs_handle : NULL, p_fs ? p_fs->read_blocks : NULL);
+        if (!udf) {
+            BD_DEBUG(DBG_FILE | DBG_CRIT, "failed opening UDF image %s\n", device_path);
         } else {
-            dir_close(dp_img);
-            BD_DEBUG(DBG_FILE, "%s does not seem to be image file or device node\n", device_path);
-        }
+            p->fs_handle          = udf;
+            p->pf_fs_close        = udf_image_close;
+            p->pf_file_open_bdrom = udf_file_open;
+            p->pf_dir_open_bdrom  = udf_dir_open;
+
+            p->udf_volid = udf_volume_id(udf);
 
-        struct dec_dev dev = { p->fs_handle, p->pf_file_open_bdrom, p, (file_openFp)disc_open_path, p->disc_root, device_path };
-        p->dec = dec_init(&dev, enc_info, keyfile_path, regs, psr_read, psr_write);
+            /* root not accessible with stdio */
+            X_FREE(p->disc_root);
+        }
+    } else {
+        dir_close(dp_img);
+        BD_DEBUG(DBG_FILE, "%s does not seem to be image file or device node\n", device_path);
     }
 
+    struct dec_dev dev = { p->fs_handle, p->pf_file_open_bdrom, p, (file_openFp)disc_open_path, p->disc_root, device_path };
+    p->dec = dec_init(&dev, enc_info, keyfile_path, regs, psr_read, psr_write);
+
     return p;
 }
 



More information about the libbluray-devel mailing list