fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-12-10 10:26 am

[dw-free] avoid uninitialized warnings in ljtextutil.pl

[commit: http://hg.dwscoalition.org/dw-free/rev/0ba86eefb2b0]

http://bugs.dwscoalition.org/show_bug.cgi?id=3323

Do the check in the other order to avoid warnings.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/ljtextutil.pl
--------------------------------------------------------------------------------
diff -r 29a8d7e6fef1 -r 0ba86eefb2b0 cgi-bin/ljtextutil.pl
--- a/cgi-bin/ljtextutil.pl	Fri Dec 10 18:21:49 2010 +0800
+++ b/cgi-bin/ljtextutil.pl	Fri Dec 10 18:25:45 2010 +0800
@@ -451,7 +451,7 @@ sub text_trim
 
     while ($text =~ m/$utf_char/gco) {
     last unless $char_max;
-        last if $cur + length($1) > $byte_max and $byte_max;
+        last if $byte_max and $cur + length($1) > $byte_max;
         $cur += length($1);
         $char_max--;
     }
--------------------------------------------------------------------------------