Commit bdcd1116 authored by Petri Hintukainen's avatar Petri Hintukainen

Use enum for BD-J check result

parent 3c455ce4
/*
* This file is part of libbluray
* Copyright (C) 2010 William Hahne
* Copyright (C) 2012 Petri Hintukainen <phintuka@users.sourceforge.net>
* Copyright (C) 2012-2019 Petri Hintukainen <phintuka@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -743,18 +743,18 @@ int bdj_jvm_available(BDJ_STORAGE *storage)
void* jvm_lib = _load_jvm(&java_home);
if (!jvm_lib) {
BD_DEBUG(DBG_BDJ | DBG_CRIT, "BD-J check: Failed to load JVM library\n");
return 0;
return BDJ_CHECK_NO_JVM;
}
dl_dlclose(jvm_lib);
if (!_find_libbluray_jar(storage)) {
BD_DEBUG(DBG_BDJ | DBG_CRIT, "BD-J check: Failed to load libbluray.jar\n");
return 1;
return BDJ_CHECK_NO_JAR;
}
BD_DEBUG(DBG_BDJ, "BD-J check: OK\n");
return 2;
return BDJ_CHECK_OK;
}
static int _find_jvm(void *jvm_lib, JNIEnv **env, JavaVM **jvm)
......
/*
* This file is part of libbluray
* Copyright (C) 2010 William Hahne
* Copyright (C) 2012-2019 Petri Hintukainen <phintuka@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -80,7 +81,13 @@ BD_PRIVATE BDJAVA* bdj_open(const char *path, struct bluray *bd,
BD_PRIVATE void bdj_close(BDJAVA *bdjava);
BD_PRIVATE int bdj_process_event(BDJAVA *bdjava, unsigned ev, unsigned param);
BD_PRIVATE int bdj_jvm_available(BDJ_STORAGE *storage); /* 0: no. 1: only jvm. 2: jvm + libbluray.jar. */
enum {
BDJ_CHECK_OK = 0,
BDJ_CHECK_NO_JVM = 1,
BDJ_CHECK_NO_JAR = 2,
};
BD_PRIVATE int bdj_jvm_available(BDJ_STORAGE *storage); /* rreturn: BDJ_CHECK_* */
BD_PRIVATE void bdj_storage_cleanup(BDJ_STORAGE *);
......
......@@ -903,10 +903,13 @@ static void _check_bdj(BLURAY *bd)
/* Check if jvm + jar can be loaded ? */
switch (bdj_jvm_available(&bd->bdjstorage)) {
case 2: bd->disc_info.bdj_handled = 1;
case BDJ_CHECK_OK:
bd->disc_info.bdj_handled = 1;
/* fall thru */
case 1: bd->disc_info.libjvm_detected = 1;
default:;
case BDJ_CHECK_NO_JAR:
bd->disc_info.libjvm_detected = 1;
/* fall thru */
default:;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment