r71596 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71595‎ | r71596 | r71597 >
Date:22:34, 24 August 2010
Author:reedy
Status:ok
Tags:
Comment:
Fixup whitespace from r71592

if ( !($buf == self::$png_sig) ) { to if ( $buf != self::$png_sig ) {

Add a couple of braces
Modified paths:
  • /trunk/phase3/includes/media/PNGMetadataExtractor.php (modified) (history)
  • /trunk/phase3/maintenance/tests/SearchEngineTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/SearchEngineTest.php
@@ -34,12 +34,12 @@
3535 }
3636
3737 function removeSearchData() {
38 - return;
39 - /*while ( count( $this->pageList ) ) {
40 - list( $title, $id ) = array_pop( $this->pageList );
41 - $article = new Article( $title, $id );
42 - $article->doDeleteArticle( "Search Test" );
43 - }*/
 38+ return;
 39+ /*while ( count( $this->pageList ) ) {
 40+ list( $title, $id ) = array_pop( $this->pageList );
 41+ $article = new Article( $title, $id );
 42+ $article->doDeleteArticle( "Search Test" );
 43+ }*/
4444 }
4545
4646 function fetchIds( $results ) {
Index: trunk/phase3/includes/media/PNGMetadataExtractor.php
@@ -33,12 +33,13 @@
3434
3535 $fh = fopen( $filename, 'r' );
3636
37 - if (!$fh)
 37+ if (!$fh) {
3838 throw new Exception( __METHOD__ . ": Unable to open file $filename" );
 39+ }
3940
4041 // Check for the PNG header
4142 $buf = fread( $fh, 8 );
42 - if ( !($buf == self::$png_sig) ) {
 43+ if ( $buf != self::$png_sig ) {
4344 throw new Exception( __METHOD__ . ": Not a valid PNG file; header: $buf" );
4445 }
4546
@@ -46,21 +47,21 @@
4748 while( !feof( $fh ) ) {
4849 $buf = fread( $fh, 4 );
4950 if( !$buf ) {
50 - throw new Exception( __METHOD__ . ": Read error" );
51 - }
 51+ throw new Exception( __METHOD__ . ": Read error" );
 52+ }
5253 $chunk_size = unpack( "N", $buf);
5354 $chunk_size = $chunk_size[1];
5455
5556 $chunk_type = fread( $fh, 4 );
5657 if( !$chunk_type ) {
57 - throw new Exception( __METHOD__ . ": Read error" );
58 - }
 58+ throw new Exception( __METHOD__ . ": Read error" );
 59+ }
5960
6061 if ( $chunk_type == "acTL" ) {
6162 $buf = fread( $fh, $chunk_size );
6263 if( !$buf ) {
63 - throw new Exception( __METHOD__ . ": Read error" );
64 - }
 64+ throw new Exception( __METHOD__ . ": Read error" );
 65+ }
6566
6667 $actl = unpack( "Nframes/Nplays", $buf );
6768 $frameCount = $actl['frames'];
@@ -68,8 +69,8 @@
6970 } elseif ( $chunk_type == "fcTL" ) {
7071 $buf = fread( $fh, $chunk_size );
7172 if( !$buf ) {
72 - throw new Exception( __METHOD__ . ": Read error" );
73 - }
 73+ throw new Exception( __METHOD__ . ": Read error" );
 74+ }
7475 $buf = substr( $buf, 20 );
7576
7677 $fctldur = unpack( "ndelay_num/ndelay_den", $buf );

Follow-up revisions

RevisionCommit summaryAuthorDate
r71597Fix those spaces too from r71596/r71592reedy22:36, 24 August 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r71592Remove some unreachable code (usually returns after throwing exceptions)...reedy22:03, 24 August 2010

Status & tagging log