r70843 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70842‎ | r70843 | r70844 >
Date:20:47, 10 August 2010
Author:bawolff
Status:ok
Tags:
Comment:
Merging revision 70105 of PNGMetadataExtractor into this branch.
Modified paths:
  • /branches/img_metadata/phase3/includes/media/PNGMetadataExtractor.php (modified) (history)

Diff [purge]

Index: branches/img_metadata/phase3/includes/media/PNGMetadataExtractor.php
@@ -1,7 +1,7 @@
22 <?php
33 /**
44 * PNG frame counter.
5 - * Based on
 5+ * Slightly derived from GIFMetadataExtractor.php
66 * Deliberately not using MWExceptions to avoid external dependencies, encouraging
77 * redistribution.
88 */
@@ -19,41 +19,41 @@
2020 $duration = 0.0;
2121
2222 if (!$filename)
23 - throw new Exception( __METHOD__ . "No file name specified" );
 23+ throw new Exception( __METHOD__ . ": No file name specified" );
2424 elseif ( !file_exists($filename) || is_dir($filename) )
25 - throw new Exception( __METHOD__ . "File $filename does not exist" );
 25+ throw new Exception( __METHOD__ . ": File $filename does not exist" );
2626
2727 $fh = fopen( $filename, 'r' );
2828
2929 if (!$fh)
30 - throw new Exception( __METHOD__ . "Unable to open file $filename" );
 30+ throw new Exception( __METHOD__ . ": Unable to open file $filename" );
3131
3232 // Check for the PNG header
3333 $buf = fread( $fh, 8 );
3434 if ( !($buf == self::$png_sig) ) {
35 - throw new Exception( __METHOD__ . "Not a valid PNG file; header: $buf" );
 35+ throw new Exception( __METHOD__ . ": Not a valid PNG file; header: $buf" );
3636 }
3737
3838 // Read chunks
3939 while( !feof( $fh ) ) {
4040 $buf = fread( $fh, 4 );
41 - if( !$buf ) { throw new Exception( __METHOD__ . "Read error" ); return; }
 41+ if( !$buf ) { throw new Exception( __METHOD__ . ": Read error" ); return; }
4242 $chunk_size = unpack( "N", $buf);
4343 $chunk_size = $chunk_size[1];
4444
4545 $chunk_type = fread( $fh, 4 );
46 - if( !$chunk_type ) { throw new Exception( __METHOD__ . "Read error" ); return; }
 46+ if( !$chunk_type ) { throw new Exception( __METHOD__ . ": Read error" ); return; }
4747
4848 if ( $chunk_type == "acTL" ) {
4949 $buf = fread( $fh, $chunk_size );
50 - if( !$buf ) { throw new Exception( __METHOD__ . "Read error" ); return; }
 50+ if( !$buf ) { throw new Exception( __METHOD__ . ": Read error" ); return; }
5151
5252 $actl = unpack( "Nframes/Nplays", $buf );
5353 $frameCount = $actl['frames'];
5454 $loopCount = $actl['plays'];
5555 } elseif ( $chunk_type == "fcTL" ) {
5656 $buf = fread( $fh, $chunk_size );
57 - if( !$buf ) { throw new Exception( __METHOD__ . "Read error" ); return; }
 57+ if( !$buf ) { throw new Exception( __METHOD__ . ": Read error" ); return; }
5858 $buf = substr( $buf, 20 );
5959
6060 $fctldur = unpack( "ndelay_num/ndelay_den", $buf );

Status & tagging log