Brian Wolff has submitted this change and it was merged.
Change subject: Use a combined const, instead of string concat in Exif.php
......................................................................
Use a combined const, instead of string concat in Exif.php
Fix some spacing while at it
Change-Id: I47ff4aef5125dae6308720680641f617b5795a41
---
M includes/media/Exif.php
1 file changed, 22 insertions(+), 21 deletions(-)
Approvals:
Brian Wolff: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/media/Exif.php b/includes/media/Exif.php
index 52d3195..5581503 100644
--- a/includes/media/Exif.php
+++ b/includes/media/Exif.php
@@ -36,6 +36,7 @@
const SHORT = 3; //!< A 16-bit (2-byte) unsigned integer.
const LONG = 4; //!< A 32-bit (4-byte) unsigned integer.
const RATIONAL = 5; //!< Two LONGs. The first LONG is the numerator and
the second LONG expresses the denominator
+ const SHORT_OR_LONG = 6; //!< A 16-bit (2-byte) or 32-bit (4-byte)
unsigned integer.
const UNDEFINED = 7; //!< An 8-bit byte that can take any value
depending on the field definition
const SLONG = 9; //!< A 32-bit (4-byte) signed integer (2's complement
notation),
const SRATIONAL = 10; //!< Two SLONGs. The first SLONG is the numerator
and the second SLONG is the denominator.
@@ -124,8 +125,8 @@
# TIFF Rev. 6.0 Attribute Information (p22)
'IFD0' => array(
# Tags relating to image structure
- 'ImageWidth' => Exif::SHORT.','.Exif::LONG,
# Image width
- 'ImageLength' => Exif::SHORT.','.Exif::LONG,
# Image height
+ 'ImageWidth' => Exif::SHORT_OR_LONG,
# Image width
+ 'ImageLength' => Exif::SHORT_OR_LONG,
# Image height
'BitsPerSample' => array( Exif::SHORT, 3 ),
# Number of bits per component
# "When a primary image is JPEG compressed,
this designation is not"
# "necessary and is omitted." (p23)
@@ -134,25 +135,25 @@
'Orientation' => Exif::SHORT,
# Orientation of image #p24
'SamplesPerPixel' => Exif::SHORT,
# Number of components
'PlanarConfiguration' => Exif::SHORT,
# Image data arrangement #p24
- 'YCbCrSubSampling' => array( Exif::SHORT, 2),
# Subsampling ratio of Y to C #p24
+ 'YCbCrSubSampling' => array( Exif::SHORT, 2 ),
# Subsampling ratio of Y to C #p24
'YCbCrPositioning' => Exif::SHORT,
# Y and C positioning #p24-25
'XResolution' => Exif::RATIONAL,
# Image resolution in width direction
'YResolution' => Exif::RATIONAL,
# Image resolution in height direction
'ResolutionUnit' => Exif::SHORT,
# Unit of X and Y resolution #(p26)
# Tags relating to recording offset
- 'StripOffsets' => Exif::SHORT.','.Exif::LONG,
# Image data location
- 'RowsPerStrip' => Exif::SHORT.','.Exif::LONG,
# Number of rows per strip
- 'StripByteCounts' =>
Exif::SHORT.','.Exif::LONG, # Bytes per compressed strip
- 'JPEGInterchangeFormat' =>
Exif::SHORT.','.Exif::LONG, # Offset to JPEG SOI
- 'JPEGInterchangeFormatLength' =>
Exif::SHORT.','.Exif::LONG, # Bytes of JPEG data
+ 'StripOffsets' => Exif::SHORT_OR_LONG,
# Image data location
+ 'RowsPerStrip' => Exif::SHORT_OR_LONG,
# Number of rows per strip
+ 'StripByteCounts' => Exif::SHORT_OR_LONG,
# Bytes per compressed strip
+ 'JPEGInterchangeFormat' => Exif::SHORT_OR_LONG,
# Offset to JPEG SOI
+ 'JPEGInterchangeFormatLength' =>
Exif::SHORT_OR_LONG, # Bytes of JPEG data
# Tags relating to image data characteristics
'TransferFunction' => Exif::IGNORE,
# Transfer function
- 'WhitePoint' => array( Exif::RATIONAL, 2),
# White point chromaticity
- 'PrimaryChromaticities' => array(
Exif::RATIONAL, 6), # Chromaticities of primarities
- 'YCbCrCoefficients' => array( Exif::RATIONAL,
3), # Color space transformation matrix coefficients #p27
- 'ReferenceBlackWhite' => array( Exif::RATIONAL,
6), # Pair of black and white reference values
+ 'WhitePoint' => array( Exif::RATIONAL, 2 ),
# White point chromaticity
+ 'PrimaryChromaticities' => array(
Exif::RATIONAL, 6 ), # Chromaticities of primarities
+ 'YCbCrCoefficients' => array( Exif::RATIONAL, 3
), # Color space transformation matrix coefficients #p27
+ 'ReferenceBlackWhite' => array( Exif::RATIONAL,
6 ), # Pair of black and white reference values
# Other tags
'DateTime' => Exif::ASCII,
# File change date and time
@@ -168,7 +169,7 @@
'EXIF' => array(
# TODO: NOTE: Nonexistence of this field is
taken to mean nonconformance
# to the EXIF 2.1 AND 2.2 standards
- 'ExifVersion' => Exif::UNDEFINED,
# Exif version
+ 'ExifVersion' => Exif::UNDEFINED,
# Exif version
'FlashPixVersion' => Exif::UNDEFINED,
# Supported Flashpix version #p32
# Tags relating to Image Data Characteristics
@@ -177,8 +178,8 @@
# Tags relating to image configuration
'ComponentsConfiguration' => Exif::UNDEFINED,
# Meaning of each component #p33
'CompressedBitsPerPixel' => Exif::RATIONAL,
# Image compression mode
- 'PixelYDimension' =>
Exif::SHORT.','.Exif::LONG, # Valid image width
- 'PixelXDimension' =>
Exif::SHORT.','.Exif::LONG, # Valid image height
+ 'PixelYDimension' => Exif::SHORT_OR_LONG,
# Valid image width
+ 'PixelXDimension' => Exif::SHORT_OR_LONG,
# Valid image height
# Tags relating to related user information
'MakerNote' => Exif::IGNORE,
# Manufacturer notes
@@ -218,7 +219,7 @@
'FocalPlaneXResolution' => Exif::RATIONAL,
# Focal plane X resolution
'FocalPlaneYResolution' => Exif::RATIONAL,
# Focal plane Y resolution
'FocalPlaneResolutionUnit' => Exif::SHORT,
# Focal plane resolution unit #p46
- 'SubjectLocation' => array( Exif::SHORT, 2),
# Subject location
+ 'SubjectLocation' => array( Exif::SHORT, 2 ),
# Subject location
'ExposureIndex' => Exif::RATIONAL,
# Exposure index
'SensingMethod' => Exif::SHORT,
# Sensing method #p46
'FileSource' => Exif::UNDEFINED,
# File source #p47
@@ -250,12 +251,12 @@
'GPSLatitudeRef' => Exif::ASCII,
# North or South Latitude #p52-53
'GPSLatitude' => array( Exif::RATIONAL, 3 ),
# Latitude
'GPSLongitudeRef' => Exif::ASCII,
# East or West Longitude #p53
- 'GPSLongitude' => array( Exif::RATIONAL, 3),
# Longitude
+ 'GPSLongitude' => array( Exif::RATIONAL, 3 ),
# Longitude
'GPSAltitudeRef' => Exif::UNDEFINED,
# Altitude reference. Note, the exif standard
says this should be an EXIF::Byte,
# but php seems to disagree.
'GPSAltitude' => Exif::RATIONAL,
# Altitude
- 'GPSTimeStamp' => array( Exif::RATIONAL, 3),
# GPS time (atomic clock)
+ 'GPSTimeStamp' => array( Exif::RATIONAL, 3 ),
# GPS time (atomic clock)
'GPSSatellites' => Exif::ASCII,
# Satellites used for measurement
'GPSStatus' => Exif::ASCII,
# Receiver status #p54
'GPSMeasureMode' => Exif::ASCII,
# Measurement mode #p54-55
@@ -772,6 +773,9 @@
case (string)Exif::RATIONAL:
$this->debug( $val, __FUNCTION__, $debug );
return $this->isRational( $val );
+ case (string)Exif::SHORT_OR_LONG:
+ $this->debug( $val, __FUNCTION__, $debug );
+ return $this->isShort( $val ) || $this->isLong(
$val );
case (string)Exif::UNDEFINED:
$this->debug( $val, __FUNCTION__, $debug );
return $this->isUndefined( $val );
@@ -781,9 +785,6 @@
case (string)Exif::SRATIONAL:
$this->debug( $val, __FUNCTION__, $debug );
return $this->isSrational( $val );
- case (string)Exif::SHORT.','.Exif::LONG:
- $this->debug( $val, __FUNCTION__, $debug );
- return $this->isShort( $val ) || $this->isLong(
$val );
case (string)Exif::IGNORE:
$this->debug( $val, __FUNCTION__, $debug );
return false;
--
To view, visit https://gerrit.wikimedia.org/r/58903
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I47ff4aef5125dae6308720680641f617b5795a41
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits