Ensure that ExifTagTable[] is sorted by tag to allow for future
authorDan Fandrich <dan@coneharvesters.com>
Wed, 14 Oct 2009 06:57:08 +0000 (23:57 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Wed, 14 Oct 2009 06:57:08 +0000 (23:57 -0700)
more efficient searching.

ChangeLog
libexif/exif-tag.c
libexif/exif-tag.h
test/Makefile.am
test/test-sorted.c [new file with mode: 0644]

index 79adf5f..d99700f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@
        * po/vi.po: Updated Vietnamese translation by Clytie Siddall
        * Fixed an inverted logic condition that prevented the bug
          report address from appearing in the .pot file
+       * Ensure that ExifTagTable[] is sorted by tag to allow for future
+         more efficient searching.
 
 2009-10-09  Dan Fandrich <dan@coneharvesters.com>
 
index d73c350..3f113aa 100644 (file)
 #define ESL_NNNO { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_OPTIONAL }
 #define ESL_GPS { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN }
 
+/*!
+ * Table giving information about each EXIF tag.
+ * There may be more than one entry with the same tag value because some tags
+ * have different meanings depending on the IFD in which they appear.
+ * When there are such duplicate entries, there must be no overlap in their
+ * support levels.
+ * The entries MUST be sorted in tag order.
+ * The name and title are mandatory, but the description may be NULL.
+ */
 static const struct {
        /*! Tag ID. There may be duplicate tags when the same number is used for
         * different meanings in different IFDs. */
@@ -49,10 +58,12 @@ static const struct {
        ExifSupportLevel esl[EXIF_IFD_COUNT][EXIF_DATA_TYPE_COUNT];
 } ExifTagTable[] = {
 #ifndef NO_VERBOSE_TAG_STRINGS
-       /* Not in EXIF 2.2 */
-       {EXIF_TAG_NEW_SUBFILE_TYPE, "NewSubfileType",
-        N_("New Subfile Type"), N_("A general indication of the kind of data "
-           "contained in this subfile.")},
+       {EXIF_TAG_GPS_VERSION_ID, "GPSVersionID", N_("GPS tag version"),
+        N_("Indicates the version of <GPSInfoIFD>. The version is given "
+           "as 2.0.0.0. This tag is mandatory when <GPSInfo> tag is "
+           "present. (Note: The <GPSVersionID> tag is given in bytes, "
+           "unlike the <ExifVersion> tag. When the version is "
+           "2.0.0.0, the tag value is 02000000.H)."), ESL_GPS},
        {EXIF_TAG_INTEROPERABILITY_INDEX, "InteroperabilityIndex",
         N_("Interoperability Index"),
         N_("Indicates the identification of the Interoperability rule. "
@@ -61,9 +72,152 @@ static const struct {
            "volume of Recommended Exif Interoperability Rules (ExifR98) "
            "for other tags used for ExifR98."),
         { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_OOOO } },
+       {EXIF_TAG_GPS_LATITUDE_REF, "GPSLatitudeRef", N_("North or South Latitude"),
+        N_("Indicates whether the latitude is north or south latitude. The "
+           "ASCII value 'N' indicates north latitude, and 'S' is south "
+           "latitude."), ESL_GPS},
        {EXIF_TAG_INTEROPERABILITY_VERSION, "InteroperabilityVersion",
         N_("Interoperability Version"), "",
         { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_OOOO } },
+       {EXIF_TAG_GPS_LATITUDE, "GPSLatitude", N_("Latitude"),
+        N_("Indicates the latitude. The latitude is expressed as three "
+           "RATIONAL values giving the degrees, minutes, and seconds, "
+           "respectively. When degrees, minutes and seconds are expressed, "
+           "the format is dd/1,mm/1,ss/1. When degrees and minutes are used "
+           "and, for example, fractions of minutes are given up to two "
+           "decimal places, the format is dd/1,mmmm/100,0/1."),
+        ESL_GPS},
+       {EXIF_TAG_GPS_LONGITUDE_REF, "GPSLongitudeRef", N_("East or West Longitude"),
+        N_("Indicates whether the longitude is east or west longitude. "
+           "ASCII 'E' indicates east longitude, and 'W' is west "
+           "longitude."), ESL_GPS},
+       {EXIF_TAG_GPS_LONGITUDE, "GPSLongitude", N_("Longitude"),
+        N_("Indicates the longitude. The longitude is expressed as three "
+           "RATIONAL values giving the degrees, minutes, and seconds, "
+           "respectively. When degrees, minutes and seconds are expressed, "
+           "the format is ddd/1,mm/1,ss/1. When degrees and minutes are "
+           "used and, for example, fractions of minutes are given up to "
+           "two decimal places, the format is ddd/1,mmmm/100,0/1."),
+        ESL_GPS},
+       {EXIF_TAG_GPS_ALTITUDE_REF, "GPSAltitudeRef", N_("Altitude reference"),
+        N_("Indicates the altitude used as the reference altitude. If the "
+           "reference is sea level and the altitude is above sea level, 0 "
+           "is given. If the altitude is below sea level, a value of 1 is given "
+           "and the altitude is indicated as an absolute value in the "
+           "GSPAltitude tag. The reference unit is meters. Note that this tag "
+           "is BYTE type, unlike other reference tags."), ESL_GPS},
+       {EXIF_TAG_GPS_ALTITUDE, "GPSAltitude", N_("Altitude"),
+        N_("Indicates the altitude based on the reference in GPSAltitudeRef. "
+           "Altitude is expressed as one RATIONAL value. The reference unit "
+           "is meters."), ESL_GPS},
+       {EXIF_TAG_GPS_TIME_STAMP, "GPSTimeStamp", N_("GPS time (atomic clock)"),
+         N_("Indicates the time as UTC (Coordinated Universal Time). "
+           "TimeStamp is expressed as three RATIONAL values giving "
+            "the hour, minute, and second."), ESL_GPS},
+       {EXIF_TAG_GPS_SATELLITES, "GPSSatellites", N_("GPS satellites used for measurement"),
+         N_("Indicates the GPS satellites used for measurements. This "
+            "tag can be used to describe the number of satellites, their ID "
+            "number, angle of elevation, azimuth, SNR and other information "
+            "in ASCII notation. The format is not specified. If the GPS "
+            "receiver is incapable of taking measurements, value of the tag "
+            "shall be set to NULL."), ESL_GPS},
+       {EXIF_TAG_GPS_STATUS, "GPSStatus", N_("GPS receiver status"),
+         N_("Indicates the status of the GPS receiver when the image is "
+            "recorded. 'A' means measurement is in progress, and 'V' means "
+            "the measurement is Interoperability."), ESL_GPS},
+       {EXIF_TAG_GPS_MEASURE_MODE, "GPSMeasureMode", N_("GPS measurement mode"),
+         N_("Indicates the GPS measurement mode. '2' means "
+            "two-dimensional measurement and '3' means three-dimensional "
+            "measurement is in progress."), ESL_GPS},
+       {EXIF_TAG_GPS_DOP, "GPSDOP", N_("Measurement precision"),
+         N_("Indicates the GPS DOP (data degree of precision). An HDOP "
+            "value is written during two-dimensional measurement, and PDOP "
+            "during three-dimensional measurement."), ESL_GPS},
+       {EXIF_TAG_GPS_SPEED_REF, "GPSSpeedRef", N_("Speed unit"),
+         N_("Indicates the unit used to express the GPS receiver speed "
+            "of movement. 'K', 'M' and 'N' represent kilometers per hour, "
+            "miles per hour, and knots."), ESL_GPS},
+       {EXIF_TAG_GPS_SPEED, "GPSSpeed", N_("Speed of GPS receiver"),
+        N_("Indicates the speed of GPS receiver movement."), ESL_GPS},
+       {EXIF_TAG_GPS_TRACK_REF, "GPSTrackRef", N_("Reference for direction of movement"),
+         N_("Indicates the reference for giving the direction of GPS "
+            "receiver movement. 'T' denotes true direction and 'M' is "
+            "magnetic direction."), ESL_GPS},
+       {EXIF_TAG_GPS_TRACK, "GPSTrack", N_("Direction of movement"),
+         N_("Indicates the direction of GPS receiver movement. The range "
+            "of values is from 0.00 to 359.99."), ESL_GPS},
+       {EXIF_TAG_GPS_IMG_DIRECTION_REF, "GPSImgDirectionRef", N_("GPS Img Direction Reference"),
+        N_("Indicates the reference for giving the direction of the image when it is captured. "
+           "'T' denotes true direction and 'M' is magnetic direction."), ESL_GPS},
+       {EXIF_TAG_GPS_IMG_DIRECTION, "GPSImgDirection", N_("GPS Img Direction"),
+        N_("Indicates the direction of the image when it was captured. The range of values is "
+           "from 0.00 to 359.99."), ESL_GPS},
+       {EXIF_TAG_GPS_MAP_DATUM, "GPSMapDatum", N_("Geodetic survey data used"),
+         N_("Indicates the geodetic survey data used by the GPS "
+            "receiver. If the survey data is restricted to Japan, the value "
+            "of this tag is 'TOKYO' or 'WGS-84'. If a GPS Info tag is "
+            "recorded, it is strongly recommended that this tag be recorded."), ESL_GPS},
+       {EXIF_TAG_GPS_DEST_LATITUDE_REF, "GPSDestLatitudeRef", N_("Reference for latitude of destination"),
+         N_("Indicates whether the latitude of the destination point is "
+            "north or south latitude. The ASCII value 'N' indicates north "
+            "latitude, and 'S' is south latitude."), ESL_GPS},
+       {EXIF_TAG_GPS_DEST_LATITUDE, "GPSDestLatitude", N_("Latitude of destination"),
+         N_("Indicates the latitude of the destination point. The "
+            "latitude is expressed as three RATIONAL values giving the "
+            "degrees, minutes, and seconds, respectively. If latitude is "
+            "expressed as degrees, minutes and seconds, a typical format "
+            "would be dd/1,mm/1,ss/1. When degrees and minutes are used and, "
+            "for example, fractions of minutes are given up to two decimal "
+            "places, the format would be dd/1,mmmm/100,0/1."), ESL_GPS},
+       {EXIF_TAG_GPS_DEST_LONGITUDE_REF, "GPSDestLongitudeRef", N_("Reference for longitude of destination"),
+         N_("Indicates whether the longitude of the destination point is "
+            "east or west longitude. ASCII 'E' indicates east longitude, and "
+            "'W' is west longitude."), ESL_GPS},
+       {EXIF_TAG_GPS_DEST_LONGITUDE, "GPSDestLongitude", N_("Longitude of destination"),
+         N_("Indicates the longitude of the destination point. The "
+            "longitude is expressed as three RATIONAL values giving the "
+            "degrees, minutes, and seconds, respectively. If longitude is "
+            "expressed as degrees, minutes and seconds, a typical format "
+            "would be ddd/1,mm/1,ss/1. When degrees and minutes are used "
+            "and, for example, fractions of minutes are given up to two "
+            "decimal places, the format would be ddd/1,mmmm/100,0/1."),
+         ESL_GPS},
+       {EXIF_TAG_GPS_DEST_BEARING_REF, "GPSDestBearingRef", N_("Reference for bearing of destination"),
+         N_("Indicates the reference used for giving the bearing to "
+            "the destination point. 'T' denotes true direction and 'M' is "
+            "magnetic direction."), ESL_GPS},
+       {EXIF_TAG_GPS_DEST_BEARING, "GPSDestBearing", N_("Bearing of destination"),
+         N_("Indicates the bearing to the destination point. The range "
+            "of values is from 0.00 to 359.99."), ESL_GPS},
+       {EXIF_TAG_GPS_DEST_DISTANCE_REF, "GPSDestDistanceRef", N_("Reference for distance to destination"),
+         N_("Indicates the unit used to express the distance to the "
+            "destination point. 'K', 'M' and 'N' represent kilometers, miles "
+            "and knots."), ESL_GPS},
+       {EXIF_TAG_GPS_DEST_DISTANCE, "GPSDestDistance", N_("Distance to destination"),
+        N_("Indicates the distance to the destination point."), ESL_GPS},
+       {EXIF_TAG_GPS_PROCESSING_METHOD, "GPSProcessingMethod", N_("Name of GPS processing method"),
+         N_("A character string recording the name of the method used "
+            "for location finding. The first byte indicates the character "
+            "code used, and this is followed by the name "
+            "of the method. Since the Type is not ASCII, NULL termination is "
+            "not necessary."), ESL_GPS},
+       {EXIF_TAG_GPS_AREA_INFORMATION, "GPSAreaInformation", N_("Name of GPS area"),
+         N_("A character string recording the name of the GPS area. The "
+            "first byte indicates the character code used, "
+            "and this is followed by the name of the GPS area. Since "
+            "the Type is not ASCII, NULL termination is not necessary."), ESL_GPS},
+       {EXIF_TAG_GPS_DATE_STAMP, "GPSDateStamp", N_("GPS date"),
+         N_("A character string recording date and time information "
+            "relative to UTC (Coordinated Universal Time). The format is "
+            "\"YYYY:MM:DD\". The length of the string is 11 bytes including "
+            "NULL."), ESL_GPS},
+       {EXIF_TAG_GPS_DIFFERENTIAL, "GPSDifferential", N_("GPS differential correction"),
+         N_("Indicates whether differential correction is applied to the "
+            "GPS receiver."), ESL_GPS},
+       /* Not in EXIF 2.2 */
+       {EXIF_TAG_NEW_SUBFILE_TYPE, "NewSubfileType",
+        N_("New Subfile Type"), N_("A general indication of the kind of data "
+           "contained in this subfile.")},
        {EXIF_TAG_IMAGE_WIDTH, "ImageWidth", N_("Image Width"),
         N_("The number of columns of image data, equal to the number of "
            "pixels per row. In JPEG compressed data a JPEG marker is "
@@ -201,11 +355,11 @@ static const struct {
            "specified in the color space information tag (<ColorSpace>)."),
         { ESL_OOOO, ESL_OOOO, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
        /* Not in EXIF 2.2 */
-       {EXIF_TAG_TRANSFER_RANGE, "TransferRange", N_("Transfer Range"), ""},
-       /* Not in EXIF 2.2 */
        {EXIF_TAG_SUB_IFDS, "SubIFDs", "SubIFD Offsets", N_("Defined by Adobe Corporation "
            "to enable TIFF Trees within a TIFF file.")},
        /* Not in EXIF 2.2 */
+       {EXIF_TAG_TRANSFER_RANGE, "TransferRange", N_("Transfer Range"), ""},
+       /* Not in EXIF 2.2 */
        {EXIF_TAG_JPEG_PROC, "JPEGProc", "JPEGProc", ""},
        {EXIF_TAG_JPEG_INTERCHANGE_FORMAT, "JPEGInterchangeFormat",
         N_("JPEG Interchange Format"),
@@ -344,152 +498,6 @@ static const struct {
            "Exif IFD, has no image data."),
         { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_NNNN } },
 
-       {EXIF_TAG_GPS_VERSION_ID, "GPSVersionID", N_("GPS tag version"),
-        N_("Indicates the version of <GPSInfoIFD>. The version is given "
-           "as 2.0.0.0. This tag is mandatory when <GPSInfo> tag is "
-           "present. (Note: The <GPSVersionID> tag is given in bytes, "
-           "unlike the <ExifVersion> tag. When the version is "
-           "2.0.0.0, the tag value is 02000000.H)."), ESL_GPS},
-       {EXIF_TAG_GPS_LATITUDE_REF, "GPSLatitudeRef", N_("North or South Latitude"),
-        N_("Indicates whether the latitude is north or south latitude. The "
-           "ASCII value 'N' indicates north latitude, and 'S' is south "
-           "latitude."), ESL_GPS},
-       {EXIF_TAG_GPS_LATITUDE, "GPSLatitude", N_("Latitude"),
-        N_("Indicates the latitude. The latitude is expressed as three "
-           "RATIONAL values giving the degrees, minutes, and seconds, "
-           "respectively. When degrees, minutes and seconds are expressed, "
-           "the format is dd/1,mm/1,ss/1. When degrees and minutes are used "
-           "and, for example, fractions of minutes are given up to two "
-           "decimal places, the format is dd/1,mmmm/100,0/1."),
-        ESL_GPS},
-       {EXIF_TAG_GPS_LONGITUDE_REF, "GPSLongitudeRef", N_("East or West Longitude"),
-        N_("Indicates whether the longitude is east or west longitude. "
-           "ASCII 'E' indicates east longitude, and 'W' is west "
-           "longitude."), ESL_GPS},
-       {EXIF_TAG_GPS_LONGITUDE, "GPSLongitude", N_("Longitude"),
-        N_("Indicates the longitude. The longitude is expressed as three "
-           "RATIONAL values giving the degrees, minutes, and seconds, "
-           "respectively. When degrees, minutes and seconds are expressed, "
-           "the format is ddd/1,mm/1,ss/1. When degrees and minutes are "
-           "used and, for example, fractions of minutes are given up to "
-           "two decimal places, the format is ddd/1,mmmm/100,0/1."),
-        ESL_GPS},
-       {EXIF_TAG_GPS_ALTITUDE_REF, "GPSAltitudeRef", N_("Altitude reference"),
-        N_("Indicates the altitude used as the reference altitude. If the "
-           "reference is sea level and the altitude is above sea level, 0 "
-           "is given. If the altitude is below sea level, a value of 1 is given "
-           "and the altitude is indicated as an absolute value in the "
-           "GSPAltitude tag. The reference unit is meters. Note that this tag "
-           "is BYTE type, unlike other reference tags."), ESL_GPS},
-       {EXIF_TAG_GPS_ALTITUDE, "GPSAltitude", N_("Altitude"),
-        N_("Indicates the altitude based on the reference in GPSAltitudeRef. "
-           "Altitude is expressed as one RATIONAL value. The reference unit "
-           "is meters."), ESL_GPS},
-       {EXIF_TAG_GPS_TIME_STAMP, "GPSTimeStamp", N_("GPS time (atomic clock)"),
-         N_("Indicates the time as UTC (Coordinated Universal Time). "
-           "TimeStamp is expressed as three RATIONAL values giving "
-            "the hour, minute, and second."), ESL_GPS},
-       {EXIF_TAG_GPS_SATELLITES, "GPSSatellites", N_("GPS satellites used for measurement"),
-         N_("Indicates the GPS satellites used for measurements. This "
-            "tag can be used to describe the number of satellites, their ID "
-            "number, angle of elevation, azimuth, SNR and other information "
-            "in ASCII notation. The format is not specified. If the GPS "
-            "receiver is incapable of taking measurements, value of the tag "
-            "shall be set to NULL."), ESL_GPS},
-       {EXIF_TAG_GPS_STATUS, "GPSStatus", N_("GPS receiver status"),
-         N_("Indicates the status of the GPS receiver when the image is "
-            "recorded. 'A' means measurement is in progress, and 'V' means "
-            "the measurement is Interoperability."), ESL_GPS},
-       {EXIF_TAG_GPS_MEASURE_MODE, "GPSMeasureMode", N_("GPS measurement mode"),
-         N_("Indicates the GPS measurement mode. '2' means "
-            "two-dimensional measurement and '3' means three-dimensional "
-            "measurement is in progress."), ESL_GPS},
-       {EXIF_TAG_GPS_DOP, "GPSDOP", N_("Measurement precision"),
-         N_("Indicates the GPS DOP (data degree of precision). An HDOP "
-            "value is written during two-dimensional measurement, and PDOP "
-            "during three-dimensional measurement."), ESL_GPS},
-       {EXIF_TAG_GPS_SPEED_REF, "GPSSpeedRef", N_("Speed unit"),
-         N_("Indicates the unit used to express the GPS receiver speed "
-            "of movement. 'K', 'M' and 'N' represent kilometers per hour, "
-            "miles per hour, and knots."), ESL_GPS},
-       {EXIF_TAG_GPS_SPEED, "GPSSpeed", N_("Speed of GPS receiver"),
-        N_("Indicates the speed of GPS receiver movement."), ESL_GPS},
-       {EXIF_TAG_GPS_TRACK_REF, "GPSTrackRef", N_("Reference for direction of movement"),
-         N_("Indicates the reference for giving the direction of GPS "
-            "receiver movement. 'T' denotes true direction and 'M' is "
-            "magnetic direction."), ESL_GPS},
-       {EXIF_TAG_GPS_TRACK, "GPSTrack", N_("Direction of movement"),
-         N_("Indicates the direction of GPS receiver movement. The range "
-            "of values is from 0.00 to 359.99."), ESL_GPS},
-       {EXIF_TAG_GPS_IMG_DIRECTION_REF, "GPSImgDirectionRef", N_("GPS Img Direction Reference"),
-        N_("Indicates the reference for giving the direction of the image when it is captured. "
-           "'T' denotes true direction and 'M' is magnetic direction."), ESL_GPS},
-       {EXIF_TAG_GPS_IMG_DIRECTION, "GPSImgDirection", N_("GPS Img Direction"),
-        N_("Indicates the direction of the image when it was captured. The range of values is "
-           "from 0.00 to 359.99."), ESL_GPS},
-       {EXIF_TAG_GPS_MAP_DATUM, "GPSMapDatum", N_("Geodetic survey data used"),
-         N_("Indicates the geodetic survey data used by the GPS "
-            "receiver. If the survey data is restricted to Japan, the value "
-            "of this tag is 'TOKYO' or 'WGS-84'. If a GPS Info tag is "
-            "recorded, it is strongly recommended that this tag be recorded."), ESL_GPS},
-       {EXIF_TAG_GPS_DEST_LATITUDE_REF, "GPSDestLatitudeRef", N_("Reference for latitude of destination"),
-         N_("Indicates whether the latitude of the destination point is "
-            "north or south latitude. The ASCII value 'N' indicates north "
-            "latitude, and 'S' is south latitude."), ESL_GPS},
-       {EXIF_TAG_GPS_DEST_LATITUDE, "GPSDestLatitude", N_("Latitude of destination"),
-         N_("Indicates the latitude of the destination point. The "
-            "latitude is expressed as three RATIONAL values giving the "
-            "degrees, minutes, and seconds, respectively. If latitude is "
-            "expressed as degrees, minutes and seconds, a typical format "
-            "would be dd/1,mm/1,ss/1. When degrees and minutes are used and, "
-            "for example, fractions of minutes are given up to two decimal "
-            "places, the format would be dd/1,mmmm/100,0/1."), ESL_GPS},
-       {EXIF_TAG_GPS_DEST_LONGITUDE_REF, "GPSDestLongitudeRef", N_("Reference for longitude of destination"),
-         N_("Indicates whether the longitude of the destination point is "
-            "east or west longitude. ASCII 'E' indicates east longitude, and "
-            "'W' is west longitude."), ESL_GPS},
-       {EXIF_TAG_GPS_DEST_LONGITUDE, "GPSDestLongitude", N_("Longitude of destination"),
-         N_("Indicates the longitude of the destination point. The "
-            "longitude is expressed as three RATIONAL values giving the "
-            "degrees, minutes, and seconds, respectively. If longitude is "
-            "expressed as degrees, minutes and seconds, a typical format "
-            "would be ddd/1,mm/1,ss/1. When degrees and minutes are used "
-            "and, for example, fractions of minutes are given up to two "
-            "decimal places, the format would be ddd/1,mmmm/100,0/1."),
-         ESL_GPS},
-       {EXIF_TAG_GPS_DEST_BEARING_REF, "GPSDestBearingRef", N_("Reference for bearing of destination"),
-         N_("Indicates the reference used for giving the bearing to "
-            "the destination point. 'T' denotes true direction and 'M' is "
-            "magnetic direction."), ESL_GPS},
-       {EXIF_TAG_GPS_DEST_BEARING, "GPSDestBearing", N_("Bearing of destination"),
-         N_("Indicates the bearing to the destination point. The range "
-            "of values is from 0.00 to 359.99."), ESL_GPS},
-       {EXIF_TAG_GPS_DEST_DISTANCE_REF, "GPSDestDistanceRef", N_("Reference for distance to destination"),
-         N_("Indicates the unit used to express the distance to the "
-            "destination point. 'K', 'M' and 'N' represent kilometers, miles "
-            "and knots."), ESL_GPS},
-       {EXIF_TAG_GPS_DEST_DISTANCE, "GPSDestDistance", N_("Distance to destination"),
-        N_("Indicates the distance to the destination point."), ESL_GPS},
-       {EXIF_TAG_GPS_PROCESSING_METHOD, "GPSProcessingMethod", N_("Name of GPS processing method"),
-         N_("A character string recording the name of the method used "
-            "for location finding. The first byte indicates the character "
-            "code used, and this is followed by the name "
-            "of the method. Since the Type is not ASCII, NULL termination is "
-            "not necessary."), ESL_GPS},
-       {EXIF_TAG_GPS_AREA_INFORMATION, "GPSAreaInformation", N_("Name of GPS area"),
-         N_("A character string recording the name of the GPS area. The "
-            "first byte indicates the character code used, "
-            "and this is followed by the name of the GPS area. Since "
-            "the Type is not ASCII, NULL termination is not necessary."), ESL_GPS},
-       {EXIF_TAG_GPS_DATE_STAMP, "GPSDateStamp", N_("GPS date"),
-         N_("A character string recording date and time information "
-            "relative to UTC (Coordinated Universal Time). The format is "
-            "\"YYYY:MM:DD\". The length of the string is 11 bytes including "
-            "NULL."), ESL_GPS},
-       {EXIF_TAG_GPS_DIFFERENTIAL, "GPSDifferential", N_("GPS differential correction"),
-         N_("Indicates whether differential correction is applied to the "
-            "GPS receiver."), ESL_GPS},
-
        {EXIF_TAG_ISO_SPEED_RATINGS, "ISOSpeedRatings",
         N_("ISO Speed Ratings"),
         N_("Indicates the ISO Speed and ISO Latitude of the camera or "
@@ -573,6 +581,12 @@ static const struct {
         N_("The actual focal length of the lens, in mm. Conversion is not "
            "made to the focal length of a 35 mm film camera."),
         { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
+       {EXIF_TAG_SUBJECT_AREA, "SubjectArea", N_("Subject Area"),
+        N_("This tag indicates the location and area of the main subject "
+           "in the overall scene."),
+        { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
+       /* Not in EXIF 2.2 */
+       {EXIF_TAG_TIFF_EP_STANDARD_ID, "TIFF/EPStandardID", N_("TIFF/EP Standard ID"), ""},
        {EXIF_TAG_MAKER_NOTE, "MakerNote", N_("Maker Note"),
         N_("A tag for manufacturers of Exif writers to record any desired "
            "information. The contents are up to the manufacturer."),
@@ -772,12 +786,6 @@ static const struct {
            "image sensor when a one-chip color area sensor is used. "
            "It does not apply to all sensing methods."),
         { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
-       {EXIF_TAG_SUBJECT_AREA, "SubjectArea", N_("Subject Area"),
-        N_("This tag indicates the location and area of the main subject "
-           "in the overall scene."),
-        { ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN, ESL_NNNN } },
-       /* Not in EXIF 2.2 */
-       {EXIF_TAG_TIFF_EP_STANDARD_ID, "TIFF/EPStandardID", N_("TIFF/EP Standard ID"), ""},
        {EXIF_TAG_CUSTOM_RENDERED, "CustomRendered", N_("Custom Rendered"),
         N_("This tag indicates the use of special processing on image "
            "data, such as rendering geared to output. When special "
index 5dcf933..836be07 100644 (file)
@@ -60,8 +60,8 @@ typedef enum {
        EXIF_TAG_ARTIST                         = 0x013b,
        EXIF_TAG_WHITE_POINT                    = 0x013e,
        EXIF_TAG_PRIMARY_CHROMATICITIES         = 0x013f,
-       EXIF_TAG_TRANSFER_RANGE                 = 0x0156,
        EXIF_TAG_SUB_IFDS                       = 0x014a,
+       EXIF_TAG_TRANSFER_RANGE                 = 0x0156,
        EXIF_TAG_JPEG_PROC                      = 0x0200,
        EXIF_TAG_JPEG_INTERCHANGE_FORMAT        = 0x0201,
        EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH = 0x0202,
index 8aeef46..d0a3551 100644 (file)
@@ -10,20 +10,12 @@ SUBDIRS = nls
 #      And this is just the lib - we don't have the program available
 #      here yet.
 
-TESTS = test-mem test-value test-integers test-parse test-tagtable
+TESTS = test-mem test-value test-integers test-parse test-tagtable test-sorted
 
 TEST_IMAGES = $(top_srcdir)/daniel-andrews-sample.jpg
 export TEST_IMAGES
 
 check_PROGRAMS = test-mem test-mnote test-value test-integers test-parse \
-       test-tagtable
+       test-tagtable test-sorted
 
-test_mem_LDADD   = $(top_builddir)/libexif/libexif.la $(LTLIBINTL)
-
-test_mnote_LDADD = $(top_builddir)/libexif/libexif.la $(LTLIBINTL)
-
-test_value_LDADD = $(top_builddir)/libexif/libexif.la $(LTLIBINTL)
-
-test_parse_LDADD = $(top_builddir)/libexif/libexif.la $(LTLIBINTL)
-
-test_tagtable_LDADD = $(top_builddir)/libexif/libexif.la $(LTLIBINTL)
+LDADD = $(top_builddir)/libexif/libexif.la $(LTLIBINTL)
diff --git a/test/test-sorted.c b/test/test-sorted.c
new file mode 100644 (file)
index 0000000..0d00317
--- /dev/null
@@ -0,0 +1,50 @@
+/* test-sorted.c
+ *
+ * This test ensures that the ExifTagTable[] array is stored in sorted
+ * order. If that were not so, then it a binary search of the array would
+ * not give correct results.
+ *
+ * Copyright 2009 Dan Fandrich <dan@coneharvesters.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301  USA
+ */
+
+#include <libexif/exif-tag.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+       int rc = 0;
+       unsigned int i, num;
+       ExifTag last = 0, current;
+       num = exif_tag_table_count() - 1; /* last entry is a NULL terminator */
+       for (i=0; i < num; ++i) {
+               current = exif_tag_table_get_tag(i);
+               if (current < last) {
+                       printf("Tag 0x%04x in ExifTagTable[] is out of order\n",
+                               current);
+                       rc = 1;
+               }
+               if (exif_tag_table_get_name(i) == NULL) {
+                       printf("Tag 0x%04x has a NULL name\n", current);
+                       rc = 1;
+               }
+               last = current;
+       }
+
+       return rc;
+}