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
8ddc3262
Commit
8ddc3262
authored
Aug 12, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mem: add av_strndup() for duplicating substrings
parent
aa51b049
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
1 deletion
+34
-1
APIchanges
doc/APIchanges
+3
-0
mem.c
libavutil/mem.c
+20
-0
mem.h
libavutil/mem.h
+10
-0
version.h
libavutil/version.h
+1
-1
No files found.
doc/APIchanges
View file @
8ddc3262
...
@@ -13,6 +13,9 @@ libavutil: 2014-08-09
...
@@ -13,6 +13,9 @@ libavutil: 2014-08-09
API changes, most recent first:
API changes, most recent first:
2014-08-xx - xxxxxxx - lavu 54.03.0 - mem.h
Add av_strndup().
2014-xx-xx - xxxxxxx - lavu 54.02.0 - opt.h
2014-xx-xx - xxxxxxx - lavu 54.02.0 - opt.h
Add av_opt_get_dict_val/set_dict_val with AV_OPT_TYPE_DICT to support
Add av_opt_get_dict_val/set_dict_val with AV_OPT_TYPE_DICT to support
dictionary types being set as options.
dictionary types being set as options.
...
...
libavutil/mem.c
View file @
8ddc3262
...
@@ -222,6 +222,26 @@ char *av_strdup(const char *s)
...
@@ -222,6 +222,26 @@ char *av_strdup(const char *s)
return
ptr
;
return
ptr
;
}
}
char
*
av_strndup
(
const
char
*
s
,
size_t
len
)
{
char
*
ret
=
NULL
,
*
end
;
if
(
!
s
)
return
NULL
;
end
=
memchr
(
s
,
0
,
len
);
if
(
end
)
len
=
end
-
s
;
ret
=
av_realloc
(
NULL
,
len
+
1
);
if
(
!
ret
)
return
NULL
;
memcpy
(
ret
,
s
,
len
);
ret
[
len
]
=
0
;
return
ret
;
}
static
void
fill16
(
uint8_t
*
dst
,
int
len
)
static
void
fill16
(
uint8_t
*
dst
,
int
len
)
{
{
uint32_t
v
=
AV_RN16
(
dst
-
2
);
uint32_t
v
=
AV_RN16
(
dst
-
2
);
...
...
libavutil/mem.h
View file @
8ddc3262
...
@@ -217,6 +217,16 @@ av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t si
...
@@ -217,6 +217,16 @@ av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t si
*/
*/
char
*
av_strdup
(
const
char
*
s
)
av_malloc_attrib
;
char
*
av_strdup
(
const
char
*
s
)
av_malloc_attrib
;
/**
* Duplicate a substring of the string s.
* @param s string to be duplicated
* @param len the maximum length of the resulting string (not counting the
* terminating byte).
* @return Pointer to a newly-allocated string containing a
* copy of s or NULL if the string cannot be allocated.
*/
char
*
av_strndup
(
const
char
*
s
,
size_t
len
)
av_malloc_attrib
;
/**
/**
* Free a memory block which has been allocated with av_malloc(z)() or
* Free a memory block which has been allocated with av_malloc(z)() or
* av_realloc() and set the pointer pointing to it to NULL.
* av_realloc() and set the pointer pointing to it to NULL.
...
...
libavutil/version.h
View file @
8ddc3262
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
*/
*/
#define LIBAVUTIL_VERSION_MAJOR 54
#define LIBAVUTIL_VERSION_MAJOR 54
#define LIBAVUTIL_VERSION_MINOR
2
#define LIBAVUTIL_VERSION_MINOR
3
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
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