Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
4333df63
Commit
4333df63
authored
Jan 24, 2013
by
Luca Barbato
Committed by
Diego Biurrun
Jan 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avstring: K&R formatting cosmetics
Signed-off-by:
Diego Biurrun
<
diego@biurrun.de
>
parent
2c10e2a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
59 deletions
+56
-59
avstring.c
libavutil/avstring.c
+56
-59
No files found.
libavutil/avstring.c
View file @
4333df63
...
...
@@ -24,10 +24,11 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "avstring.h"
#include "config.h"
#include "common.h"
#include "mem.h"
#include "avstring.h"
int
av_strstart
(
const
char
*
str
,
const
char
*
pfx
,
const
char
**
ptr
)
{
...
...
@@ -56,10 +57,10 @@ char *av_stristr(const char *s1, const char *s2)
if
(
!*
s2
)
return
s1
;
do
{
do
if
(
av_stristart
(
s1
,
s2
,
NULL
))
return
s1
;
}
while
(
*
s1
++
);
while
(
*
s1
++
);
return
NULL
;
}
...
...
@@ -96,8 +97,9 @@ size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
char
*
av_d2str
(
double
d
)
{
char
*
str
=
av_malloc
(
16
);
if
(
str
)
snprintf
(
str
,
16
,
"%f"
,
d
);
char
*
str
=
av_malloc
(
16
);
if
(
str
)
snprintf
(
str
,
16
,
"%f"
,
d
);
return
str
;
}
...
...
@@ -105,32 +107,33 @@ char *av_d2str(double d)
char
*
av_get_token
(
const
char
**
buf
,
const
char
*
term
)
{
char
*
out
=
av_malloc
(
strlen
(
*
buf
)
+
1
);
char
*
ret
=
out
,
*
end
=
out
;
char
*
out
=
av_malloc
(
strlen
(
*
buf
)
+
1
);
char
*
ret
=
out
,
*
end
=
out
;
const
char
*
p
=
*
buf
;
if
(
!
out
)
return
NULL
;
if
(
!
out
)
return
NULL
;
p
+=
strspn
(
p
,
WHITESPACES
);
while
(
*
p
&&
!
strspn
(
p
,
term
))
{
while
(
*
p
&&
!
strspn
(
p
,
term
))
{
char
c
=
*
p
++
;
if
(
c
==
'\\'
&&
*
p
)
{
if
(
c
==
'\\'
&&
*
p
)
{
*
out
++
=
*
p
++
;
end
=
out
;
}
else
if
(
c
==
'\''
)
{
while
(
*
p
&&
*
p
!=
'\''
)
end
=
out
;
}
else
if
(
c
==
'\''
)
{
while
(
*
p
&&
*
p
!=
'\''
)
*
out
++
=
*
p
++
;
if
(
*
p
)
{
if
(
*
p
)
{
p
++
;
end
=
out
;
end
=
out
;
}
}
else
{
}
else
{
*
out
++
=
c
;
}
}
do
{
do
*
out
--
=
0
;
}
while
(
out
>=
end
&&
strspn
(
out
,
WHITESPACES
));
while
(
out
>=
end
&&
strspn
(
out
,
WHITESPACES
));
*
buf
=
p
;
...
...
@@ -196,54 +199,48 @@ const char *av_dirname(char *path)
return
path
;
}
#ifdef TEST
#include "common.h"
int
main
(
void
)
{
int
i
;
const
char
*
strings
[]
=
{
"''"
,
""
,
":"
,
"
\\
"
,
"'"
,
" '' :"
,
" '' '' :"
,
"foo '' :"
,
"'foo'"
,
"foo "
,
" ' foo ' "
,
"foo
\\
"
,
"foo': blah:blah"
,
"foo
\\
: blah:blah"
,
"foo
\'
"
,
"'foo : ' :blahblah"
,
"
\\
:blah"
,
" foo"
,
" foo "
,
" foo
\\
"
,
"foo ':blah"
,
" foo bar : blahblah"
,
"
\\
f
\\
o
\\
o"
,
"'foo :
\\
\\
' : blahblah"
,
"'
\\
fo
\\
o:': blahblah"
,
"
\\
'fo
\\
o
\\
:': foo ' :blahblah"
};
printf
(
"Testing av_get_token()
\n
"
);
{
const
char
*
strings
[]
=
{
"''"
,
""
,
":"
,
"
\\
"
,
"'"
,
" '' :"
,
" '' '' :"
,
"foo '' :"
,
"'foo'"
,
"foo "
,
" ' foo ' "
,
"foo
\\
"
,
"foo': blah:blah"
,
"foo
\\
: blah:blah"
,
"foo
\'
"
,
"'foo : ' :blahblah"
,
"
\\
:blah"
,
" foo"
,
" foo "
,
" foo
\\
"
,
"foo ':blah"
,
" foo bar : blahblah"
,
"
\\
f
\\
o
\\
o"
,
"'foo :
\\
\\
' : blahblah"
,
"'
\\
fo
\\
o:': blahblah"
,
"
\\
'fo
\\
o
\\
:': foo ' :blahblah"
};
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
strings
);
i
++
)
{
const
char
*
p
=
strings
[
i
],
*
q
;
printf
(
"|%s|"
,
p
);
q
=
av_get_token
(
&
p
,
":"
);
printf
(
" -> |%s|"
,
q
);
printf
(
" + |%s|
\n
"
,
p
);
av_free
(
q
);
}
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
strings
);
i
++
)
{
const
char
*
p
=
strings
[
i
],
*
q
;
printf
(
"|%s|"
,
p
);
q
=
av_get_token
(
&
p
,
":"
);
printf
(
" -> |%s|"
,
q
);
printf
(
" + |%s|
\n
"
,
p
);
av_free
(
q
);
}
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment