X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FMacBinary.php;h=da357e52bb0c92d1a9cb21a8bb24668b4f91f7c9;hb=3ccc99dec18a49561d49dd42c10625ecdc61df85;hp=0217c24418296986d11b4ca1987fa43714469871;hpb=a26d5a49d755ff4b8039b11d1f26abb5d7bc7e8c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MacBinary.php b/includes/MacBinary.php index 0217c24418..da357e52bb 100644 --- a/includes/MacBinary.php +++ b/includes/MacBinary.php @@ -19,15 +19,14 @@ * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * - * @package MediaWiki - * @subpackage SpecialPage + * @addtogroup SpecialPage */ class MacBinary { - function MacBinary( $filename ) { + function __construct( $filename ) { $this->open( $filename ); $this->loadHeader(); } @@ -101,7 +100,7 @@ class MacBinary { fseek( $this->handle, 0 ); $head = fread( $this->handle, 128 ); - $this->hexdump( $head ); + #$this->hexdump( $head ); if( strlen( $head ) < 128 ) { wfDebug( "$fname: couldn't read full MacBinary header\n" ); @@ -254,16 +253,19 @@ 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" ); } } } -?> \ No newline at end of file +