summaryrefslogtreecommitdiffstats
path: root/bstr.h
Commit message (Collapse)AuthorAgeFilesLines
* bstr: rename bstr() function to bstr0(), and typedef bstr to struct bstrwm42012-07-281-13/+9
| | | | | Replace all uses of bstr() with bstr0(). Also remove the ridiculous C++ workaround.
* Merge remote-tracking branch 'origin/master'wm42012-07-281-3/+15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .gitignore bstr.c cfg-mplayer.h defaultopts.c libvo/video_out.c The conflict in bstr.c is due to uau adding a bstr_getline function in commit 2ba8b91a97e7e8. This function already existed in this branch. While uau's function is obviously derived from mine, it's incompatible. His function preserves line breaks, while mine strips them. Add a bstr_strip_linebreaks function, fix all other uses of bstr_getline, and pick uau's implementation. In .gitignore, change vo_gl3_shaders.h to use an absolute path additional to resolving the merge conflict.
| * build, codec-cfg.c: simplify builtin codecs.conf handlingUoti Urpala2012-07-161-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The player can read codec mapping (codecs.conf) from an external file or use embedded defaults. Before, the defaults were stored in the player binary in the form of final already-parsed data structures. Simplify things by storing the text of the codecs.conf file instead, and parse that at runtime the same way an external file would be parsed. To create the previous parsed form, the build system first compiled a separate binary named "codec-cfg", which parsed etc/codecs.conf and then wrote the results as a C data structure that could be compiled into the program. The new simple conversion of codecs.conf into a C string is handled by the new script TOOLS/file2string.py. After removing the codec-cfg binary, HOST_CC is no longer used for anything. Remove the --host-cc configure option and associated logic. Also remove the codec2html and codec-cfg-test functionality. Building those was already broken and nobody cared. There was a broken 3-character-long "fourcc" entry in etc/codecs.conf. This happened to be accepted before but triggered a parse error after the changes. Remove the broken entry and make the parsing functions explicitly test for this error.
| * options: fix specifying string options without parameterUoti Urpala2012-07-161-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifying a string option with no parameter, as in "--dumpfile" with no '=', erroneously set the corresponding variable to NULL. Fix this to give an error about missing parameter instead. Suboption parsing explicitly treated empty option values as if the option had been specified with no value (no '='). Thus it was not possible to specify empty strings as values. I think this behavior was originally added only because of other limitations in the old implementation. Remove it, so that suboptions now behave the same as top-level ones in this regard. Document the NULL-distinguishing property of bstrdup0() that the code depends on, and also make bstrdup() behave consistently.
* | Merge remote-tracking branch 'origin/master'wm42012-04-291-1/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bstr.c bstr.h libvo/cocoa_common.m libvo/gl_common.c libvo/video_out.c mplayer.c screenshot.c sub/subassconvert.c Merge of cocoa_common.m done by pigoz. Picking my version of screenshot.c. The fix in commit aadf1002f8a will be redone in a follow-up commit, as the original commit causes too many conflicts with the work done locally in this branch, and other work in progress.
| * subassconvert: handle unquoted attributes in subrip font tagswm42012-04-171-0/+3
| | | | | | | | | | Previously, mplayer didn't convert tags like <font color=#00FF00>. But such subtitles exist in the wild, and should be handled.
| * input: allow unicode keys and reassign internal key codeswm42012-03-251-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves all key codes above the highest valid unicode code point (which is 0x10FFFF). All key codes below MP_KEY_BASE now directly map to unicode (KEY_ENTER is 13, carriage return). Configuration files (input.conf) can contain unicode characters in UTF-8 to map non-ASCII characters/keys. This shouldn't change anything user visible, except that "direct key codes" (as used in input.conf) will change their meaning. Parts of the bstr functions taken from libavutil's GET_UTF8 and slightly modified.
* | bstr: add bstr_eatstart()wm42012-02-091-0/+3
| |
* | bstr: add some utility functionswm42012-01-181-0/+17
| | | | | | | | | | | | | | | | 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"
* | bstr: add function for UTF-8 parsing (taken from libav)wm42012-01-141-0/+13
|/ | | | Parts taken from libavutil's GET_UTF8 and slightly modified.
* options: change option parsing to use bstrUoti Urpala2011-07-291-10/+47
| | | | | | Using bstr allows simpler parsing code, especially because it avoids the need to modify or copy strings just to terminate extracted substrings.
* bstr: rename BSTR() -> bstr()Uoti Urpala2011-07-271-1/+1
| | | | | | 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.
* input: fix input.conf parse errorsUoti Urpala2011-07-201-0/+2
| | | | | | | | | 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.
* bstr.h: change BSTR() from macro to inline functionUoti Urpala2011-04-241-2/+6
| | | | | | | | 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).
* cleanup: find_subfiles.c: simplify (mainly using bstr)Uoti Urpala2011-04-201-1/+11
|
* subs: move vobsub loading logic down to find_subfiles.cUoti Urpala2011-04-201-0/+1
| | | | | | | 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.
* bstr.[ch], path.[ch]: add string and path handling functionsUoti Urpala2011-02-261-2/+34
| | | | | | | Add some new string and path handling functions to be used in following commits. Use new path handling functions to simplify find_files().
* bstr.[ch]: add new files for struct bstr related functionalityUoti Urpala2010-05-201-0/+39
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.