Skip to content

Commit

Permalink
Merge pull request #420 from drewnoakes/fix-issue-419-stack-overflow
Browse files Browse the repository at this point in the history
Fix stack overflow
  • Loading branch information
drewnoakes authored Jul 24, 2019
2 parents 1f15c79 + 405875d commit f866af5
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 84 deletions.
54 changes: 0 additions & 54 deletions Source/com/drew/metadata/TagDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -409,60 +409,6 @@ protected String getShutterSpeedDescription(int tag)
*/
}

// EXIF LightSource
@Nullable
protected String getLightSourceDescription(short wbtype)
{
switch (wbtype) {
case 0:
return "Unknown";
case 1:
return "Daylight";
case 2:
return "Fluorescent";
case 3:
return "Tungsten (Incandescent)";
case 4:
return "Flash";
case 9:
return "Fine Weather";
case 10:
return "Cloudy";
case 11:
return "Shade";
case 12:
return "Daylight Fluorescent"; // (D 5700 - 7100K)
case 13:
return "Day White Fluorescent"; // (N 4600 - 5500K)
case 14:
return "Cool White Fluorescent"; // (W 3800 - 4500K)
case 15:
return "White Fluorescent"; // (WW 3250 - 3800K)
case 16:
return "Warm White Fluorescent"; // (L 2600 - 3250K)
case 17:
return "Standard Light A";
case 18:
return "Standard Light B";
case 19:
return "Standard Light C";
case 20:
return "D55";
case 21:
return "D65";
case 22:
return "D75";
case 23:
return "D50";
case 24:
return "ISO Studio Tungsten";
case 255:
return "Other";
}

return getDescription(wbtype);
}

// EXIF UserComment, GPSProcessingMethod and GPSAreaInformation
@Nullable
protected String getEncodedTextDescription(int tagType)
Expand Down
30 changes: 18 additions & 12 deletions Source/com/drew/metadata/exif/ExifDescriptorBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -778,33 +778,39 @@ public String getMeteringModeDescription()
@Nullable
public String getWhiteBalanceDescription()
{
// See http://web.archive.org/web/20131018091152/http://exif.org/Exif2-2.PDF page 35
final Integer value = _directory.getInteger(TAG_WHITE_BALANCE);
if (value == null)
return null;
return getWhiteBalanceDescription(value);
}

static String getWhiteBalanceDescription(int value)
{
// See http://web.archive.org/web/20131018091152/http://exif.org/Exif2-2.PDF page 35

switch (value) {
case 0: return "Unknown";
case 1: return "Daylight";
case 2: return "Florescent";
case 3: return "Tungsten";
case 3: return "Tungsten (Incandescent)";
case 4: return "Flash";
case 9: return "Fine Weather";
case 10: return "Cloudy";
case 11: return "Shade";
case 12: return "Daylight Fluorescent";
case 13: return "Day White Fluorescent";
case 14: return "Cool White Fluorescent";
case 15: return "White Fluorescent";
case 16: return "Warm White Fluorescent";
case 17: return "Standard light";
case 18: return "Standard light (B)";
case 19: return "Standard light (C)";
case 12: return "Daylight Fluorescent"; // (D 5700 - 7100K)
case 13: return "Day White Fluorescent"; // (N 4600 - 5500K)
case 14: return "Cool White Fluorescent"; // (W 3800 - 4500K)
case 15: return "White Fluorescent"; // (WW 3250 - 3800K)
case 16: return "Warm White Fluorescent"; // (L 2600 - 3250K)
case 17: return "Standard light A";
case 18: return "Standard light B";
case 19: return "Standard light C";
case 20: return "D55";
case 21: return "D65";
case 22: return "D75";
case 23: return "D50";
case 24: return "Studio Tungsten";
case 255: return "(Other)";
case 24: return "ISO Studio Tungsten";
case 255: return "Other";
default:
return "Unknown (" + value + ")";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,6 @@ public String getDescription(int tagType)
}
}

@Nullable
public String getWbTypeDescription(int tagType)
{
Integer wbtype = _directory.getInteger(tagType);
if (wbtype == null)
return null;

return super.getLightSourceDescription(wbtype.shortValue());
}

@Nullable
public String getDistortionParam02Description()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ public String getDescription(int tagType)
@Nullable
public String getWbTypeDescription(int tagType)
{
Integer wbtype = _directory.getInteger(tagType);
if (wbtype == null)
Integer value = _directory.getInteger(tagType);
if (value == null)
return null;

return super.getLightSourceDescription(wbtype.shortValue());
return ExifDescriptorBase.getWhiteBalanceDescription(value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ public String getDescription(int tagType)
@Nullable
public String getWbTypeDescription(int tagType)
{
Integer wbtype = _directory.getInteger(tagType);
if (wbtype == null)
Integer value = _directory.getInteger(tagType);
if (value == null)
return null;

return super.getLightSourceDescription(wbtype.shortValue());
return ExifDescriptorBase.getWhiteBalanceDescription(value);
}
}

0 comments on commit f866af5

Please sign in to comment.