closedcaption: Fix broken debug function macros with MSVC build
authorSeungha Yang <seungha@centricular.com>
Sat, 2 Oct 2021 12:22:23 +0000 (21:22 +0900)
committerSeungha Yang <seungha@centricular.com>
Mon, 4 Oct 2021 14:03:20 +0000 (23:03 +0900)
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>

subprojects/gst-plugins-bad/ext/closedcaption/bit_slicer.c
subprojects/gst-plugins-bad/ext/closedcaption/io-sim.c
subprojects/gst-plugins-bad/ext/closedcaption/misc.h
subprojects/gst-plugins-bad/ext/closedcaption/sampling_par.c

index 98d6ad7..bfc1977 100644 (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 "
index 9535e82..4b3da36 100644 (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);
   }
index 687b454..64b891a 100644 (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__)
index b08c63a..3c5dfee 100644 (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;