perl-Glib r1068 - in branches/stable-1-20: . t



Author: tsch
Date: Tue Feb  3 19:25:54 2009
New Revision: 1068
URL: http://svn.gnome.org/viewvc/perl-Glib?rev=1068&view=rev

Log:
Merge r1067 from trunk.


Modified:
   branches/stable-1-20/   (props changed)
   branches/stable-1-20/ChangeLog
   branches/stable-1-20/GLog.xs
   branches/stable-1-20/t/a.t

Modified: branches/stable-1-20/GLog.xs
==============================================================================
--- branches/stable-1-20/GLog.xs	(original)
+++ branches/stable-1-20/GLog.xs	Tue Feb  3 19:25:54 2009
@@ -235,7 +235,7 @@
 
 void g_log (class, gchar_ornull * log_domain, SV * log_level, const gchar *message)
     CODE:
-	g_log (log_domain, SvGLogLevelFlags (log_level), message);
+	g_log (log_domain, SvGLogLevelFlags (log_level), "%s", message);
 
 MODULE = Glib::Log	PACKAGE = Glib::Log	PREFIX = g_log_
 
@@ -292,7 +292,7 @@
 		case 2: flags = G_LOG_LEVEL_CRITICAL; break;
 		case 3: flags = G_LOG_LEVEL_WARNING; break;
 	}
-	g_log (domain, flags, message);
+	g_log (domain, flags, "%s", message);
 
 ##
 ## these are not needed -- perl's print() and warn() do the job.

Modified: branches/stable-1-20/t/a.t
==============================================================================
--- branches/stable-1-20/t/a.t	(original)
+++ branches/stable-1-20/t/a.t	Tue Feb  3 19:25:54 2009
@@ -20,7 +20,7 @@
 	# have to bail out.
 	plan skip_all => "g_log doubles messages by accident on 64-bit platforms";
 } else {
-	plan tests => 11;
+	plan tests => 12;
 }
 
 package Foo;
@@ -30,7 +30,7 @@
 
 package main;
 
-$SIG{__WARN__} = sub { ok(1, "in __WARN__: $_[0]"); };
+$SIG{__WARN__} = sub { chomp (my $msg = $_[0]); ok(1, "in __WARN__: $msg"); };
 #$SIG{__DIE__} = sub { ok(1, 'in __DIE__'); };
 
 Glib->message (undef, 'whee message');
@@ -90,6 +90,19 @@
 #print "$ \n";
 #}
 
+# Check that messages with % chars make it through unaltered and don't cause
+# crashes
+{
+	my $id = Glib::Log->set_handler (
+		__PACKAGE__,
+		qw/debug/,
+		sub { is($_[2], '%s %d %s', 'a message with % chars'); });
+
+	Glib->log (__PACKAGE__, qw/debug/, '%s %d %s');
+
+	Glib::Log->remove_handler (__PACKAGE__, $id);
+}
+
 Glib::Log->set_fatal_mask (__PACKAGE__, [qw/ warning message /]);
 Glib::Log->set_always_fatal ([qw/ info debug /]);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]