r86195 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86194‎ | r86195 | r86196 >
Date:11:17, 16 April 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Remove some unused variables

Fix typo in wfDeprecated usage

Fix some more unreachable code
Modified paths:
  • /trunk/phase3/includes/media/Bitmap.php (modified) (history)
  • /trunk/phase3/includes/media/BitmapMetadataHandler.php (modified) (history)
  • /trunk/phase3/includes/media/GIFMetadataExtractor.php (modified) (history)
  • /trunk/phase3/includes/media/Generic.php (modified) (history)
  • /trunk/phase3/includes/media/IPTC.php (modified) (history)
  • /trunk/phase3/includes/media/JpegMetadataExtractor.php (modified) (history)
  • /trunk/phase3/includes/media/PNGMetadataExtractor.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/media/IPTC.php
@@ -401,7 +401,6 @@
402402 * @param $charset String: The charset
403403 */
404404 private static function convIPTC ( $data, $charset ) {
405 - global $wgLang;
406405 if ( is_array( $data ) ) {
407406 foreach ($data as &$val) {
408407 $val = self::convIPTCHelper( $val, $charset );
Index: trunk/phase3/includes/media/GIFMetadataExtractor.php
@@ -114,8 +114,6 @@
115115 }
116116 } elseif ($extension_code == 0xFE) {
117117 // Comment block(s).
118 - $data = '';
119 -
120118 $data = self::readBlock( $fh );
121119 if ( $data === "" ) {
122120 throw new Exception( 'Read error, zero-length comment block' );
Index: trunk/phase3/includes/media/BitmapMetadataHandler.php
@@ -114,7 +114,7 @@
115115 $showXMP = function_exists( 'xml_parser_create_ns' );
116116 $meta = new self();
117117 $meta->getExif( $filename );
118 - $seg = Array();
 118+
119119 $seg = JpegMetadataExtractor::segmentSplitter( $filename );
120120 if ( isset( $seg['COM'] ) && isset( $seg['COM'][0] ) ) {
121121 $meta->addMetadata( Array( 'JPEGFileComment' => $seg['COM'] ), 'native' );
Index: trunk/phase3/includes/media/Bitmap.php
@@ -682,7 +682,7 @@
683683 * @deprecated
684684 */
685685 function getMetadata( $image, $filename ) {
686 - wfDeprected( __METHOD__ );
 686+ wfDeprecated( __METHOD__ );
687687 global $wgShowEXIF;
688688 if ( $wgShowEXIF && file_exists( $filename ) ) {
689689 $exif = new Exif( $filename );
Index: trunk/phase3/includes/media/Generic.php
@@ -125,10 +125,12 @@
126126 */
127127 function convertMetadataVersion( $metadata, $version = 1 ) {
128128 if ( !is_array( $metadata ) ) {
 129+
129130 //unserialize to keep return parameter consistent.
130131 wfSuppressWarnings();
131 - return unserialize( $metadata );
 132+ $ret = unserialize( $metadata );
132133 wfRestoreWarnings();
 134+ return $ret;
133135 }
134136 return $metadata;
135137 }
Index: trunk/phase3/includes/media/PNGMetadataExtractor.php
@@ -53,8 +53,6 @@
5454 /* Other potentially useful things - Document */
5555 );
5656
57 - $showXMP = function_exists( 'xml_parser_create_ns' );
58 -
5957 $frameCount = 0;
6058 $loopCount = 1;
6159 $text = array();
@@ -203,8 +201,6 @@
204202
205203 } elseif ( $chunk_type == 'tEXt' ) {
206204 $buf = self::read( $fh, $chunk_size );
207 - $keyword = '';
208 - $content = '';
209205
210206 list( $keyword, $content ) = explode( "\x00", $buf, 2 );
211207 if ( $keyword === '' || $content === '' ) {
@@ -233,8 +229,6 @@
234230 } elseif ( $chunk_type == 'zTXt' ) {
235231 if ( function_exists( 'gzuncompress' ) ) {
236232 $buf = self::read( $fh, $chunk_size );
237 - $keyword = '';
238 - $postKeyword = '';
239233
240234 list( $keyword, $postKeyword ) = explode( "\x00", $buf, 2 );
241235 if ( $keyword === '' || $postKeyword === '' ) {
Index: trunk/phase3/includes/media/JpegMetadataExtractor.php
@@ -142,11 +142,6 @@
143143
144144 // the +12 is the length of an empty item.
145145 while ( $offset + 12 <= $appLen ) {
146 - $valid = true;
147 - $id = false;
148 - $lenName = false;
149 - $lenData = false;
150 -
151146 if ( substr( $app13, $offset, 4 ) !== '8BIM' ) {
152147 // its supposed to be 8BIM
153148 // but apparently sometimes isn't esp. in

Sign-offs

UserFlagDate
Nikerabbitinspected11:22, 16 April 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r86213follow-up r86195 - That $valid really was reachable :P...bawolff16:23, 16 April 2011
r86225follow-up r86195 (Sort of). Make sure the string there can really be exploded...bawolff18:34, 16 April 2011

Comments

#Comment by Bawolff (talk | contribs)   16:26, 16 April 2011

The wfDeprected is just embarrassing on my part.

The $valid = true; actually is needed there :P. (r86195)

Status & tagging log