New hook getOtherBlockLogLink, called in Special:IPBlockList to show links to block...
[lhc/web/wiklou.git] / includes / MacBinary.php
index 0217c24..b5b11e6 100644 (file)
  *
  * 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
+ * @ingroup 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,17 @@ 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