closedcaption: Fix broken debug function macros with MSVC build

warning C4003: not enough arguments for function-like macro invocation 'warning'

G_STMT_END macro is extended to the below form with MSVC
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
while(0) \
__pragma(warning(pop))

So MSVC preprocessor will extend it further to
__pragma(VBI_CAT_LEVEL_LOG(push)) ...

Should rename warning() debug macro function therefore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1018>
This commit is contained in:
Seungha Yang 2021-10-02 21:22:23 +09:00
parent 90e5e0efea
commit 05496df0d1
4 changed files with 18 additions and 19 deletions

View file

@ -463,7 +463,7 @@ null_function (vbi3_bit_slicer * bs,
/* n_points = n_points; */
/* raw = raw; */
warning (&bs->log, "vbi3_bit_slicer_set_params() not called.");
warn (&bs->log, "vbi3_bit_slicer_set_params() not called.");
return FALSE;
}
@ -524,13 +524,13 @@ vbi_bool
*n_points = 0;
if (bs->payload > buffer_size * 8) {
warning (&bs->log,
warn (&bs->log,
"buffer_size %u < %u bits of payload.", buffer_size * 8, bs->payload);
return FALSE;
}
if (bs->total_bits > max_points) {
warning (&bs->log,
warn (&bs->log,
"max_points %u < %u CRI, FRC and payload bits.",
max_points, bs->total_bits);
return FALSE;
@ -539,7 +539,7 @@ vbi_bool
if (low_pass_bit_slicer_Y8 == bs->func) {
return bs->func (bs, buffer, points, n_points, raw);
} else if (bit_slicer_Y8 != bs->func) {
warning (&bs->log,
warn (&bs->log,
"Function not implemented for pixfmt %u.", bs->sample_format);
return bs->func (bs, buffer,
/* points */ NULL,
@ -582,7 +582,7 @@ vbi3_bit_slicer_slice (vbi3_bit_slicer * bs,
assert (NULL != raw);
if (bs->payload > buffer_size * 8) {
warning (&bs->log,
warn (&bs->log,
"buffer_size %u < %u bits of payload.", buffer_size * 8, bs->payload);
return FALSE;
}
@ -677,13 +677,12 @@ vbi3_bit_slicer_set_params (vbi3_bit_slicer * bs,
assert (samples_per_line <= 32767);
if (cri_rate > sampling_rate) {
warning (&bs->log,
"cri_rate %u > sampling_rate %u.", cri_rate, sampling_rate);
warn (&bs->log, "cri_rate %u > sampling_rate %u.", cri_rate, sampling_rate);
goto failure;
}
if (payload_rate > sampling_rate) {
warning (&bs->log,
warn (&bs->log,
"payload_rate %u > sampling_rate %u.", payload_rate, sampling_rate);
goto failure;
}
@ -835,7 +834,7 @@ vbi3_bit_slicer_set_params (vbi3_bit_slicer * bs,
default:
warning (&bs->log,
warn (&bs->log,
"Unknown sample_format 0x%x.", (unsigned int) sample_format);
return FALSE;
}
@ -858,7 +857,7 @@ vbi3_bit_slicer_set_params (vbi3_bit_slicer * bs,
if ((sample_offset > samples_per_line)
|| ((cri_samples + data_samples)
> (samples_per_line - sample_offset))) {
warning (&bs->log,
warn (&bs->log,
"%u samples_per_line too small for "
"sample_offset %u + %u cri_bits (%u samples) "
"+ %u frc_bits and %u payload_bits "

View file

@ -541,7 +541,7 @@ signal_u8 (uint8_t * raw,
}
} else {
bounds:
warning (caller, "Sliced line %u out of bounds.", sliced->line);
warn (caller, "Sliced line %u out of bounds.", sliced->line);
return FALSE;
}
@ -620,7 +620,7 @@ signal_u8 (uint8_t * raw,
break;
default:
warning (caller,
warn (caller,
"Service 0x%08x (%s) not supported.",
sliced->id, vbi_sliced_name (sliced->id));
return FALSE;
@ -646,7 +646,7 @@ _vbi_raw_vbi_image (uint8_t * raw,
n_scan_lines = sp->count[0] + sp->count[1];
if (unlikely (n_scan_lines * sp->bytes_per_line > raw_size)) {
warning (__FUNCTION__,
warn (__FUNCTION__,
"(%u + %u lines) * %lu bytes_per_line "
"> %lu raw_size.",
sp->count[0], sp->count[1],
@ -655,7 +655,7 @@ _vbi_raw_vbi_image (uint8_t * raw,
}
if (unlikely (0 != white_level && blank_level > white_level)) {
warning (__FUNCTION__,
warn (__FUNCTION__,
"Invalid blanking %d or peak white level %d.",
blank_level, white_level);
}
@ -796,7 +796,7 @@ _vbi_raw_video_image (uint8_t * raw,
n_scan_lines = sp->count[0] + sp->count[1];
if (unlikely (n_scan_lines * sp->bytes_per_line > raw_size)) {
warning (__FUNCTION__,
warn (__FUNCTION__,
"%u + %u lines * %lu bytes_per_line > %lu raw_size.",
sp->count[0], sp->count[1],
(unsigned long) sp->bytes_per_line, raw_size);
@ -805,7 +805,7 @@ _vbi_raw_video_image (uint8_t * raw,
if (unlikely (0 != white_level
&& (blank_level > black_level || black_level > white_level))) {
warning (__FUNCTION__,
warn (__FUNCTION__,
"Invalid blanking %d, black %d or peak "
"white level %d.", blank_level, black_level, white_level);
}

View file

@ -348,7 +348,7 @@ VBI_CAT_LEVEL_LOG (GstDebugLevel level,
#ifdef G_HAVE_GNUC_VARARGS
#define error(hook, templ, args...) \
VBI_CAT_LEVEL_LOG (GST_LEVEL_ERROR, NULL, templ , ##args)
#define warning(hook, templ, args...) \
#define warn(hook, templ, args...) \
VBI_CAT_LEVEL_LOG (GST_LEVEL_WARNING, NULL, templ , ##args)
#define notice(hook, templ, args...) \
VBI_CAT_LEVEL_LOG (GST_LEVEL_INFO, NULL, templ , ##args)
@ -363,7 +363,7 @@ VBI_CAT_LEVEL_LOG (GstDebugLevel level,
#elif defined(G_HAVE_ISO_VARARGS)
#define error(hook, templ, ...) \
VBI_CAT_LEVEL_LOG (GST_LEVEL_ERROR, NULL, templ, __VA_ARGS__)
#define warning(hook, templ, ...) \
#define warn(hook, templ, ...) \
VBI_CAT_LEVEL_LOG (GST_LEVEL_WARNING, NULL, templ, __VA_ARGS__)
#define notice(hook, templ, ...) \
VBI_CAT_LEVEL_LOG (GST_LEVEL_INFO, NULL, templ, __VA_ARGS__)

View file

@ -374,7 +374,7 @@ vbi_service_set
if (0 == (VBI_VIDEOSTD_SET_ALL & videostd_set_req)
|| ((VBI_VIDEOSTD_SET_525_60 & videostd_set_req)
&& (VBI_VIDEOSTD_SET_625_50 & videostd_set_req))) {
warning (log,
warn (log,
"Ambiguous videostd_set 0x%lx.", (unsigned long) videostd_set_req);
CLEAR (*sp);
return 0;