[libbluray-devel] Patch: guard accesses to bd->bdjstorage in bluray.c

Chris Clayton chris2553 at googlemail.com
Fri Jul 29 11:22:44 CEST 2016


Hi,

Commit cbb86e18b4575e06ab1237aa91c413757f8c441f breaks the build when --disable-bdjava is passed to configure.

The patch below allows the build to complete, but you'll want to check it for correctness.

Chris

--- libbluray-cbb86e1/src/libbluray/bluray.c~   2016-07-29 09:59:04.663873899 +0100
+++ libbluray-cbb86e1/src/libbluray/bluray.c    2016-07-29 10:06:40.135864604 +0100
@@ -1388,7 +1388,9 @@ static void _storage_free(BLURAY *bd)

 BLURAY *bd_init(void)
 {
+#ifdef USING_BDJAVA
     char *env;
+#endif

     BD_DEBUG(DBG_BLURAY, "libbluray version "BLURAY_VERSION_STRING"\n");

@@ -1409,13 +1411,13 @@ BLURAY *bd_init(void)
     bd_mutex_init(&bd->mutex);
 #ifdef USING_BDJAVA
     bd_mutex_init(&bd->argb_buffer_mutex);
-#endif

     env = getenv("LIBBLURAY_PERSISTENT_STORAGE");
     if (env) {
         int v = (!strcmp(env, "yes")) ? 1 : (!strcmp(env, "no")) ? 0 : atoi(env);
         bd->bdjstorage.no_persistent_storage = !v;
     }
+#endif

     BD_DEBUG(DBG_BLURAY, "BLURAY initialized!\n");

@@ -2775,6 +2777,8 @@ int bd_set_player_setting(BLURAY *bd, ui
         bd_mutex_unlock(&bd->mutex);
         return result;
     }
+
+#ifdef USING_BDJAVA
     if (idx == BLURAY_PLAYER_SETTING_PERSISTENT_STORAGE) {
         if (bd->title_type != title_undef) {
             BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Can't disable persistent storage during playback\n");
@@ -2783,6 +2787,7 @@ int bd_set_player_setting(BLURAY *bd, ui
         bd->bdjstorage.no_persistent_storage = !value;
         return 1;
     }
+#endif

     for (i = 0; i < sizeof(map) / sizeof(map[0]); i++) {
         if (idx == map[i].idx) {


More information about the libbluray-devel mailing list