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.
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.
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).
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.
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.