Commit Graph

11 Commits

Author SHA1 Message Date
wm4 70bf672096 bstr: add bstr_eatstart() 2012-02-09 12:44:19 +01:00
wm4 f88674509e bstr: add some utility functions
bstr_strip_ext and bstr_get_ext were taken from find_subfiles.c.

bstr_cut is extended to work like bstr_splice: passing a negative
argument will start counting from the end of the string, e.g.
  bstr_cut("abc", -2) == "bc"
2012-01-18 04:24:38 +01:00
wm4 7700e6effc bstr: add function for UTF-8 parsing (taken from libav)
Parts taken from libavutil's GET_UTF8 and slightly modified.
2012-01-14 14:35:39 +01:00
Uoti Urpala e873d703e9 options: change option parsing to use bstr
Using bstr allows simpler parsing code, especially because it avoids
the need to modify or copy strings just to terminate extracted
substrings.
2011-07-29 05:50:38 +03:00
Uoti Urpala 0958620591 bstr: rename BSTR() -> bstr()
Rename the BSTR() function to bstr(). The former caused a conflict
with some Windows OS name, and it's no longer a macro so uppercase
naming is less appropriate.
2011-07-27 08:38:12 +03:00
Uoti Urpala d6890a7b53 input: fix input.conf parse errors
Commit df899f59be removing a write outside a buffer triggered another
problem, as for some reason the code did not 0-terminate its read
buffer in the specific case that it had encountered an EOF, and as a
result could parse contents left in the buffer for a second time.
Usually this resulted in parsing error messages. Fix the problem by
rewriting the offending code in a less hacky form.
2011-07-20 04:41:51 +03:00
Uoti Urpala 28b3cc0efe bstr.h: change BSTR() from macro to inline function
Change BSTR() from a macro producing a compound literal to an inline
function returning the same value. This works for all existing uses,
and avoids a warning from BSTR(NULL) (the macro expansion contained
strlen(NULL); this was valid code because the strlen call was never
evaluated, but still triggered a GCC warning).
2011-04-24 03:05:24 +03:00
Uoti Urpala a2d28010cc cleanup: find_subfiles.c: simplify (mainly using bstr) 2011-04-20 04:22:53 +03:00
Uoti Urpala bdfdece245 subs: move vobsub loading logic down to find_subfiles.c
Analogously to the previous commit, move path handling logic for
loading external vobsub files from mplayer.c to find_subfiles.c.

Based on a commit from Clément Bœsch but fixed and simplified.
2011-04-20 04:22:52 +03:00
Uoti Urpala 962eec0440 bstr.[ch], path.[ch]: add string and path handling functions
Add some new string and path handling functions to be used in
following commits.

Use new path handling functions to simplify find_files().
2011-02-26 16:40:31 +02:00
Uoti Urpala d72541b75c bstr.[ch]: add new files for struct bstr related functionality
Move "struct bstr" definition from ebml.h to its own header and add
some utility functions/macros. Change length field type from int to
size_t and adjust using code accordingly.

Partially based on a patch from Anton Khirnov.
2010-05-20 23:50:18 +03:00