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
88bdf747
Commit
88bdf747
authored
Oct 14, 2011
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffprobe: move up ESCAPE_CHECK_SIZE and ESCAPE_REALLOC_BUF macros
So they can be used by other escaping routines.
parent
2f3b028c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
25 deletions
+25
-25
ffprobe.c
ffprobe.c
+25
-25
No files found.
ffprobe.c
View file @
88bdf747
...
@@ -335,6 +335,31 @@ fail:
...
@@ -335,6 +335,31 @@ fail:
return
NULL
;
return
NULL
;
}
}
#define ESCAPE_INIT_BUF_SIZE 256
#define ESCAPE_CHECK_SIZE(src, size, max_size) \
if (size > max_size) { \
char buf[64]; \
snprintf(buf, sizeof(buf), "%s", src); \
av_log(log_ctx, AV_LOG_WARNING, \
"String '%s...' with is too big\n", buf); \
return "FFPROBE_TOO_BIG_STRING"; \
}
#define ESCAPE_REALLOC_BUF(dst_size_p, dst_p, src, size) \
if (*dst_size_p < size) { \
char *q = av_realloc(*dst_p, size); \
if (!q) { \
char buf[64]; \
snprintf(buf, sizeof(buf), "%s", src); \
av_log(log_ctx, AV_LOG_WARNING, \
"String '%s...' could not be escaped\n", buf); \
return "FFPROBE_THIS_STRING_COULD_NOT_BE_ESCAPED"; \
} \
*dst_size_p = size; \
*dst = q; \
}
/* WRITERS */
/* WRITERS */
/* Default output */
/* Default output */
...
@@ -414,8 +439,6 @@ typedef struct {
...
@@ -414,8 +439,6 @@ typedef struct {
size_t
buf_size
;
size_t
buf_size
;
}
JSONContext
;
}
JSONContext
;
#define ESCAPE_INIT_BUF_SIZE 256
static
av_cold
int
json_init
(
WriterContext
*
wctx
,
const
char
*
args
,
void
*
opaque
)
static
av_cold
int
json_init
(
WriterContext
*
wctx
,
const
char
*
args
,
void
*
opaque
)
{
{
JSONContext
*
json
=
wctx
->
priv
;
JSONContext
*
json
=
wctx
->
priv
;
...
@@ -433,29 +456,6 @@ static av_cold void json_uninit(WriterContext *wctx)
...
@@ -433,29 +456,6 @@ static av_cold void json_uninit(WriterContext *wctx)
av_freep
(
&
json
->
buf
);
av_freep
(
&
json
->
buf
);
}
}
#define ESCAPE_CHECK_SIZE(src, size, max_size) \
if (size > max_size) { \
char buf[64]; \
snprintf(buf, sizeof(buf), "%s", src); \
av_log(log_ctx, AV_LOG_WARNING, \
"String '%s...' with is too big\n", buf); \
return "FFPROBE_TOO_BIG_STRING"; \
}
#define ESCAPE_REALLOC_BUF(dst_size_p, dst_p, src, size) \
if (*dst_size_p < size) { \
char *q = av_realloc(*dst_p, size); \
if (!q) { \
char buf[64]; \
snprintf(buf, sizeof(buf), "%s", src); \
av_log(log_ctx, AV_LOG_WARNING, \
"String '%s...' could not be escaped\n", buf); \
return "FFPROBE_THIS_STRING_COULD_NOT_BE_ESCAPED"; \
} \
*dst_size_p = size; \
*dst = q; \
}
static
const
char
*
json_escape_str
(
char
**
dst
,
size_t
*
dst_size
,
const
char
*
src
,
static
const
char
*
json_escape_str
(
char
**
dst
,
size_t
*
dst_size
,
const
char
*
src
,
void
*
log_ctx
)
void
*
log_ctx
)
{
{
...
...
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