summaryrefslogtreecommitdiffstats
path: root/timeline
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-07-28 23:47:42 +0200
committerwm4 <wm4@mplayer2.org>2012-07-28 23:47:42 +0200
commit08caadb9c0b3c9070f2e5cb7f883f43d6cd5590e (patch)
treee6a6c3a2042231651ec2f622e312657da900280b /timeline
parentca0979a5db442ae212c92a34dcbd97101eb5e51c (diff)
downloadmpv-08caadb9c0b3c9070f2e5cb7f883f43d6cd5590e.tar.bz2
mpv-08caadb9c0b3c9070f2e5cb7f883f43d6cd5590e.tar.xz
bstr: rename bstr() function to bstr0(), and typedef bstr to struct bstr
Replace all uses of bstr() with bstr0(). Also remove the ridiculous C++ workaround.
Diffstat (limited to 'timeline')
-rw-r--r--timeline/tl_cue.c16
-rw-r--r--timeline/tl_edl.c10
-rw-r--r--timeline/tl_matroska.c2
3 files changed, 14 insertions, 14 deletions
diff --git a/timeline/tl_cue.c b/timeline/tl_cue.c
index c4958a823a..14d1127819 100644
--- a/timeline/tl_cue.c
+++ b/timeline/tl_cue.c
@@ -83,7 +83,7 @@ static enum cue_command read_cmd(struct bstr *data, struct bstr *out_params)
if (line.len == 0)
return CUE_EMPTY;
for (int n = 0; cue_command_strings[n].command != -1; n++) {
- struct bstr name = bstr(cue_command_strings[n].text);
+ struct bstr name = bstr0(cue_command_strings[n].text);
if (bstr_startswith(line, name)) {
struct bstr rest = bstr_cut(line, name.len);
if (rest.len && !strchr(WHITESPACE, rest.start[0]))
@@ -187,12 +187,12 @@ static void add_source(struct MPContext *mpctx, struct stream *s,
static bool try_open(struct MPContext *mpctx, char *filename)
{
- struct bstr bfilename = bstr(filename);
+ struct bstr bfilename = bstr0(filename);
// Avoid trying to open itself or another .cue file. Best would be
// to check the result of demuxer auto-detection, but the demuxer
// API doesn't allow this without opening a full demuxer.
- if (bstr_case_endswith(bfilename, bstr(".cue"))
- || bstrcasecmp(bstr(mpctx->demuxer->filename), bfilename) == 0)
+ if (bstr_case_endswith(bfilename, bstr0(".cue"))
+ || bstrcasecmp(bstr0(mpctx->demuxer->filename), bfilename) == 0)
return false;
int format = 0;
@@ -210,7 +210,7 @@ static bool try_open(struct MPContext *mpctx, char *filename)
// fragile, but it's about the only way we have.
// TODO: maybe also could check if the .bin file is a multiple of the Audio
// CD sector size (2352 bytes)
- if (!d && bstr_case_endswith(bfilename, bstr(".bin"))) {
+ if (!d && bstr_case_endswith(bfilename, bstr0(".bin"))) {
mp_msg(MSGT_CPLAYER, MSGL_WARN, "CUE: Opening as BIN file!\n");
d = demux_open(&mpctx->opts, s, DEMUXER_TYPE_RAWAUDIO,
mpctx->opts.audio_id,
@@ -234,7 +234,7 @@ static bool open_source(struct MPContext *mpctx, struct bstr filename)
struct bstr dirname = mp_dirname(mpctx->demuxer->filename);
- struct bstr base_filename = bstr(mp_basename(bstrdup0(ctx, filename)));
+ struct bstr base_filename = bstr0(mp_basename(bstrdup0(ctx, filename)));
if (!base_filename.len) {
mp_msg(MSGT_CPLAYER, MSGL_WARN,
"CUE: Invalid audio filename in .cue file!\n");
@@ -252,7 +252,7 @@ static bool open_source(struct MPContext *mpctx, struct bstr filename)
// are renamed.
struct bstr cuefile =
- bstr_strip_ext(bstr(mp_basename(mpctx->demuxer->filename)));
+ bstr_strip_ext(bstr0(mp_basename(mpctx->demuxer->filename)));
DIR *d = opendir(bstrdup0(ctx, dirname));
if (!d)
@@ -260,7 +260,7 @@ static bool open_source(struct MPContext *mpctx, struct bstr filename)
struct dirent *de;
while ((de = readdir(d))) {
char *dename0 = de->d_name;
- struct bstr dename = bstr(dename0);
+ struct bstr dename = bstr0(dename0);
if (bstr_case_startswith(dename, cuefile)) {
mp_msg(MSGT_CPLAYER, MSGL_WARN, "CUE: No useful audio filename "
"in .cue file found, trying with '%s' instead!\n",
diff --git a/timeline/tl_edl.c b/timeline/tl_edl.c
index 8bd5c18f3e..6763c9fa63 100644
--- a/timeline/tl_edl.c
+++ b/timeline/tl_edl.c
@@ -64,18 +64,18 @@ static int find_edl_source(struct edl_source *sources, int num_sources,
void build_edl_timeline(struct MPContext *mpctx)
{
- const struct bstr file_prefix = bstr("<");
+ const struct bstr file_prefix = bstr0("<");
void *tmpmem = talloc_new(NULL);
struct bstr *lines = bstr_splitlines(tmpmem, mpctx->demuxer->file_contents);
int linec = MP_TALLOC_ELEMS(lines);
- struct bstr header = bstr("mplayer EDL file, version ");
+ struct bstr header = bstr0("mplayer EDL file, version ");
if (!linec || !bstr_startswith(lines[0], header)) {
mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Bad EDL header!\n");
goto out;
}
struct bstr version = bstr_strip(bstr_cut(lines[0], header.len));
- if (bstrcmp(bstr("2"), version)) {
+ if (bstrcmp(bstr0("2"), version)) {
mp_msg(MSGT_CPLAYER, MSGL_ERR, "EDL: Unsupported EDL file version!\n");
goto out;
}
@@ -125,7 +125,7 @@ void build_edl_timeline(struct MPContext *mpctx)
goto out;
}
struct bstr dirname = mp_dirname(mpctx->demuxer->filename);
- char *fullname = mp_path_join(tmpmem, dirname, bstr(filename));
+ char *fullname = mp_path_join(tmpmem, dirname, bstr0(filename));
edl_ids[num_sources++] = (struct edl_source){id, fullname, i+1};
}
@@ -175,7 +175,7 @@ void build_edl_timeline(struct MPContext *mpctx)
if (!arg.len)
goto bad;
int64_t val;
- if (!bstrcmp(arg, bstr("*")))
+ if (!bstrcmp(arg, bstr0("*")))
val = -1;
else if (isdigit(*arg.start)) {
val = bstrtoll(arg, &arg, 10) * 1000000000;
diff --git a/timeline/tl_matroska.c b/timeline/tl_matroska.c
index 09f86b8284..562b1bda1f 100644
--- a/timeline/tl_matroska.c
+++ b/timeline/tl_matroska.c
@@ -82,7 +82,7 @@ static char **find_files(const char *original_file, const char *suffix)
if (!strcmp(ep->d_name, basename))
continue;
- char *name = mp_path_join(results, directory, bstr(ep->d_name));
+ char *name = mp_path_join(results, directory, bstr0(ep->d_name));
char *s1 = ep->d_name;
char *s2 = basename;
int matchlen = 0;