One more round of misc cleanup for warnings.
Patch by kareila.
diffs (199 lines):
diff -r dbf331f4a571 -r f4fcc06b2940 cgi-bin/LJ/CleanHTML.pm
--- a/cgi-bin/LJ/CleanHTML.pm Wed Oct 27 17:20:12 2010 +0800
+++ b/cgi-bin/LJ/CleanHTML.pm Thu Oct 28 10:15:22 2010 +0800
@@ -1349,6 +1349,7 @@ sub clean_event
sub clean_event
{
my ($ref, $opts) = @_;
+ return unless $$ref; # nothing to do
# old prototype was passing in the ref and preformatted flag.
# now the second argument is a hashref of options, so convert it to
support the old way.
diff -r dbf331f4a571 -r f4fcc06b2940 cgi-bin/LJ/EmbedModule.pm
--- a/cgi-bin/LJ/EmbedModule.pm Wed Oct 27 17:20:12 2010 +0800
+++ b/cgi-bin/LJ/EmbedModule.pm Thu Oct 28 10:15:22 2010 +0800
@@ -79,7 +79,8 @@ sub expand_entry {
sub expand_entry {
my ($class, $journal, $entryref, %opts) = @_;
- $$entryref =~
s/(<(?:lj|site)\-embed[^>]+\/>)/$class->_expand_tag($journal, $1, $opts{edit},
%opts)/ge;
+ $$entryref =~
s/(<(?:lj|site)\-embed[^>]+\/>)/$class->_expand_tag($journal, $1, $opts{edit},
%opts)/ge
+ if $$entryref;
}
sub _expand_tag {
diff -r dbf331f4a571 -r f4fcc06b2940 cgi-bin/LJ/Message.pm
--- a/cgi-bin/LJ/Message.pm Wed Oct 27 17:20:12 2010 +0800
+++ b/cgi-bin/LJ/Message.pm Thu Oct 28 10:15:22 2010 +0800
@@ -455,7 +455,8 @@ sub preload_rows {
my @rows = eval "${class}::_get_${table}_rows(\$self, \...@msglist)";
# make a mapping of journalid-msgid=> $row
- my %row_map = map { join("-", $_->{journalid}, $_->{msgid}) => $_ } @rows;
+ my %row_map = map { join("-", $_->{journalid}, $_->{msgid}) => $_ }
+ grep { $_ } @rows;
foreach my $msg (@objlist) {
my $row = $row_map{join("-", $msg->journalid, $msg->msgid)};
diff -r dbf331f4a571 -r f4fcc06b2940 cgi-bin/LJ/Poll.pm
--- a/cgi-bin/LJ/Poll.pm Wed Oct 27 17:20:12 2010 +0800
+++ b/cgi-bin/LJ/Poll.pm Thu Oct 28 10:15:22 2010 +0800
@@ -1153,7 +1153,8 @@ sub render {
# displaying a radio or checkbox
if ($do_form) {
- $prevanswer = $clearanswers ? 0 : $preval{$qid} =~
/\b$itid\b/;
+ my $preval_qid = $preval{$qid} || '';
+ $prevanswer = $clearanswers ? 0 : $preval_qid =~
/\b$itid\b/;
$results_table .= LJ::html_check({ 'type' => $q->type,
'name' => "pollq-$qid", 'class'=>"poll-$pollid",
'value' => $itid, 'id' =>
"pollq-$pollid-$qid-$itid",
'selected' => $prevanswer });
@@ -1162,7 +1163,7 @@ sub render {
}
# displaying results
- my $count = $itvotes{$itid}+0;
+ my $count = $itid ? $itvotes{$itid} || 0 : 0;
my $percent = sprintf("%.1f", (100 * $count /
($usersvoted||1)));
my $width = 20+int(($count/$maxitvotes)*380);
@@ -1354,7 +1355,7 @@ sub expand_entry {
return $poll->render;
};
- $$entryref =~ s/<(?:lj-)?poll-(\d+)>/$expand->($1)/eg;
+ $$entryref =~ s/<(?:lj-)?poll-(\d+)>/$expand->($1)/eg if $$entryref;
}
sub process_submission {
diff -r dbf331f4a571 -r f4fcc06b2940 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm Wed Oct 27 17:20:12 2010 +0800
+++ b/cgi-bin/LJ/S2.pm Thu Oct 28 10:15:22 2010 +0800
@@ -3625,8 +3625,9 @@ sub EntryLite__formatted_subject {
# always be at a minimum a hidden visibility subject line for
screenreaders.
my $set_subject = sub {
my ( $all_subs, $always ) = @_;
- return unless $subject eq ""; # no subject
-
+ return if defined $subject and $subject ne "";
+
+ # no subject
my $text_nosubject = $ctx->[S2::PROPS]->{text_nosubject};
if ( $text_nosubject ne "" ) {
# if text_nosubject is set, use it as the subject if
diff -r dbf331f4a571 -r f4fcc06b2940 cgi-bin/LJ/Subscription.pm
--- a/cgi-bin/LJ/Subscription.pm Wed Oct 27 17:20:12 2010 +0800
+++ b/cgi-bin/LJ/Subscription.pm Thu Oct 28 10:15:22 2010 +0800
@@ -585,7 +585,7 @@ sub equals {
sub equals {
my ($self, $other) = @_;
- return 1 if $self->id == $other->id;
+ return 1 if defined $other->id && $self->id == $other->id;
my $match = $self->ntypeid == $other->ntypeid &&
$self->etypeid == $other->etypeid && $self->flags == $other->flags;
diff -r dbf331f4a571 -r f4fcc06b2940 cgi-bin/LJ/Support.pm
--- a/cgi-bin/LJ/Support.pm Wed Oct 27 17:20:12 2010 +0800
+++ b/cgi-bin/LJ/Support.pm Thu Oct 28 10:15:22 2010 +0800
@@ -173,6 +173,7 @@ sub get_cat_by_key
sub get_cat_by_key
{
my ($cats, $cat) = @_;
+ $cat ||= '';
foreach (keys %$cats) {
if ($cats->{$_}->{'catkey'} eq $cat) {
return $cats->{$_};
diff -r dbf331f4a571 -r f4fcc06b2940 cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm Wed Oct 27 17:20:12 2010 +0800
+++ b/cgi-bin/LJ/Talk.pm Thu Oct 28 10:15:22 2010 +0800
@@ -1900,7 +1900,7 @@ sub talkform {
# if parent comment is screened, and user can unscreen, give option to
unscreen it
# default is not to unscreen
- if ( $parpost->{state} eq "S" && LJ::Talk::can_unscreen( $remote,
$journalu, $entry->poster ) ) {
+ if ( $parpost->{state} && $parpost->{state} eq "S" &&
LJ::Talk::can_unscreen( $remote, $journalu, $entry->poster ) ) {
$ret .= "<label
for='unscreen_parent'>$BML::ML{'.opt.unscreenparent'}</label>";
$ret .= LJ::html_check(
{
diff -r dbf331f4a571 -r f4fcc06b2940 cgi-bin/LJ/Widget/CreateAccountEnterCode.pm
--- a/cgi-bin/LJ/Widget/CreateAccountEnterCode.pm Wed Oct 27 17:20:12
2010 +0800
+++ b/cgi-bin/LJ/Widget/CreateAccountEnterCode.pm Thu Oct 28 10:15:22
2010 +0800
@@ -34,7 +34,7 @@ sub render_body {
my $error_msg = sub {
my ( $key, $pre, $post ) = @_;
my $msg = $errors->{$key};
- return unless $msg;
+ return '' unless $msg;
return "$pre $msg $post";
};
diff -r dbf331f4a571 -r f4fcc06b2940 cgi-bin/LJ/Widget/SubmitRequest.pm
--- a/cgi-bin/LJ/Widget/SubmitRequest.pm Wed Oct 27 17:20:12 2010 +0800
+++ b/cgi-bin/LJ/Widget/SubmitRequest.pm Thu Oct 28 10:15:22 2010 +0800
@@ -81,7 +81,7 @@ sub render_body {
}
$ret .= $class->html_select(name => 'spcatid', list => \...@choices,
selected => $post->{spcatid});
- $ret .= LJ::Hooks::run_hook("support_request_cat_extra_text");
+ $ret .= LJ::Hooks::run_hook("support_request_cat_extra_text") || '';
$ret .= "</p></div>";
}
diff -r dbf331f4a571 -r f4fcc06b2940 cgi-bin/ljcapabilities.pl
--- a/cgi-bin/ljcapabilities.pl Wed Oct 27 17:20:12 2010 +0800
+++ b/cgi-bin/ljcapabilities.pl Thu Oct 28 10:15:22 2010 +0800
@@ -68,9 +68,10 @@ sub mask_from_bits {
sub caps_in_group {
my ($caps, $class) = @_;
+ $caps = $caps ? $caps + 0 : 0;
my $bit = LJ::class_bit($class);
die "unknown class '$class'" unless defined $bit;
- return ($caps+0 & (1 << $bit)) ? 1 : 0;
+ return ( $caps & ( 1 << $bit ) ) ? 1 : 0;
}
# <LJFUNC>
diff -r dbf331f4a571 -r f4fcc06b2940 cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl Wed Oct 27 17:20:12 2010 +0800
+++ b/cgi-bin/weblib.pl Thu Oct 28 10:15:22 2010 +0800
@@ -3433,7 +3433,7 @@ sub subscribe_interface {
$ret .= LJ::html_hidden({name => 'post_to_settings_page', value =>
$post_to_settings_page});
# print buttons
- my $referer = BML::get_client_header('Referer');
+ my $referer = BML::get_client_header('Referer') || '';
my $uri = $LJ::SITEROOT . DW::Request->get->uri;
# normalize the URLs -- ../index.bml doesn't make it a different page.
diff -r dbf331f4a571 -r f4fcc06b2940 htdocs/moodlist.bml
--- a/htdocs/moodlist.bml Wed Oct 27 17:20:12 2010 +0800
+++ b/htdocs/moodlist.bml Thu Oct 28 10:15:22 2010 +0800
@@ -54,7 +54,7 @@ body<=
# Get a list of all possible moods
my $moods = DW::Mood->get_moods;
my @mlist = ();
- my %lists = {};
+ my %lists = ();
foreach (sort { $moods->{$a}->{'name'} cmp $moods->{$b}->{'name'} } keys
%$moods) {
my $m = $moods->{$_};
push @mlist, $m;
@@ -192,7 +192,7 @@ body<=
if ($GET{'ownerid'}) {
$ret .= "<div style='margin-bottom:15px; font-weight:bold'>";
- $ret .= LJ::ehtml(@user_themes[0]->{name}) . ' - ';
+ $ret .= LJ::ehtml($user_themes[0]->{name}) . ' - ';
$ret .= LJ::ljuser(LJ::get_username($GET{'ownerid'}));
$ret .= "</div></td></tr>";
} else {
@@ -266,7 +266,7 @@ body<=
if ($GET{'ownerid'}) {
$ret .= "<div style='margin-bottom:15px; font-weight:bold'
align='center'>";
- $ret .= LJ::ehtml(@user_themes[0]->{name}) . ' - ';
+ $ret .= LJ::ehtml($user_themes[0]->{name}) . ' - ';
$ret .= LJ::ljuser(LJ::get_username($GET{'ownerid'}));
$ret .= "</div></td></tr>";
} else {
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog