annotate bstr.c @ 35801:98693cc5df48

Exit GUI if we can't return to the skin we started with. If there are errors in both the selected skin and the skin we started with, there's nothing we can do but exit.
author ib
date Sat, 26 Jan 2013 00:34:43 +0000
parents d206960484fe
children 389d43c448b3
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 #include <string.h>
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
20 #include <libavutil/avutil.h>
35712
d206960484fe Add a number of missing libavutil header #includes.
diego
parents: 31686
diff changeset
21 #include <libavutil/common.h>
31686
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
22
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
23 #include "bstr.h"
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
24
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
25 int bstrcmp(struct bstr str1, struct bstr str2)
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
26 {
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
27 int ret = memcmp(str1.start, str2.start, FFMIN(str1.len, str2.len));
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
28
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
29 if (!ret) {
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
30 if (str1.len == str2.len)
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
31 return 0;
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
32 else if (str1.len > str2.len)
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
33 return 1;
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
34 else
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
35 return -1;
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
36 }
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
37 return ret;
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
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
40 int bstrcasecmp(struct bstr str1, struct bstr str2)
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
41 {
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
42 int ret = strncasecmp(str1.start, str2.start, FFMIN(str1.len, str2.len));
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
43
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
44 if (!ret) {
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
45 if (str1.len == str2.len)
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
46 return 0;
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
47 else if (str1.len > str2.len)
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
48 return 1;
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
49 else
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
50 return -1;
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
51 }
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
52 return ret;
b41cbf02f854 subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
diff changeset
53 }