* Fix notice in MacBinary detection debug data for files of certain lengths

This commit is contained in:
Brion Vibber 2006-06-24 07:04:53 +00:00
parent 1b6b3b177b
commit d37e0b6ecd
2 changed files with 6 additions and 1 deletions

View file

@ -547,6 +547,8 @@ Some default configuration options have changed:
* (bug 2316) Add "caption" attribute to <gallery> tag
* Allow setting the skin object that ImageGallery will use; needed during parse
operations (the skin must come from the ParserOptions, not $wgUser)
* Fix notice in MacBinary detection debug data for files of certain lengths
== Compatibility ==

View file

@ -254,13 +254,16 @@ class MacBinary {
for( $remaining = strlen( $data ); $remaining > 0; $remaining -= $width ) {
$line = sprintf( "%04x:", $at );
$printable = '';
for( $i = 0; $i < $width; $i++ ) {
for( $i = 0; $i < $width && $remaining - $i > 0; $i++ ) {
$byte = ord( $data{$at++} );
$line .= sprintf( " %02x", $byte );
$printable .= ($byte >= 32 && $byte <= 126 )
? chr( $byte )
: '.';
}
if( $i < $width ) {
$line .= str_repeat( ' ', $width - $i );
}
wfDebug( "MacBinary: $line $printable\n" );
}
}