Mercurial > mplayer.hg
annotate libass/ass_library.c @ 20904:e5456123de82
Fix statement-before-declaration warnings.
Having a look at the gcc output before committing is a good idea btw.
author | reimar |
---|---|
date | Tue, 14 Nov 2006 13:41:24 +0000 |
parents | 2edba6772316 |
children | 7af6c25a0cfc |
rev | line source |
---|---|
20477 | 1 // -*- c-basic-offset: 8; indent-tabs-mode: t -*- |
2 // vim:ts=8:sw=8:noet:ai: | |
3 /* | |
4 Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com> | |
5 | |
6 This program is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
8 the Free Software Foundation; either version 2 of the License, or | |
9 (at your option) any later version. | |
10 | |
11 This program is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with this program; if not, write to the Free Software | |
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 */ | |
20 | |
21 #include <inttypes.h> | |
22 #include <stdio.h> | |
23 #include <stdlib.h> | |
24 #include <string.h> | |
25 | |
26 #include "ass.h" | |
27 #include "ass_library.h" | |
28 | |
29 | |
30 ass_library_t* ass_library_init(void) | |
31 { | |
32 return calloc(1, sizeof(ass_library_t)); | |
33 } | |
34 | |
35 void ass_library_done(ass_library_t* priv) | |
36 { | |
37 if (priv) free(priv); | |
38 } | |
39 | |
40 void ass_set_fonts_dir(ass_library_t* priv, const char* fonts_dir) | |
41 { | |
42 if (priv->fonts_dir) | |
43 free(priv->fonts_dir); | |
44 | |
45 priv->fonts_dir = fonts_dir ? strdup(fonts_dir) : 0; | |
46 } | |
47 | |
48 void ass_set_extract_fonts(ass_library_t* priv, int extract) | |
49 { | |
50 priv->extract_fonts = !!extract; | |
51 } | |
52 | |
53 void ass_set_style_overrides(ass_library_t* priv, char** list) | |
54 { | |
55 char** p; | |
56 char** q; | |
57 int cnt; | |
58 | |
59 if (priv->style_overrides) { | |
60 for (p = priv->style_overrides; *p; ++p) | |
61 free(*p); | |
62 free(priv->style_overrides); | |
63 } | |
64 | |
65 if (!list) return; | |
66 | |
67 for (p = list, cnt = 0; *p; ++p, ++cnt) {} | |
68 | |
20722
2edba6772316
Bugfix: when copying ass_force_style_list, ending 0 was left out.
eugeni
parents:
20477
diff
changeset
|
69 priv->style_overrides = malloc((cnt + 1) * sizeof(char*)); |
20477 | 70 for (p = list, q = priv->style_overrides; *p; ++p, ++q) |
71 *q = strdup(*p); | |
20722
2edba6772316
Bugfix: when copying ass_force_style_list, ending 0 was left out.
eugeni
parents:
20477
diff
changeset
|
72 priv->style_overrides[cnt] = NULL; |
20477 | 73 } |