[libbluray-devel] [PATCH] Use DIR_SEP directive where reasonable.
Andreas Zelend
ace at kodi.tv
Tue Sep 23 11:32:47 CEST 2014
Yes, sorry!
>From c12efa17ddd2c89c25912dad1cac352481773283 Mon Sep 17 00:00:00 2001
From: ace20022 <ace20022 at ymail.com>
Date: Fri, 19 Sep 2014 13:21:09 +0200
Subject: [PATCH 1/2] Use DIR_SEP directive where reasonable.
---
src/examples/mpls_dump.c | 5 +++--
src/file/dir_win32.c | 2 +-
src/file/dirs_darwin.c | 6 +++---
src/file/dirs_xdg.c | 6 +++---
src/file/libaacs.c | 6 +++---
src/file/libbdplus.c | 6 +++---
src/libbluray/bdj/bdj.c | 11 ++++++-----
src/libbluray/bdj/common.h | 4 ++--
src/libbluray/bdj/native/org_videolan_Libbluray.c | 3 ++-
src/libbluray/bdnav/bdid_parse.c | 2 +-
src/libbluray/bdnav/clpi_parse.c | 2 +-
src/libbluray/bdnav/index_parse.c | 4 ++--
src/libbluray/bdnav/mpls_parse.c | 2 +-
src/libbluray/bluray.c | 4 ++--
src/libbluray/hdmv/mobj_parse.c | 4 ++--
15 files changed, 35 insertions(+), 32 deletions(-)
diff --git a/src/examples/mpls_dump.c b/src/examples/mpls_dump.c
index a97ee33..7d94343 100644
--- a/src/examples/mpls_dump.c
+++ b/src/examples/mpls_dump.c
@@ -26,6 +26,7 @@
#include <libgen.h>
#include "util/strutl.h"
+#include "file/file.h"
#include "libbluray/bdnav/mpls_parse.h"
#include "libbluray/bluray.h"
@@ -720,7 +721,7 @@ main(int argc, char *argv[])
if (S_ISDIR(st.st_mode)) {
printf("Directory: %s:\n", argv[ii]);
- path = str_printf("%s/BDMV/PLAYLIST", argv[ii]);
+ path = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "PLAYLIST",
argv[ii]);
if (path == NULL) {
fprintf(stderr, "Failed to find playlist path: %s\n",
argv[ii]);
continue;
@@ -742,7 +743,7 @@ main(int argc, char *argv[])
qsort(dirlist, jj, sizeof(char*), _qsort_str_cmp);
for (jj = 0; dirlist[jj] != NULL; jj++) {
char *name = NULL;
- name = str_printf("%s/%s", path, dirlist[jj]);
+ name = str_printf("%s" DIR_SEP "%s", path, dirlist[jj]);
free(dirlist[jj]);
if (stat(name, &st)) {
free(name);
diff --git a/src/file/dir_win32.c b/src/file/dir_win32.c
index f2e8f1c..598b723 100644
--- a/src/file/dir_win32.c
+++ b/src/file/dir_win32.c
@@ -78,7 +78,7 @@ static BD_DIR_H *_dir_open_win32(const char* dirname)
dir->close = _dir_close_win32;
dir->read = _dir_read_win32;
- char *filespec = str_printf("%s/*", dirname);
+ char *filespec = str_printf("%s" DIR_SEP "*", dirname);
dir_data_t *priv = calloc(1, sizeof(dir_data_t));
dir->internal = priv;
diff --git a/src/file/dirs_darwin.c b/src/file/dirs_darwin.c
index b7fcc29..4895d9c 100644
--- a/src/file/dirs_darwin.c
+++ b/src/file/dirs_darwin.c
@@ -48,7 +48,7 @@ const char *file_get_config_home(void)
const char *user_home = getenv("HOME");
if (user_home && *user_home) {
- return dir = str_printf("%s/%s", user_home, USER_CFG_DIR);
+ return dir = str_printf("%s" DIR_SEP "%s", user_home,
USER_CFG_DIR);
}
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
@@ -67,7 +67,7 @@ const char *file_get_data_home(void)
const char *user_home = getenv("HOME");
if (user_home && *user_home) {
- return dir = str_printf("%s/%s", user_home, USER_DATA_DIR);
+ return dir = str_printf("%s" DIR_SEP "%s", user_home,
USER_DATA_DIR);
}
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
@@ -86,7 +86,7 @@ const char *file_get_cache_home(void)
const char *user_home = getenv("HOME");
if (user_home && *user_home) {
- return dir = str_printf("%s/%s", user_home, USER_CACHE_DIR);
+ return dir = str_printf("%s" DIR_SEP "%s", user_home,
USER_CACHE_DIR);
}
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
diff --git a/src/file/dirs_xdg.c b/src/file/dirs_xdg.c
index df5d81b..3d08f33 100644
--- a/src/file/dirs_xdg.c
+++ b/src/file/dirs_xdg.c
@@ -56,7 +56,7 @@ const char *file_get_config_home(void)
const char *user_home = getenv("HOME");
if (user_home && *user_home) {
- return dir = str_printf("%s/%s", user_home, USER_CFG_DIR);
+ return dir = str_printf("%s" DIR_SEP "%s", user_home,
USER_CFG_DIR);
}
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
@@ -80,7 +80,7 @@ const char *file_get_data_home(void)
const char *user_home = getenv("HOME");
if (user_home && *user_home) {
- return dir = str_printf("%s/%s", user_home, USER_DATA_DIR);
+ return dir = str_printf("%s" DIR_SEP "%s", user_home,
USER_DATA_DIR);
}
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
@@ -104,7 +104,7 @@ const char *file_get_cache_home(void)
const char *user_home = getenv("HOME");
if (user_home && *user_home) {
- return dir = str_printf("%s/%s", user_home, USER_CACHE_DIR);
+ return dir = str_printf("%s" DIR_SEP "%s", user_home,
USER_CACHE_DIR);
}
BD_DEBUG(DBG_FILE, "Can't find user home directory ($HOME) !\n");
diff --git a/src/file/libaacs.c b/src/file/libaacs.c
index d539d41..33d4cfa 100644
--- a/src/file/libaacs.c
+++ b/src/file/libaacs.c
@@ -72,18 +72,18 @@ int libaacs_required(const char *device_path)
BD_FILE_H *fd;
char *tmp;
- tmp = str_printf("%s/AACS/Unit_Key_RO.inf", device_path);
+ tmp = str_printf("%s" DIR_SEP "AACS" DIR_SEP "Unit_Key_RO.inf",
device_path);
fd = file_open(tmp, "rb");
X_FREE(tmp);
if (fd) {
file_close(fd);
- BD_DEBUG(DBG_BLURAY, "AACS/Unit_Key_RO.inf found. Disc seems to be
AACS protected.\n");
+ BD_DEBUG(DBG_BLURAY, "AACS" DIR_SEP "Unit_Key_RO.inf found. Disc
seems to be AACS protected.\n");
return 1;
}
- BD_DEBUG(DBG_BLURAY, "AACS/Unit_Key_RO.inf not found. No AACS
protection.\n");
+ BD_DEBUG(DBG_BLURAY, "AACS" DIR_SEP "Unit_Key_RO.inf not found. No
AACS protection.\n");
return 0;
}
diff --git a/src/file/libbdplus.c b/src/file/libbdplus.c
index f0f1ec5..977d4af 100644
--- a/src/file/libbdplus.c
+++ b/src/file/libbdplus.c
@@ -71,18 +71,18 @@ int libbdplus_required(const char *device_path)
BD_FILE_H *fd;
char *tmp;
- tmp = str_printf("%s/BDSVM/00000.svm", device_path);
+ tmp = str_printf("%s" DIR_SEP "BDSVM" DIR_SEP "00000.svm",
device_path);
fd = file_open(tmp, "rb");
X_FREE(tmp);
if (fd) {
file_close(fd);
- BD_DEBUG(DBG_BLURAY, "BDSVM/00000.svm found. Disc seems to be BD+
protected.\n");
+ BD_DEBUG(DBG_BLURAY, "BDSVM" DIR_SEP "00000.svm found. Disc seems
to be BD+ protected.\n");
return 1;
}
- BD_DEBUG(DBG_BLURAY, "BDSVM/00000.svm not found. No BD+
protection.\n");
+ BD_DEBUG(DBG_BLURAY, "BDSVM" DIR_SEP "00000.svm not found. No BD+
protection.\n");
return 0;
}
diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index c54e7ee..7d0b97e 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -31,6 +31,7 @@
#include "libbluray/register.h"
#include "file/dirs.h"
#include "file/dl.h"
+#include "file/file.h"
#include "util/strutl.h"
#include "util/macro.h"
#include "util/logging.h"
@@ -125,7 +126,7 @@ static void *_load_jvm_win32(const char **p_java_home)
static void *_jvm_dlopen(const char *java_home, const char *jvm_dir, const
char *jvm_lib)
{
if (java_home) {
- char *path = str_printf("%s/%s/%s", java_home, jvm_dir, jvm_lib);
+ char *path = str_printf("%s" DIR_SEP "%s" DIR_SEP "%s", java_home,
jvm_dir, jvm_lib);
BD_DEBUG(DBG_BDJ, "Opening %s ...\n", path);
void *h = dl_dlopen(path, NULL);
X_FREE(path);
@@ -151,7 +152,7 @@ static void *_load_jvm(const char **p_java_home)
#else
# ifdef _WIN32
static const char *jvm_path[] = {NULL, JDK_HOME};
- static const char jvm_dir[] = "jre/bin/server";
+ static const char jvm_dir[] = "jre" DIR_SEP "bin" DIR_SEP "server";
static const char jvm_lib[] = "jvm";
# else
static const char *jvm_path[] = {NULL, JDK_HOME,
@@ -271,7 +272,7 @@ static const char *_bdj_persistent_root(void)
if (!root) {
root = "";
}
- root = str_printf("%s/bluray/dvb.persistent.root/", root);
+ root = str_printf("%s" DIR_SEP "bluray" DIR_SEP "dvb.persistent.root"
DIR_SEP, root);
BD_DEBUG(DBG_BDJ, "LIBBLURAY_PERSISTENT_ROOT not set, using %s\n",
root);
@@ -295,7 +296,7 @@ static const char *_bdj_buda_root(void)
if (!root) {
root = "";
}
- root = str_printf("%s/bluray/bluray.bindingunit.root/", root);
+ root = str_printf("%s" DIR_SEP "bluray" DIR_SEP
"bluray.bindingunit.root" DIR_SEP, root);
BD_DEBUG(DBG_BDJ, "LIBBLURAY_CACHE_ROOT not set, using %s\n", root);
@@ -316,7 +317,7 @@ static int _bdj_init(BDJAVA *bdjava, JNIEnv *env)
return 0;
}
- char* id_path = str_printf("%s/CERTIFICATE/id.bdmv", bdjava->path);
+ char* id_path = str_printf("%s" DIR_SEP "CERTIFICATE" DIR_SEP
"id.bdmv", bdjava->path);
BDID_DATA *id = bdid_parse(id_path);
jlong param_bdjava_ptr = (jlong)(intptr_t) bdjava;
jstring param_disc_id = (*env)->NewStringUTF(env,
diff --git a/src/libbluray/bdj/common.h b/src/libbluray/bdj/common.h
index 745ea2c..8ad0ad6 100644
--- a/src/libbluray/bdj/common.h
+++ b/src/libbluray/bdj/common.h
@@ -28,8 +28,8 @@
#define BDJ_JARFILE "libbluray-j2se-" VERSION ".jar"
#endif
#define BDJ_CLASSPATH BDJ_JARFILE
-#define BDJ_BDJO_PATH "/BDMV/BDJO"
-#define BDJ_JAR_PATH "/BDMV/JAR"
+#define BDJ_BDJO_PATH DIR_SEP "BDMV" DIR_SEP "BDJO"
+#define BDJ_JAR_PATH DIR_SEP "BDMV" DIR_SEP "JAR"
#define BDJ_ERROR 0
#define BDJ_SUCCESS 1
diff --git a/src/libbluray/bdj/native/org_videolan_Libbluray.c
b/src/libbluray/bdj/native/org_videolan_Libbluray.c
index 052f02e..2bae889 100644
--- a/src/libbluray/bdj/native/org_videolan_Libbluray.c
+++ b/src/libbluray/bdj/native/org_videolan_Libbluray.c
@@ -29,6 +29,7 @@
#include "util/strutl.h"
#include "util/macro.h"
#include "util/logging.h"
+#include "file/file.h"
#include <string.h>
#include <inttypes.h>
@@ -412,7 +413,7 @@ JNIEXPORT jobject JNICALL
Java_org_videolan_Libbluray_getBdjoN(JNIEnv * env,
BDJAVA* bdj = (BDJAVA*)(intptr_t)np;
const char *bdjo_name = (*env)->GetStringUTFChars(env, name, NULL);;
- char* bdjo_path = str_printf("%s%s/%s.bdjo", bdj->path, BDJ_BDJO_PATH,
bdjo_name);
+ char* bdjo_path = str_printf("%s%s" DIR_SEP "%s.bdjo", bdj->path,
BDJ_BDJO_PATH, bdjo_name);
(*env)->ReleaseStringUTFChars(env, name, bdjo_name);
jobject bdjo = bdjo_read(env, bdjo_path);
X_FREE(bdjo_path);
diff --git a/src/libbluray/bdnav/bdid_parse.c
b/src/libbluray/bdnav/bdid_parse.c
index e2a79b3..26874da 100644
--- a/src/libbluray/bdnav/bdid_parse.c
+++ b/src/libbluray/bdnav/bdid_parse.c
@@ -103,7 +103,7 @@ BDID_DATA *bdid_parse(const char *file_name)
char *backup = malloc(len + 8);
strcpy(backup, file_name);
- strcpy(backup + len - 7, "BACKUP/id.bdmv");
+ strcpy(backup + len - 7, "BACKUP" DIR_SEP "id.bdmv");
bdid = _bdid_parse(backup);
diff --git a/src/libbluray/bdnav/clpi_parse.c
b/src/libbluray/bdnav/clpi_parse.c
index a6588b4..fe3ed49 100644
--- a/src/libbluray/bdnav/clpi_parse.c
+++ b/src/libbluray/bdnav/clpi_parse.c
@@ -743,7 +743,7 @@ clpi_parse(const char *path)
char *backup = malloc(len + 8);
strncpy(backup, path, len - 18);
- strcpy(backup + len - 18, "BACKUP/");
+ strcpy(backup + len - 18, "BACKUP" DIR_SEP);
strcpy(backup + len - 18 + 7, path + len - 18);
cl = _clpi_parse(backup);
diff --git a/src/libbluray/bdnav/index_parse.c
b/src/libbluray/bdnav/index_parse.c
index d76a9c9..a8a6c49 100644
--- a/src/libbluray/bdnav/index_parse.c
+++ b/src/libbluray/bdnav/index_parse.c
@@ -231,7 +231,7 @@ INDX_ROOT *indx_parse(const char *disc_root)
INDX_ROOT *index;
char *file;
- file = str_printf("%s/BDMV/index.bdmv", disc_root);
+ file = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "index.bdmv", disc_root);
index = _indx_parse(file);
X_FREE(file);
if (index) {
@@ -239,7 +239,7 @@ INDX_ROOT *indx_parse(const char *disc_root)
}
/* try backup */
- file = str_printf("%s/BDMV/BACKUP/index.bdmv", disc_root);
+ file = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "BACKUP" DIR_SEP
"index.bdmv", disc_root);
index = _indx_parse(file);
X_FREE(file);
return index;
diff --git a/src/libbluray/bdnav/mpls_parse.c
b/src/libbluray/bdnav/mpls_parse.c
index 715dcfa..82a029e 100644
--- a/src/libbluray/bdnav/mpls_parse.c
+++ b/src/libbluray/bdnav/mpls_parse.c
@@ -965,7 +965,7 @@ mpls_parse(const char *path)
char *backup = malloc(len + 8);
strncpy(backup, path, len - 19);
- strcpy(backup + len - 19, "BACKUP/");
+ strcpy(backup + len - 19, "BACKUP" DIR_SEP);
strcpy(backup + len - 19 + 7, path + len - 19);
pl = _mpls_parse(backup);
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 320f009..3a0c2c1 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1996,7 +1996,7 @@ static int _preload_textst_subpath(BLURAY *bd)
/* set fonts and encoding from clip info */
gc_add_font(bd->graphics_controller, NULL);
for (ii = 0; ii < bd->st_textst.clip->cl->font_info.font_count; ii++) {
- char *file = str_printf("%s/BDMV/AUXDATA/%s.otf", bd->device_path,
bd->st_textst.clip->cl->font_info.font[ii].file_id);
+ char *file = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "AUXDATA"
DIR_SEP "%s.otf", bd->device_path,
bd->st_textst.clip->cl->font_info.font[ii].file_id);
gc_add_font(bd->graphics_controller, file);
X_FREE(file);
}
@@ -3368,7 +3368,7 @@ int bd_get_sound_effect(BLURAY *bd, unsigned
sound_id, BLURAY_SOUND_EFFECT *effe
if (!bd->sound_effects) {
- char *file = str_printf("%s/BDMV/AUXDATA/sound.bdmv",
bd->device_path);
+ char *file = str_printf("%s"DIR_SEP "BDMV" DIR_SEP "AUXDATA"
DIR_SEP "sound.bdmv", bd->device_path);
bd->sound_effects = sound_parse(file);
X_FREE(file);
diff --git a/src/libbluray/hdmv/mobj_parse.c
b/src/libbluray/hdmv/mobj_parse.c
index ae30398..3e26e72 100644
--- a/src/libbluray/hdmv/mobj_parse.c
+++ b/src/libbluray/hdmv/mobj_parse.c
@@ -193,7 +193,7 @@ MOBJ_OBJECTS *mobj_parse(const char *disc_root)
MOBJ_OBJECTS *objects;
char *file;
- file = str_printf("%s/BDMV/MovieObject.bdmv", disc_root);
+ file = str_printf("%s"DIR_SEP "BDMV" DIR_SEP "MovieObject.bdmv",
disc_root);
objects = _mobj_parse(file);
X_FREE(file);
if (objects) {
@@ -201,7 +201,7 @@ MOBJ_OBJECTS *mobj_parse(const char *disc_root)
}
/* if failed, try backup file */
- file = str_printf("%s/BDMV/BACKUP/MovieObject.bdmv", disc_root);
+ file = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "BACKUP" DIR_SEP
"MovieObject.bdmv", disc_root);
objects = _mobj_parse(file);
X_FREE(file);
return objects;
--
1.9.4.msysgit.1
2014-09-23 9:42 GMT+02:00 Petri Hintukainen <phintuka at users.sourceforge.net>
:
> On ma, 2014-09-22 at 10:22 +0200, Andreas Zelend wrote:
> > From 72b9bb8c2c20e7e2080e16c3129e73fb7acf9933 Mon Sep 17 00:00:00 2001
> > From: ace20022 <ace20022 at ymail.com>
> > Date: Fri, 19 Sep 2014 16:00:06 +0200
> > Subject: [PATCH 1/2] Add the possibility to set the persistent/cache
> root path
> > via bd_set_player_setting_str().
>
> Wrong patch attached ?
>
> _______________________________________________
> libbluray-devel mailing list
> libbluray-devel at videolan.org
> https://mailman.videolan.org/listinfo/libbluray-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libbluray-devel/attachments/20140923/d7369c0d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-DIR_SEP-directive-where-reasonable.patch
Type: application/octet-stream
Size: 15501 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/libbluray-devel/attachments/20140923/d7369c0d/attachment-0001.obj>
More information about the libbluray-devel
mailing list