From 5d002f4988bf267584f34fa23e69329c73aa15fa Mon Sep 17 00:00:00 2001 From: David Schleef Date: Wed, 4 Feb 2004 19:45:32 +0000 Subject: [PATCH] Convert GST_DEBUG_CAPS() to GST_DEBUG(): Original commit message from CVS: Convert GST_DEBUG_CAPS() to GST_DEBUG(): * gst/mpeg1videoparse/gstmp1videoparse.c: (mp1videoparse_parse_seq): * gst/realmedia/rmdemux.c: (gst_rmdemux_add_stream): * gst/videoscale/gstvideoscale.c: (gst_videoscale_getcaps): * sys/xvideo/gstxwindow.c: (_gst_xwindow_new): * sys/xvideo/xvideosink.c: (gst_xvideosink_sinkconnect), (gst_xvideosink_getcaps): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support): * testsuite/gst-lint: more tests --- ChangeLog | 13 +++++++++++++ gst/videoscale/gstvideoscale.c | 4 ++-- sys/xvimage/xvimagesink.c | 2 +- tests/old/testsuite/gst-lint | 28 +++++++++++++++++++++++++++- testsuite/gst-lint | 28 +++++++++++++++++++++++++++- 5 files changed, 70 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b351c28728..87e31591a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-02-04 David Schleef + + Convert GST_DEBUG_CAPS() to GST_DEBUG(): + * gst/mpeg1videoparse/gstmp1videoparse.c: + (mp1videoparse_parse_seq): + * gst/realmedia/rmdemux.c: (gst_rmdemux_add_stream): + * gst/videoscale/gstvideoscale.c: (gst_videoscale_getcaps): + * sys/xvideo/gstxwindow.c: (_gst_xwindow_new): + * sys/xvideo/xvideosink.c: (gst_xvideosink_sinkconnect), + (gst_xvideosink_getcaps): + * sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_xv_support): + * testsuite/gst-lint: more tests + 2004-02-04 David Schleef Replace use of GST_PAD_FORMATS_FUNCTION() and similar macros diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index ca556562f0..88df0c8f54 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -176,7 +176,7 @@ gst_videoscale_getcaps (GstPad *pad) videoscale->srcpad; othercaps = gst_pad_get_allowed_caps (otherpad); - GST_DEBUG_CAPS("othercaps are", othercaps); + GST_DEBUG ("othercaps are: " GST_PTR_FORMAT, othercaps); caps = gst_caps_copy (othercaps); for(i=0;i) { check_caps(); check_lib_deprecated(); check_typo(); + check_glibisms(); + check_explicit_caps(); # less important stuff @@ -81,7 +84,6 @@ if (0) { check_buffer_alloc(); check_c99_comments(); check_carriage_returns(); - check_glibisms(); #check_indentation(); check_varargs_functions(); check_debugging(); @@ -226,6 +228,9 @@ sub check_glibisms() if (grep { /\brealloc\s*\(/; } @lines) { print "E: use g_realloc() instead of realloc()\n" } + if (grep { /^#include\s+/; } @lines) { + print "E: ctype.h functions are not locale-independent and don't work in UTF-8 locales. Use g_ascii_is*()\n" + } } # @@ -482,3 +487,24 @@ sub check_typo() } } +# +# set_explicit_caps() should preceed pad_add() +# +sub check_explicit_caps() +{ + my $n = 0; + my $lineno = 1; + + foreach $line (@lines){ + if($line =~ /gst_element_add_pad/){ + $n=10; + } + if($n>0 && $line =~ /gst_pad_set_explicit_caps/){ + print "W: ($lineno) explicit caps should be set before adding pad\n"; + return; + } + $n--; + $lineno++; + } +} + diff --git a/testsuite/gst-lint b/testsuite/gst-lint index ce0875124b..16ac951c1c 100755 --- a/testsuite/gst-lint +++ b/testsuite/gst-lint @@ -44,6 +44,7 @@ sub check_gnuc_const(); sub check_caps(); sub check_lib_deprecated(); sub check_typo(); +sub check_explicit_caps(); sub m_check_plugindir(); sub m_check_interfaces(); @@ -69,6 +70,8 @@ foreach $filename () { check_caps(); check_lib_deprecated(); check_typo(); + check_glibisms(); + check_explicit_caps(); # less important stuff @@ -81,7 +84,6 @@ if (0) { check_buffer_alloc(); check_c99_comments(); check_carriage_returns(); - check_glibisms(); #check_indentation(); check_varargs_functions(); check_debugging(); @@ -226,6 +228,9 @@ sub check_glibisms() if (grep { /\brealloc\s*\(/; } @lines) { print "E: use g_realloc() instead of realloc()\n" } + if (grep { /^#include\s+/; } @lines) { + print "E: ctype.h functions are not locale-independent and don't work in UTF-8 locales. Use g_ascii_is*()\n" + } } # @@ -482,3 +487,24 @@ sub check_typo() } } +# +# set_explicit_caps() should preceed pad_add() +# +sub check_explicit_caps() +{ + my $n = 0; + my $lineno = 1; + + foreach $line (@lines){ + if($line =~ /gst_element_add_pad/){ + $n=10; + } + if($n>0 && $line =~ /gst_pad_set_explicit_caps/){ + print "W: ($lineno) explicit caps should be set before adding pad\n"; + return; + } + $n--; + $lineno++; + } +} +