[FFmpeg-user] changes to ffmpeg to stop having to put an escape
Julian Gardner
joolzg at gardnersweden.com
Tue Sep 17 18:37:36 EEST 2019
You mean like this
diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index 4c068f5..8a264c0 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -150,14 +150,26 @@ char *av_get_token(const char **buf, const char
*term)
{
char *out = av_malloc(strlen(*buf) + 1);
char *ret = out, *end = out;
+ int p_count = 0;
+ int speech = 0;
+
const char *p = *buf;
if (!out)
return NULL;
p += strspn(p, WHITESPACES);
- while (*p && !strspn(p, term)) {
+ while (*p && (!strspn(p, term) || p_count)) {
char c = *p++;
- if (c == '\\' && *p) {
+ if (c == 0x22) {
+ speech = !speech;
+ *out++ = c;
+ } else if (speech) {
+ *out++ = c;
+ } else if (c == ')') {
+ if( p_count) {
+ p_count--;
+ }
+ *out++ = c;
+ }
+ else if (c == '(') {
+ p_count++;
+ *out++ = c;
+ }
+ else if (c == '\\' && *p) {
*out++ = *p++;
end = out;
} else if (c == '\'') {
---
BR
Joolz
On 2019-09-17 17:25, Nicolas George wrote:
> Julian Gardner (12019-09-17):
>> Not balanced, can you please give me an example so I can look into the
>> problem.
>>
>> I can think of only one case and that would be someone using braces
>> inside a
>> text field?
>
> Exactly. The function you are proposing to change is meant to parse
> strings. Giving it a special case for parentheses is a maintenance and
> user-experience nightmare.
>
> Regards,
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list