From 05496df0d180cf7f264456b6863f2a7b3507d1e4 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 2 Oct 2021 21:22:23 +0900 Subject: [PATCH] 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: --- .../gst-plugins-bad/ext/closedcaption/bit_slicer.c | 19 +++++++++---------- .../gst-plugins-bad/ext/closedcaption/io-sim.c | 12 ++++++------ subprojects/gst-plugins-bad/ext/closedcaption/misc.h | 4 ++-- .../gst-plugins-bad/ext/closedcaption/sampling_par.c | 2 +- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/closedcaption/bit_slicer.c b/subprojects/gst-plugins-bad/ext/closedcaption/bit_slicer.c index 98d6ad7..bfc1977 100644 --- a/subprojects/gst-plugins-bad/ext/closedcaption/bit_slicer.c +++ b/subprojects/gst-plugins-bad/ext/closedcaption/bit_slicer.c @@ -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 " diff --git a/subprojects/gst-plugins-bad/ext/closedcaption/io-sim.c b/subprojects/gst-plugins-bad/ext/closedcaption/io-sim.c index 9535e82..4b3da36 100644 --- a/subprojects/gst-plugins-bad/ext/closedcaption/io-sim.c +++ b/subprojects/gst-plugins-bad/ext/closedcaption/io-sim.c @@ -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); } diff --git a/subprojects/gst-plugins-bad/ext/closedcaption/misc.h b/subprojects/gst-plugins-bad/ext/closedcaption/misc.h index 687b454..64b891a 100644 --- a/subprojects/gst-plugins-bad/ext/closedcaption/misc.h +++ b/subprojects/gst-plugins-bad/ext/closedcaption/misc.h @@ -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__) diff --git a/subprojects/gst-plugins-bad/ext/closedcaption/sampling_par.c b/subprojects/gst-plugins-bad/ext/closedcaption/sampling_par.c index b08c63a..3c5dfee 100644 --- a/subprojects/gst-plugins-bad/ext/closedcaption/sampling_par.c +++ b/subprojects/gst-plugins-bad/ext/closedcaption/sampling_par.c @@ -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; -- 2.7.4