annotate bstr.h @ 33667:adb10970ec83

Fix bug introduced as a side effect in r33750. It was no longer possible to start gmplayer from the command line with a file argument. Every time gmplayer is called with a file argument this file goes into the GUI specific playlist. As a side effect, GUI's file(name) to play and MPlayer's filename point to the same address. guiInit() pointlessly tries to set GUI's filename (free and strdup) from MPlayer's filename instead of getting it from its playlist. The previous memset set GUI's filename to NULL rendering the free() effectless while now such an operation on the same address to strdup() afterwards isn't a good idea. Remove the pointless code.
author ib
date Tue, 28 Jun 2011 15:00:05 +0000
parents b41cbf02f854
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31686
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
1 /*
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
2 * This file is part of MPlayer.
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
3 *
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
7 * (at your option) any later version.
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
8 *
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
12 * GNU General Public License for more details.
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
13 *
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License along
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
17 */
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
18
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
19 #ifndef MPLAYER_BSTR_H
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
20 #define MPLAYER_BSTR_H
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
21
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
22 #include <stdint.h>
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
23 #include <string.h>
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
24 #include <sys/types.h>
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
25
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
26 struct bstr {
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
27 const uint8_t *start;
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
28 size_t len;
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
29 };
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
30
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
31 int bstrcmp(struct bstr str1, struct bstr str2);
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
32 int bstrcasecmp(struct bstr str1, struct bstr str2);
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
33
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
34 // Create bstr compound literal from null-terminated string
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
35 #define BSTR(s) (struct bstr){(s), (s) ? strlen(s) : 0}
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
36 // create a pair (not single value!) for "%.*s" printf syntax
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
37 #define BSTR_P(bstr) (int)((bstr).len), (bstr).start
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
38
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
39 #endif /* MPLAYER_BSTR_H */