diff --git a/rtexif/canonattribs.cc b/rtexif/canonattribs.cc index c61b8d774..01b00dd53 100644 --- a/rtexif/canonattribs.cc +++ b/rtexif/canonattribs.cc @@ -36,9 +36,9 @@ public: { int n = t->toInt(); - if( n == 0 ) { + if ( n == 0 ) { return "OFF"; - } else if( n == 1) { + } else if ( n == 1) { return "ON"; } else { return "undef"; @@ -66,9 +66,9 @@ public: virtual std::string toString (Tag* t) { char buffer[32]; - double v = pow(2.0, t->toDouble() / 64.0); + double v = pow (2.0, t->toDouble() / 64.0); - if( v < 0. || v > 1000.) { + if ( v < 0. || v > 1000.) { return "undef"; } @@ -94,9 +94,9 @@ class CASelfTimerInterpreter : public Interpreter public: virtual std::string toString (Tag* t) { - int sec = t->toInt(0, SHORT); + int sec = t->toInt (0, SHORT); - if( !sec ) { + if ( !sec ) { return "OFF"; } @@ -388,41 +388,41 @@ public: virtual std::string toString (Tag* t) { std::ostringstream s; - unsigned bits = t->toInt(0, SHORT); + unsigned bits = t->toInt (0, SHORT); - if( bits & 0x0001 ) { + if ( bits & 0x0001 ) { s << "Manual "; } - if( bits & 0x0002 ) { + if ( bits & 0x0002 ) { s << "TTL "; } - if( bits & 0x0004 ) { + if ( bits & 0x0004 ) { s << "A-TTL "; } - if( bits & 0x0008 ) { + if ( bits & 0x0008 ) { s << "E-TTL "; } - if( bits & 0x0010 ) { + if ( bits & 0x0010 ) { s << "FP sync enabled "; } - if( bits & 0x0080 ) { + if ( bits & 0x0080 ) { s << "2nd curtain "; } - if( bits & 0x0800 ) { + if ( bits & 0x0800 ) { s << "FP sync used "; } - if( bits & 0x2000 ) { + if ( bits & 0x2000 ) { s << "Built-in "; } - if( bits & 0x4000 ) { + if ( bits & 0x4000 ) { s << "External "; } @@ -535,11 +535,11 @@ class CAFocalInterpreter : public Interpreter public: virtual std::string toString (Tag* t) { - Tag *unitTag = t->getParent()->getRoot()->findTag("FocalUnits"); + Tag *unitTag = t->getParent()->getRoot()->findTag ("FocalUnits"); double v = unitTag ? unitTag->toDouble() : 1.; v = (v > 0. ? t->toDouble() / v : t->toDouble()); - if( v < 0. || v > 1000000.) { + if ( v < 0. || v > 1000000.) { return "undef"; } @@ -555,350 +555,350 @@ class CALensInterpreter : public IntLensInterpreter< int > public: CALensInterpreter () { - choices.insert(p_t(1, "Canon EF 50mm f/1.8")); - choices.insert(p_t(2, "Canon EF 28mm f/2.8")); - choices.insert(p_t(3, "Canon EF 135mm f/2.8 Soft")); - choices.insert(p_t(4, "Canon EF 35-105mm f/3.5-4.5 or Sigma Lens")); - choices.insert(p_t(4, "Sigma UC Zoom 35-135mm f/4-5.6")); - choices.insert(p_t(5, "Canon EF 35-70mm f/3.5-4.5")); - choices.insert(p_t(6, "Canon EF 28-70mm f/3.5-4.5 or Sigma or Tokina Lens")); - choices.insert(p_t(6, "Sigma 18-50mm f/3.5-5.6 DC")); - choices.insert(p_t(6, "Sigma 18-125mm f/3.5-5.6 DC IF ASP")); - choices.insert(p_t(6, "Tokina AF 193-2 19-35mm f/3.5-4.5")); - choices.insert(p_t(6, "Sigma 28-80mm f/3.5-5.6 II Macro")); - choices.insert(p_t(7, "Canon EF 100-300mm f/5.6L")); - choices.insert(p_t(8, "Canon EF 100-300mm f/5.6 or Sigma or Tokina Lens")); - choices.insert(p_t(8, "Sigma 70-300mm f/4-5.6 [APO] DG Macro")); - choices.insert(p_t(8, "Tokina AT-X 242 AF 24-200mm f/3.5-5.6")); - choices.insert(p_t(9, "Canon EF 70-210mm f/4")); - choices.insert(p_t(9, "Sigma 55-200mm f/4-5.6 DC")); - choices.insert(p_t(10, "Canon EF 50mm f/2.5 Macro or Sigma Lens")); - choices.insert(p_t(10, "Sigma 50mm f/2.8 EX")); - choices.insert(p_t(10, "Sigma 28mm f/1.8")); - choices.insert(p_t(10, "Sigma 105mm f/2.8 Macro EX")); - choices.insert(p_t(10, "Sigma 70mm f/2.8 EX DG Macro EF")); - choices.insert(p_t(11, "Canon EF 35mm f/2")); - choices.insert(p_t(13, "Canon EF 15mm f/2.8 Fisheye")); - choices.insert(p_t(14, "Canon EF 50-200mm f/3.5-4.5L")); - choices.insert(p_t(15, "Canon EF 50-200mm f/3.5-4.5")); - choices.insert(p_t(16, "Canon EF 35-135mm f/3.5-4.5")); - choices.insert(p_t(17, "Canon EF 35-70mm f/3.5-4.5A")); - choices.insert(p_t(18, "Canon EF 28-70mm f/3.5-4.5")); - choices.insert(p_t(20, "Canon EF 100-200mm f/4.5A")); - choices.insert(p_t(21, "Canon EF 80-200mm f/2.8L")); - choices.insert(p_t(22, "Canon EF 20-35mm f/2.8L or Tokina Lens")); - choices.insert(p_t(22, "Tokina AT-X 280 AF Pro 28-80mm f/2.8 Aspherical")); - choices.insert(p_t(23, "Canon EF 35-105mm f/3.5-4.5")); - choices.insert(p_t(24, "Canon EF 35-80mm f/4-5.6 Power Zoom")); - choices.insert(p_t(25, "Canon EF 35-80mm f/4-5.6 Power Zoom")); - choices.insert(p_t(26, "Canon EF 100mm f/2.8 Macro or Other Lens")); - choices.insert(p_t(26, "Cosina 100mm f/3.5 Macro AF")); - choices.insert(p_t(26, "Tamron SP AF 90mm f/2.8 Di Macro")); - choices.insert(p_t(26, "Tamron SP AF 180mm f/3.5 Di Macro")); - choices.insert(p_t(26, "Carl Zeiss Planar T* 50mm f/1.4")); - choices.insert(p_t(27, "Canon EF 35-80mm f/4-5.6")); - choices.insert(p_t(28, "Canon EF 80-200mm f/4.5-5.6 or Tamron Lens")); - choices.insert(p_t(28, "Tamron SP AF 28-105mm f/2.8 LD Aspherical IF")); - choices.insert(p_t(28, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro")); - choices.insert(p_t(28, "Tamron AF 70-300mm f/4-5.6 Di LD 1:2 Macro")); - choices.insert(p_t(28, "Tamron AF Aspherical 28-200mm f/3.8-5.6")); - choices.insert(p_t(29, "Canon EF 50mm f/1.8 II")); - choices.insert(p_t(30, "Canon EF 35-105mm f/4.5-5.6")); - choices.insert(p_t(31, "Canon EF 75-300mm f/4-5.6 or Tamron Lens")); - choices.insert(p_t(31, "Tamron SP AF 300mm f/2.8 LD IF")); - choices.insert(p_t(32, "Canon EF 24mm f/2.8 or Sigma Lens")); - choices.insert(p_t(32, "Sigma 15mm f/2.8 EX Fisheye")); - choices.insert(p_t(33, "Voigtlander or Carl Zeiss Lens")); - choices.insert(p_t(33, "Voigtlander Ultron 40mm f/2 SLII Aspherical")); - choices.insert(p_t(33, "Voigtlander Color Skopar 20mm f/3.5 SLII Aspherical")); - choices.insert(p_t(33, "Voigtlander APO-Lanthar 90mm f/3.5 SLII Close Focus")); - choices.insert(p_t(33, "Carl Zeiss Distagon T* 15mm f/2.8 ZE")); - choices.insert(p_t(33, "Carl Zeiss Distagon T* 18mm f/3.5 ZE")); - choices.insert(p_t(33, "Carl Zeiss Distagon T* 21mm f/2.8 ZE")); - choices.insert(p_t(33, "Carl Zeiss Distagon T* 25mm f/2 ZE")); - choices.insert(p_t(33, "Carl Zeiss Distagon T* 28mm f/2 ZE")); - choices.insert(p_t(33, "Carl Zeiss Distagon T* 35mm f/2 ZE")); - choices.insert(p_t(33, "Carl Zeiss Distagon T* 35mm f/1.4 ZE")); - choices.insert(p_t(33, "Carl Zeiss Planar T* 50mm f/1.4 ZE")); - choices.insert(p_t(33, "Carl Zeiss Makro-Planar T* 50mm f/2 ZE")); - choices.insert(p_t(33, "Carl Zeiss Makro-Planar T* 100mm f/2 ZE")); - choices.insert(p_t(33, "Carl Zeiss Apo-Sonnar T* 135mm f/2 ZE")); - choices.insert(p_t(35, "Canon EF 35-80mm f/4-5.6")); - choices.insert(p_t(36, "Canon EF 38-76mm f/4.5-5.6")); - choices.insert(p_t(37, "Canon EF 35-80mm f/4-5.6 or Tamron Lens")); - choices.insert(p_t(37, "Tamron 70-200mm f/2.8 Di LD IF Macro")); - choices.insert(p_t(37, "Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20")); - choices.insert(p_t(37, "Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical [IF]")); - choices.insert(p_t(37, "Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical [IF] Macro")); - choices.insert(p_t(38, "Canon EF 80-200mm f/4.5-5.6")); - choices.insert(p_t(39, "Canon EF 75-300mm f/4-5.6")); - choices.insert(p_t(40, "Canon EF 28-80mm f/3.5-5.6")); - choices.insert(p_t(41, "Canon EF 28-90mm f/4-5.6")); - choices.insert(p_t(42, "Canon EF 28-200mm f/3.5-5.6 or Tamron Lens")); - choices.insert(p_t(42, "Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20")); - choices.insert(p_t(43, "Canon EF 28-105mm f/4-5.6")); - choices.insert(p_t(44, "Canon EF 90-300mm f/4.5-5.6")); - choices.insert(p_t(45, "Canon EF-S 18-55mm f/3.5-5.6 [II]")); - choices.insert(p_t(46, "Canon EF 28-90mm f/4-5.6")); - choices.insert(p_t(47, "Zeiss Milvus 35mm f/2 or 50mm f/2")); - choices.insert(p_t(47, "Zeiss Milvus 50mm f/2 Makro")); - choices.insert(p_t(48, "Canon EF-S 18-55mm f/3.5-5.6 IS")); - choices.insert(p_t(49, "Canon EF-S 55-250mm f/4-5.6 IS")); - choices.insert(p_t(50, "Canon EF-S 18-200mm f/3.5-5.6 IS")); - choices.insert(p_t(51, "Canon EF-S 18-135mm f/3.5-5.6 IS")); - choices.insert(p_t(52, "Canon EF-S 18-55mm f/3.5-5.6 IS II")); - choices.insert(p_t(53, "Canon EF-S 18-55mm f/3.5-5.6 III")); - choices.insert(p_t(54, "Canon EF-S 55-250mm f/4-5.6 IS II")); - choices.insert(p_t(60, "Irix 11mm f/4")); - choices.insert(p_t(94, "Canon TS-E 17mm f/4L")); - choices.insert(p_t(95, "Canon TS-E 24.0mm f/3.5 L II")); - choices.insert(p_t(124, "Canon MP-E 65mm f/2.8 1-5x Macro Photo")); - choices.insert(p_t(125, "Canon TS-E 24mm f/3.5L")); - choices.insert(p_t(126, "Canon TS-E 45mm f/2.8")); - choices.insert(p_t(127, "Canon TS-E 90mm f/2.8")); - choices.insert(p_t(129, "Canon EF 300mm f/2.8L")); - choices.insert(p_t(130, "Canon EF 50mm f/1.0L")); - choices.insert(p_t(131, "Canon EF 28-80mm f/2.8-4L or Sigma Lens")); - choices.insert(p_t(131, "Sigma 8mm f/3.5 EX DG Circular Fisheye")); - choices.insert(p_t(131, "Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM")); - choices.insert(p_t(131, "Sigma 17-70mm f/2.8-4.5 DC Macro")); - choices.insert(p_t(131, "Sigma APO 50-150mm f/2.8 [II] EX DC HSM")); - choices.insert(p_t(131, "Sigma APO 120-300mm f/2.8 EX DG HSM")); - choices.insert(p_t(131, "Sigma 4.5mm f/2.8 EX DC HSM Circular Fisheye")); - choices.insert(p_t(131, "Sigma 70-200mm f/2.8 APO EX HSM")); - choices.insert(p_t(132, "Canon EF 1200mm f/5.6L")); - choices.insert(p_t(134, "Canon EF 600mm f/4L IS")); - choices.insert(p_t(135, "Canon EF 200mm f/1.8L")); - choices.insert(p_t(136, "Canon EF 300mm f/2.8L")); - choices.insert(p_t(137, "Canon EF 85mm f/1.2L or Sigma or Tamron Lens")); - choices.insert(p_t(137, "Sigma 18-50mm f/2.8-4.5 DC OS HSM")); - choices.insert(p_t(137, "Sigma 50-200mm f/4-5.6 DC OS HSM")); - choices.insert(p_t(137, "Sigma 18-250mm f/3.5-6.3 DC OS HSM")); - choices.insert(p_t(137, "Sigma 24-70mm f/2.8 IF EX DG HSM")); - choices.insert(p_t(137, "Sigma 18-125mm f/3.8-5.6 DC OS HSM")); - choices.insert(p_t(137, "Sigma 17-70mm f/2.8-4 DC Macro OS HSM | C")); - choices.insert(p_t(137, "Sigma 17-50mm f/2.8 OS HSM")); - choices.insert(p_t(137, "Sigma 18-200mm f/3.5-6.3 DC OS HSM [II]")); - choices.insert(p_t(137, "Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD")); - choices.insert(p_t(137, "Sigma 8-16mm f/4.5-5.6 DC HSM")); - choices.insert(p_t(137, "Tamron SP 17-50mm f/2.8 XR Di II VC")); - choices.insert(p_t(137, "Tamron SP 60mm f/2 Macro Di II")); - choices.insert(p_t(137, "Sigma 10-20mm f/3.5 EX DC HSM")); - choices.insert(p_t(137, "Tamron SP 24-70mm f/2.8 Di VC USD")); - choices.insert(p_t(137, "Sigma 18-35mm f/1.8 DC HSM")); - choices.insert(p_t(137, "Sigma 12-24mm f/4.5-5.6 DG HSM II")); - choices.insert(p_t(138, "Canon EF 28-80mm f/2.8-4L")); - choices.insert(p_t(139, "Canon EF 400mm f/2.8L")); - choices.insert(p_t(140, "Canon EF 500mm f/4.5L")); - choices.insert(p_t(141, "Canon EF 500mm f/4.5L")); - choices.insert(p_t(142, "Canon EF 300mm f/2.8L IS")); - choices.insert(p_t(143, "Canon EF 500mm f/4L IS or Sigma Lens")); - choices.insert(p_t(143, "Sigma 17-70mm f/2.8-4 DC Macro OS HSM")); - choices.insert(p_t(144, "Canon EF 35-135mm f/4-5.6 USM")); - choices.insert(p_t(145, "Canon EF 100-300mm f/4.5-5.6 USM")); - choices.insert(p_t(146, "Canon EF 70-210mm f/3.5-4.5 USM")); - choices.insert(p_t(147, "Canon EF 35-135mm f/4-5.6 USM")); - choices.insert(p_t(148, "Canon EF 28-80mm f/3.5-5.6 USM")); - choices.insert(p_t(149, "Canon EF 100mm f/2 USM")); - choices.insert(p_t(150, "Canon EF 14mm f/2.8L or Sigma Lens")); - choices.insert(p_t(150, "Sigma 20mm EX f/1.8")); - choices.insert(p_t(150, "Sigma 30mm f/1.4 DC HSM")); - choices.insert(p_t(150, "Sigma 24mm f/1.8 DG Macro EX")); - choices.insert(p_t(150, "Sigma 28mm f/1.8 DG Macro EX")); - choices.insert(p_t(151, "Canon EF 200mm f/2.8L")); - choices.insert(p_t(152, "Canon EF 300mm f/4L IS or Sigma Lens")); - choices.insert(p_t(152, "Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM")); - choices.insert(p_t(152, "Sigma 14mm f/2.8 EX Aspherical HSM")); - choices.insert(p_t(152, "Sigma 10-20mm f/4-5.6")); - choices.insert(p_t(152, "Sigma 100-300mm f/4")); - choices.insert(p_t(153, "Canon EF 35-350mm f/3.5-5.6L or Sigma or Tamron Lens")); - choices.insert(p_t(153, "Sigma 50-500mm f/4-6.3 APO HSM EX")); - choices.insert(p_t(153, "Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical [IF] Macro")); - choices.insert(p_t(153, "Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro Model A14")); - choices.insert(p_t(153, "Tamron 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro")); - choices.insert(p_t(154, "Canon EF 20mm f/2.8 USM or Zeiss Lens")); - choices.insert(p_t(154, "Zeiss Milvus 21mm f/2.8")); - choices.insert(p_t(155, "Canon EF 85mm f/1.8 USM")); - choices.insert(p_t(156, "Canon EF 28-105mm f/3.5-4.5 USM or Tamron Lens")); - choices.insert(p_t(156, "Tamron SP 70-300mm f/4.0-5.6 Di VC USD")); - choices.insert(p_t(156, "Tamron SP AF 28-105mm f/2.8 LD Aspherical IF")); - choices.insert(p_t(160, "Canon EF 20-35mm f/3.5-4.5 USM or Tamron or Tokina Lens")); - choices.insert(p_t(160, "Tamron AF 19-35mm f/3.5-4.5")); - choices.insert(p_t(160, "Tokina AT-X 124 AF Pro DX 12-24mm f/4")); - choices.insert(p_t(160, "Tokina AT-X 107 AF DX 10-17mm f/3.5-4.5 Fisheye")); - choices.insert(p_t(160, "Tokina AT-X 116 AF Pro DX 11-16mm f/2.8")); - choices.insert(p_t(160, "Tokina AT-X 11-20 F2.8 PRO DX Aspherical 11-20mm f/2.8")); - choices.insert(p_t(161, "Canon EF 28-70mm f/2.8L or Sigma or Tamron Lens")); - choices.insert(p_t(161, "Sigma 24-70mm f/2.8 EX")); - choices.insert(p_t(161, "Sigma 28-70mm f/2.8 EX")); - choices.insert(p_t(161, "Sigma 24-60mm f/2.8 EX DG")); - choices.insert(p_t(161, "Tamron AF 17-50mm f/2.8 Di-II LD Aspherical")); - choices.insert(p_t(161, "Tamron 90mm f/2.8")); - choices.insert(p_t(161, "Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF")); - choices.insert(p_t(161, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro")); - choices.insert(p_t(162, "Canon EF 200mm f/2.8L")); - choices.insert(p_t(163, "Canon EF 300mm f/4L")); - choices.insert(p_t(164, "Canon EF 400mm f/5.6L")); - choices.insert(p_t(165, "Canon EF 70-200mm f/2.8 L")); - choices.insert(p_t(166, "Canon EF 70-200mm f/2.8 L + 1.4x")); - choices.insert(p_t(167, "Canon EF 70-200mm f/2.8 L + 2x")); - choices.insert(p_t(168, "Canon EF 28mm f/1.8 USM or Sigma Lens")); - choices.insert(p_t(168, "Sigma 50-100mm f/1.8 DC HSM | A")); - choices.insert(p_t(169, "Canon EF 17-35mm f/2.8L or Sigma Lens")); - choices.insert(p_t(169, "Sigma 18-200mm f/3.5-6.3 DC OS")); - choices.insert(p_t(169, "Sigma 15-30mm f/3.5-4.5 EX DG Aspherical")); - choices.insert(p_t(169, "Sigma 18-50mm f/2.8 Macro")); - choices.insert(p_t(169, "Sigma 50mm f/1.4 EX DG HSM")); - choices.insert(p_t(169, "Sigma 85mm f/1.4 EX DG HSM")); - choices.insert(p_t(169, "Sigma 30mm f/1.4 EX DC HSM")); - choices.insert(p_t(169, "Sigma 35mm f/1.4 DG HSM")); - choices.insert(p_t(170, "Canon EF 200mm f/2.8L II")); - choices.insert(p_t(171, "Canon EF 300mm f/4L")); - choices.insert(p_t(172, "Canon EF 400mm f/5.6L or Sigma Lens")); - choices.insert(p_t(172, "Sigma 150-600mm f/5-6.3 DG OS HSM | S")); - choices.insert(p_t(173, "Canon EF 180mm Macro f/3.5L or Sigma Lens")); - choices.insert(p_t(173, "Sigma 180mm EX HSM Macro f/3.5")); - choices.insert(p_t(173, "Sigma APO Macro 150mm f/2.8 EX DG HSM")); - choices.insert(p_t(174, "Canon EF 135mm f/2L or Other Lens")); - choices.insert(p_t(174, "Sigma 70-200mm f/2.8 EX DG APO OS HSM")); - choices.insert(p_t(174, "Sigma 50-500mm f/4.5-6.3 APO DG OS HSM")); - choices.insert(p_t(174, "Sigma 150-500mm f/5-6.3 APO DG OS HSM")); - choices.insert(p_t(174, "Zeiss Milvus 100mm f/2 Makro")); - choices.insert(p_t(175, "Canon EF 400mm f/2.8L")); - choices.insert(p_t(176, "Canon EF 24-85mm f/3.5-4.5 USM")); - choices.insert(p_t(177, "Canon EF 300mm f/4L IS")); - choices.insert(p_t(178, "Canon EF 28-135mm f/3.5-5.6 IS")); - choices.insert(p_t(179, "Canon EF 24mm f/1.4L")); - choices.insert(p_t(180, "Canon EF 35mm f/1.4L or Other Lens")); - choices.insert(p_t(180, "Sigma 50mm f/1.4 DG HSM | A")); - choices.insert(p_t(180, "Sigma 24mm f/1.4 DG HSM | A")); - choices.insert(p_t(180, "Zeiss Milvus 50mm f/1.4")); - choices.insert(p_t(180, "Zeiss Milvus 85mm f/1.4")); - choices.insert(p_t(180, "Zeiss Otus 28mm f/1.4 ZE")); - choices.insert(p_t(181, "Canon EF 100-400mm f/4.5-5.6L IS + 1.4x or Sigma Lens")); - choices.insert(p_t(181, "Sigma 150-600mm f/5-6.3 DG OS HSM | S + 1.4x")); - choices.insert(p_t(182, "Canon EF 100-400mm f/4.5-5.6L IS + 2x or Sigma Lens")); - choices.insert(p_t(182, "Sigma 150-600mm f/5-6.3 DG OS HSM | S + 2x")); - choices.insert(p_t(183, "Canon EF 100-400mm f/4.5-5.6L IS or Sigma Lens")); - choices.insert(p_t(183, "Sigma 150mm f/2.8 EX DG OS HSM APO Macro")); - choices.insert(p_t(183, "Sigma 105mm f/2.8 EX DG OS HSM Macro")); - choices.insert(p_t(183, "Sigma 180mm f/2.8 EX DG OS HSM APO Macro")); - choices.insert(p_t(183, "Sigma 150-600mm f/5-6.3 DG OS HSM | C")); - choices.insert(p_t(183, "Sigma 150-600mm f/5-6.3 DG OS HSM | S")); - choices.insert(p_t(184, "Canon EF 400mm f/2.8L + 2x")); - choices.insert(p_t(185, "Canon EF 600mm f/4L IS")); - choices.insert(p_t(186, "Canon EF 70-200mm f/4L")); - choices.insert(p_t(187, "Canon EF 70-200mm f/4L + 1.4x")); - choices.insert(p_t(188, "Canon EF 70-200mm f/4L + 2x")); - choices.insert(p_t(189, "Canon EF 70-200mm f/4L + 2.8x")); - choices.insert(p_t(190, "Canon EF 100mm f/2.8 Macro USM")); - choices.insert(p_t(191, "Canon EF 400mm f/4 DO IS")); - choices.insert(p_t(193, "Canon EF 35-80mm f/4-5.6 USM")); - choices.insert(p_t(194, "Canon EF 80-200mm f/4.5-5.6 USM")); - choices.insert(p_t(195, "Canon EF 35-105mm f/4.5-5.6 USM")); - choices.insert(p_t(196, "Canon EF 75-300mm f/4-5.6 USM")); - choices.insert(p_t(197, "Canon EF 75-300mm f/4-5.6 IS USM")); - choices.insert(p_t(198, "Canon EF 50mm f/1.4 USM or Zeiss Lens")); - choices.insert(p_t(198, "Zeiss Otus 55mm f/1.4 ZE")); - choices.insert(p_t(198, "Zeiss Otus 85mm f/1.4 ZE")); - choices.insert(p_t(199, "Canon EF 28-80mm f/3.5-5.6 USM")); - choices.insert(p_t(200, "Canon EF 75-300mm f/4-5.6 USM")); - choices.insert(p_t(201, "Canon EF 28-80mm f/3.5-5.6 USM")); - choices.insert(p_t(202, "Canon EF 28-80mm f/3.5-5.6 USM IV")); - choices.insert(p_t(208, "Canon EF 22-55mm f/4-5.6 USM")); - choices.insert(p_t(209, "Canon EF 55-200mm f/4.5-5.6")); - choices.insert(p_t(210, "Canon EF 28-90mm f/4-5.6 USM")); - choices.insert(p_t(211, "Canon EF 28-200mm f/3.5-5.6 USM")); - choices.insert(p_t(212, "Canon EF 28-105mm f/4-5.6 USM")); - choices.insert(p_t(213, "Canon EF 90-300mm f/4.5-5.6 USM or Tamron Lens")); - choices.insert(p_t(213, "Tamron SP 150-600mm f/5-6.3 Di VC USD")); - choices.insert(p_t(213, "Tamron 16-300mm f/3.5-6.3 Di II VC PZD Macro")); - choices.insert(p_t(213, "Tamron SP 35mm f/1.8 Di VC USD")); - choices.insert(p_t(213, "Tamron SP 45mm f/1.8 Di VC USD")); - choices.insert(p_t(214, "Canon EF-S 18-55mm f/3.5-5.6 USM")); - choices.insert(p_t(215, "Canon EF 55-200mm f/4.5-5.6 II USM")); - choices.insert(p_t(217, "Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD")); - choices.insert(p_t(224, "Canon EF 70-200mm f/2.8L IS")); - choices.insert(p_t(225, "Canon EF 70-200mm f/2.8L IS + 1.4x")); - choices.insert(p_t(226, "Canon EF 70-200mm f/2.8L IS + 2x")); - choices.insert(p_t(227, "Canon EF 70-200mm f/2.8L IS + 2.8x")); - choices.insert(p_t(228, "Canon EF 28-105mm f/3.5-4.5 USM")); - choices.insert(p_t(229, "Canon EF 16-35mm f/2.8L")); - choices.insert(p_t(230, "Canon EF 24-70mm f/2.8L")); - choices.insert(p_t(231, "Canon EF 17-40mm f/4L")); - choices.insert(p_t(232, "Canon EF 70-300mm f/4.5-5.6 DO IS USM")); - choices.insert(p_t(233, "Canon EF 28-300mm f/3.5-5.6L IS")); - choices.insert(p_t(234, "Canon EF-S 17-85mm f/4-5.6 IS USM or Tokina Lens")); - choices.insert(p_t(234, "Tokina AT-X 12-28 PRO DX 12-28mm f/4")); - choices.insert(p_t(235, "Canon EF-S 10-22mm f/3.5-4.5 USM")); - choices.insert(p_t(236, "Canon EF-S 60mm f/2.8 Macro USM")); - choices.insert(p_t(237, "Canon EF 24-105mm f/4L IS")); - choices.insert(p_t(238, "Canon EF 70-300mm f/4-5.6 IS USM")); - choices.insert(p_t(239, "Canon EF 85mm f/1.2L II")); - choices.insert(p_t(240, "Canon EF-S 17-55mm f/2.8 IS USM")); - choices.insert(p_t(241, "Canon EF 50mm f/1.2L")); - choices.insert(p_t(242, "Canon EF 70-200mm f/4L IS")); - choices.insert(p_t(243, "Canon EF 70-200mm f/4L IS + 1.4x")); - choices.insert(p_t(244, "Canon EF 70-200mm f/4L IS + 2x")); - choices.insert(p_t(245, "Canon EF 70-200mm f/4L IS + 2.8x")); - choices.insert(p_t(246, "Canon EF 16-35mm f/2.8L II")); - choices.insert(p_t(247, "Canon EF 14mm f/2.8L II USM")); - choices.insert(p_t(248, "Canon EF 200mm f/2L IS or Sigma Lens")); - choices.insert(p_t(248, "Sigma 24-35mm f/2 DG HSM | A")); - choices.insert(p_t(249, "Canon EF 800mm f/5.6L IS")); - choices.insert(p_t(250, "Canon EF 24mm f/1.4L II or Sigma Lens")); - choices.insert(p_t(250, "Sigma 20mm f/1.4 DG HSM | A")); - choices.insert(p_t(251, "Canon EF 70-200mm f/2.8L IS II USM")); - choices.insert(p_t(252, "Canon EF 70-200mm f/2.8L IS II USM + 1.4x")); - choices.insert(p_t(253, "Canon EF 70-200mm f/2.8L IS II USM + 2x")); - choices.insert(p_t(254, "Canon EF 100mm f/2.8L Macro IS USM")); - choices.insert(p_t(255, "Sigma 24-105mm f/4 DG OS HSM | A or Other Sigma Lens")); - choices.insert(p_t(255, "Sigma 180mm f/2.8 EX DG OS HSM APO Macro")); - choices.insert(p_t(488, "Canon EF-S 15-85mm f/3.5-5.6 IS USM")); - choices.insert(p_t(489, "Canon EF 70-300mm f/4-5.6L IS USM")); - choices.insert(p_t(490, "Canon EF 8-15mm f/4L Fisheye USM")); - choices.insert(p_t(491, "Canon EF 300mm f/2.8L IS II USM or Tamron Lens")); - choices.insert(p_t(491, "Tamron SP 70-200mm f/2.8 Di VC USD G2 (A025)")); - choices.insert(p_t(492, "Canon EF 400mm f/2.8L IS II USM")); - choices.insert(p_t(493, "Canon EF 500mm f/4L IS II USM or EF 24-105mm f4L IS USM")); - choices.insert(p_t(493, "Canon EF 24-105mm f/4L IS USM")); - choices.insert(p_t(494, "Canon EF 600mm f/4.0L IS II USM")); - choices.insert(p_t(495, "Canon EF 24-70mm f/2.8L II USM")); - choices.insert(p_t(496, "Canon EF 200-400mm f/4L IS USM")); - choices.insert(p_t(499, "Canon EF 200-400mm f/4L IS USM + 1.4x")); - choices.insert(p_t(502, "Canon EF 28mm f/2.8 IS USM")); - choices.insert(p_t(503, "Canon EF 24mm f/2.8 IS USM")); - choices.insert(p_t(504, "Canon EF 24-70mm f/4L IS USM")); - choices.insert(p_t(505, "Canon EF 35mm f/2 IS USM")); - choices.insert(p_t(506, "Canon EF 400mm f/4 DO IS II USM")); - choices.insert(p_t(507, "Canon EF 16-35mm f/4L IS USM")); - choices.insert(p_t(508, "Canon EF 11-24mm f/4L USM")); - choices.insert(p_t(747, "Canon EF 100-400mm f/4.5-5.6L IS II USM or Tamron Lens")); - choices.insert(p_t(747, "Tamron SP 150-600mm F5-6.3 Di VC USD G2")); - choices.insert(p_t(748, "Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x")); - choices.insert(p_t(750, "Canon EF 35mm f/1.4L II USM")); - choices.insert(p_t(751, "Canon EF 16-35mm f/2.8L III USM")); - choices.insert(p_t(752, "Canon EF 24-105mm f/4L IS II USM")); - choices.insert(p_t(4142, "Canon EF-S 18-135mm f/3.5-5.6 IS STM")); - choices.insert(p_t(4143, "Canon EF-M 18-55mm f/3.5-5.6 IS STM or Tamron Lens")); - choices.insert(p_t(4143, "Tamron 18-200mm f/3.5-6.3 Di III VC")); - choices.insert(p_t(4144, "Canon EF 40mm f/2.8 STM")); - choices.insert(p_t(4145, "Canon EF-M 22mm f/2 STM")); - choices.insert(p_t(4146, "Canon EF-S 18-55mm f/3.5-5.6 IS STM")); - choices.insert(p_t(4147, "Canon EF-M 11-22mm f/4-5.6 IS STM")); - choices.insert(p_t(4148, "Canon EF-S 55-250mm f/4-5.6 IS STM")); - choices.insert(p_t(4149, "Canon EF-M 55-200mm f/4.5-6.3 IS STM")); - choices.insert(p_t(4150, "Canon EF-S 10-18mm f/4.5-5.6 IS STM")); - choices.insert(p_t(4152, "Canon EF 24-105mm f/3.5-5.6 IS STM")); - choices.insert(p_t(4153, "Canon EF-M 15-45mm f/3.5-6.3 IS STM")); - choices.insert(p_t(4154, "Canon EF-S 24mm f/2.8 STM")); - choices.insert(p_t(4155, "Canon EF-M 28mm f/3.5 Macro IS STM")); - choices.insert(p_t(4156, "Canon EF 50mm f/1.8 STM")); - choices.insert(p_t(4157, "Canon EF-M 18-150mm 1:3.5-6.3 IS STM")); - choices.insert(p_t(4158, "Canon EF-S 18-55mm f/4-5.6 IS STM")); - choices.insert(p_t(36910, "Canon EF 70-300mm f/4-5.6 IS II USM")); - choices.insert(p_t(36912, "Canon EF-S 18-135mm f/3.5-5.6 IS USM")); - choices.insert(p_t(65535, "n/a")); + choices.insert (p_t (1, "Canon EF 50mm f/1.8")); + choices.insert (p_t (2, "Canon EF 28mm f/2.8")); + choices.insert (p_t (3, "Canon EF 135mm f/2.8 Soft")); + choices.insert (p_t (4, "Canon EF 35-105mm f/3.5-4.5 or Sigma Lens")); + choices.insert (p_t (4, "Sigma UC Zoom 35-135mm f/4-5.6")); + choices.insert (p_t (5, "Canon EF 35-70mm f/3.5-4.5")); + choices.insert (p_t (6, "Canon EF 28-70mm f/3.5-4.5 or Sigma or Tokina Lens")); + choices.insert (p_t (6, "Sigma 18-50mm f/3.5-5.6 DC")); + choices.insert (p_t (6, "Sigma 18-125mm f/3.5-5.6 DC IF ASP")); + choices.insert (p_t (6, "Tokina AF 193-2 19-35mm f/3.5-4.5")); + choices.insert (p_t (6, "Sigma 28-80mm f/3.5-5.6 II Macro")); + choices.insert (p_t (7, "Canon EF 100-300mm f/5.6L")); + choices.insert (p_t (8, "Canon EF 100-300mm f/5.6 or Sigma or Tokina Lens")); + choices.insert (p_t (8, "Sigma 70-300mm f/4-5.6 [APO] DG Macro")); + choices.insert (p_t (8, "Tokina AT-X 242 AF 24-200mm f/3.5-5.6")); + choices.insert (p_t (9, "Canon EF 70-210mm f/4")); + choices.insert (p_t (9, "Sigma 55-200mm f/4-5.6 DC")); + choices.insert (p_t (10, "Canon EF 50mm f/2.5 Macro or Sigma Lens")); + choices.insert (p_t (10, "Sigma 50mm f/2.8 EX")); + choices.insert (p_t (10, "Sigma 28mm f/1.8")); + choices.insert (p_t (10, "Sigma 105mm f/2.8 Macro EX")); + choices.insert (p_t (10, "Sigma 70mm f/2.8 EX DG Macro EF")); + choices.insert (p_t (11, "Canon EF 35mm f/2")); + choices.insert (p_t (13, "Canon EF 15mm f/2.8 Fisheye")); + choices.insert (p_t (14, "Canon EF 50-200mm f/3.5-4.5L")); + choices.insert (p_t (15, "Canon EF 50-200mm f/3.5-4.5")); + choices.insert (p_t (16, "Canon EF 35-135mm f/3.5-4.5")); + choices.insert (p_t (17, "Canon EF 35-70mm f/3.5-4.5A")); + choices.insert (p_t (18, "Canon EF 28-70mm f/3.5-4.5")); + choices.insert (p_t (20, "Canon EF 100-200mm f/4.5A")); + choices.insert (p_t (21, "Canon EF 80-200mm f/2.8L")); + choices.insert (p_t (22, "Canon EF 20-35mm f/2.8L or Tokina Lens")); + choices.insert (p_t (22, "Tokina AT-X 280 AF Pro 28-80mm f/2.8 Aspherical")); + choices.insert (p_t (23, "Canon EF 35-105mm f/3.5-4.5")); + choices.insert (p_t (24, "Canon EF 35-80mm f/4-5.6 Power Zoom")); + choices.insert (p_t (25, "Canon EF 35-80mm f/4-5.6 Power Zoom")); + choices.insert (p_t (26, "Canon EF 100mm f/2.8 Macro or Other Lens")); + choices.insert (p_t (26, "Cosina 100mm f/3.5 Macro AF")); + choices.insert (p_t (26, "Tamron SP AF 90mm f/2.8 Di Macro")); + choices.insert (p_t (26, "Tamron SP AF 180mm f/3.5 Di Macro")); + choices.insert (p_t (26, "Carl Zeiss Planar T* 50mm f/1.4")); + choices.insert (p_t (27, "Canon EF 35-80mm f/4-5.6")); + choices.insert (p_t (28, "Canon EF 80-200mm f/4.5-5.6 or Tamron Lens")); + choices.insert (p_t (28, "Tamron SP AF 28-105mm f/2.8 LD Aspherical IF")); + choices.insert (p_t (28, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro")); + choices.insert (p_t (28, "Tamron AF 70-300mm f/4-5.6 Di LD 1:2 Macro")); + choices.insert (p_t (28, "Tamron AF Aspherical 28-200mm f/3.8-5.6")); + choices.insert (p_t (29, "Canon EF 50mm f/1.8 II")); + choices.insert (p_t (30, "Canon EF 35-105mm f/4.5-5.6")); + choices.insert (p_t (31, "Canon EF 75-300mm f/4-5.6 or Tamron Lens")); + choices.insert (p_t (31, "Tamron SP AF 300mm f/2.8 LD IF")); + choices.insert (p_t (32, "Canon EF 24mm f/2.8 or Sigma Lens")); + choices.insert (p_t (32, "Sigma 15mm f/2.8 EX Fisheye")); + choices.insert (p_t (33, "Voigtlander or Carl Zeiss Lens")); + choices.insert (p_t (33, "Voigtlander Ultron 40mm f/2 SLII Aspherical")); + choices.insert (p_t (33, "Voigtlander Color Skopar 20mm f/3.5 SLII Aspherical")); + choices.insert (p_t (33, "Voigtlander APO-Lanthar 90mm f/3.5 SLII Close Focus")); + choices.insert (p_t (33, "Carl Zeiss Distagon T* 15mm f/2.8 ZE")); + choices.insert (p_t (33, "Carl Zeiss Distagon T* 18mm f/3.5 ZE")); + choices.insert (p_t (33, "Carl Zeiss Distagon T* 21mm f/2.8 ZE")); + choices.insert (p_t (33, "Carl Zeiss Distagon T* 25mm f/2 ZE")); + choices.insert (p_t (33, "Carl Zeiss Distagon T* 28mm f/2 ZE")); + choices.insert (p_t (33, "Carl Zeiss Distagon T* 35mm f/2 ZE")); + choices.insert (p_t (33, "Carl Zeiss Distagon T* 35mm f/1.4 ZE")); + choices.insert (p_t (33, "Carl Zeiss Planar T* 50mm f/1.4 ZE")); + choices.insert (p_t (33, "Carl Zeiss Makro-Planar T* 50mm f/2 ZE")); + choices.insert (p_t (33, "Carl Zeiss Makro-Planar T* 100mm f/2 ZE")); + choices.insert (p_t (33, "Carl Zeiss Apo-Sonnar T* 135mm f/2 ZE")); + choices.insert (p_t (35, "Canon EF 35-80mm f/4-5.6")); + choices.insert (p_t (36, "Canon EF 38-76mm f/4.5-5.6")); + choices.insert (p_t (37, "Canon EF 35-80mm f/4-5.6 or Tamron Lens")); + choices.insert (p_t (37, "Tamron 70-200mm f/2.8 Di LD IF Macro")); + choices.insert (p_t (37, "Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20")); + choices.insert (p_t (37, "Tamron SP AF 17-50mm f/2.8 XR Di II VC LD Aspherical [IF]")); + choices.insert (p_t (37, "Tamron AF 18-270mm f/3.5-6.3 Di II VC LD Aspherical [IF] Macro")); + choices.insert (p_t (38, "Canon EF 80-200mm f/4.5-5.6")); + choices.insert (p_t (39, "Canon EF 75-300mm f/4-5.6")); + choices.insert (p_t (40, "Canon EF 28-80mm f/3.5-5.6")); + choices.insert (p_t (41, "Canon EF 28-90mm f/4-5.6")); + choices.insert (p_t (42, "Canon EF 28-200mm f/3.5-5.6 or Tamron Lens")); + choices.insert (p_t (42, "Tamron AF 28-300mm f/3.5-6.3 XR Di VC LD Aspherical [IF] Macro Model A20")); + choices.insert (p_t (43, "Canon EF 28-105mm f/4-5.6")); + choices.insert (p_t (44, "Canon EF 90-300mm f/4.5-5.6")); + choices.insert (p_t (45, "Canon EF-S 18-55mm f/3.5-5.6 [II]")); + choices.insert (p_t (46, "Canon EF 28-90mm f/4-5.6")); + choices.insert (p_t (47, "Zeiss Milvus 35mm f/2 or 50mm f/2")); + choices.insert (p_t (47, "Zeiss Milvus 50mm f/2 Makro")); + choices.insert (p_t (48, "Canon EF-S 18-55mm f/3.5-5.6 IS")); + choices.insert (p_t (49, "Canon EF-S 55-250mm f/4-5.6 IS")); + choices.insert (p_t (50, "Canon EF-S 18-200mm f/3.5-5.6 IS")); + choices.insert (p_t (51, "Canon EF-S 18-135mm f/3.5-5.6 IS")); + choices.insert (p_t (52, "Canon EF-S 18-55mm f/3.5-5.6 IS II")); + choices.insert (p_t (53, "Canon EF-S 18-55mm f/3.5-5.6 III")); + choices.insert (p_t (54, "Canon EF-S 55-250mm f/4-5.6 IS II")); + choices.insert (p_t (60, "Irix 11mm f/4")); + choices.insert (p_t (94, "Canon TS-E 17mm f/4L")); + choices.insert (p_t (95, "Canon TS-E 24.0mm f/3.5 L II")); + choices.insert (p_t (124, "Canon MP-E 65mm f/2.8 1-5x Macro Photo")); + choices.insert (p_t (125, "Canon TS-E 24mm f/3.5L")); + choices.insert (p_t (126, "Canon TS-E 45mm f/2.8")); + choices.insert (p_t (127, "Canon TS-E 90mm f/2.8")); + choices.insert (p_t (129, "Canon EF 300mm f/2.8L")); + choices.insert (p_t (130, "Canon EF 50mm f/1.0L")); + choices.insert (p_t (131, "Canon EF 28-80mm f/2.8-4L or Sigma Lens")); + choices.insert (p_t (131, "Sigma 8mm f/3.5 EX DG Circular Fisheye")); + choices.insert (p_t (131, "Sigma 17-35mm f/2.8-4 EX DG Aspherical HSM")); + choices.insert (p_t (131, "Sigma 17-70mm f/2.8-4.5 DC Macro")); + choices.insert (p_t (131, "Sigma APO 50-150mm f/2.8 [II] EX DC HSM")); + choices.insert (p_t (131, "Sigma APO 120-300mm f/2.8 EX DG HSM")); + choices.insert (p_t (131, "Sigma 4.5mm f/2.8 EX DC HSM Circular Fisheye")); + choices.insert (p_t (131, "Sigma 70-200mm f/2.8 APO EX HSM")); + choices.insert (p_t (132, "Canon EF 1200mm f/5.6L")); + choices.insert (p_t (134, "Canon EF 600mm f/4L IS")); + choices.insert (p_t (135, "Canon EF 200mm f/1.8L")); + choices.insert (p_t (136, "Canon EF 300mm f/2.8L")); + choices.insert (p_t (137, "Canon EF 85mm f/1.2L or Sigma or Tamron Lens")); + choices.insert (p_t (137, "Sigma 18-50mm f/2.8-4.5 DC OS HSM")); + choices.insert (p_t (137, "Sigma 50-200mm f/4-5.6 DC OS HSM")); + choices.insert (p_t (137, "Sigma 18-250mm f/3.5-6.3 DC OS HSM")); + choices.insert (p_t (137, "Sigma 24-70mm f/2.8 IF EX DG HSM")); + choices.insert (p_t (137, "Sigma 18-125mm f/3.8-5.6 DC OS HSM")); + choices.insert (p_t (137, "Sigma 17-70mm f/2.8-4 DC Macro OS HSM | C")); + choices.insert (p_t (137, "Sigma 17-50mm f/2.8 OS HSM")); + choices.insert (p_t (137, "Sigma 18-200mm f/3.5-6.3 DC OS HSM [II]")); + choices.insert (p_t (137, "Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD")); + choices.insert (p_t (137, "Sigma 8-16mm f/4.5-5.6 DC HSM")); + choices.insert (p_t (137, "Tamron SP 17-50mm f/2.8 XR Di II VC")); + choices.insert (p_t (137, "Tamron SP 60mm f/2 Macro Di II")); + choices.insert (p_t (137, "Sigma 10-20mm f/3.5 EX DC HSM")); + choices.insert (p_t (137, "Tamron SP 24-70mm f/2.8 Di VC USD")); + choices.insert (p_t (137, "Sigma 18-35mm f/1.8 DC HSM")); + choices.insert (p_t (137, "Sigma 12-24mm f/4.5-5.6 DG HSM II")); + choices.insert (p_t (138, "Canon EF 28-80mm f/2.8-4L")); + choices.insert (p_t (139, "Canon EF 400mm f/2.8L")); + choices.insert (p_t (140, "Canon EF 500mm f/4.5L")); + choices.insert (p_t (141, "Canon EF 500mm f/4.5L")); + choices.insert (p_t (142, "Canon EF 300mm f/2.8L IS")); + choices.insert (p_t (143, "Canon EF 500mm f/4L IS or Sigma Lens")); + choices.insert (p_t (143, "Sigma 17-70mm f/2.8-4 DC Macro OS HSM")); + choices.insert (p_t (144, "Canon EF 35-135mm f/4-5.6 USM")); + choices.insert (p_t (145, "Canon EF 100-300mm f/4.5-5.6 USM")); + choices.insert (p_t (146, "Canon EF 70-210mm f/3.5-4.5 USM")); + choices.insert (p_t (147, "Canon EF 35-135mm f/4-5.6 USM")); + choices.insert (p_t (148, "Canon EF 28-80mm f/3.5-5.6 USM")); + choices.insert (p_t (149, "Canon EF 100mm f/2 USM")); + choices.insert (p_t (150, "Canon EF 14mm f/2.8L or Sigma Lens")); + choices.insert (p_t (150, "Sigma 20mm EX f/1.8")); + choices.insert (p_t (150, "Sigma 30mm f/1.4 DC HSM")); + choices.insert (p_t (150, "Sigma 24mm f/1.8 DG Macro EX")); + choices.insert (p_t (150, "Sigma 28mm f/1.8 DG Macro EX")); + choices.insert (p_t (151, "Canon EF 200mm f/2.8L")); + choices.insert (p_t (152, "Canon EF 300mm f/4L IS or Sigma Lens")); + choices.insert (p_t (152, "Sigma 12-24mm f/4.5-5.6 EX DG ASPHERICAL HSM")); + choices.insert (p_t (152, "Sigma 14mm f/2.8 EX Aspherical HSM")); + choices.insert (p_t (152, "Sigma 10-20mm f/4-5.6")); + choices.insert (p_t (152, "Sigma 100-300mm f/4")); + choices.insert (p_t (153, "Canon EF 35-350mm f/3.5-5.6L or Sigma or Tamron Lens")); + choices.insert (p_t (153, "Sigma 50-500mm f/4-6.3 APO HSM EX")); + choices.insert (p_t (153, "Tamron AF 28-300mm f/3.5-6.3 XR LD Aspherical [IF] Macro")); + choices.insert (p_t (153, "Tamron AF 18-200mm f/3.5-6.3 XR Di II LD Aspherical [IF] Macro Model A14")); + choices.insert (p_t (153, "Tamron 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro")); + choices.insert (p_t (154, "Canon EF 20mm f/2.8 USM or Zeiss Lens")); + choices.insert (p_t (154, "Zeiss Milvus 21mm f/2.8")); + choices.insert (p_t (155, "Canon EF 85mm f/1.8 USM")); + choices.insert (p_t (156, "Canon EF 28-105mm f/3.5-4.5 USM or Tamron Lens")); + choices.insert (p_t (156, "Tamron SP 70-300mm f/4.0-5.6 Di VC USD")); + choices.insert (p_t (156, "Tamron SP AF 28-105mm f/2.8 LD Aspherical IF")); + choices.insert (p_t (160, "Canon EF 20-35mm f/3.5-4.5 USM or Tamron or Tokina Lens")); + choices.insert (p_t (160, "Tamron AF 19-35mm f/3.5-4.5")); + choices.insert (p_t (160, "Tokina AT-X 124 AF Pro DX 12-24mm f/4")); + choices.insert (p_t (160, "Tokina AT-X 107 AF DX 10-17mm f/3.5-4.5 Fisheye")); + choices.insert (p_t (160, "Tokina AT-X 116 AF Pro DX 11-16mm f/2.8")); + choices.insert (p_t (160, "Tokina AT-X 11-20 F2.8 PRO DX Aspherical 11-20mm f/2.8")); + choices.insert (p_t (161, "Canon EF 28-70mm f/2.8L or Sigma or Tamron Lens")); + choices.insert (p_t (161, "Sigma 24-70mm f/2.8 EX")); + choices.insert (p_t (161, "Sigma 28-70mm f/2.8 EX")); + choices.insert (p_t (161, "Sigma 24-60mm f/2.8 EX DG")); + choices.insert (p_t (161, "Tamron AF 17-50mm f/2.8 Di-II LD Aspherical")); + choices.insert (p_t (161, "Tamron 90mm f/2.8")); + choices.insert (p_t (161, "Tamron SP AF 17-35mm f/2.8-4 Di LD Aspherical IF")); + choices.insert (p_t (161, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro")); + choices.insert (p_t (162, "Canon EF 200mm f/2.8L")); + choices.insert (p_t (163, "Canon EF 300mm f/4L")); + choices.insert (p_t (164, "Canon EF 400mm f/5.6L")); + choices.insert (p_t (165, "Canon EF 70-200mm f/2.8 L")); + choices.insert (p_t (166, "Canon EF 70-200mm f/2.8 L + 1.4x")); + choices.insert (p_t (167, "Canon EF 70-200mm f/2.8 L + 2x")); + choices.insert (p_t (168, "Canon EF 28mm f/1.8 USM or Sigma Lens")); + choices.insert (p_t (168, "Sigma 50-100mm f/1.8 DC HSM | A")); + choices.insert (p_t (169, "Canon EF 17-35mm f/2.8L or Sigma Lens")); + choices.insert (p_t (169, "Sigma 18-200mm f/3.5-6.3 DC OS")); + choices.insert (p_t (169, "Sigma 15-30mm f/3.5-4.5 EX DG Aspherical")); + choices.insert (p_t (169, "Sigma 18-50mm f/2.8 Macro")); + choices.insert (p_t (169, "Sigma 50mm f/1.4 EX DG HSM")); + choices.insert (p_t (169, "Sigma 85mm f/1.4 EX DG HSM")); + choices.insert (p_t (169, "Sigma 30mm f/1.4 EX DC HSM")); + choices.insert (p_t (169, "Sigma 35mm f/1.4 DG HSM")); + choices.insert (p_t (170, "Canon EF 200mm f/2.8L II")); + choices.insert (p_t (171, "Canon EF 300mm f/4L")); + choices.insert (p_t (172, "Canon EF 400mm f/5.6L or Sigma Lens")); + choices.insert (p_t (172, "Sigma 150-600mm f/5-6.3 DG OS HSM | S")); + choices.insert (p_t (173, "Canon EF 180mm Macro f/3.5L or Sigma Lens")); + choices.insert (p_t (173, "Sigma 180mm EX HSM Macro f/3.5")); + choices.insert (p_t (173, "Sigma APO Macro 150mm f/2.8 EX DG HSM")); + choices.insert (p_t (174, "Canon EF 135mm f/2L or Other Lens")); + choices.insert (p_t (174, "Sigma 70-200mm f/2.8 EX DG APO OS HSM")); + choices.insert (p_t (174, "Sigma 50-500mm f/4.5-6.3 APO DG OS HSM")); + choices.insert (p_t (174, "Sigma 150-500mm f/5-6.3 APO DG OS HSM")); + choices.insert (p_t (174, "Zeiss Milvus 100mm f/2 Makro")); + choices.insert (p_t (175, "Canon EF 400mm f/2.8L")); + choices.insert (p_t (176, "Canon EF 24-85mm f/3.5-4.5 USM")); + choices.insert (p_t (177, "Canon EF 300mm f/4L IS")); + choices.insert (p_t (178, "Canon EF 28-135mm f/3.5-5.6 IS")); + choices.insert (p_t (179, "Canon EF 24mm f/1.4L")); + choices.insert (p_t (180, "Canon EF 35mm f/1.4L or Other Lens")); + choices.insert (p_t (180, "Sigma 50mm f/1.4 DG HSM | A")); + choices.insert (p_t (180, "Sigma 24mm f/1.4 DG HSM | A")); + choices.insert (p_t (180, "Zeiss Milvus 50mm f/1.4")); + choices.insert (p_t (180, "Zeiss Milvus 85mm f/1.4")); + choices.insert (p_t (180, "Zeiss Otus 28mm f/1.4 ZE")); + choices.insert (p_t (181, "Canon EF 100-400mm f/4.5-5.6L IS + 1.4x or Sigma Lens")); + choices.insert (p_t (181, "Sigma 150-600mm f/5-6.3 DG OS HSM | S + 1.4x")); + choices.insert (p_t (182, "Canon EF 100-400mm f/4.5-5.6L IS + 2x or Sigma Lens")); + choices.insert (p_t (182, "Sigma 150-600mm f/5-6.3 DG OS HSM | S + 2x")); + choices.insert (p_t (183, "Canon EF 100-400mm f/4.5-5.6L IS or Sigma Lens")); + choices.insert (p_t (183, "Sigma 150mm f/2.8 EX DG OS HSM APO Macro")); + choices.insert (p_t (183, "Sigma 105mm f/2.8 EX DG OS HSM Macro")); + choices.insert (p_t (183, "Sigma 180mm f/2.8 EX DG OS HSM APO Macro")); + choices.insert (p_t (183, "Sigma 150-600mm f/5-6.3 DG OS HSM | C")); + choices.insert (p_t (183, "Sigma 150-600mm f/5-6.3 DG OS HSM | S")); + choices.insert (p_t (184, "Canon EF 400mm f/2.8L + 2x")); + choices.insert (p_t (185, "Canon EF 600mm f/4L IS")); + choices.insert (p_t (186, "Canon EF 70-200mm f/4L")); + choices.insert (p_t (187, "Canon EF 70-200mm f/4L + 1.4x")); + choices.insert (p_t (188, "Canon EF 70-200mm f/4L + 2x")); + choices.insert (p_t (189, "Canon EF 70-200mm f/4L + 2.8x")); + choices.insert (p_t (190, "Canon EF 100mm f/2.8 Macro USM")); + choices.insert (p_t (191, "Canon EF 400mm f/4 DO IS")); + choices.insert (p_t (193, "Canon EF 35-80mm f/4-5.6 USM")); + choices.insert (p_t (194, "Canon EF 80-200mm f/4.5-5.6 USM")); + choices.insert (p_t (195, "Canon EF 35-105mm f/4.5-5.6 USM")); + choices.insert (p_t (196, "Canon EF 75-300mm f/4-5.6 USM")); + choices.insert (p_t (197, "Canon EF 75-300mm f/4-5.6 IS USM")); + choices.insert (p_t (198, "Canon EF 50mm f/1.4 USM or Zeiss Lens")); + choices.insert (p_t (198, "Zeiss Otus 55mm f/1.4 ZE")); + choices.insert (p_t (198, "Zeiss Otus 85mm f/1.4 ZE")); + choices.insert (p_t (199, "Canon EF 28-80mm f/3.5-5.6 USM")); + choices.insert (p_t (200, "Canon EF 75-300mm f/4-5.6 USM")); + choices.insert (p_t (201, "Canon EF 28-80mm f/3.5-5.6 USM")); + choices.insert (p_t (202, "Canon EF 28-80mm f/3.5-5.6 USM IV")); + choices.insert (p_t (208, "Canon EF 22-55mm f/4-5.6 USM")); + choices.insert (p_t (209, "Canon EF 55-200mm f/4.5-5.6")); + choices.insert (p_t (210, "Canon EF 28-90mm f/4-5.6 USM")); + choices.insert (p_t (211, "Canon EF 28-200mm f/3.5-5.6 USM")); + choices.insert (p_t (212, "Canon EF 28-105mm f/4-5.6 USM")); + choices.insert (p_t (213, "Canon EF 90-300mm f/4.5-5.6 USM or Tamron Lens")); + choices.insert (p_t (213, "Tamron SP 150-600mm f/5-6.3 Di VC USD")); + choices.insert (p_t (213, "Tamron 16-300mm f/3.5-6.3 Di II VC PZD Macro")); + choices.insert (p_t (213, "Tamron SP 35mm f/1.8 Di VC USD")); + choices.insert (p_t (213, "Tamron SP 45mm f/1.8 Di VC USD")); + choices.insert (p_t (214, "Canon EF-S 18-55mm f/3.5-5.6 USM")); + choices.insert (p_t (215, "Canon EF 55-200mm f/4.5-5.6 II USM")); + choices.insert (p_t (217, "Tamron AF 18-270mm f/3.5-6.3 Di II VC PZD")); + choices.insert (p_t (224, "Canon EF 70-200mm f/2.8L IS")); + choices.insert (p_t (225, "Canon EF 70-200mm f/2.8L IS + 1.4x")); + choices.insert (p_t (226, "Canon EF 70-200mm f/2.8L IS + 2x")); + choices.insert (p_t (227, "Canon EF 70-200mm f/2.8L IS + 2.8x")); + choices.insert (p_t (228, "Canon EF 28-105mm f/3.5-4.5 USM")); + choices.insert (p_t (229, "Canon EF 16-35mm f/2.8L")); + choices.insert (p_t (230, "Canon EF 24-70mm f/2.8L")); + choices.insert (p_t (231, "Canon EF 17-40mm f/4L")); + choices.insert (p_t (232, "Canon EF 70-300mm f/4.5-5.6 DO IS USM")); + choices.insert (p_t (233, "Canon EF 28-300mm f/3.5-5.6L IS")); + choices.insert (p_t (234, "Canon EF-S 17-85mm f/4-5.6 IS USM or Tokina Lens")); + choices.insert (p_t (234, "Tokina AT-X 12-28 PRO DX 12-28mm f/4")); + choices.insert (p_t (235, "Canon EF-S 10-22mm f/3.5-4.5 USM")); + choices.insert (p_t (236, "Canon EF-S 60mm f/2.8 Macro USM")); + choices.insert (p_t (237, "Canon EF 24-105mm f/4L IS")); + choices.insert (p_t (238, "Canon EF 70-300mm f/4-5.6 IS USM")); + choices.insert (p_t (239, "Canon EF 85mm f/1.2L II")); + choices.insert (p_t (240, "Canon EF-S 17-55mm f/2.8 IS USM")); + choices.insert (p_t (241, "Canon EF 50mm f/1.2L")); + choices.insert (p_t (242, "Canon EF 70-200mm f/4L IS")); + choices.insert (p_t (243, "Canon EF 70-200mm f/4L IS + 1.4x")); + choices.insert (p_t (244, "Canon EF 70-200mm f/4L IS + 2x")); + choices.insert (p_t (245, "Canon EF 70-200mm f/4L IS + 2.8x")); + choices.insert (p_t (246, "Canon EF 16-35mm f/2.8L II")); + choices.insert (p_t (247, "Canon EF 14mm f/2.8L II USM")); + choices.insert (p_t (248, "Canon EF 200mm f/2L IS or Sigma Lens")); + choices.insert (p_t (248, "Sigma 24-35mm f/2 DG HSM | A")); + choices.insert (p_t (249, "Canon EF 800mm f/5.6L IS")); + choices.insert (p_t (250, "Canon EF 24mm f/1.4L II or Sigma Lens")); + choices.insert (p_t (250, "Sigma 20mm f/1.4 DG HSM | A")); + choices.insert (p_t (251, "Canon EF 70-200mm f/2.8L IS II USM")); + choices.insert (p_t (252, "Canon EF 70-200mm f/2.8L IS II USM + 1.4x")); + choices.insert (p_t (253, "Canon EF 70-200mm f/2.8L IS II USM + 2x")); + choices.insert (p_t (254, "Canon EF 100mm f/2.8L Macro IS USM")); + choices.insert (p_t (255, "Sigma 24-105mm f/4 DG OS HSM | A or Other Sigma Lens")); + choices.insert (p_t (255, "Sigma 180mm f/2.8 EX DG OS HSM APO Macro")); + choices.insert (p_t (488, "Canon EF-S 15-85mm f/3.5-5.6 IS USM")); + choices.insert (p_t (489, "Canon EF 70-300mm f/4-5.6L IS USM")); + choices.insert (p_t (490, "Canon EF 8-15mm f/4L Fisheye USM")); + choices.insert (p_t (491, "Canon EF 300mm f/2.8L IS II USM or Tamron Lens")); + choices.insert (p_t (491, "Tamron SP 70-200mm f/2.8 Di VC USD G2 (A025)")); + choices.insert (p_t (492, "Canon EF 400mm f/2.8L IS II USM")); + choices.insert (p_t (493, "Canon EF 500mm f/4L IS II USM or EF 24-105mm f4L IS USM")); + choices.insert (p_t (493, "Canon EF 24-105mm f/4L IS USM")); + choices.insert (p_t (494, "Canon EF 600mm f/4.0L IS II USM")); + choices.insert (p_t (495, "Canon EF 24-70mm f/2.8L II USM")); + choices.insert (p_t (496, "Canon EF 200-400mm f/4L IS USM")); + choices.insert (p_t (499, "Canon EF 200-400mm f/4L IS USM + 1.4x")); + choices.insert (p_t (502, "Canon EF 28mm f/2.8 IS USM")); + choices.insert (p_t (503, "Canon EF 24mm f/2.8 IS USM")); + choices.insert (p_t (504, "Canon EF 24-70mm f/4L IS USM")); + choices.insert (p_t (505, "Canon EF 35mm f/2 IS USM")); + choices.insert (p_t (506, "Canon EF 400mm f/4 DO IS II USM")); + choices.insert (p_t (507, "Canon EF 16-35mm f/4L IS USM")); + choices.insert (p_t (508, "Canon EF 11-24mm f/4L USM")); + choices.insert (p_t (747, "Canon EF 100-400mm f/4.5-5.6L IS II USM or Tamron Lens")); + choices.insert (p_t (747, "Tamron SP 150-600mm F5-6.3 Di VC USD G2")); + choices.insert (p_t (748, "Canon EF 100-400mm f/4.5-5.6L IS II USM + 1.4x")); + choices.insert (p_t (750, "Canon EF 35mm f/1.4L II USM")); + choices.insert (p_t (751, "Canon EF 16-35mm f/2.8L III USM")); + choices.insert (p_t (752, "Canon EF 24-105mm f/4L IS II USM")); + choices.insert (p_t (4142, "Canon EF-S 18-135mm f/3.5-5.6 IS STM")); + choices.insert (p_t (4143, "Canon EF-M 18-55mm f/3.5-5.6 IS STM or Tamron Lens")); + choices.insert (p_t (4143, "Tamron 18-200mm f/3.5-6.3 Di III VC")); + choices.insert (p_t (4144, "Canon EF 40mm f/2.8 STM")); + choices.insert (p_t (4145, "Canon EF-M 22mm f/2 STM")); + choices.insert (p_t (4146, "Canon EF-S 18-55mm f/3.5-5.6 IS STM")); + choices.insert (p_t (4147, "Canon EF-M 11-22mm f/4-5.6 IS STM")); + choices.insert (p_t (4148, "Canon EF-S 55-250mm f/4-5.6 IS STM")); + choices.insert (p_t (4149, "Canon EF-M 55-200mm f/4.5-6.3 IS STM")); + choices.insert (p_t (4150, "Canon EF-S 10-18mm f/4.5-5.6 IS STM")); + choices.insert (p_t (4152, "Canon EF 24-105mm f/3.5-5.6 IS STM")); + choices.insert (p_t (4153, "Canon EF-M 15-45mm f/3.5-6.3 IS STM")); + choices.insert (p_t (4154, "Canon EF-S 24mm f/2.8 STM")); + choices.insert (p_t (4155, "Canon EF-M 28mm f/3.5 Macro IS STM")); + choices.insert (p_t (4156, "Canon EF 50mm f/1.8 STM")); + choices.insert (p_t (4157, "Canon EF-M 18-150mm 1:3.5-6.3 IS STM")); + choices.insert (p_t (4158, "Canon EF-S 18-55mm f/4-5.6 IS STM")); + choices.insert (p_t (36910, "Canon EF 70-300mm f/4-5.6 IS II USM")); + choices.insert (p_t (36912, "Canon EF-S 18-135mm f/3.5-5.6 IS USM")); + choices.insert (p_t (65535, "n/a")); } virtual std::string toString (Tag* t) @@ -906,43 +906,43 @@ public: int lensID = t->toInt(); it_t r; - size_t nFound = choices.count( lensID ); + size_t nFound = choices.count ( lensID ); - if(1 == nFound) { + if (1 == nFound) { r = choices.find ( lensID ); return r->second; } - Tag *apertureTag = t->getParent()->getRoot()->findTag("MaxAperture"); - Tag *focalLengthTag = t->getParent()->getRoot()->findTag("FocalLength"); - Tag *focalLengthMaxTag = t->getParent()->getRoot()->findTag("LongFocal"); - Tag *focalLengthMinTag = t->getParent()->getRoot()->findTag("ShortFocal"); - Tag *unitTag = t->getParent()->getRoot()->findTag("FocalUnits"); + Tag *apertureTag = t->getParent()->getRoot()->findTag ("MaxAperture"); + Tag *focalLengthTag = t->getParent()->getRoot()->findTag ("FocalLength"); + Tag *focalLengthMaxTag = t->getParent()->getRoot()->findTag ("LongFocal"); + Tag *focalLengthMinTag = t->getParent()->getRoot()->findTag ("ShortFocal"); + Tag *unitTag = t->getParent()->getRoot()->findTag ("FocalUnits"); double maxApertureAtFocal = 0.; double focalLength = 0.; double focalLengthMin = 0.; double focalLengthMax = 0.; - if( apertureTag ) { - maxApertureAtFocal = pow(2.0, apertureTag->toDouble() / 64.0); + if ( apertureTag ) { + maxApertureAtFocal = pow (2.0, apertureTag->toDouble() / 64.0); } - if( unitTag ) { + if ( unitTag ) { double unit = unitTag->toDouble(); - if( unit == 0. ) { + if ( unit == 0. ) { unit = 1; } - if( focalLengthTag ) { + if ( focalLengthTag ) { focalLength = focalLengthTag->toDouble(); } - if( focalLengthMinTag ) { + if ( focalLengthMinTag ) { focalLengthMin = focalLengthMinTag->toDouble() / unit; } - if( focalLengthMaxTag ) { + if ( focalLengthMaxTag ) { focalLengthMax = focalLengthMaxTag->toDouble() / unit; } } @@ -970,56 +970,57 @@ public: double deltaMin = 1000.; - std::string bestMatch(s.str()); + std::string bestMatch (s.str()); std::ostringstream candidates; - for (r = choices.lower_bound(lensID); r != choices.upper_bound(lensID); r++) { + for (r = choices.lower_bound (lensID); r != choices.upper_bound (lensID); r++) { double a1, a2, f1, f2, dif; - if( !extractLensInfo( r->second , f1, f2, a1, a2) ) { + if ( !extractLensInfo ( r->second, f1, f2, a1, a2) ) { continue; } - if( f1 == 0. || a1 == 0.) { + if ( f1 == 0. || a1 == 0.) { continue; } - if( focalLength < f1 - .5 || focalLength > f2 + 0.5 ) { + if ( focalLength < f1 - .5 || focalLength > f2 + 0.5 ) { continue; } - if( focalLengthMin > 0. && fabs(f1 - focalLengthMin) > 0.5 ) { + if ( focalLengthMin > 0. && fabs (f1 - focalLengthMin) > 0.5 ) { continue; } - if( focalLengthMax > 0. && fabs(f2 - focalLengthMax) > 0.5 ) { + if ( focalLengthMax > 0. && fabs (f2 - focalLengthMax) > 0.5 ) { continue; } - if( maxApertureAtFocal > 0.1) { + if ( maxApertureAtFocal > 0.1) { double lensAperture; - if( maxApertureAtFocal < a1 - 0.15 || maxApertureAtFocal > a2 + 0.15) { + + if ( maxApertureAtFocal < a1 - 0.15 || maxApertureAtFocal > a2 + 0.15) { continue; } - if( a1 == a2 || f1 == f2) { + if ( a1 == a2 || f1 == f2) { lensAperture = a1; } else { - lensAperture = exp( log(a1) + (log(a2) - log(a1)) / (log(f2) - log(f1)) * (log(focalLength) - log(f1)) ); + lensAperture = exp ( log (a1) + (log (a2) - log (a1)) / (log (f2) - log (f1)) * (log (focalLength) - log (f1)) ); } - dif = abs(lensAperture - maxApertureAtFocal); + dif = abs (lensAperture - maxApertureAtFocal); } else { dif = 0; } - if( dif < deltaMin ) { + if ( dif < deltaMin ) { deltaMin = dif; bestMatch = r->second; } - if( dif < 0.15) { - if( candidates.tellp() ) { + if ( dif < 0.15) { + if ( candidates.tellp() ) { candidates << "\n or " << r->second; } else { candidates << r->second; @@ -1028,7 +1029,7 @@ public: } - if( !candidates.tellp() ) { + if ( !candidates.tellp() ) { return bestMatch; } else { return candidates.str(); @@ -1056,7 +1057,7 @@ public: { int val = t->toInt(); - if( val < 40 ) { + if ( val < 40 ) { return "undef"; } @@ -1103,10 +1104,10 @@ public: } virtual double toDouble (Tag* t, int ofs) { - int a = Interpreter::toInt(t, ofs); + int a = Interpreter::toInt (t, ofs); - if(a > 1) { - double i = pow(2., double(a) / 32. - 4.) * 50.; + if (a > 1) { + double i = pow (2., double (a) / 32. - 4.) * 50.; return i; } else { return 0.; @@ -1114,10 +1115,10 @@ public: } virtual int toInt (Tag* t, int ofs, TagType astype) { - int a = Interpreter::toInt(t, ofs, astype); + int a = Interpreter::toInt (t, ofs, astype); - if(a > 1) { - int i = int(double(powf(2.f, float(a) / 32.f - 4.f)) * 50.f + 0.5f); + if (a > 1) { + int i = int (double (powf (2.f, float (a) / 32.f - 4.f)) * 50.f + 0.5f); return i; } else { return 0; @@ -1235,7 +1236,7 @@ public: { int n = t->toInt(); - if( n == -1) { + if ( n == -1) { return "undef"; } @@ -1441,7 +1442,7 @@ class CAFileNumberInterpreter : public Interpreter public: virtual std::string toString (Tag* t) { - unsigned long val = t->toInt(0, LONG); + unsigned long val = t->toInt (0, LONG); char buffer[32]; sprintf (buffer, "%ld", ((val & 0xffc0) >> 6) * 10000 + ((val >> 16) & 0xff) + ((val & 0x3f) << 8) ); return buffer; @@ -1846,7 +1847,7 @@ const TagAttrib canonFocalLengthAttribs[] = { const TagAttrib canonShotInfoAttribs[] = { {0, AC_WRITE, 0, nullptr, 1, AUTO, "AutoISO", &stdInterpreter}, - {0, AC_WRITE, 0, nullptr, 2, AUTO, "BaseISO" , &caBaseISOInterpreter}, + {0, AC_WRITE, 0, nullptr, 2, AUTO, "BaseISO", &caBaseISOInterpreter}, {0, AC_WRITE, 0, nullptr, 3, AUTO, "MeasuredEV", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 4, AUTO, "TargetAperture", &caApertureInterpreter}, {0, AC_WRITE, 0, nullptr, 5, AUTO, "TargetExposureTime", &caExposureTimeInterpreter}, @@ -1855,13 +1856,13 @@ const TagAttrib canonShotInfoAttribs[] = { {0, AC_WRITE, 0, nullptr, 8, AUTO, "SlowShutter", &caSlowShutterInterpreter}, {0, AC_WRITE, 0, nullptr, 9, AUTO, "SequenceNumber", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 10, AUTO, "OpticalZoomCode", &stdInterpreter}, - {0, AC_WRITE, 0, nullptr, 13, AUTO, "FlashGuideNumber" , &caFlashGuideNumberInterpreter}, + {0, AC_WRITE, 0, nullptr, 13, AUTO, "FlashGuideNumber", &caFlashGuideNumberInterpreter}, {0, AC_WRITE, 0, nullptr, 14, AUTO, "AFPointsInFocus", &caAFPointsInFocusInterpreter}, {0, AC_WRITE, 0, nullptr, 15, AUTO, "FlashExposureComp", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 16, AUTO, "AutoExposureBracketing", &caAutoExposureBracketingInterpreter}, {0, AC_WRITE, 0, nullptr, 17, AUTO, "AEBBracketValue", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 18, AUTO, "ControlMode", &caControModeInterpreter}, - {0, AC_WRITE, 0, nullptr, 21, AUTO, "FNumber" , &caApertureInterpreter}, + {0, AC_WRITE, 0, nullptr, 21, AUTO, "FNumber", &caApertureInterpreter}, {0, AC_WRITE, 0, nullptr, 22, AUTO, "ExposureTime", &caExposureTimeInterpreter}, {0, AC_WRITE, 0, nullptr, 23, AUTO, "MeasuredEV2", &caMeasuredEVInterpreter}, {0, AC_WRITE, 0, nullptr, 24, AUTO, "BulbDuration", &stdInterpreter}, @@ -1881,15 +1882,15 @@ const TagAttrib canonFileInfoAttribs[] = { {0, AC_WRITE, 0, nullptr, 6, AUTO, "RawJpgQuality", &caRAWJpegQualityInterpreter}, {0, AC_WRITE, 0, nullptr, 7, AUTO, "RawJpgSize", &caJpegSizeInterpreter}, {0, AC_WRITE, 0, nullptr, 8, AUTO, "NoiseReduction", &stdInterpreter}, - {0, AC_WRITE, 0, nullptr, 9, AUTO, "WBBracketMode" , &caWBBracketModeInterpreter}, + {0, AC_WRITE, 0, nullptr, 9, AUTO, "WBBracketMode", &caWBBracketModeInterpreter}, {0, AC_WRITE, 0, nullptr, 12, AUTO, "WBBracketValueAB", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 13, AUTO, "WBBracketValueGM", &stdInterpreter}, - {0, AC_WRITE, 0, nullptr, 14, AUTO, "FilterEffect" , &caFilterEffectInterpreter}, - {0, AC_WRITE, 0, nullptr, 15, AUTO, "ToningEffect" , &caToningEffectInterpreter}, - {0, AC_WRITE, 0, nullptr, 19, AUTO, "LiveViewShooting" , &caOnOffInterpreter}, + {0, AC_WRITE, 0, nullptr, 14, AUTO, "FilterEffect", &caFilterEffectInterpreter}, + {0, AC_WRITE, 0, nullptr, 15, AUTO, "ToningEffect", &caToningEffectInterpreter}, + {0, AC_WRITE, 0, nullptr, 19, AUTO, "LiveViewShooting", &caOnOffInterpreter}, {0, AC_WRITE, 0, nullptr, 20, AUTO, "FocusDistanceUpper", &caFocusDistanceInterpreter}, {0, AC_WRITE, 0, nullptr, 21, AUTO, "FocusDistanceLower", &caFocusDistanceInterpreter}, - {0, AC_WRITE, 0, nullptr, 25, AUTO, "FlashExposureLock" , &caOnOffInterpreter}, + {0, AC_WRITE, 0, nullptr, 25, AUTO, "FlashExposureLock", &caOnOffInterpreter}, { -1, AC_DONTWRITE, 0, nullptr, 0, AUTO, "", nullptr}, }; @@ -1980,7 +1981,7 @@ const TagAttrib canonAttribs[] = { {0, AC_WRITE, 0, nullptr, 0x00a9, AUTO, "ColorBalance", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0x00aa, AUTO, "MeasuredColor", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0x00ae, AUTO, "ColorTemperature", &stdInterpreter}, - {0, AC_NEW , 0, nullptr, 0x00b0, AUTO, "CanonFlags", &stdInterpreter}, + {0, AC_NEW, 0, nullptr, 0x00b0, AUTO, "CanonFlags", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0x00b1, AUTO, "ModifiedInfo", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0x00b2, AUTO, "ToneCurveMatching", &stdInterpreter}, {0, AC_WRITE, 0, nullptr, 0x00b3, AUTO, "WhiteBalanceMatching", &stdInterpreter}, diff --git a/rtexif/kodakattribs.cc b/rtexif/kodakattribs.cc index f2d6e84dd..1b6e522c5 100644 --- a/rtexif/kodakattribs.cc +++ b/rtexif/kodakattribs.cc @@ -11,7 +11,7 @@ namespace rtexif { -void parseKodakIfdTextualInfo(Tag *textualInfo, Tag* exif_) +void parseKodakIfdTextualInfo (Tag *textualInfo, Tag* exif_) { // parse TextualInfo and copy values into corresponding standard Exif if (textualInfo->getType() != ASCII) { @@ -24,7 +24,7 @@ void parseKodakIfdTextualInfo(Tag *textualInfo, Tag* exif_) char *p = value; char *pc, *plf; - while ((pc = strchr(p, ':')) != nullptr && (plf = strchr(pc, '\n')) != nullptr) { + while ((pc = strchr (p, ':')) != nullptr && (plf = strchr (pc, '\n')) != nullptr) { while (*p == ' ') { p++; } @@ -35,7 +35,7 @@ void parseKodakIfdTextualInfo(Tag *textualInfo, Tag* exif_) len--; } - std::string key = std::string(p, len); + std::string key = std::string (p, len); ++pc; while (*pc == ' ') { @@ -48,7 +48,7 @@ void parseKodakIfdTextualInfo(Tag *textualInfo, Tag* exif_) len--; } - std::string val = std::string(pc, len); + std::string val = std::string (pc, len); p = ++plf; // we pick out a few select tags here @@ -56,78 +56,78 @@ void parseKodakIfdTextualInfo(Tag *textualInfo, Tag* exif_) if (key == "Lens") { // Proback645 may have "Lens" but not "Focal Length" - float flen = atof(val.c_str()); + float flen = atof (val.c_str()); if (flen != 0.0) { - t = new Tag(exif, lookupAttrib(exifAttribs, "FocalLength")); - t->initRational(flen * 32, 32); - exif->replaceTag(t); + t = new Tag (exif, lookupAttrib (exifAttribs, "FocalLength")); + t->initRational (flen * 32, 32); + exif->replaceTag (t); } } else if (key == "Focal Length") { - float flen = atof(val.c_str()); + float flen = atof (val.c_str()); if (flen != 0.0) { - t = new Tag(exif, lookupAttrib(exifAttribs, "FocalLength")); - t->initRational(flen * 32, 32); - exif->replaceTag(t); + t = new Tag (exif, lookupAttrib (exifAttribs, "FocalLength")); + t->initRational (flen * 32, 32); + exif->replaceTag (t); } } else if (key == "Aperture") { - float aperture = atof(&val.c_str()[1]); + float aperture = atof (&val.c_str()[1]); if (aperture != 0.0) { - t = new Tag(exif, lookupAttrib(exifAttribs, "FNumber")); - t->initRational((int)(aperture * 10), 10); - exif->replaceTag(t); + t = new Tag (exif, lookupAttrib (exifAttribs, "FNumber")); + t->initRational ((int) (aperture * 10), 10); + exif->replaceTag (t); } } else if (key == "Exposure Bias" || key == "Compensation") { float bias = 0.0; if (val != "Off") { - bias = atof(val.c_str()); + bias = atof (val.c_str()); } - t = new Tag (exif, lookupAttrib(exifAttribs, "ExposureBiasValue")); - t->initRational ((int)(bias * 1000), 1000); - exif->replaceTag(t); + t = new Tag (exif, lookupAttrib (exifAttribs, "ExposureBiasValue")); + t->initRational ((int) (bias * 1000), 1000); + exif->replaceTag (t); } else if (key == "ISO Speed") { - t = new Tag (exif, lookupAttrib(exifAttribs, "ISOSpeedRatings")); - t->initInt(atoi(val.c_str()), SHORT); - exif->replaceTag(t); + t = new Tag (exif, lookupAttrib (exifAttribs, "ISOSpeedRatings")); + t->initInt (atoi (val.c_str()), SHORT); + exif->replaceTag (t); } else if (key == "Shutter") { - const char *p1 = strchr(val.c_str(), '/'); + const char *p1 = strchr (val.c_str(), '/'); int a, b; if (p1 == nullptr) { - a = atoi(val.c_str()); + a = atoi (val.c_str()); b = 1; } else { - a = atoi(val.c_str()); - b = atoi(&p1[1]); + a = atoi (val.c_str()); + b = atoi (&p1[1]); } - t = new Tag (exif, lookupAttrib(exifAttribs, "ExposureTime")); - t->initRational(a, b); - exif->replaceTag(t); + t = new Tag (exif, lookupAttrib (exifAttribs, "ExposureTime")); + t->initRational (a, b); + exif->replaceTag (t); - float ssv = -log2((float)a / (float)b); // convert to APEX value - t = new Tag (exif, lookupAttrib(exifAttribs, "ShutterSpeedValue")); - t->initRational(1000000 * ssv, 1000000); - exif->replaceTag(t); + float ssv = -log2 ((float)a / (float)b); // convert to APEX value + t = new Tag (exif, lookupAttrib (exifAttribs, "ShutterSpeedValue")); + t->initRational (1000000 * ssv, 1000000); + exif->replaceTag (t); } else if (key == "Flash Fired") { - t = new Tag (exif, lookupAttrib(exifAttribs, "Flash")); + t = new Tag (exif, lookupAttrib (exifAttribs, "Flash")); if (val == "No") { - t->initInt(0, SHORT); + t->initInt (0, SHORT); } else { // not sure if "Flash Fired" is only yes/no, only seen "No" in test pictures - t->initInt(1, SHORT); + t->initInt (1, SHORT); } - exif->replaceTag(t); + exif->replaceTag (t); } else if (key == "White balance") { // yes should be small 'b' int 'balance'. - t = new Tag (exif, lookupAttrib(exifAttribs, "Flash")); - t->initInt((val == "Auto") ? 0 : 1, SHORT); - exif->replaceTag(t); + t = new Tag (exif, lookupAttrib (exifAttribs, "Flash")); + t->initInt ((val == "Auto") ? 0 : 1, SHORT); + exif->replaceTag (t); } } } diff --git a/rtexif/nikonattribs.cc b/rtexif/nikonattribs.cc index 4a2b4a63a..bf4fc5a6b 100644 --- a/rtexif/nikonattribs.cc +++ b/rtexif/nikonattribs.cc @@ -38,7 +38,7 @@ public: virtual std::string toString (Tag* t) { char buffer[32]; - sprintf (buffer, "%d", t->toInt(2)); + sprintf (buffer, "%d", t->toInt (2)); return buffer; } }; @@ -59,8 +59,8 @@ public: { int a = t->getValue()[ofs]; - if(a > 1) { - double i = pow(2., double(a) / 12. - 5.) * 100.; + if (a > 1) { + double i = pow (2., double (a) / 12. - 5.) * 100.; return i; } else { return 0.; @@ -70,8 +70,8 @@ public: { int a = t->getValue()[ofs]; - if(a > 1) { - int i = int(double(powf(2.f, float(a) / 12.f - 5.f)) * 100.f + 0.5f); + if (a > 1) { + int i = int (double (powf (2.f, float (a) / 12.f - 5.f)) * 100.f + 0.5f); return i; } else { return 0; @@ -90,50 +90,50 @@ public: // unclear if this interpretation is correct! switch (a) { - case 0x0: - return "Off"; + case 0x0: + return "Off"; - case 0x101: - return "Hi 0.3"; + case 0x101: + return "Hi 0.3"; - case 0x102: - return "Hi 0.5"; + case 0x102: + return "Hi 0.5"; - case 0x103: - return "Hi 0.7"; + case 0x103: + return "Hi 0.7"; - case 0x104: - return "Hi 1.0"; + case 0x104: + return "Hi 1.0"; - case 0x105: - return "Hi 1.3"; + case 0x105: + return "Hi 1.3"; - case 0x106: - return "Hi 1.5"; + case 0x106: + return "Hi 1.5"; - case 0x107: - return "Hi 1.7"; + case 0x107: + return "Hi 1.7"; - case 0x108: - return "Hi 2.0"; + case 0x108: + return "Hi 2.0"; - case 0x201: - return "Lo 0.3"; + case 0x201: + return "Lo 0.3"; - case 0x202: - return "Lo 0.5"; + case 0x202: + return "Lo 0.5"; - case 0x203: - return "Lo 0.7"; + case 0x203: + return "Lo 0.7"; - case 0x204: - return "Lo 1.0"; + case 0x204: + return "Lo 1.0"; - default: { - char buffer[32]; - sprintf(buffer, "0x%04X", a); - return buffer; - } + default: { + char buffer[32]; + sprintf (buffer, "0x%04X", a); + return buffer; + } } } }; @@ -222,7 +222,7 @@ public: amchoices[0x3] = "Group Dynamic"; amchoices[0x4] = "Single Area (wide)"; amchoices[0x5] = "Dynamic Area (wide)"; - // AFPoint + // AFPoint afpchoices[0x0] = "Center"; afpchoices[0x1] = "Top"; afpchoices[0x2] = "Bottom"; @@ -251,62 +251,52 @@ public: af << "Center"; } else { af << ", Center"; - } - else if (aff & 2) + } else if (aff & 2) if (af.str() == "") { af << "Top"; } else { af << ", Top"; - } - else if (aff & 4) + } else if (aff & 4) if (af.str() == "") { af << "Bottom"; } else { af << ", Bottom"; - } - else if (aff & 8) + } else if (aff & 8) if (af.str() == "") { af << "Left"; } else { af << ", Left"; - } - else if (aff & 16) + } else if (aff & 16) if (af.str() == "") { af << "Right"; } else { af << ", Right"; - } - else if (aff & 32) + } else if (aff & 32) if (af.str() == "") { af << "Upper-left"; } else { af << ", Upper-left"; - } - else if (aff & 64) + } else if (aff & 64) if (af.str() == "") { af << "Upper-right"; } else { af << ", Upper-right"; - } - else if (aff & 128) + } else if (aff & 128) if (af.str() == "") { af << " Lower-left"; } else { af << ", Lower-left"; - } - else if (aff & 256) + } else if (aff & 256) if (af.str() == "") { af << "Lower-right"; } else { af << ", Lower-right"; - } - else if (aff & 512) + } else if (aff & 512) if (af.str() == "") { af << "Far Left"; } else { af << ", Far Left"; - } - else if (aff & 1024) { + } else if (aff & 1024) { if (af.str() == "") { af << "Far Right"; } else { @@ -372,21 +362,21 @@ public: std::ostringstream ld; ld << "Version = " << ver << std::endl; - int lenstype = t->getParent()->getTag(0x0083)->toInt(0, BYTE); + int lenstype = t->getParent()->getTag (0x0083)->toInt (0, BYTE); std::ostringstream lid; lid.setf (std::ios_base::hex, std::ios_base::basefield); lid.setf (std::ios_base::uppercase); - Tag *modelTag = t->getParent()->getRoot()->findTag("Model"); - std::string model( modelTag ? modelTag->valueToString() : ""); + Tag *modelTag = t->getParent()->getRoot()->findTag ("Model"); + std::string model ( modelTag ? modelTag->valueToString() : ""); int lidoffs = 7; bool d100 = false; - if (model.substr(0, 10) == "NIKON D100" || model.substr(0, 9) == "NIKON D1X") { + if (model.substr (0, 10) == "NIKON D100" || model.substr (0, 9) == "NIKON D1X") { lidoffs = 0; d100 = true; - } else if( ver < 204) { + } else if ( ver < 204) { lidoffs = 7; d100 = false; } else { @@ -403,14 +393,14 @@ public: } if (ver >= 201) { - const unsigned char* serval = t->getParent()->getTag(0x001d)->getValue (); + const unsigned char* serval = t->getParent()->getTag (0x001d)->getValue (); int serial = 0; for (int i = 0; serval[i]; i++) { - serial = serial * 10 + (isdigit(serval[i]) ? serval[i] - '0' : serval[i] % 10); + serial = serial * 10 + (isdigit (serval[i]) ? serval[i] - '0' : serval[i] % 10); } - const unsigned char* scval = t->getParent()->getTag(0x00a7)->getValue (); + const unsigned char* scval = t->getParent()->getTag (0x00a7)->getValue (); int key = 0; for (int i = 0; i < 4; i++) { @@ -431,7 +421,7 @@ public: if (!d100) { int EffectiveMaxApertureValue; - if( ver < 204 ) { + if ( ver < 204 ) { ld << "ExitPupilPosition = " << (int) buffer[0] << std::endl; ld << "AFAperture = " << (int) buffer[1] << std::endl; ld << "FocusPosition = " << (int) buffer[4] << std::endl; @@ -448,111 +438,111 @@ public: } switch (EffectiveMaxApertureValue) { - case 0x8: - EffectiveMaxApertureString = "1.2"; - break; + case 0x8: + EffectiveMaxApertureString = "1.2"; + break; - case 0xc: - EffectiveMaxApertureString = "1.4"; - break; + case 0xc: + EffectiveMaxApertureString = "1.4"; + break; - case 0x14: - EffectiveMaxApertureString = "1.8"; - break; + case 0x14: + EffectiveMaxApertureString = "1.8"; + break; - case 0x18: - EffectiveMaxApertureString = "2.0"; - break; + case 0x18: + EffectiveMaxApertureString = "2.0"; + break; - case 0x20: - EffectiveMaxApertureString = "2.5"; - break; + case 0x20: + EffectiveMaxApertureString = "2.5"; + break; - case 0x24: - EffectiveMaxApertureString = "2.8"; - break; + case 0x24: + EffectiveMaxApertureString = "2.8"; + break; - case 0x2a: - EffectiveMaxApertureString = "3.3"; - break; + case 0x2a: + EffectiveMaxApertureString = "3.3"; + break; - case 0x2c: - EffectiveMaxApertureString = "3.5"; - break; + case 0x2c: + EffectiveMaxApertureString = "3.5"; + break; - case 0x30: - EffectiveMaxApertureString = "4.0"; - break; + case 0x30: + EffectiveMaxApertureString = "4.0"; + break; - case 0x34: - EffectiveMaxApertureString = "4.5"; - break; + case 0x34: + EffectiveMaxApertureString = "4.5"; + break; - case 0x38: - EffectiveMaxApertureString = "5.0"; - break; + case 0x38: + EffectiveMaxApertureString = "5.0"; + break; - case 0x3c: - EffectiveMaxApertureString = "5.6"; - break; + case 0x3c: + EffectiveMaxApertureString = "5.6"; + break; - case 0x40: - EffectiveMaxApertureString = "6.3"; - break; + case 0x40: + EffectiveMaxApertureString = "6.3"; + break; - case 0x44: - EffectiveMaxApertureString = "7.1"; - break; + case 0x44: + EffectiveMaxApertureString = "7.1"; + break; - case 0x48: - EffectiveMaxApertureString = "8.0"; - break; + case 0x48: + EffectiveMaxApertureString = "8.0"; + break; - case 0x4e: - EffectiveMaxApertureString = "9.5"; - break; + case 0x4e: + EffectiveMaxApertureString = "9.5"; + break; - case 0x54: - EffectiveMaxApertureString = "11.0"; - break; + case 0x54: + EffectiveMaxApertureString = "11.0"; + break; - case 0x5a: - EffectiveMaxApertureString = "13.0"; - break; + case 0x5a: + EffectiveMaxApertureString = "13.0"; + break; - case 0x5e: - EffectiveMaxApertureString = "15.0"; - break; + case 0x5e: + EffectiveMaxApertureString = "15.0"; + break; - case 0x60: - EffectiveMaxApertureString = "16.0"; - break; + case 0x60: + EffectiveMaxApertureString = "16.0"; + break; - case 0x66: - EffectiveMaxApertureString = "19.0"; - break; + case 0x66: + EffectiveMaxApertureString = "19.0"; + break; - case 0x6c: - EffectiveMaxApertureString = "22.0"; - break; + case 0x6c: + EffectiveMaxApertureString = "22.0"; + break; - default : - EffectiveMaxApertureString = ""; + default : + EffectiveMaxApertureString = ""; } ld << "EffectiveMaxAperture = " << EffectiveMaxApertureString << std::endl; } for (int i = 0; i < 7; i++) { - lid << std::setw(2) << std::setfill('0') << (int)buffer[lidoffs + i] << ' '; + lid << std::setw (2) << std::setfill ('0') << (int)buffer[lidoffs + i] << ' '; } - lid << std::setw(2) << std::setfill('0') << lenstype; + lid << std::setw (2) << std::setfill ('0') << lenstype; std::map::const_iterator r = lenses.find (lid.str()); if (r != lenses.end()) { - if(r == lenses.begin() && EffectiveMaxApertureString != "") { // first entry is for unchipped lenses + if (r == lenses.begin() && EffectiveMaxApertureString != "") { // first entry is for unchipped lenses ld << "Lens = Unknown $FL$mm f/" << EffectiveMaxApertureString; } else { ld << "Lens = " << r->second; diff --git a/rtexif/olympusattribs.cc b/rtexif/olympusattribs.cc index 6e9b2a2e9..21cfb5738 100644 --- a/rtexif/olympusattribs.cc +++ b/rtexif/olympusattribs.cc @@ -66,8 +66,8 @@ public: virtual std::string toString (Tag* t) { std::ostringstream str; - str.precision(2); - str << pow(2, t->toInt() / 512.0); + str.precision (2); + str << pow (2, t->toInt() / 512.0); return str.str(); } }; @@ -196,9 +196,9 @@ public: std::ostringstream lid; lid.setf (std::ios_base::hex, std::ios_base::basefield); lid.setf (std::ios_base::uppercase); - lid << std::setw(2) << std::setfill('0') << t->toInt(0) << ' '; //maker - lid << std::setw(2) << std::setfill('0') << t->toInt(2) << ' '; //model - lid << std::setw(2) << std::setfill('0') << t->toInt(3); // submodel + lid << std::setw (2) << std::setfill ('0') << t->toInt (0) << ' '; //maker + lid << std::setw (2) << std::setfill ('0') << t->toInt (2) << ' '; //model + lid << std::setw (2) << std::setfill ('0') << t->toInt (3); // submodel std::map::iterator r = lenses.find (lid.str()); diff --git a/rtexif/pentaxattribs.cc b/rtexif/pentaxattribs.cc index 451756f6a..b57de067c 100644 --- a/rtexif/pentaxattribs.cc +++ b/rtexif/pentaxattribs.cc @@ -419,7 +419,7 @@ public: char buffer[32]; double v = t->toDouble() / 10; - if( v < 0. || v > 1000. ) { + if ( v < 0. || v > 1000. ) { return "undef"; } @@ -611,14 +611,14 @@ public: } virtual std::string toString (Tag* t) { - int c = 256 * t->toInt(0, BYTE) + t->toInt(1, BYTE); + int c = 256 * t->toInt (0, BYTE) + t->toInt (1, BYTE); std::map::iterator r = choices.find (c); if (r != choices.end()) { std::ostringstream s; s << r->second; - if( t->toInt(1, BYTE) == 0 ) { + if ( t->toInt (1, BYTE) == 0 ) { s << "\n1/2 EV steps"; } else { s << "\n1/3 EV steps"; @@ -670,10 +670,10 @@ public: } virtual std::string toString (Tag* t) { - std::map::iterator r = choices.find (t->toInt(0, BYTE)); - std::map::iterator r1 = choices1.find (t->toInt(1, BYTE)); - std::map::iterator r2 = choices2.find (t->toInt(2, BYTE)); - std::map::iterator r3 = choices3.find (t->toInt(3, BYTE)); + std::map::iterator r = choices.find (t->toInt (0, BYTE)); + std::map::iterator r1 = choices1.find (t->toInt (1, BYTE)); + std::map::iterator r2 = choices2.find (t->toInt (2, BYTE)); + std::map::iterator r3 = choices3.find (t->toInt (3, BYTE)); std::ostringstream s; s << ((r != choices.end()) ? r->second : ""); s << ((r1 != choices1.end()) ? r1->second : "") << " "; @@ -700,338 +700,338 @@ class PALensTypeInterpreter : public IntLensInterpreter< int > public: PALensTypeInterpreter () { - choices.insert(p_t(256 * 0 + 0, "M-42 or No Lens")); - choices.insert(p_t(256 * 1 + 0, "K or M Lens")); - choices.insert(p_t(256 * 2 + 0, "A Series Lens")); - choices.insert(p_t(256 * 3 + 0, "Sigma")); - choices.insert(p_t(256 * 3 + 17, "smc PENTAX-FA SOFT 85mm f/2.8")); - choices.insert(p_t(256 * 3 + 18, "smc PENTAX-F 1.7X AF ADAPTER")); - choices.insert(p_t(256 * 3 + 19, "smc PENTAX-F 24-50mm f/4")); - choices.insert(p_t(256 * 3 + 20, "smc PENTAX-F 35-80mm f/4-5.6")); - choices.insert(p_t(256 * 3 + 21, "smc PENTAX-F 80-200mm f/4.7-5.6")); - choices.insert(p_t(256 * 3 + 22, "smc PENTAX-F FISH-EYE 17-28mm f/3.5-4.5")); - choices.insert(p_t(256 * 3 + 23, "smc PENTAX-F 100-300mm f/4.5-5.6 or Sigma Lens")); - choices.insert(p_t(256 * 3 + 23, "Sigma AF 28-300mm f/3.5-5.6 DL IF")); - choices.insert(p_t(256 * 3 + 23, "Sigma AF 28-300mm f/3.5-6.3 DG IF Macro")); - choices.insert(p_t(256 * 3 + 23, "Tokina 80-200mm f/2.8 ATX-Pro")); - choices.insert(p_t(256 * 3 + 24, "smc PENTAX-F 35-135mm f/3.5-4.5")); - choices.insert(p_t(256 * 3 + 25, "smc PENTAX-F 35-105mm f/4-5.6 or Sigma or Tokina Lens")); - choices.insert(p_t(256 * 3 + 25, "Sigma 55-200mm f/4-5.6 DC")); - choices.insert(p_t(256 * 3 + 25, "Sigma AF 28-300mm f/3.5-5.6 DL IF")); - choices.insert(p_t(256 * 3 + 25, "Sigma AF 28-300mm f/3.5-6.3 DL IF")); - choices.insert(p_t(256 * 3 + 25, "Sigma AF 28-300mm f/3.5-6.3 DG IF Macro")); - choices.insert(p_t(256 * 3 + 25, "Tokina 80-200mm f/2.8 ATX-Pro")); - choices.insert(p_t(256 * 3 + 26, "smc PENTAX-F* 250-600mm f/5.6 ED[IF]")); - choices.insert(p_t(256 * 3 + 27, "smc PENTAX-F 28-80mm f/3.5-4.5 or Tokina Lens")); - choices.insert(p_t(256 * 3 + 27, "Tokina AT-X Pro AF 28-70mm f/2.6-2.8")); - choices.insert(p_t(256 * 3 + 28, "smc PENTAX-F 35-70mm f/3.5-4.5 or Tokina Lens")); - choices.insert(p_t(256 * 3 + 28, "Tokina 19-35mm f/3.5-4.5 AF")); - choices.insert(p_t(256 * 3 + 28, "Tokina AT-X AF 400mm f/5.6")); - choices.insert(p_t(256 * 3 + 29, "PENTAX-F 28-80mm f/3.5-4.5 or Sigma or Tokina Lens")); - choices.insert(p_t(256 * 3 + 29, "Sigma AF 18-125mm f/3.5-5.6 DC")); - choices.insert(p_t(256 * 3 + 29, "Tokina AT-X PRO 28-70mm f/2.6-2.8")); - choices.insert(p_t(256 * 3 + 30, "PENTAX-F 70-200mm f/4-5.6")); - choices.insert(p_t(256 * 3 + 31, "smc PENTAX-F 70-210mm f/4-5.6 or Tokina or Takumar Lens")); - choices.insert(p_t(256 * 3 + 31, "Tokina AF 730 75-300mm f/4.5-5.6")); - choices.insert(p_t(256 * 3 + 31, "Takumar-F 70-210mm f/4-5.6")); - choices.insert(p_t(256 * 3 + 32, "smc PENTAX-F 50mm f/1.4")); - choices.insert(p_t(256 * 3 + 33, "smc PENTAX-F 50mm f/1.7")); - choices.insert(p_t(256 * 3 + 34, "smc PENTAX-F 135mm f/2.8 [IF]")); - choices.insert(p_t(256 * 3 + 35, "smc PENTAX-F 28mm f/2.8")); - choices.insert(p_t(256 * 3 + 36, "Sigma 20mm f/1.8 EX DG Aspherical RF")); - choices.insert(p_t(256 * 3 + 38, "smc PENTAX-F* 300mm f/4.5 ED[IF]")); - choices.insert(p_t(256 * 3 + 39, "smc PENTAX-F* 600mm f/4 ED[IF]")); - choices.insert(p_t(256 * 3 + 40, "smc PENTAX-F Macro 100mm f/2.8")); - choices.insert(p_t(256 * 3 + 41, "smc PENTAX-F Macro 50mm f/2.8 or Sigma Lens")); - choices.insert(p_t(256 * 3 + 41, "Sigma 50mm f/2.8 Macro")); - choices.insert(p_t(256 * 3 + 42, "Sigma 300mm f/2.8 EX DG APO IF")); - choices.insert(p_t(256 * 3 + 44, "Sigma or Tamron Lens (3 44)")); - choices.insert(p_t(256 * 3 + 44, "Sigma AF 10-20mm f/4-5.6 EX DC")); - choices.insert(p_t(256 * 3 + 44, "Sigma 12-24mm f/4.5-5.6 EX DG")); - choices.insert(p_t(256 * 3 + 44, "Sigma 17-70mm f/2.8-4.5 DC Macro")); - choices.insert(p_t(256 * 3 + 44, "Sigma 18-50mm f/3.5-5.6 DC")); - choices.insert(p_t(256 * 3 + 44, "Sigma 17-35mm f/2.8-4 EX DG")); - choices.insert(p_t(256 * 3 + 44, "Tamron 35-90mm f/4 AF")); - choices.insert(p_t(256 * 3 + 44, "Sigma AF 18-35mm f/3.5-4.5 Aspherical")); - choices.insert(p_t(256 * 3 + 46, "Sigma or Samsung Lens (3 46)")); - choices.insert(p_t(256 * 3 + 46, "Sigma APO 70-200mm f/2.8 EX")); - choices.insert(p_t(256 * 3 + 46, "Sigma EX APO 100-300mm f/4 IF")); - choices.insert(p_t(256 * 3 + 46, "Samsung/Schneider D-XENON 50-200mm f/4-5.6 ED")); - choices.insert(p_t(256 * 3 + 50, "smc PENTAX-FA 28-70mm f/4 AL")); - choices.insert(p_t(256 * 3 + 51, "Sigma 28mm f/1.8 EX DG Aspherical Macro")); - choices.insert(p_t(256 * 3 + 52, "smc PENTAX-FA 28-200mm f/3.8-5.6 AL[IF] or Tamron Lens")); - choices.insert(p_t(256 * 3 + 52, "Tamron AF LD 28-200mm f/3.8-5.6 [IF] Aspherical (171D)")); - choices.insert(p_t(256 * 3 + 53, "smc PENTAX-FA 28-80mm f/3.5-5.6 AL")); - choices.insert(p_t(256 * 3 + 247, "smc PENTAX-DA FISH-EYE 10-17mm f/3.5-4.5 ED[IF]")); - choices.insert(p_t(256 * 3 + 248, "smc PENTAX-DA 12-24mm f/4 ED AL[IF]")); - choices.insert(p_t(256 * 3 + 250, "smc PENTAX-DA 50-200mm f/4-5.6 ED")); - choices.insert(p_t(256 * 3 + 251, "smc PENTAX-DA 40mm f/2.8 Limited")); - choices.insert(p_t(256 * 3 + 252, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL")); - choices.insert(p_t(256 * 3 + 253, "smc PENTAX-DA 14mm f/2.8 ED[IF]")); - choices.insert(p_t(256 * 3 + 254, "smc PENTAX-DA 16-45mm f/4 ED AL")); - choices.insert(p_t(256 * 3 + 255, "Sigma Lens (3 255)")); - choices.insert(p_t(256 * 3 + 255, "Sigma 18-200mm f/3.5-6.3 DC")); - choices.insert(p_t(256 * 3 + 255, "Sigma DL-II 35-80mm f/4-5.6")); - choices.insert(p_t(256 * 3 + 255, "Sigma DL Zoom 75-300mm f/4-5.6")); - choices.insert(p_t(256 * 3 + 255, "Sigma DF EX Aspherical 28-70mm f/2.8")); - choices.insert(p_t(256 * 3 + 255, "Sigma AF Tele 400mm f/5.6 Multi-coated")); - choices.insert(p_t(256 * 3 + 255, "Sigma 24-60mm f/2.8 EX DG")); - choices.insert(p_t(256 * 3 + 255, "Sigma 70-300mm f/4-5.6 Macro")); - choices.insert(p_t(256 * 3 + 255, "Sigma 55-200mm f/4-5.6 DC")); - choices.insert(p_t(256 * 3 + 255, "Sigma 18-50mm f/2.8 EX DC")); - choices.insert(p_t(256 * 4 + 1, "smc PENTAX-FA SOFT 28mm f/2.8")); - choices.insert(p_t(256 * 4 + 2, "smc PENTAX-FA 80-320mm f/4.5-5.6")); - choices.insert(p_t(256 * 4 + 3, "smc PENTAX-FA 43mm f/1.9 Limited")); - choices.insert(p_t(256 * 4 + 6, "smc PENTAX-FA 35-80mm f/4-5.6")); - choices.insert(p_t(256 * 4 + 10, "Irix 15mm f/2.4")); - choices.insert(p_t(256 * 4 + 12, "smc PENTAX-FA 50mm f/1.4")); - choices.insert(p_t(256 * 4 + 15, "smc PENTAX-FA 28-105mm f/4-5.6 [IF]")); - choices.insert(p_t(256 * 4 + 16, "Tamron AF 80-210mm f/4-5.6 (178D)")); - choices.insert(p_t(256 * 4 + 19, "Tamron SP AF 90mm f/2.8 (172E)")); - choices.insert(p_t(256 * 4 + 20, "smc PENTAX-FA 28-80mm f/3.5-5.6")); - choices.insert(p_t(256 * 4 + 21, "Cosina AF 100-300mm f/5.6-6.7")); - choices.insert(p_t(256 * 4 + 22, "Tokina 28-80mm f/3.5-5.6")); - choices.insert(p_t(256 * 4 + 23, "smc PENTAX-FA 20-35mm f/4 AL")); - choices.insert(p_t(256 * 4 + 24, "smc PENTAX-FA 77mm f/1.8 Limited")); - choices.insert(p_t(256 * 4 + 25, "Tamron SP AF 14mm f/2.8")); - choices.insert(p_t(256 * 4 + 26, "smc PENTAX-FA Macro 100mm f/3.5 or Cosina Lens")); - choices.insert(p_t(256 * 4 + 26, "Cosina 100mm f/3.5 Macro")); - choices.insert(p_t(256 * 4 + 27, "Tamron AF 28-300mm f/3.5-6.3 LD Aspherical[IF] Macro (185D/285D)")); - choices.insert(p_t(256 * 4 + 28, "smc PENTAX-FA 35mm f/2 AL")); - choices.insert(p_t(256 * 4 + 29, "Tamron AF 28-200mm f/3.8-5.6 LD Super II Macro (371D)")); - choices.insert(p_t(256 * 4 + 34, "smc PENTAX-FA 24-90mm f/3.5-4.5 AL[IF]")); - choices.insert(p_t(256 * 4 + 35, "smc PENTAX-FA 100-300mm f/4.7-5.8")); - choices.insert(p_t(256 * 4 + 36, "Tamron AF 70-300mm f/4-5.6 LD Macro 1:2")); - choices.insert(p_t(256 * 4 + 37, "Tamron SP AF 24-135mm f/3.5-5.6 AD AL (190D)")); - choices.insert(p_t(256 * 4 + 38, "smc PENTAX-FA 28-105mm f/3.2-4.5 AL[IF]")); - choices.insert(p_t(256 * 4 + 39, "smc PENTAX-FA 31mm f/1.8 AL Limited")); - choices.insert(p_t(256 * 4 + 41, "Tamron AF 28-200mm Super Zoom f/3.8-5.6 Aspherical XR [IF] Macro (A03)")); - choices.insert(p_t(256 * 4 + 43, "smc PENTAX-FA 28-90mm f/3.5-5.6")); - choices.insert(p_t(256 * 4 + 44, "smc PENTAX-FA J 75-300mm f/4.5-5.8 AL")); - choices.insert(p_t(256 * 4 + 45, "Tamron Lens (4 45)")); - choices.insert(p_t(256 * 4 + 45, "Tamron 28-300mm f/3.5-6.3 Ultra zoom XR")); - choices.insert(p_t(256 * 4 + 45, "Tamron AF 28-300mm f/3.5-6.3 XR Di LD Aspherical [IF] Macro")); - choices.insert(p_t(256 * 4 + 46, "smc PENTAX-FA J 28-80mm f/3.5-5.6 AL")); - choices.insert(p_t(256 * 4 + 47, "smc PENTAX-FA J 18-35mm f/4-5.6 AL")); - choices.insert(p_t(256 * 4 + 49, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro")); - choices.insert(p_t(256 * 4 + 51, "smc PENTAX-D FA 50mm f/2.8 Macro")); - choices.insert(p_t(256 * 4 + 52, "smc PENTAX-D FA 100mm f/2.8 Macro")); - choices.insert(p_t(256 * 4 + 55, "Samsung/Schneider D-XENOGON 35mm f/2")); - choices.insert(p_t(256 * 4 + 56, "Samsung/Schneider D-XENON 100mm f/2.8 Macro")); - choices.insert(p_t(256 * 4 + 75, "Tamron SP AF 70-200mm f/2.8 Di LD [IF] Macro (A001)")); - choices.insert(p_t(256 * 4 + 214, "smc PENTAX-DA 35mm f/2.4 AL")); - choices.insert(p_t(256 * 4 + 229, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL II")); - choices.insert(p_t(256 * 4 + 230, "Tamron SP AF 17-50mm f/2.8 XR Di II")); - choices.insert(p_t(256 * 4 + 231, "smc PENTAX-DA 18-250mm f/3.5-6.3 ED AL [IF]")); - choices.insert(p_t(256 * 4 + 237, "Samsung/Schneider D-XENOGON 10-17mm f/3.5-4.5")); - choices.insert(p_t(256 * 4 + 239, "Samsung/Schneider D-XENON 12-24mm f/4 ED AL [IF]")); - choices.insert(p_t(256 * 4 + 242, "smc PENTAX-DA* 16-50mm f/2.8 ED AL [IF] SDM (SDM unused)")); - choices.insert(p_t(256 * 4 + 243, "smc PENTAX-DA 70mm f/2.4 Limited")); - choices.insert(p_t(256 * 4 + 244, "smc PENTAX-DA 21mm f/3.2 AL Limited")); - choices.insert(p_t(256 * 4 + 245, "Samsung/Schneider D-XENON 50-200mm f/4-5.6")); - choices.insert(p_t(256 * 4 + 246, "Samsung/Schneider D-XENON 18-55mm f/3.5-5.6")); - choices.insert(p_t(256 * 4 + 247, "smc PENTAX-DA FISH-EYE 10-17mm f/3.5-4.5 ED[IF]")); - choices.insert(p_t(256 * 4 + 248, "smc PENTAX-DA 12-24mm f/4 ED AL [IF]")); - choices.insert(p_t(256 * 4 + 249, "Tamron XR DiII 18-200mm f/3.5-6.3 (A14)")); - choices.insert(p_t(256 * 4 + 250, "smc PENTAX-DA 50-200mm f/4-5.6 ED")); - choices.insert(p_t(256 * 4 + 251, "smc PENTAX-DA 40mm f/2.8 Limited")); - choices.insert(p_t(256 * 4 + 252, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL")); - choices.insert(p_t(256 * 4 + 253, "smc PENTAX-DA 14mm f/2.8 ED[IF]")); - choices.insert(p_t(256 * 4 + 254, "smc PENTAX-DA 16-45mm f/4 ED AL")); - choices.insert(p_t(256 * 5 + 1, "smc PENTAX-FA* 24mm f/2 AL[IF]")); - choices.insert(p_t(256 * 5 + 2, "smc PENTAX-FA 28mm f/2.8 AL")); - choices.insert(p_t(256 * 5 + 3, "smc PENTAX-FA 50mm f/1.7")); - choices.insert(p_t(256 * 5 + 4, "smc PENTAX-FA 50mm f/1.4")); - choices.insert(p_t(256 * 5 + 5, "smc PENTAX-FA* 600mm f/4 ED[IF]")); - choices.insert(p_t(256 * 5 + 6, "smc PENTAX-FA* 300mm f/4.5 ED[IF]")); - choices.insert(p_t(256 * 5 + 7, "smc PENTAX-FA 135mm f/2.8 [IF]")); - choices.insert(p_t(256 * 5 + 8, "smc PENTAX-FA Macro 50mm f/2.8")); - choices.insert(p_t(256 * 5 + 9, "smc PENTAX-FA Macro 100mm f/2.8")); - choices.insert(p_t(256 * 5 + 10, "smc PENTAX-FA* 85mm f/1.4 [IF]")); - choices.insert(p_t(256 * 5 + 11, "smc PENTAX-FA* 200mm f/2.8 ED[IF]")); - choices.insert(p_t(256 * 5 + 12, "smc PENTAX-FA 28-80mm f/3.5-4.7")); - choices.insert(p_t(256 * 5 + 13, "smc PENTAX-FA 70-200mm f/4-5.6")); - choices.insert(p_t(256 * 5 + 14, "smc PENTAX-FA* 250-600mm f/5.6 ED[IF]")); - choices.insert(p_t(256 * 5 + 15, "smc PENTAX-FA 28-105mm f/4-5.6")); - choices.insert(p_t(256 * 5 + 16, "smc PENTAX-FA 100-300mm f/4.5-5.6")); - choices.insert(p_t(256 * 5 + 98, "smc PENTAX-FA 100-300mm f/4.5-5.6")); - choices.insert(p_t(256 * 6 + 1, "smc PENTAX-FA* 85mm f/1.4 [IF]")); - choices.insert(p_t(256 * 6 + 2, "smc PENTAX-FA* 200mm f/2.8 ED[IF]")); - choices.insert(p_t(256 * 6 + 3, "smc PENTAX-FA* 300mm f/2.8 ED[IF]")); - choices.insert(p_t(256 * 6 + 4, "smc PENTAX-FA* 28-70mm f/2.8 AL")); - choices.insert(p_t(256 * 6 + 5, "smc PENTAX-FA* 80-200mm f/2.8 ED[IF]")); - choices.insert(p_t(256 * 6 + 6, "smc PENTAX-FA* 28-70mm f/2.8 AL")); - choices.insert(p_t(256 * 6 + 7, "smc PENTAX-FA* 80-200mm f/2.8 ED[IF]")); - choices.insert(p_t(256 * 6 + 8, "smc PENTAX-FA 28-70mm f/4AL")); - choices.insert(p_t(256 * 6 + 9, "smc PENTAX-FA 20mm f/2.8")); - choices.insert(p_t(256 * 6 + 10, "smc PENTAX-FA* 400mm f/5.6 ED[IF]")); - choices.insert(p_t(256 * 6 + 13, "smc PENTAX-FA* 400mm f/5.6 ED[IF]")); - choices.insert(p_t(256 * 6 + 14, "smc PENTAX-FA* Macro 200mm f/4 ED[IF]")); - choices.insert(p_t(256 * 7 + 0, "smc PENTAX-DA 21mm f/3.2 AL Limited")); - choices.insert(p_t(256 * 7 + 58, "smc PENTAX-D FA Macro 100mm f/2.8 WR")); - choices.insert(p_t(256 * 7 + 75, "Tamron SP AF 70-200mm f/2.8 Di LD [IF] Macro (A001)")); - choices.insert(p_t(256 * 7 + 201, "smc Pentax-DA L 50-200mm f/4-5.6 ED WR")); - choices.insert(p_t(256 * 7 + 202, "smc PENTAX-DA L 18-55mm f/3.5-5.6 AL WR")); - choices.insert(p_t(256 * 7 + 203, "HD PENTAX-DA 55-300mm f/4-5.8 ED WR")); - choices.insert(p_t(256 * 7 + 204, "HD PENTAX-DA 15mm f/4 ED AL Limited")); - choices.insert(p_t(256 * 7 + 205, "HD PENTAX-DA 35mm f/2.8 Macro Limited")); - choices.insert(p_t(256 * 7 + 206, "HD PENTAX-DA 70mm f/2.4 Limited")); - choices.insert(p_t(256 * 7 + 207, "HD PENTAX-DA 21mm f/3.2 ED AL Limited")); - choices.insert(p_t(256 * 7 + 208, "HD PENTAX-DA 40mm f/2.8 Limited")); - choices.insert(p_t(256 * 7 + 212, "smc PENTAX-DA 50mm f/1.8")); - choices.insert(p_t(256 * 7 + 213, "smc PENTAX-DA 40mm f/2.8 XS")); - choices.insert(p_t(256 * 7 + 214, "smc PENTAX-DA 35mm f/2.4 AL")); - choices.insert(p_t(256 * 7 + 216, "smc PENTAX-DA L 55-300mm f/4-5.8 ED")); - choices.insert(p_t(256 * 7 + 217, "smc PENTAX-DA 50-200mm f/4-5.6 ED WR")); - choices.insert(p_t(256 * 7 + 218, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL WR")); - choices.insert(p_t(256 * 7 + 220, "Tamron SP AF 10-24mm f/3.5-4.5 Di II LD Aspherical [IF]")); - choices.insert(p_t(256 * 7 + 221, "smc PENTAX-DA L 50-200mm f/4-5.6 ED")); - choices.insert(p_t(256 * 7 + 222, "smc PENTAX-DA L 18-55mm f/3.5-5.6")); - choices.insert(p_t(256 * 7 + 223, "Samsung/Schneider D-XENON 18-55mm f/3.5-5.6 II")); - choices.insert(p_t(256 * 7 + 224, "smc PENTAX-DA 15mm f/4 ED AL Limited")); - choices.insert(p_t(256 * 7 + 225, "Samsung/Schneider D-XENON 18-250mm f/3.5-6.3")); - choices.insert(p_t(256 * 7 + 226, "smc PENTAX-DA* 55mm f/1.4 SDM (SDM unused)")); - choices.insert(p_t(256 * 7 + 227, "smc PENTAX-DA* 60-250mm f/4 [IF] SDM (SDM unused)")); - choices.insert(p_t(256 * 7 + 228, "Samsung 16-45mm f/4 ED")); - choices.insert(p_t(256 * 7 + 229, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL II")); - choices.insert(p_t(256 * 7 + 230, "Tamron AF 17-50mm f/2.8 XR Di-II LD (Model A16)")); - choices.insert(p_t(256 * 7 + 231, "smc PENTAX-DA 18-250mm f/3.5-6.3 ED AL [IF]")); - choices.insert(p_t(256 * 7 + 233, "smc PENTAX-DA 35mm f/2.8 Macro Limited")); - choices.insert(p_t(256 * 7 + 234, "smc PENTAX-DA* 300mm f/4 ED [IF] SDM (SDM unused)")); - choices.insert(p_t(256 * 7 + 235, "smc PENTAX-DA* 200mm f/2.8 ED [IF] SDM (SDM unused)")); - choices.insert(p_t(256 * 7 + 236, "smc PENTAX-DA 55-300mm f/4-5.8 ED")); - choices.insert(p_t(256 * 7 + 238, "Tamron AF 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro")); - choices.insert(p_t(256 * 7 + 241, "smc PENTAX-DA* 50-135mm f/2.8 ED [IF] SDM (SDM unused)")); - choices.insert(p_t(256 * 7 + 242, "smc PENTAX-DA* 16-50mm f/2.8 ED AL [IF] SDM (SDM unused)")); - choices.insert(p_t(256 * 7 + 243, "smc PENTAX-DA 70mm f/2.4 Limited")); - choices.insert(p_t(256 * 7 + 244, "smc PENTAX-DA 21mm f/3.2 AL Limited")); - choices.insert(p_t(256 * 8 + 0, "Sigma 50-150mm f/2.8 II APO EX DC HSM")); - choices.insert(p_t(256 * 8 + 3, "Sigma AF 18-125mm f/3.5-5.6 DC")); - choices.insert(p_t(256 * 8 + 4, "Sigma 50mm f/1.4 EX DG HSM")); - choices.insert(p_t(256 * 8 + 7, "Sigma 24-70mm f/2.8 IF EX DG HSM")); - choices.insert(p_t(256 * 8 + 8, "Sigma 18-250mm f/3.5-6.3 DC OS HSM")); - choices.insert(p_t(256 * 8 + 11, "Sigma 10-20mm f/3.5 EX DC HSM")); - choices.insert(p_t(256 * 8 + 12, "Sigma 70-300mm f/4-5.6 DG OS")); - choices.insert(p_t(256 * 8 + 13, "Sigma 120-400mm f/4.5-5.6 APO DG OS HSM")); - choices.insert(p_t(256 * 8 + 14, "Sigma 17-70mm f/2.8-4.0 DC Macro OS HSM")); - choices.insert(p_t(256 * 8 + 15, "Sigma 150-500mm f/5-6.3 APO DG OS HSM")); - choices.insert(p_t(256 * 8 + 16, "Sigma 70-200mm f/2.8 EX DG Macro HSM II")); - choices.insert(p_t(256 * 8 + 17, "Sigma 50-500mm f/4.5-6.3 DG OS HSM")); - choices.insert(p_t(256 * 8 + 18, "Sigma 8-16mm f/4.5-5.6 DC HSM")); - choices.insert(p_t(256 * 8 + 21, "Sigma 17-50mm f/2.8 EX DC OS HSM")); - choices.insert(p_t(256 * 8 + 22, "Sigma 85mm f/1.4 EX DG HSM")); - choices.insert(p_t(256 * 8 + 23, "Sigma 70-200mm f/2.8 APO EX DG OS HSM")); - choices.insert(p_t(256 * 8 + 25, "Sigma 17-50mm f/2.8 EX DC HSM")); - choices.insert(p_t(256 * 8 + 27, "Sigma 18-200mm f/3.5-6.3 II DC HSM")); - choices.insert(p_t(256 * 8 + 28, "Sigma 18-250mm f/3.5-6.3 DC Macro HSM")); - choices.insert(p_t(256 * 8 + 29, "Sigma 35mm f/1.4 DG HSM")); - choices.insert(p_t(256 * 8 + 30, "Sigma 17-70mm f/2.8-4 DC Macro HSM | C")); - choices.insert(p_t(256 * 8 + 31, "Sigma 18-35mm f/1.8 DC HSM")); - choices.insert(p_t(256 * 8 + 32, "Sigma 30mm f/1.4 DC HSM | A")); - choices.insert(p_t(256 * 8 + 34, "Sigma 18-300mm f/3.5-6.3 DC Macro HSM")); - choices.insert(p_t(256 * 8 + 59, "HD PENTAX-D FA 150-450mm f/4.5-5.6 ED DC AW")); - choices.insert(p_t(256 * 8 + 60, "HD PENTAX-D FA* 70-200mm f/2.8 ED DC AW")); - choices.insert(p_t(256 * 8 + 61, "HD PENTAX-D FA 28-105mm f/3.5-5.6 ED DC WR")); - choices.insert(p_t(256 * 8 + 62, "HD PENTAX-D FA 24-70mm f/2.8 ED SDM WR")); - choices.insert(p_t(256 * 8 + 63, "HD PENTAX-D FA 15-30mm f/2.8 ED SDM WR")); - choices.insert(p_t(256 * 8 + 197, "HD PENTAX-DA 55-300mm f/4.5-6.3 ED PLM WR RE")); - choices.insert(p_t(256 * 8 + 198, "smc PENTAX-DA L 18-50mm f/4-5.6 DC WR RE")); - choices.insert(p_t(256 * 8 + 199, "HD PENTAX-DA 18-50mm f/4-5.6 DC WR RE")); - choices.insert(p_t(256 * 8 + 200, "HD PENTAX-DA 16-85mm f/3.5-5.6 ED DC WR")); - choices.insert(p_t(256 * 8 + 209, "HD PENTAX-DA 20-40mm f/2.8-4 ED Limited DC WR")); - choices.insert(p_t(256 * 8 + 210, "smc PENTAX-DA 18-270mm f/3.5-6.3 ED SDM")); - choices.insert(p_t(256 * 8 + 211, "HD PENTAX-DA 560mm f/5.6 ED AW")); - choices.insert(p_t(256 * 8 + 215, "smc PENTAX-DA 18-135mm f/3.5-5.6 ED AL [IF] DC WR")); - choices.insert(p_t(256 * 8 + 226, "smc PENTAX-DA* 55mm f/1.4 SDM")); - choices.insert(p_t(256 * 8 + 227, "smc PENTAX-DA* 60-250mm f/4 [IF] SDM")); - choices.insert(p_t(256 * 8 + 232, "smc PENTAX-DA 17-70mm f/4 AL [IF] SDM")); - choices.insert(p_t(256 * 8 + 234, "smc PENTAX-DA* 300mm f/4 ED [IF] SDM")); - choices.insert(p_t(256 * 8 + 235, "smc PENTAX-DA* 200mm f/2.8 ED [IF] SDM")); - choices.insert(p_t(256 * 8 + 241, "smc PENTAX-DA* 50-135mm f/2.8 ED [IF] SDM")); - choices.insert(p_t(256 * 8 + 242, "smc PENTAX-DA* 16-50mm f/2.8 ED AL [IF] SDM")); - choices.insert(p_t(256 * 8 + 255, "Sigma Lens (8 255)")); - choices.insert(p_t(256 * 8 + 255, "Sigma 70-200mm f/2.8 EX DG Macro HSM II")); - choices.insert(p_t(256 * 8 + 255, "Sigma 150-500mm f/5-6.3 DG APO [OS] HSM")); - choices.insert(p_t(256 * 8 + 255, "Sigma 50-150mm f/2.8 II APO EX DC HSM")); - choices.insert(p_t(256 * 8 + 255, "Sigma 4.5mm f/2.8 EX DC HSM Circular Fisheye")); - choices.insert(p_t(256 * 8 + 255, "Sigma 50-200mm f/4-5.6 DC OS")); - choices.insert(p_t(256 * 8 + 255, "Sigma 24-70mm f/2.8 EX DG HSM")); - choices.insert(p_t(256 * 9 + 0, "645 Manual Lens")); - choices.insert(p_t(256 * 10 + 0, "645 A Series Lens")); - choices.insert(p_t(256 * 11 + 1, "smc PENTAX-FA 645 75mm f/2.8")); - choices.insert(p_t(256 * 11 + 2, "smc PENTAX-FA 645 45mm f/2.8")); - choices.insert(p_t(256 * 11 + 3, "smc PENTAX-FA* 645 300mm f/4 ED [IF]")); - choices.insert(p_t(256 * 11 + 4, "smc PENTAX-FA 645 45-85mm f/4.5")); - choices.insert(p_t(256 * 11 + 5, "smc PENTAX-FA 645 400mm f/5.6 ED [IF]")); - choices.insert(p_t(256 * 11 + 7, "smc PENTAX-FA 645 Macro 120mm f/4")); - choices.insert(p_t(256 * 11 + 8, "smc PENTAX-FA 645 80-160mm f/4.5")); - choices.insert(p_t(256 * 11 + 9, "smc PENTAX-FA 645 200mm f/4 [IF]")); - choices.insert(p_t(256 * 11 + 10, "smc PENTAX-FA 645 150mm f/2.8 [IF]")); - choices.insert(p_t(256 * 11 + 11, "smc PENTAX-FA 645 35mm f/3.5 AL [IF]")); - choices.insert(p_t(256 * 11 + 12, "smc PENTAX-FA 645 300mm f/5.6 ED [IF]")); - choices.insert(p_t(256 * 11 + 14, "smc PENTAX-FA 645 55-110mm f/5.6")); - choices.insert(p_t(256 * 11 + 16, "smc PENTAX-FA 645 33-55mm f/4.5 AL")); - choices.insert(p_t(256 * 11 + 17, "smc PENTAX-FA 645 150-300mm f/5.6 ED [IF]")); - choices.insert(p_t(256 * 11 + 21, "HD PENTAX-D FA 645 35mm f/3.5 AL [IF]")); - choices.insert(p_t(256 * 13 + 18, "smc PENTAX-D FA 645 55mm f/2.8 AL [IF] SDM AW")); - choices.insert(p_t(256 * 13 + 19, "smc PENTAX-D FA 645 25mm f/4 AL [IF] SDM AW")); - choices.insert(p_t(256 * 13 + 20, "HD PENTAX-D FA 645 90mm f/2.8 ED AW SR")); - choices.insert(p_t(256 * 13 + 253, "HD PENTAX-DA 645 28-45mm f/4.5 ED AW SR")); - choices.insert(p_t(256 * 21 + 0, "Pentax Q Manual Lens")); - choices.insert(p_t(256 * 21 + 1, "01 Standard Prime 8.5mm f/1.9")); - choices.insert(p_t(256 * 21 + 2, "02 Standard Zoom 5-15mm f/2.8-4.5")); - choices.insert(p_t(256 * 21 + 6, "06 Telephoto Zoom 15-45mm f/2.8")); - choices.insert(p_t(256 * 21 + 7, "07 Mount Shield 11.5mm f/9")); - choices.insert(p_t(256 * 21 + 8, "08 Wide Zoom 3.8-5.9mm f/3.7-4")); - choices.insert(p_t(256 * 21 + 233, "Adapter Q for K-mount Lens")); - choices.insert(p_t(256 * 22 + 3, "03 Fish-eye 3.2mm f/5.6")); - choices.insert(p_t(256 * 22 + 4, "04 Toy Lens Wide 6.3mm f/7.1")); - choices.insert(p_t(256 * 22 + 5, "05 Toy Lens Telephoto 18mm f/8")); + choices.insert (p_t (256 * 0 + 0, "M-42 or No Lens")); + choices.insert (p_t (256 * 1 + 0, "K or M Lens")); + choices.insert (p_t (256 * 2 + 0, "A Series Lens")); + choices.insert (p_t (256 * 3 + 0, "Sigma")); + choices.insert (p_t (256 * 3 + 17, "smc PENTAX-FA SOFT 85mm f/2.8")); + choices.insert (p_t (256 * 3 + 18, "smc PENTAX-F 1.7X AF ADAPTER")); + choices.insert (p_t (256 * 3 + 19, "smc PENTAX-F 24-50mm f/4")); + choices.insert (p_t (256 * 3 + 20, "smc PENTAX-F 35-80mm f/4-5.6")); + choices.insert (p_t (256 * 3 + 21, "smc PENTAX-F 80-200mm f/4.7-5.6")); + choices.insert (p_t (256 * 3 + 22, "smc PENTAX-F FISH-EYE 17-28mm f/3.5-4.5")); + choices.insert (p_t (256 * 3 + 23, "smc PENTAX-F 100-300mm f/4.5-5.6 or Sigma Lens")); + choices.insert (p_t (256 * 3 + 23, "Sigma AF 28-300mm f/3.5-5.6 DL IF")); + choices.insert (p_t (256 * 3 + 23, "Sigma AF 28-300mm f/3.5-6.3 DG IF Macro")); + choices.insert (p_t (256 * 3 + 23, "Tokina 80-200mm f/2.8 ATX-Pro")); + choices.insert (p_t (256 * 3 + 24, "smc PENTAX-F 35-135mm f/3.5-4.5")); + choices.insert (p_t (256 * 3 + 25, "smc PENTAX-F 35-105mm f/4-5.6 or Sigma or Tokina Lens")); + choices.insert (p_t (256 * 3 + 25, "Sigma 55-200mm f/4-5.6 DC")); + choices.insert (p_t (256 * 3 + 25, "Sigma AF 28-300mm f/3.5-5.6 DL IF")); + choices.insert (p_t (256 * 3 + 25, "Sigma AF 28-300mm f/3.5-6.3 DL IF")); + choices.insert (p_t (256 * 3 + 25, "Sigma AF 28-300mm f/3.5-6.3 DG IF Macro")); + choices.insert (p_t (256 * 3 + 25, "Tokina 80-200mm f/2.8 ATX-Pro")); + choices.insert (p_t (256 * 3 + 26, "smc PENTAX-F* 250-600mm f/5.6 ED[IF]")); + choices.insert (p_t (256 * 3 + 27, "smc PENTAX-F 28-80mm f/3.5-4.5 or Tokina Lens")); + choices.insert (p_t (256 * 3 + 27, "Tokina AT-X Pro AF 28-70mm f/2.6-2.8")); + choices.insert (p_t (256 * 3 + 28, "smc PENTAX-F 35-70mm f/3.5-4.5 or Tokina Lens")); + choices.insert (p_t (256 * 3 + 28, "Tokina 19-35mm f/3.5-4.5 AF")); + choices.insert (p_t (256 * 3 + 28, "Tokina AT-X AF 400mm f/5.6")); + choices.insert (p_t (256 * 3 + 29, "PENTAX-F 28-80mm f/3.5-4.5 or Sigma or Tokina Lens")); + choices.insert (p_t (256 * 3 + 29, "Sigma AF 18-125mm f/3.5-5.6 DC")); + choices.insert (p_t (256 * 3 + 29, "Tokina AT-X PRO 28-70mm f/2.6-2.8")); + choices.insert (p_t (256 * 3 + 30, "PENTAX-F 70-200mm f/4-5.6")); + choices.insert (p_t (256 * 3 + 31, "smc PENTAX-F 70-210mm f/4-5.6 or Tokina or Takumar Lens")); + choices.insert (p_t (256 * 3 + 31, "Tokina AF 730 75-300mm f/4.5-5.6")); + choices.insert (p_t (256 * 3 + 31, "Takumar-F 70-210mm f/4-5.6")); + choices.insert (p_t (256 * 3 + 32, "smc PENTAX-F 50mm f/1.4")); + choices.insert (p_t (256 * 3 + 33, "smc PENTAX-F 50mm f/1.7")); + choices.insert (p_t (256 * 3 + 34, "smc PENTAX-F 135mm f/2.8 [IF]")); + choices.insert (p_t (256 * 3 + 35, "smc PENTAX-F 28mm f/2.8")); + choices.insert (p_t (256 * 3 + 36, "Sigma 20mm f/1.8 EX DG Aspherical RF")); + choices.insert (p_t (256 * 3 + 38, "smc PENTAX-F* 300mm f/4.5 ED[IF]")); + choices.insert (p_t (256 * 3 + 39, "smc PENTAX-F* 600mm f/4 ED[IF]")); + choices.insert (p_t (256 * 3 + 40, "smc PENTAX-F Macro 100mm f/2.8")); + choices.insert (p_t (256 * 3 + 41, "smc PENTAX-F Macro 50mm f/2.8 or Sigma Lens")); + choices.insert (p_t (256 * 3 + 41, "Sigma 50mm f/2.8 Macro")); + choices.insert (p_t (256 * 3 + 42, "Sigma 300mm f/2.8 EX DG APO IF")); + choices.insert (p_t (256 * 3 + 44, "Sigma or Tamron Lens (3 44)")); + choices.insert (p_t (256 * 3 + 44, "Sigma AF 10-20mm f/4-5.6 EX DC")); + choices.insert (p_t (256 * 3 + 44, "Sigma 12-24mm f/4.5-5.6 EX DG")); + choices.insert (p_t (256 * 3 + 44, "Sigma 17-70mm f/2.8-4.5 DC Macro")); + choices.insert (p_t (256 * 3 + 44, "Sigma 18-50mm f/3.5-5.6 DC")); + choices.insert (p_t (256 * 3 + 44, "Sigma 17-35mm f/2.8-4 EX DG")); + choices.insert (p_t (256 * 3 + 44, "Tamron 35-90mm f/4 AF")); + choices.insert (p_t (256 * 3 + 44, "Sigma AF 18-35mm f/3.5-4.5 Aspherical")); + choices.insert (p_t (256 * 3 + 46, "Sigma or Samsung Lens (3 46)")); + choices.insert (p_t (256 * 3 + 46, "Sigma APO 70-200mm f/2.8 EX")); + choices.insert (p_t (256 * 3 + 46, "Sigma EX APO 100-300mm f/4 IF")); + choices.insert (p_t (256 * 3 + 46, "Samsung/Schneider D-XENON 50-200mm f/4-5.6 ED")); + choices.insert (p_t (256 * 3 + 50, "smc PENTAX-FA 28-70mm f/4 AL")); + choices.insert (p_t (256 * 3 + 51, "Sigma 28mm f/1.8 EX DG Aspherical Macro")); + choices.insert (p_t (256 * 3 + 52, "smc PENTAX-FA 28-200mm f/3.8-5.6 AL[IF] or Tamron Lens")); + choices.insert (p_t (256 * 3 + 52, "Tamron AF LD 28-200mm f/3.8-5.6 [IF] Aspherical (171D)")); + choices.insert (p_t (256 * 3 + 53, "smc PENTAX-FA 28-80mm f/3.5-5.6 AL")); + choices.insert (p_t (256 * 3 + 247, "smc PENTAX-DA FISH-EYE 10-17mm f/3.5-4.5 ED[IF]")); + choices.insert (p_t (256 * 3 + 248, "smc PENTAX-DA 12-24mm f/4 ED AL[IF]")); + choices.insert (p_t (256 * 3 + 250, "smc PENTAX-DA 50-200mm f/4-5.6 ED")); + choices.insert (p_t (256 * 3 + 251, "smc PENTAX-DA 40mm f/2.8 Limited")); + choices.insert (p_t (256 * 3 + 252, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL")); + choices.insert (p_t (256 * 3 + 253, "smc PENTAX-DA 14mm f/2.8 ED[IF]")); + choices.insert (p_t (256 * 3 + 254, "smc PENTAX-DA 16-45mm f/4 ED AL")); + choices.insert (p_t (256 * 3 + 255, "Sigma Lens (3 255)")); + choices.insert (p_t (256 * 3 + 255, "Sigma 18-200mm f/3.5-6.3 DC")); + choices.insert (p_t (256 * 3 + 255, "Sigma DL-II 35-80mm f/4-5.6")); + choices.insert (p_t (256 * 3 + 255, "Sigma DL Zoom 75-300mm f/4-5.6")); + choices.insert (p_t (256 * 3 + 255, "Sigma DF EX Aspherical 28-70mm f/2.8")); + choices.insert (p_t (256 * 3 + 255, "Sigma AF Tele 400mm f/5.6 Multi-coated")); + choices.insert (p_t (256 * 3 + 255, "Sigma 24-60mm f/2.8 EX DG")); + choices.insert (p_t (256 * 3 + 255, "Sigma 70-300mm f/4-5.6 Macro")); + choices.insert (p_t (256 * 3 + 255, "Sigma 55-200mm f/4-5.6 DC")); + choices.insert (p_t (256 * 3 + 255, "Sigma 18-50mm f/2.8 EX DC")); + choices.insert (p_t (256 * 4 + 1, "smc PENTAX-FA SOFT 28mm f/2.8")); + choices.insert (p_t (256 * 4 + 2, "smc PENTAX-FA 80-320mm f/4.5-5.6")); + choices.insert (p_t (256 * 4 + 3, "smc PENTAX-FA 43mm f/1.9 Limited")); + choices.insert (p_t (256 * 4 + 6, "smc PENTAX-FA 35-80mm f/4-5.6")); + choices.insert (p_t (256 * 4 + 10, "Irix 15mm f/2.4")); + choices.insert (p_t (256 * 4 + 12, "smc PENTAX-FA 50mm f/1.4")); + choices.insert (p_t (256 * 4 + 15, "smc PENTAX-FA 28-105mm f/4-5.6 [IF]")); + choices.insert (p_t (256 * 4 + 16, "Tamron AF 80-210mm f/4-5.6 (178D)")); + choices.insert (p_t (256 * 4 + 19, "Tamron SP AF 90mm f/2.8 (172E)")); + choices.insert (p_t (256 * 4 + 20, "smc PENTAX-FA 28-80mm f/3.5-5.6")); + choices.insert (p_t (256 * 4 + 21, "Cosina AF 100-300mm f/5.6-6.7")); + choices.insert (p_t (256 * 4 + 22, "Tokina 28-80mm f/3.5-5.6")); + choices.insert (p_t (256 * 4 + 23, "smc PENTAX-FA 20-35mm f/4 AL")); + choices.insert (p_t (256 * 4 + 24, "smc PENTAX-FA 77mm f/1.8 Limited")); + choices.insert (p_t (256 * 4 + 25, "Tamron SP AF 14mm f/2.8")); + choices.insert (p_t (256 * 4 + 26, "smc PENTAX-FA Macro 100mm f/3.5 or Cosina Lens")); + choices.insert (p_t (256 * 4 + 26, "Cosina 100mm f/3.5 Macro")); + choices.insert (p_t (256 * 4 + 27, "Tamron AF 28-300mm f/3.5-6.3 LD Aspherical[IF] Macro (185D/285D)")); + choices.insert (p_t (256 * 4 + 28, "smc PENTAX-FA 35mm f/2 AL")); + choices.insert (p_t (256 * 4 + 29, "Tamron AF 28-200mm f/3.8-5.6 LD Super II Macro (371D)")); + choices.insert (p_t (256 * 4 + 34, "smc PENTAX-FA 24-90mm f/3.5-4.5 AL[IF]")); + choices.insert (p_t (256 * 4 + 35, "smc PENTAX-FA 100-300mm f/4.7-5.8")); + choices.insert (p_t (256 * 4 + 36, "Tamron AF 70-300mm f/4-5.6 LD Macro 1:2")); + choices.insert (p_t (256 * 4 + 37, "Tamron SP AF 24-135mm f/3.5-5.6 AD AL (190D)")); + choices.insert (p_t (256 * 4 + 38, "smc PENTAX-FA 28-105mm f/3.2-4.5 AL[IF]")); + choices.insert (p_t (256 * 4 + 39, "smc PENTAX-FA 31mm f/1.8 AL Limited")); + choices.insert (p_t (256 * 4 + 41, "Tamron AF 28-200mm Super Zoom f/3.8-5.6 Aspherical XR [IF] Macro (A03)")); + choices.insert (p_t (256 * 4 + 43, "smc PENTAX-FA 28-90mm f/3.5-5.6")); + choices.insert (p_t (256 * 4 + 44, "smc PENTAX-FA J 75-300mm f/4.5-5.8 AL")); + choices.insert (p_t (256 * 4 + 45, "Tamron Lens (4 45)")); + choices.insert (p_t (256 * 4 + 45, "Tamron 28-300mm f/3.5-6.3 Ultra zoom XR")); + choices.insert (p_t (256 * 4 + 45, "Tamron AF 28-300mm f/3.5-6.3 XR Di LD Aspherical [IF] Macro")); + choices.insert (p_t (256 * 4 + 46, "smc PENTAX-FA J 28-80mm f/3.5-5.6 AL")); + choices.insert (p_t (256 * 4 + 47, "smc PENTAX-FA J 18-35mm f/4-5.6 AL")); + choices.insert (p_t (256 * 4 + 49, "Tamron SP AF 28-75mm f/2.8 XR Di LD Aspherical [IF] Macro")); + choices.insert (p_t (256 * 4 + 51, "smc PENTAX-D FA 50mm f/2.8 Macro")); + choices.insert (p_t (256 * 4 + 52, "smc PENTAX-D FA 100mm f/2.8 Macro")); + choices.insert (p_t (256 * 4 + 55, "Samsung/Schneider D-XENOGON 35mm f/2")); + choices.insert (p_t (256 * 4 + 56, "Samsung/Schneider D-XENON 100mm f/2.8 Macro")); + choices.insert (p_t (256 * 4 + 75, "Tamron SP AF 70-200mm f/2.8 Di LD [IF] Macro (A001)")); + choices.insert (p_t (256 * 4 + 214, "smc PENTAX-DA 35mm f/2.4 AL")); + choices.insert (p_t (256 * 4 + 229, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL II")); + choices.insert (p_t (256 * 4 + 230, "Tamron SP AF 17-50mm f/2.8 XR Di II")); + choices.insert (p_t (256 * 4 + 231, "smc PENTAX-DA 18-250mm f/3.5-6.3 ED AL [IF]")); + choices.insert (p_t (256 * 4 + 237, "Samsung/Schneider D-XENOGON 10-17mm f/3.5-4.5")); + choices.insert (p_t (256 * 4 + 239, "Samsung/Schneider D-XENON 12-24mm f/4 ED AL [IF]")); + choices.insert (p_t (256 * 4 + 242, "smc PENTAX-DA* 16-50mm f/2.8 ED AL [IF] SDM (SDM unused)")); + choices.insert (p_t (256 * 4 + 243, "smc PENTAX-DA 70mm f/2.4 Limited")); + choices.insert (p_t (256 * 4 + 244, "smc PENTAX-DA 21mm f/3.2 AL Limited")); + choices.insert (p_t (256 * 4 + 245, "Samsung/Schneider D-XENON 50-200mm f/4-5.6")); + choices.insert (p_t (256 * 4 + 246, "Samsung/Schneider D-XENON 18-55mm f/3.5-5.6")); + choices.insert (p_t (256 * 4 + 247, "smc PENTAX-DA FISH-EYE 10-17mm f/3.5-4.5 ED[IF]")); + choices.insert (p_t (256 * 4 + 248, "smc PENTAX-DA 12-24mm f/4 ED AL [IF]")); + choices.insert (p_t (256 * 4 + 249, "Tamron XR DiII 18-200mm f/3.5-6.3 (A14)")); + choices.insert (p_t (256 * 4 + 250, "smc PENTAX-DA 50-200mm f/4-5.6 ED")); + choices.insert (p_t (256 * 4 + 251, "smc PENTAX-DA 40mm f/2.8 Limited")); + choices.insert (p_t (256 * 4 + 252, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL")); + choices.insert (p_t (256 * 4 + 253, "smc PENTAX-DA 14mm f/2.8 ED[IF]")); + choices.insert (p_t (256 * 4 + 254, "smc PENTAX-DA 16-45mm f/4 ED AL")); + choices.insert (p_t (256 * 5 + 1, "smc PENTAX-FA* 24mm f/2 AL[IF]")); + choices.insert (p_t (256 * 5 + 2, "smc PENTAX-FA 28mm f/2.8 AL")); + choices.insert (p_t (256 * 5 + 3, "smc PENTAX-FA 50mm f/1.7")); + choices.insert (p_t (256 * 5 + 4, "smc PENTAX-FA 50mm f/1.4")); + choices.insert (p_t (256 * 5 + 5, "smc PENTAX-FA* 600mm f/4 ED[IF]")); + choices.insert (p_t (256 * 5 + 6, "smc PENTAX-FA* 300mm f/4.5 ED[IF]")); + choices.insert (p_t (256 * 5 + 7, "smc PENTAX-FA 135mm f/2.8 [IF]")); + choices.insert (p_t (256 * 5 + 8, "smc PENTAX-FA Macro 50mm f/2.8")); + choices.insert (p_t (256 * 5 + 9, "smc PENTAX-FA Macro 100mm f/2.8")); + choices.insert (p_t (256 * 5 + 10, "smc PENTAX-FA* 85mm f/1.4 [IF]")); + choices.insert (p_t (256 * 5 + 11, "smc PENTAX-FA* 200mm f/2.8 ED[IF]")); + choices.insert (p_t (256 * 5 + 12, "smc PENTAX-FA 28-80mm f/3.5-4.7")); + choices.insert (p_t (256 * 5 + 13, "smc PENTAX-FA 70-200mm f/4-5.6")); + choices.insert (p_t (256 * 5 + 14, "smc PENTAX-FA* 250-600mm f/5.6 ED[IF]")); + choices.insert (p_t (256 * 5 + 15, "smc PENTAX-FA 28-105mm f/4-5.6")); + choices.insert (p_t (256 * 5 + 16, "smc PENTAX-FA 100-300mm f/4.5-5.6")); + choices.insert (p_t (256 * 5 + 98, "smc PENTAX-FA 100-300mm f/4.5-5.6")); + choices.insert (p_t (256 * 6 + 1, "smc PENTAX-FA* 85mm f/1.4 [IF]")); + choices.insert (p_t (256 * 6 + 2, "smc PENTAX-FA* 200mm f/2.8 ED[IF]")); + choices.insert (p_t (256 * 6 + 3, "smc PENTAX-FA* 300mm f/2.8 ED[IF]")); + choices.insert (p_t (256 * 6 + 4, "smc PENTAX-FA* 28-70mm f/2.8 AL")); + choices.insert (p_t (256 * 6 + 5, "smc PENTAX-FA* 80-200mm f/2.8 ED[IF]")); + choices.insert (p_t (256 * 6 + 6, "smc PENTAX-FA* 28-70mm f/2.8 AL")); + choices.insert (p_t (256 * 6 + 7, "smc PENTAX-FA* 80-200mm f/2.8 ED[IF]")); + choices.insert (p_t (256 * 6 + 8, "smc PENTAX-FA 28-70mm f/4AL")); + choices.insert (p_t (256 * 6 + 9, "smc PENTAX-FA 20mm f/2.8")); + choices.insert (p_t (256 * 6 + 10, "smc PENTAX-FA* 400mm f/5.6 ED[IF]")); + choices.insert (p_t (256 * 6 + 13, "smc PENTAX-FA* 400mm f/5.6 ED[IF]")); + choices.insert (p_t (256 * 6 + 14, "smc PENTAX-FA* Macro 200mm f/4 ED[IF]")); + choices.insert (p_t (256 * 7 + 0, "smc PENTAX-DA 21mm f/3.2 AL Limited")); + choices.insert (p_t (256 * 7 + 58, "smc PENTAX-D FA Macro 100mm f/2.8 WR")); + choices.insert (p_t (256 * 7 + 75, "Tamron SP AF 70-200mm f/2.8 Di LD [IF] Macro (A001)")); + choices.insert (p_t (256 * 7 + 201, "smc Pentax-DA L 50-200mm f/4-5.6 ED WR")); + choices.insert (p_t (256 * 7 + 202, "smc PENTAX-DA L 18-55mm f/3.5-5.6 AL WR")); + choices.insert (p_t (256 * 7 + 203, "HD PENTAX-DA 55-300mm f/4-5.8 ED WR")); + choices.insert (p_t (256 * 7 + 204, "HD PENTAX-DA 15mm f/4 ED AL Limited")); + choices.insert (p_t (256 * 7 + 205, "HD PENTAX-DA 35mm f/2.8 Macro Limited")); + choices.insert (p_t (256 * 7 + 206, "HD PENTAX-DA 70mm f/2.4 Limited")); + choices.insert (p_t (256 * 7 + 207, "HD PENTAX-DA 21mm f/3.2 ED AL Limited")); + choices.insert (p_t (256 * 7 + 208, "HD PENTAX-DA 40mm f/2.8 Limited")); + choices.insert (p_t (256 * 7 + 212, "smc PENTAX-DA 50mm f/1.8")); + choices.insert (p_t (256 * 7 + 213, "smc PENTAX-DA 40mm f/2.8 XS")); + choices.insert (p_t (256 * 7 + 214, "smc PENTAX-DA 35mm f/2.4 AL")); + choices.insert (p_t (256 * 7 + 216, "smc PENTAX-DA L 55-300mm f/4-5.8 ED")); + choices.insert (p_t (256 * 7 + 217, "smc PENTAX-DA 50-200mm f/4-5.6 ED WR")); + choices.insert (p_t (256 * 7 + 218, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL WR")); + choices.insert (p_t (256 * 7 + 220, "Tamron SP AF 10-24mm f/3.5-4.5 Di II LD Aspherical [IF]")); + choices.insert (p_t (256 * 7 + 221, "smc PENTAX-DA L 50-200mm f/4-5.6 ED")); + choices.insert (p_t (256 * 7 + 222, "smc PENTAX-DA L 18-55mm f/3.5-5.6")); + choices.insert (p_t (256 * 7 + 223, "Samsung/Schneider D-XENON 18-55mm f/3.5-5.6 II")); + choices.insert (p_t (256 * 7 + 224, "smc PENTAX-DA 15mm f/4 ED AL Limited")); + choices.insert (p_t (256 * 7 + 225, "Samsung/Schneider D-XENON 18-250mm f/3.5-6.3")); + choices.insert (p_t (256 * 7 + 226, "smc PENTAX-DA* 55mm f/1.4 SDM (SDM unused)")); + choices.insert (p_t (256 * 7 + 227, "smc PENTAX-DA* 60-250mm f/4 [IF] SDM (SDM unused)")); + choices.insert (p_t (256 * 7 + 228, "Samsung 16-45mm f/4 ED")); + choices.insert (p_t (256 * 7 + 229, "smc PENTAX-DA 18-55mm f/3.5-5.6 AL II")); + choices.insert (p_t (256 * 7 + 230, "Tamron AF 17-50mm f/2.8 XR Di-II LD (Model A16)")); + choices.insert (p_t (256 * 7 + 231, "smc PENTAX-DA 18-250mm f/3.5-6.3 ED AL [IF]")); + choices.insert (p_t (256 * 7 + 233, "smc PENTAX-DA 35mm f/2.8 Macro Limited")); + choices.insert (p_t (256 * 7 + 234, "smc PENTAX-DA* 300mm f/4 ED [IF] SDM (SDM unused)")); + choices.insert (p_t (256 * 7 + 235, "smc PENTAX-DA* 200mm f/2.8 ED [IF] SDM (SDM unused)")); + choices.insert (p_t (256 * 7 + 236, "smc PENTAX-DA 55-300mm f/4-5.8 ED")); + choices.insert (p_t (256 * 7 + 238, "Tamron AF 18-250mm f/3.5-6.3 Di II LD Aspherical [IF] Macro")); + choices.insert (p_t (256 * 7 + 241, "smc PENTAX-DA* 50-135mm f/2.8 ED [IF] SDM (SDM unused)")); + choices.insert (p_t (256 * 7 + 242, "smc PENTAX-DA* 16-50mm f/2.8 ED AL [IF] SDM (SDM unused)")); + choices.insert (p_t (256 * 7 + 243, "smc PENTAX-DA 70mm f/2.4 Limited")); + choices.insert (p_t (256 * 7 + 244, "smc PENTAX-DA 21mm f/3.2 AL Limited")); + choices.insert (p_t (256 * 8 + 0, "Sigma 50-150mm f/2.8 II APO EX DC HSM")); + choices.insert (p_t (256 * 8 + 3, "Sigma AF 18-125mm f/3.5-5.6 DC")); + choices.insert (p_t (256 * 8 + 4, "Sigma 50mm f/1.4 EX DG HSM")); + choices.insert (p_t (256 * 8 + 7, "Sigma 24-70mm f/2.8 IF EX DG HSM")); + choices.insert (p_t (256 * 8 + 8, "Sigma 18-250mm f/3.5-6.3 DC OS HSM")); + choices.insert (p_t (256 * 8 + 11, "Sigma 10-20mm f/3.5 EX DC HSM")); + choices.insert (p_t (256 * 8 + 12, "Sigma 70-300mm f/4-5.6 DG OS")); + choices.insert (p_t (256 * 8 + 13, "Sigma 120-400mm f/4.5-5.6 APO DG OS HSM")); + choices.insert (p_t (256 * 8 + 14, "Sigma 17-70mm f/2.8-4.0 DC Macro OS HSM")); + choices.insert (p_t (256 * 8 + 15, "Sigma 150-500mm f/5-6.3 APO DG OS HSM")); + choices.insert (p_t (256 * 8 + 16, "Sigma 70-200mm f/2.8 EX DG Macro HSM II")); + choices.insert (p_t (256 * 8 + 17, "Sigma 50-500mm f/4.5-6.3 DG OS HSM")); + choices.insert (p_t (256 * 8 + 18, "Sigma 8-16mm f/4.5-5.6 DC HSM")); + choices.insert (p_t (256 * 8 + 21, "Sigma 17-50mm f/2.8 EX DC OS HSM")); + choices.insert (p_t (256 * 8 + 22, "Sigma 85mm f/1.4 EX DG HSM")); + choices.insert (p_t (256 * 8 + 23, "Sigma 70-200mm f/2.8 APO EX DG OS HSM")); + choices.insert (p_t (256 * 8 + 25, "Sigma 17-50mm f/2.8 EX DC HSM")); + choices.insert (p_t (256 * 8 + 27, "Sigma 18-200mm f/3.5-6.3 II DC HSM")); + choices.insert (p_t (256 * 8 + 28, "Sigma 18-250mm f/3.5-6.3 DC Macro HSM")); + choices.insert (p_t (256 * 8 + 29, "Sigma 35mm f/1.4 DG HSM")); + choices.insert (p_t (256 * 8 + 30, "Sigma 17-70mm f/2.8-4 DC Macro HSM | C")); + choices.insert (p_t (256 * 8 + 31, "Sigma 18-35mm f/1.8 DC HSM")); + choices.insert (p_t (256 * 8 + 32, "Sigma 30mm f/1.4 DC HSM | A")); + choices.insert (p_t (256 * 8 + 34, "Sigma 18-300mm f/3.5-6.3 DC Macro HSM")); + choices.insert (p_t (256 * 8 + 59, "HD PENTAX-D FA 150-450mm f/4.5-5.6 ED DC AW")); + choices.insert (p_t (256 * 8 + 60, "HD PENTAX-D FA* 70-200mm f/2.8 ED DC AW")); + choices.insert (p_t (256 * 8 + 61, "HD PENTAX-D FA 28-105mm f/3.5-5.6 ED DC WR")); + choices.insert (p_t (256 * 8 + 62, "HD PENTAX-D FA 24-70mm f/2.8 ED SDM WR")); + choices.insert (p_t (256 * 8 + 63, "HD PENTAX-D FA 15-30mm f/2.8 ED SDM WR")); + choices.insert (p_t (256 * 8 + 197, "HD PENTAX-DA 55-300mm f/4.5-6.3 ED PLM WR RE")); + choices.insert (p_t (256 * 8 + 198, "smc PENTAX-DA L 18-50mm f/4-5.6 DC WR RE")); + choices.insert (p_t (256 * 8 + 199, "HD PENTAX-DA 18-50mm f/4-5.6 DC WR RE")); + choices.insert (p_t (256 * 8 + 200, "HD PENTAX-DA 16-85mm f/3.5-5.6 ED DC WR")); + choices.insert (p_t (256 * 8 + 209, "HD PENTAX-DA 20-40mm f/2.8-4 ED Limited DC WR")); + choices.insert (p_t (256 * 8 + 210, "smc PENTAX-DA 18-270mm f/3.5-6.3 ED SDM")); + choices.insert (p_t (256 * 8 + 211, "HD PENTAX-DA 560mm f/5.6 ED AW")); + choices.insert (p_t (256 * 8 + 215, "smc PENTAX-DA 18-135mm f/3.5-5.6 ED AL [IF] DC WR")); + choices.insert (p_t (256 * 8 + 226, "smc PENTAX-DA* 55mm f/1.4 SDM")); + choices.insert (p_t (256 * 8 + 227, "smc PENTAX-DA* 60-250mm f/4 [IF] SDM")); + choices.insert (p_t (256 * 8 + 232, "smc PENTAX-DA 17-70mm f/4 AL [IF] SDM")); + choices.insert (p_t (256 * 8 + 234, "smc PENTAX-DA* 300mm f/4 ED [IF] SDM")); + choices.insert (p_t (256 * 8 + 235, "smc PENTAX-DA* 200mm f/2.8 ED [IF] SDM")); + choices.insert (p_t (256 * 8 + 241, "smc PENTAX-DA* 50-135mm f/2.8 ED [IF] SDM")); + choices.insert (p_t (256 * 8 + 242, "smc PENTAX-DA* 16-50mm f/2.8 ED AL [IF] SDM")); + choices.insert (p_t (256 * 8 + 255, "Sigma Lens (8 255)")); + choices.insert (p_t (256 * 8 + 255, "Sigma 70-200mm f/2.8 EX DG Macro HSM II")); + choices.insert (p_t (256 * 8 + 255, "Sigma 150-500mm f/5-6.3 DG APO [OS] HSM")); + choices.insert (p_t (256 * 8 + 255, "Sigma 50-150mm f/2.8 II APO EX DC HSM")); + choices.insert (p_t (256 * 8 + 255, "Sigma 4.5mm f/2.8 EX DC HSM Circular Fisheye")); + choices.insert (p_t (256 * 8 + 255, "Sigma 50-200mm f/4-5.6 DC OS")); + choices.insert (p_t (256 * 8 + 255, "Sigma 24-70mm f/2.8 EX DG HSM")); + choices.insert (p_t (256 * 9 + 0, "645 Manual Lens")); + choices.insert (p_t (256 * 10 + 0, "645 A Series Lens")); + choices.insert (p_t (256 * 11 + 1, "smc PENTAX-FA 645 75mm f/2.8")); + choices.insert (p_t (256 * 11 + 2, "smc PENTAX-FA 645 45mm f/2.8")); + choices.insert (p_t (256 * 11 + 3, "smc PENTAX-FA* 645 300mm f/4 ED [IF]")); + choices.insert (p_t (256 * 11 + 4, "smc PENTAX-FA 645 45-85mm f/4.5")); + choices.insert (p_t (256 * 11 + 5, "smc PENTAX-FA 645 400mm f/5.6 ED [IF]")); + choices.insert (p_t (256 * 11 + 7, "smc PENTAX-FA 645 Macro 120mm f/4")); + choices.insert (p_t (256 * 11 + 8, "smc PENTAX-FA 645 80-160mm f/4.5")); + choices.insert (p_t (256 * 11 + 9, "smc PENTAX-FA 645 200mm f/4 [IF]")); + choices.insert (p_t (256 * 11 + 10, "smc PENTAX-FA 645 150mm f/2.8 [IF]")); + choices.insert (p_t (256 * 11 + 11, "smc PENTAX-FA 645 35mm f/3.5 AL [IF]")); + choices.insert (p_t (256 * 11 + 12, "smc PENTAX-FA 645 300mm f/5.6 ED [IF]")); + choices.insert (p_t (256 * 11 + 14, "smc PENTAX-FA 645 55-110mm f/5.6")); + choices.insert (p_t (256 * 11 + 16, "smc PENTAX-FA 645 33-55mm f/4.5 AL")); + choices.insert (p_t (256 * 11 + 17, "smc PENTAX-FA 645 150-300mm f/5.6 ED [IF]")); + choices.insert (p_t (256 * 11 + 21, "HD PENTAX-D FA 645 35mm f/3.5 AL [IF]")); + choices.insert (p_t (256 * 13 + 18, "smc PENTAX-D FA 645 55mm f/2.8 AL [IF] SDM AW")); + choices.insert (p_t (256 * 13 + 19, "smc PENTAX-D FA 645 25mm f/4 AL [IF] SDM AW")); + choices.insert (p_t (256 * 13 + 20, "HD PENTAX-D FA 645 90mm f/2.8 ED AW SR")); + choices.insert (p_t (256 * 13 + 253, "HD PENTAX-DA 645 28-45mm f/4.5 ED AW SR")); + choices.insert (p_t (256 * 21 + 0, "Pentax Q Manual Lens")); + choices.insert (p_t (256 * 21 + 1, "01 Standard Prime 8.5mm f/1.9")); + choices.insert (p_t (256 * 21 + 2, "02 Standard Zoom 5-15mm f/2.8-4.5")); + choices.insert (p_t (256 * 21 + 6, "06 Telephoto Zoom 15-45mm f/2.8")); + choices.insert (p_t (256 * 21 + 7, "07 Mount Shield 11.5mm f/9")); + choices.insert (p_t (256 * 21 + 8, "08 Wide Zoom 3.8-5.9mm f/3.7-4")); + choices.insert (p_t (256 * 21 + 233, "Adapter Q for K-mount Lens")); + choices.insert (p_t (256 * 22 + 3, "03 Fish-eye 3.2mm f/5.6")); + choices.insert (p_t (256 * 22 + 4, "04 Toy Lens Wide 6.3mm f/7.1")); + choices.insert (p_t (256 * 22 + 5, "05 Toy Lens Telephoto 18mm f/8")); } virtual std::string toString (Tag* t) { double *liArray = nullptr; double maxApertureAtFocal = 0.; double focalLength = 0.; - int lensID = 256 * t->toInt(0, BYTE) + t->toInt(1, BYTE); + int lensID = 256 * t->toInt (0, BYTE) + t->toInt (1, BYTE); TagDirectory *root = t->getParent()->getRoot(); if (root) { Tag *t1; - t1 = root->findTag("FocalLength"); // Should get tag 0x920A (rational64u) from the standard Exif tag list + t1 = root->findTag ("FocalLength"); // Should get tag 0x920A (rational64u) from the standard Exif tag list - if( t1) { + if ( t1) { focalLength = t1->toDouble(); // Focal Length } - t1 = root->findTag("MaxAperture"); + t1 = root->findTag ("MaxAperture"); - if(t1) { + if (t1) { double maxAperture = t1->toDouble(); // MaxApertureValue at focal Length if (maxAperture != 0.) { maxApertureAtFocal = maxAperture; } else { - t1 = root->findTag("NominalMaxAperture"); + t1 = root->findTag ("NominalMaxAperture"); - if(t1) { + if (t1) { maxApertureAtFocal = t1->toDouble(); } } } - t1 = root->getTagP("LensInfo"); + t1 = root->getTagP ("LensInfo"); - if(t1) { + if (t1) { liArray = t1->toDoubleArray(); } // Focal length below 10mm are set to 0 by the camera in the standard Exif tag, so we'll look into the makernotes // This value will have decimals, which reflects more precision... or imprecision, due to the packed form of this value, who knows? if (focalLength == 0.) { - rtexif::TagDirectory* mnote = root->findTag("MakerNote")->getDirectory(); - rtexif::Tag* flt = mnote->getTagP("LensInfo/FocalLength"); + rtexif::TagDirectory* mnote = root->findTag ("MakerNote")->getDirectory(); + rtexif::Tag* flt = mnote->getTagP ("LensInfo/FocalLength"); if (flt) { focalLength = flt->toDouble (); @@ -1041,9 +1041,9 @@ public: } } - std::string retval = guess( lensID, focalLength, maxApertureAtFocal, liArray); + std::string retval = guess ( lensID, focalLength, maxApertureAtFocal, liArray); - if(liArray) { + if (liArray) { delete [] liArray; } @@ -1059,7 +1059,7 @@ public: virtual std::string toString (Tag* t) { std::ostringstream str; - int b = t->toInt(0, BYTE); + int b = t->toInt (0, BYTE); if (!b) { str << "Not stabilized"; @@ -1146,9 +1146,9 @@ public: int idx = 0; if (t->getCount() == 1) { - idx = t->toInt(0, BYTE); + idx = t->toInt (0, BYTE); } else if (t->getCount() == 2) { - idx = t->toInt(0, BYTE) << 8 | t->toInt(1, BYTE); + idx = t->toInt (0, BYTE) << 8 | t->toInt (1, BYTE); } std::map::iterator r = choices.find (idx); @@ -1170,7 +1170,7 @@ public: } virtual std::string toString (Tag* t) { - std::map::iterator r = choices.find (t->toInt(0, BYTE)); + std::map::iterator r = choices.find (t->toInt (0, BYTE)); std::ostringstream s; s << ((r != choices.end()) ? r->second : "n/a"); return s.str(); @@ -1208,7 +1208,7 @@ public: } virtual std::string toString (Tag* t) { - std::map::iterator r = choices.find (t->toInt(0, BYTE)); + std::map::iterator r = choices.find (t->toInt (0, BYTE)); std::ostringstream s; s << ((r != choices.end()) ? r->second : "n/a"); return s.str(); @@ -1239,9 +1239,9 @@ public: } virtual std::string toString (Tag* t) { - std::map::iterator r = choices.find (t->toInt(0, BYTE)); - std::map::iterator r1 = choices1.find (t->toInt(1, BYTE)); - std::map::iterator r2 = choices2.find (t->toInt(2, BYTE)); + std::map::iterator r = choices.find (t->toInt (0, BYTE)); + std::map::iterator r1 = choices1.find (t->toInt (1, BYTE)); + std::map::iterator r2 = choices2.find (t->toInt (2, BYTE)); std::ostringstream s; s << ((r != choices.end() ) ? r->second : "") << std::endl; s << ((r1 != choices1.end()) ? r1->second : "") << std::endl; @@ -1291,7 +1291,7 @@ public: return buffer; // TODO: how to get the string content!? // normal path below (copy the content of the string), but has to be bug fixed - memcpy(buffer, t->getValue(), 30); + memcpy (buffer, t->getValue(), 30); buffer[30] = 0; return buffer; } @@ -1309,7 +1309,7 @@ public: return buffer; // TODO: how to get the string content!? // normal path below (copy the content of the string), but has to be bug fixed - memcpy(buffer, t->getValue(), 20); + memcpy (buffer, t->getValue(), 20); buffer[20] = 0; return buffer; } @@ -1325,9 +1325,9 @@ public: int a; if (t->getCount() == 1) { - a = t->toInt(0, SLONG) / 256; // int32u + a = t->toInt (0, SLONG) / 256; // int32u } else { - a = t->toInt(0, SBYTE) / 6; // int8u[2] + a = t->toInt (0, SBYTE) / 6; // int8u[2] } char buffer[32]; @@ -1339,12 +1339,12 @@ public: int a; if (t->getCount() == 1) { - a = t->toInt(0, SLONG) / 256; // int32u + a = t->toInt (0, SLONG) / 256; // int32u } else { - a = t->toInt(0, SBYTE) / 6; // int8u[2] + a = t->toInt (0, SBYTE) / 6; // int8u[2] } - return double(a); + return double (a); } }; PAFlashExposureCompInterpreter paFlashExposureCompInterpreter; @@ -1355,9 +1355,9 @@ public: PAFocalLengthInterpreter() {} virtual std::string toString (Tag* t) { - double a = double(t->toInt(0, LONG)); + double a = double (t->toInt (0, LONG)); - if(a > 1.) { + if (a > 1.) { char buffer[32]; sprintf (buffer, "%.2f", a / 100. ); return buffer; @@ -1367,9 +1367,9 @@ public: } virtual double toDouble (Tag* t, int ofs) { - double a = double(t->toInt(0, LONG)); + double a = double (t->toInt (0, LONG)); - if(a > 1.) { + if (a > 1.) { return a / 100.; } else { return 0.; @@ -1384,10 +1384,10 @@ public: PALensDataFocalLengthInterpreter() {} virtual std::string toString (Tag* t) { - int a = t->toInt(0, BYTE); - float b = float(10 * int(a >> 2)) * pow(4.f, float(int(a & 0x03) - 2)); + int a = t->toInt (0, BYTE); + float b = float (10 * int (a >> 2)) * pow (4.f, float (int (a & 0x03) - 2)); - if(b > 1.f) { + if (b > 1.f) { char buffer[32]; sprintf (buffer, "%.2f", b ); return buffer; @@ -1397,10 +1397,10 @@ public: } virtual double toDouble (Tag* t, int ofs) { - int a = t->toInt(ofs, BYTE); - float b = float(10 * int(a >> 2)) * pow(4.f, float(int(a & 0x03) - 2)); + int a = t->toInt (ofs, BYTE); + float b = float (10 * int (a >> 2)) * pow (4.f, float (int (a & 0x03) - 2)); - if(b > 1.f) { + if (b > 1.f) { return b; } else { return 0.; @@ -1415,16 +1415,16 @@ public: PAISOfInterpreter() {} virtual std::string toString (Tag* t) { - int a = t->toInt(0, BYTE); + int a = t->toInt (0, BYTE); char buffer[32]; - double v = 100.*exp(double(a - 32) * log(2.) / 8.); + double v = 100.*exp (double (a - 32) * log (2.) / 8.); sprintf (buffer, "%.1f", v ); return buffer; } virtual double toDouble (Tag* t, int ofs) { - int a = t->toInt(0, BYTE); - return 100.*exp(double(a - 32) * log(2.) / 8.); + int a = t->toInt (0, BYTE); + return 100.*exp (double (a - 32) * log (2.) / 8.); } }; PAISOfInterpreter paISOfInterpreter; @@ -1435,14 +1435,14 @@ public: PAMaxApertureInterpreter() {} virtual std::string toString (Tag* t) { - int a = t->toInt(0, BYTE); + int a = t->toInt (0, BYTE); a &= 0x7F; - if(a > 1) { + if (a > 1) { char buffer[32]; - double v = pow(2.0, (a - 1) / 32.0); + double v = pow (2.0, (a - 1) / 32.0); - if( v < 0. || v > 1000. ) { + if ( v < 0. || v > 1000. ) { return "undef"; } @@ -1454,11 +1454,11 @@ public: } virtual double toDouble (Tag* t, int ofs) { - int a = t->toInt(0, BYTE); + int a = t->toInt (0, BYTE); a &= 0x7F; - if(a > 1) { - return pow(2.0, double(a - 1) / 32.0); + if (a > 1) { + return pow (2.0, double (a - 1) / 32.0); } else { return 0.; } @@ -1472,16 +1472,16 @@ public: PAAEXvInterpreter() {} virtual std::string toString (Tag* t) { - int a = t->toInt(0, BYTE); + int a = t->toInt (0, BYTE); char buffer[32]; - double v = double(a - 64) / 8.; + double v = double (a - 64) / 8.; sprintf (buffer, "%.1f", v ); return buffer; } virtual double toDouble (Tag* t, int ofs) { - int a = t->toInt(0, BYTE); - return double(a - 64) / 8.; + int a = t->toInt (0, BYTE); + return double (a - 64) / 8.; } }; PAAEXvInterpreter paAEXvInterpreter; @@ -1492,16 +1492,16 @@ public: PAAEBXvInterpreter() {} virtual std::string toString (Tag* t) { - int a = t->toInt(0, SBYTE); + int a = t->toInt (0, SBYTE); char buffer[32]; - double v = double(a) / 8.; + double v = double (a) / 8.; sprintf (buffer, "%.1f", v ); return buffer; } virtual double toDouble (Tag* t, int ofs) { - int a = t->toInt(0, SBYTE); - return double(a) / 8.; + int a = t->toInt (0, SBYTE); + return double (a) / 8.; } }; PAAEBXvInterpreter paAEBXvInterpreter; @@ -1512,16 +1512,16 @@ public: PAApertureInterpreter() {} virtual std::string toString (Tag* t) { - int a = t->toInt(0, BYTE); + int a = t->toInt (0, BYTE); char buffer[32]; - double v = exp((double(a) - 68.) * log(2.) / 16.); + double v = exp ((double (a) - 68.) * log (2.) / 16.); sprintf (buffer, "%.1f", v ); return buffer; } virtual double toDouble (Tag* t, int ofs) { - int a = t->toInt(0, BYTE); - return exp((double(a) - 68.) * log(2.) / 16.); + int a = t->toInt (0, BYTE); + return exp ((double (a) - 68.) * log (2.) / 16.); } }; PAApertureInterpreter paApertureInterpreter; @@ -1532,16 +1532,16 @@ public: PAExposureTimeInterpreter() {} virtual std::string toString (Tag* t) { - int a = t->toInt(0, BYTE); + int a = t->toInt (0, BYTE); char buffer[32]; - double v = 24.*exp(-(double(a) - 32.) * log(2.) / 8.); + double v = 24.*exp (- (double (a) - 32.) * log (2.) / 8.); sprintf (buffer, "%.6f", v ); return buffer; } virtual double toDouble (Tag* t, int ofs) { - int a = t->toInt(0, BYTE); - return 24.*exp(-(double(a) - 32.) * log(2.) / 8.); + int a = t->toInt (0, BYTE); + return 24.*exp (- (double (a) - 32.) * log (2.) / 8.); } }; PAExposureTimeInterpreter paExposureTimeInterpreter; @@ -1553,15 +1553,15 @@ public: virtual std::string toString (Tag* t) { char buffer[32]; - int a = t->toInt(0, BYTE); + int a = t->toInt (0, BYTE); int mina = a & 0x0F; - sprintf (buffer, "%.1f", double(int(pow(2.0, double(mina + 10) / 4.0) + 0.2))); + sprintf (buffer, "%.1f", double (int (pow (2.0, double (mina + 10) / 4.0) + 0.2))); return buffer; } virtual double toDouble (Tag* t, int ofs) { - int a = t->toInt(0, BYTE) & 0x0F; - return double(int(pow(2.0, double(a + 10) / 4.0) + 0.2)); + int a = t->toInt (0, BYTE) & 0x0F; + return double (int (pow (2.0, double (a + 10) / 4.0) + 0.2)); } }; PANominalMinApertureInterpreter paNominalMinApertureInterpreter; @@ -1573,15 +1573,15 @@ public: virtual std::string toString (Tag* t) { char buffer[32]; - int a = t->toInt(0, BYTE); + int a = t->toInt (0, BYTE); int maxa = (a & 0xF0) >> 4; - sprintf (buffer, "%.1f", double(int(pow(2.0, double(maxa) / 4.0) + 0.2)) ); + sprintf (buffer, "%.1f", double (int (pow (2.0, double (maxa) / 4.0) + 0.2)) ); return buffer; } virtual double toDouble (Tag* t, int ofs) { - int a = ( t->toInt(0, BYTE) & 0xF0) >> 4; - return double(int(pow(2.0, double(a) / 4.0) + 0.2)); + int a = ( t->toInt (0, BYTE) & 0xF0) >> 4; + return double (int (pow (2.0, double (a) / 4.0) + 0.2)); } }; PANominalMaxApertureInterpreter paNominalMaxApertureInterpreter; @@ -1691,8 +1691,8 @@ public: virtual std::string toString (Tag* t) { char buffer[32]; - int b = t->toInt(0, BYTE) & 0x1F; - sprintf (buffer, "%.0f", pow(2., b / 16. + 4) ); + int b = t->toInt (0, BYTE) & 0x1F; + sprintf (buffer, "%.0f", pow (2., b / 16. + 4) ); return buffer; } }; @@ -1706,7 +1706,7 @@ public: { std::ostringstream str; - if( t->toInt(0, BYTE) & 0x20 ) { + if ( t->toInt (0, BYTE) & 0x20 ) { str << "1/3 EV steps"; } else { str << "1/2 EV steps"; @@ -1725,7 +1725,7 @@ public: { std::ostringstream str; - if( t->toInt(0, BYTE) & 0x40 ) { + if ( t->toInt (0, BYTE) & 0x40 ) { str << "P Shift"; } else { str << "Tv or Av"; @@ -1744,7 +1744,7 @@ public: { std::ostringstream str; - if( t->toInt(0, BYTE) & 0x80 ) { + if ( t->toInt (0, BYTE) & 0x80 ) { str << "Permitted"; } else { str << "Prohibited"; @@ -1772,7 +1772,7 @@ public: } virtual std::string toString (Tag* t) { - std::map::iterator r = choices.find (t->toInt(0, BYTE) >> 4); + std::map::iterator r = choices.find (t->toInt (0, BYTE) >> 4); if (r != choices.end()) { return r->second; @@ -1792,13 +1792,13 @@ public: virtual std::string toString (Tag* t) { std::ostringstream str; - int v = (t->toInt(0, BYTE) & 0xF); + int v = (t->toInt (0, BYTE) & 0xF); - if(!v) { + if (!v) { str << "Multi-segment"; - } else if(v & 1) { + } else if (v & 1) { str << "Center-weighted average"; - } else if(v & 2) { + } else if (v & 2) { str << "Spot"; } @@ -1856,31 +1856,31 @@ public: virtual std::string toString (Tag* t) { std::ostringstream str; - int c = t->toInt(0, BYTE); + int c = t->toInt (0, BYTE); - switch(c & 0xf) { - case 0: - str << "Manual"; - break; + switch (c & 0xf) { + case 0: + str << "Manual"; + break; - case 1: - str << "AF-S"; - break; + case 1: + str << "AF-S"; + break; - case 2: - str << "AF-C"; - break; + case 2: + str << "AF-C"; + break; - case 3: - str << "AF-A"; - break; + case 3: + str << "AF-A"; + break; } - if( (c & 0xF0) == 0) { + if ( (c & 0xF0) == 0) { str << ", Point Selection Auto"; - } else if( c & 0x20 ) { + } else if ( c & 0x20 ) { str << ", Fixed Center Point Selected"; - } else if( c & 0x10 ) { + } else if ( c & 0x10 ) { str << ", Point Selected"; } @@ -1895,18 +1895,18 @@ public: PAAFModeInterpreter() {} virtual std::string toString (Tag* t) { - switch(t->toInt(0, BYTE) & 0x3) { - case 0: - return "Normal"; + switch (t->toInt (0, BYTE) & 0x3) { + case 0: + return "Normal"; - case 1: - return "Hi Speed"; + case 1: + return "Hi Speed"; - case 2: - return "Depth"; + case 2: + return "Depth"; - case 3: - return "MTF"; + case 3: + return "MTF"; } return"Normal"; @@ -1921,14 +1921,15 @@ public: PAAFPointSelectedInterpreter() {} virtual std::string toString (Tag* t) { - int c = t->toInt(0, SHORT); + int c = t->toInt (0, SHORT); - if( !c ) { + if ( !c ) { return "Auto"; } else { const char *ps[] = {"Upper-left", "Top", "Upper-right", "Left", "Mid-left", "Center", "Mid-right", "Right", "Lower-left", "Bottom", "Lower-right"}; - for( int iBit = 0; iBit < 11; iBit++) - if( c & (1 << iBit) ) { + + for ( int iBit = 0; iBit < 11; iBit++) + if ( c & (1 << iBit) ) { return ps[iBit]; } @@ -1944,25 +1945,25 @@ public: PADriveMode2Interpreter() {} virtual std::string toString (Tag* t) { - int c = t->toInt(0, BYTE); + int c = t->toInt (0, BYTE); - if( !c ) { + if ( !c ) { return "Single-frame"; - } else if( c & 0x01) { + } else if ( c & 0x01) { return "Continuous"; - } else if( c & 0x02) { + } else if ( c & 0x02) { return "Continuous (Lo)"; - } else if( c & 0x04) { + } else if ( c & 0x04) { return "Self-timer (12 s)"; - } else if( c & 0x08) { + } else if ( c & 0x08) { return "Self-timer (2 s)"; - } else if( c & 0x10 ) { + } else if ( c & 0x10 ) { return "Remote Control (3 s delay)"; - } else if( c & 0x20) { + } else if ( c & 0x20) { return "Remote Control"; - } else if( c & 0x40) { + } else if ( c & 0x40) { return "Exposure Bracket"; - } else if( c & 0x80) { + } else if ( c & 0x80) { return "Multiple Exposure"; } else { return "Unknown"; diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index 58b60ee3f..b353fd246 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -47,13 +47,13 @@ Interpreter stdInterpreter; #define TAG_SUBFILETYPE 0x00fe TagDirectory::TagDirectory () - : attribs(ifdAttribs), order(HOSTORDER), parent(nullptr) {} + : attribs (ifdAttribs), order (HOSTORDER), parent (nullptr) {} TagDirectory::TagDirectory (TagDirectory* p, const TagAttrib* ta, ByteOrder border) - : attribs(ta), order(border), parent(p) {} + : attribs (ta), order (border), parent (p) {} TagDirectory::TagDirectory (TagDirectory* p, FILE* f, int base, const TagAttrib* ta, ByteOrder border, bool skipIgnored) - : attribs(ta), order(border), parent(p) + : attribs (ta), order (border), parent (p) { int numOfTags = get2 (f, order); @@ -119,13 +119,13 @@ void TagDirectory::sort () for (size_t i = 0; i < tags.size(); i++) if (tags[i]->isDirectory()) - for (int j = 0; tags[i]->getDirectory(j); j++) { - tags[i]->getDirectory(j)->sort (); + for (int j = 0; tags[i]->getDirectory (j); j++) { + tags[i]->getDirectory (j)->sort (); } } TagDirectory* TagDirectory::getRoot() { - if(parent) { + if (parent) { return parent->getRoot(); } else { return this; @@ -177,7 +177,7 @@ const TagAttrib* TagDirectory::getAttribP (const char* name) TagDirectory *tagDir; if (attribs[i].subdirAttribs && tag && (tagDir = tag->getDirectory())) { - return tagDir->getAttribP(n + 1); + return tagDir->getAttribP (n + 1); } else { return nullptr; } @@ -208,9 +208,9 @@ void TagDirectory::printAll (unsigned int level) const std::string name = tags[i]->nameToString (); if (tags[i]->isDirectory()) { - for (int j = 0; tags[i]->getDirectory(j); j++) { + for (int j = 0; tags[i]->getDirectory (j); j++) { printf ("%s+-- DIRECTORY %s[%d]:\n", prefixStr, name.c_str(), j); - tags[i]->getDirectory(j)->printAll (level + 1); + tags[i]->getDirectory (j)->printAll (level + 1); } } } @@ -270,7 +270,7 @@ bool TagDirectory::CPBDump (const Glib::ustring &commFName, const Glib::ustring f = g_fopen (commFName.c_str (), "wt"); if (f == nullptr) { - printf("TagDirectory::keyFileDump(\"%s\") >>> Error: unable to open file with write access!\n", commFName.c_str()); + printf ("TagDirectory::keyFileDump(\"%s\") >>> Error: unable to open file with write access!\n", commFName.c_str()); delete kf; return false; } @@ -279,16 +279,16 @@ bool TagDirectory::CPBDump (const Glib::ustring &commFName, const Glib::ustring kf->set_string ("RT General", "CachePath", options.cacheBaseDir); kf->set_string ("RT General", "AppVersion", RTVERSION); - kf->set_integer("RT General", "ProcParamsVersion", PPVERSION); + kf->set_integer ("RT General", "ProcParamsVersion", PPVERSION); kf->set_string ("RT General", "ImageFileName", imageFName); kf->set_string ("RT General", "OutputProfileFileName", profileFName); kf->set_string ("RT General", "DefaultProcParams", defaultPParams); - kf->set_boolean("RT General", "FlaggingMode", flagMode); + kf->set_boolean ("RT General", "FlaggingMode", flagMode); kf->set_double ("Common Data", "FNumber", cfs->fnumber); kf->set_double ("Common Data", "Shutter", cfs->shutter); kf->set_double ("Common Data", "FocalLength", cfs->focalLen); - kf->set_integer("Common Data", "ISO", cfs->iso); + kf->set_integer ("Common Data", "ISO", cfs->iso); kf->set_string ("Common Data", "Lens", cfs->lens); kf->set_string ("Common Data", "Make", cfs->camMake); kf->set_string ("Common Data", "Model", cfs->camModel); @@ -301,25 +301,24 @@ bool TagDirectory::CPBDump (const Glib::ustring &commFName, const Glib::ustring std::string tagName = tags[i]->nameToString (); if (tags[i]->isDirectory()) - for (int j = 0; tags[i]->getDirectory(j); j++) { + for (int j = 0; tags[i]->getDirectory (j); j++) { // Accumulating the TagDirectories to dump later - tagDirPaths.push_back( Glib::ustring( tagDirName + "/" + getDumpKey(tags[i]->getID(), tagName) ) ); - tagDirList.push_back(tags[i]->getDirectory(j)); + tagDirPaths.push_back ( Glib::ustring ( tagDirName + "/" + getDumpKey (tags[i]->getID(), tagName) ) ); + tagDirList.push_back (tags[i]->getDirectory (j)); try { - kf->set_string (tagDirName, getDumpKey(tags[i]->getID(), tagName), "$subdir"); + kf->set_string (tagDirName, getDumpKey (tags[i]->getID(), tagName), "$subdir"); } catch (Glib::KeyFileError&) {} - } - else { + } else { try { - kf->set_string (tagDirName, getDumpKey(tags[i]->getID(), tagName), tags[i]->valueToString()); + kf->set_string (tagDirName, getDumpKey (tags[i]->getID(), tagName), tags[i]->valueToString()); } catch (Glib::KeyFileError&) {} } } // dumping the sub-directories for (size_t i = 0; i < tagDirList.size(); i++) { - tagDirList.at(i)->CPBDump(commFName, imageFName, profileFName, defaultPParams, cfs, flagMode, kf, tagDirPaths.at(i)); + tagDirList.at (i)->CPBDump (commFName, imageFName, profileFName, defaultPParams, cfs, flagMode, kf, tagDirPaths.at (i)); } if (!keyFile) { @@ -339,15 +338,15 @@ Glib::ustring TagDirectory::getDumpKey (int tagID, const Glib::ustring &tagName) Glib::ustring key; if (options.CPBKeys == CPBKT_TID || options.CPBKeys == CPBKT_TID_NAME) { - key = Glib::ustring(Glib::ustring::format(std::fixed, std::hex, std::setfill(L'0'), std::setw(4), tagID)); + key = Glib::ustring (Glib::ustring::format (std::fixed, std::hex, std::setfill (L'0'), std::setw (4), tagID)); } if (options.CPBKeys == CPBKT_TID_NAME) { - key += Glib::ustring("_"); + key += Glib::ustring ("_"); } if (options.CPBKeys == CPBKT_TID_NAME || options.CPBKeys == CPBKT_NAME) { - key += Glib::ustring(tagName); + key += Glib::ustring (tagName); } return key; @@ -433,7 +432,7 @@ Tag* TagDirectory::getTagP (const char* name) const TagDirectory *tagDir; if (attribs[i].subdirAttribs && tag && (tagDir = tag->getDirectory())) { - return tagDir->getTagP(n + 1); + return tagDir->getTagP (n + 1); } else { return nullptr; } @@ -453,7 +452,7 @@ Tag* TagDirectory::findTag (const char* name) const if (!strcmp (attribs[i].name, name)) { Tag* t = getTag (attribs[i].ID); - if(t) { + if (t) { return t; } else { break; @@ -462,11 +461,11 @@ Tag* TagDirectory::findTag (const char* name) const } for (size_t i = 0; i < tags.size(); i++) - if(tags[i]->isDirectory()) { + if (tags[i]->isDirectory()) { TagDirectory *dir = tags[i]->getDirectory(); - Tag* t = dir->findTag(name); + Tag* t = dir->findTag (name); - if(t) { + if (t) { return t; } } @@ -476,15 +475,15 @@ Tag* TagDirectory::findTag (const char* name) const // Searches a simple value, as either attribute or element // only for simple values, not for entries with special chars or free text -bool TagDirectory::getXMPTagValue(const char* name, char* value) const +bool TagDirectory::getXMPTagValue (const char* name, char* value) const { *value = 0; - if (!getTag("ApplicationNotes")) { + if (!getTag ("ApplicationNotes")) { return false; } - char *sXMP = (char*)getTag("ApplicationNotes")->getValue(); + char *sXMP = (char*)getTag ("ApplicationNotes")->getValue(); // Check for full word char *pos = sXMP; @@ -492,15 +491,15 @@ bool TagDirectory::getXMPTagValue(const char* name, char* value) const bool found = false; do { - pos = strstr(pos, name); + pos = strstr (pos, name); if (pos) { - char nextChar = *(pos + strlen(name)); + char nextChar = * (pos + strlen (name)); if (nextChar == ' ' || nextChar == '>' || nextChar == '=') { found = true; } else { - pos += strlen(name); + pos += strlen (name); } } } while (pos && !found); @@ -509,8 +508,8 @@ bool TagDirectory::getXMPTagValue(const char* name, char* value) const return false; } - char *posTag = strchr(pos, '>'); - char *posAttr = strchr(pos, '"'); + char *posTag = strchr (pos, '>'); + char *posAttr = strchr (pos, '"'); if (!posTag && !posAttr) { return false; @@ -518,14 +517,14 @@ bool TagDirectory::getXMPTagValue(const char* name, char* value) const if (posTag && (!posAttr || posTag < posAttr)) { // Tag - pos = strchr(posTag + 1, '<'); - strncpy(value, posTag + 1, pos - posTag - 1); + pos = strchr (posTag + 1, '<'); + strncpy (value, posTag + 1, pos - posTag - 1); value[pos - posTag - 1] = 0; return true; } else if (posAttr && (!posTag || posAttr < posTag)) { // Attribute - pos = strchr(posAttr + 1, '"'); - strncpy(value, posAttr + 1, pos - posAttr - 1); + pos = strchr (posAttr + 1, '"'); + strncpy (value, posAttr + 1, pos - posAttr - 1); value[pos - posAttr - 1] = 0; return true; } else { @@ -537,7 +536,7 @@ void TagDirectory::keepTag (int ID) { for (size_t i = 0; i < tags.size(); i++) if (tags[i]->getID() == ID) { - tags[i]->setKeep(true); + tags[i]->setKeep (true); } } @@ -655,8 +654,8 @@ void TagDirectory::applyChange (std::string name, std::string value) for (size_t i = 0; i < tags.size(); i++) if (tags[i]->isDirectory()) { - for (int j = 0; tags[i]->getDirectory(j); j++) { - if (tags[i]->nameToString(j) == fseg) { + for (int j = 0; tags[i]->getDirectory (j); j++) { + if (tags[i]->nameToString (j) == fseg) { t = tags[i]; dirnum = j; break; @@ -688,43 +687,43 @@ void TagDirectory::applyChange (std::string name, std::string value) } if (t && dirnum >= 0) { - t->getDirectory(dirnum)->applyChange (name.substr (dp + 1, std::string::npos), value); + t->getDirectory (dirnum)->applyChange (name.substr (dp + 1, std::string::npos), value); } } } TagDirectoryTable::TagDirectoryTable () - : values(nullptr), zeroOffset(0), valuesSize(0), defaultType(INVALID) + : values (nullptr), zeroOffset (0), valuesSize (0), defaultType (INVALID) { } TagDirectoryTable::TagDirectoryTable (TagDirectory* p, unsigned char *v, int memsize, int offs, TagType type, const TagAttrib* ta, ByteOrder border) - : TagDirectory(p, ta, border), zeroOffset(offs), valuesSize(memsize), defaultType( type ) + : TagDirectory (p, ta, border), zeroOffset (offs), valuesSize (memsize), defaultType ( type ) { values = new unsigned char[valuesSize]; - memcpy(values, v, valuesSize); + memcpy (values, v, valuesSize); // Security ; will avoid to read above the buffer limit if the RT's tagDirectoryTable is longer that what's in the file - int count = valuesSize / getTypeSize(type); + int count = valuesSize / getTypeSize (type); - for(const TagAttrib* tattr = ta; tattr->ignore != -1 && tattr->ID < count; ++tattr) { - Tag* newTag = new Tag (this, tattr, (values + zeroOffset + tattr->ID * getTypeSize(type)), tattr->type == AUTO ? type : tattr->type); - tags.push_back(newTag); // Here we can insert more tag in the same offset because of bitfield meaning + for (const TagAttrib* tattr = ta; tattr->ignore != -1 && tattr->ID < count; ++tattr) { + Tag* newTag = new Tag (this, tattr, (values + zeroOffset + tattr->ID * getTypeSize (type)), tattr->type == AUTO ? type : tattr->type); + tags.push_back (newTag); // Here we can insert more tag in the same offset because of bitfield meaning } } TagDirectoryTable::TagDirectoryTable (TagDirectory* p, FILE* f, int memsize, int offs, TagType type, const TagAttrib* ta, ByteOrder border) - : TagDirectory(p, ta, border), zeroOffset(offs), valuesSize(memsize), defaultType( type ) + : TagDirectory (p, ta, border), zeroOffset (offs), valuesSize (memsize), defaultType ( type ) { values = new unsigned char[valuesSize]; fread (values, 1, valuesSize, f); // Security ; will avoid to read above the buffer limit if the RT's tagDirectoryTable is longer that what's in the file - int count = valuesSize / getTypeSize(type); + int count = valuesSize / getTypeSize (type); - for(const TagAttrib* tattr = ta; tattr->ignore != -1 && tattr->ID < count; ++tattr) { - Tag* newTag = new Tag (this, tattr, (values + zeroOffset + tattr->ID * getTypeSize(type)), tattr->type == AUTO ? type : tattr->type); - tags.push_back(newTag); // Here we can insert more tag in the same offset because of bitfield meaning + for (const TagAttrib* tattr = ta; tattr->ignore != -1 && tattr->ID < count; ++tattr) { + Tag* newTag = new Tag (this, tattr, (values + zeroOffset + tattr->ID * getTypeSize (type)), tattr->type == AUTO ? type : tattr->type); + tags.push_back (newTag); // Here we can insert more tag in the same offset because of bitfield meaning } } TagDirectory* TagDirectoryTable::clone (TagDirectory* parent) @@ -736,7 +735,7 @@ TagDirectory* TagDirectoryTable::clone (TagDirectory* parent) TagDirectoryTable::~TagDirectoryTable() { - if(values) { + if (values) { delete [] values; } } @@ -747,8 +746,8 @@ int TagDirectoryTable::calculateSize () int TagDirectoryTable::write (int start, unsigned char* buffer) { - if( values && valuesSize) { - memcpy(buffer + start, values, valuesSize); + if ( values && valuesSize) { + memcpy (buffer + start, values, valuesSize); return start + valuesSize; } else { return start; @@ -760,7 +759,7 @@ int TagDirectoryTable::write (int start, unsigned char* buffer) //----------------------------------------------------------------------------- Tag::Tag (TagDirectory* p, FILE* f, int base) - : type(INVALID), count(0), value(nullptr), allocOwnMemory(true), attrib(nullptr), parent(p), directory(nullptr) + : type (INVALID), count (0), value (nullptr), allocOwnMemory (true), attrib (nullptr), parent (p), directory (nullptr) { ByteOrder order = getOrder(); @@ -785,13 +784,13 @@ Tag::Tag (TagDirectory* p, FILE* f, int base) } // store next Tag's position in file - int save = ftell(f) + 4; + int save = ftell (f) + 4; // load value field (possibly seek before) - valuesize = count * getTypeSize(type); + valuesize = count * getTypeSize (type); if (valuesize > 4) { - fseek (f, get4(f, getOrder()) + base, SEEK_SET); + fseek (f, get4 (f, getOrder()) + base, SEEK_SET); } attrib = parent->getAttrib (tag); @@ -800,36 +799,36 @@ Tag::Tag (TagDirectory* p, FILE* f, int base) keep = true; } - if( tag == 0xc634 ) { // DNGPrivateData - int currPos = ftell(f); + if ( tag == 0xc634 ) { // DNGPrivateData + int currPos = ftell (f); const int buffersize = 32; char buffer[buffersize], *p = buffer; - while( fread (p, 1, 1, f ) && *p != 0 && p - buffer < buffersize - 1 ) { + while ( fread (p, 1, 1, f ) && *p != 0 && p - buffer < buffersize - 1 ) { p++; } *p = 0; - if( !strncmp(buffer, "Adobe", 5) ) { + if ( !strncmp (buffer, "Adobe", 5) ) { fread (buffer, 1, 14, f ); - if( !strncmp( buffer, "MakN", 4) ) { + if ( !strncmp ( buffer, "MakN", 4) ) { ByteOrder bom = ((buffer[8] == 'M' && buffer[9] == 'M') ? MOTOROLA : INTEL) ; - Tag* tmake = parent->getRoot()->findTag("Make"); - std::string make( tmake ? tmake->valueToString() : ""); - int save = ftell(f); - int originalOffset = sget4( (unsigned char*)&buffer[10], ( make.find("SONY") != std::string::npos ) || ( make.find("Canon") != std::string::npos ) || ( make.find("OLYMPUS") != std::string::npos ) ? MOTOROLA : bom ); + Tag* tmake = parent->getRoot()->findTag ("Make"); + std::string make ( tmake ? tmake->valueToString() : ""); + int save = ftell (f); + int originalOffset = sget4 ( (unsigned char*)&buffer[10], ( make.find ("SONY") != std::string::npos ) || ( make.find ("Canon") != std::string::npos ) || ( make.find ("OLYMPUS") != std::string::npos ) ? MOTOROLA : bom ); - if( !parseMakerNote(f, save - originalOffset , bom )) { + if ( !parseMakerNote (f, save - originalOffset, bom )) { type = INVALID; } } - } else if( !strncmp(buffer, "PENTAX", 6) ) { + } else if ( !strncmp (buffer, "PENTAX", 6) ) { makerNoteKind = HEADERIFD; fread (buffer, 1, 2, f); directory = new TagDirectory*[2]; - directory[0] = new TagDirectory (parent, f, currPos, pentaxAttribs, strncmp(buffer, "MM", 2) ? INTEL : MOTOROLA); + directory[0] = new TagDirectory (parent, f, currPos, pentaxAttribs, strncmp (buffer, "MM", 2) ? INTEL : MOTOROLA); directory[1] = nullptr; } else /* SONY uses this tag to write hidden info and pointer to private encrypted tags @@ -850,7 +849,7 @@ Tag::Tag (TagDirectory* p, FILE* f, int base) // if this tag is the makernote, it needs special treatment (brand specific parsing) if (tag == 0x927C && attrib && !strcmp (attrib->name, "MakerNote") ) { - if( !parseMakerNote(f, base, order )) { + if ( !parseMakerNote (f, base, order )) { type = INVALID; fseek (f, save, SEEK_SET); return; @@ -872,180 +871,180 @@ Tag::Tag (TagDirectory* p, FILE* f, int base) tmodel->toString (model); } - if (!strncmp(make, "SONY", 4)) { - switch( tag ) { - case 0x0010: - directory = new TagDirectory*[2]; - directory[1] = nullptr; + if (!strncmp (make, "SONY", 4)) { + switch ( tag ) { + case 0x0010: + directory = new TagDirectory*[2]; + directory[1] = nullptr; - if (count == 15360) { - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE , sonyCameraInfoAttribs, order); - } else { - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE , sonyCameraInfo2Attribs, order); - } + if (count == 15360) { + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE, sonyCameraInfoAttribs, order); + } else { + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE, sonyCameraInfo2Attribs, order); + } - break; + break; - case 0x0114: - directory = new TagDirectory*[2]; - directory[1] = nullptr; + case 0x0114: + directory = new TagDirectory*[2]; + directory[1] = nullptr; - if (count == 280 || count == 364) { - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, SHORT , sonyCameraSettingsAttribs, MOTOROLA); - } else if (count == 332) { - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, SHORT , sonyCameraSettingsAttribs2, MOTOROLA); - } else if(count == 1536 || count == 2048) { - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE , sonyCameraSettingsAttribs3, INTEL); - } else { - // Unknown CameraSettings - delete [] directory; - directory = nullptr; - type = INVALID; - } + if (count == 280 || count == 364) { + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, SHORT, sonyCameraSettingsAttribs, MOTOROLA); + } else if (count == 332) { + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, SHORT, sonyCameraSettingsAttribs2, MOTOROLA); + } else if (count == 1536 || count == 2048) { + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE, sonyCameraSettingsAttribs3, INTEL); + } else { + // Unknown CameraSettings + delete [] directory; + directory = nullptr; + type = INVALID; + } - makerNoteKind = directory ? TABLESUBDIR : NOMK; - break; + makerNoteKind = directory ? TABLESUBDIR : NOMK; + break; - case 0x9405: - directory = new TagDirectory*[2]; - directory[1] = nullptr; - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, SHORT , attrib->subdirAttribs, order); - makerNoteKind = TABLESUBDIR; - break; + case 0x9405: + directory = new TagDirectory*[2]; + directory[1] = nullptr; + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, SHORT, attrib->subdirAttribs, order); + makerNoteKind = TABLESUBDIR; + break; - default: - goto defsubdirs; + default: + goto defsubdirs; } - } else if ((!strncmp(make, "PENTAX", 6)) || (!strncmp(make, "RICOH", 5) && !strncmp(model, "PENTAX", 6))) { // Either the former Pentax brand or the RICOH brand + PENTAX model" - switch( tag ) { - case 0x007d: - case 0x0205: - case 0x0208: - case 0x0216: - directory = new TagDirectory*[2]; - directory[1] = nullptr; - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE , attrib->subdirAttribs, order); - makerNoteKind = TABLESUBDIR; - break; + } else if ((!strncmp (make, "PENTAX", 6)) || (!strncmp (make, "RICOH", 5) && !strncmp (model, "PENTAX", 6))) { // Either the former Pentax brand or the RICOH brand + PENTAX model" + switch ( tag ) { + case 0x007d: + case 0x0205: + case 0x0208: + case 0x0216: + directory = new TagDirectory*[2]; + directory[1] = nullptr; + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE, attrib->subdirAttribs, order); + makerNoteKind = TABLESUBDIR; + break; - case 0x0215: - directory = new TagDirectory*[2]; - directory[1] = nullptr; - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, LONG , attrib->subdirAttribs, order); - makerNoteKind = TABLESUBDIR; - break; + case 0x0215: + directory = new TagDirectory*[2]; + directory[1] = nullptr; + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, LONG, attrib->subdirAttribs, order); + makerNoteKind = TABLESUBDIR; + break; - case 0x005c: - directory = new TagDirectory*[2]; - directory[1] = nullptr; + case 0x005c: + directory = new TagDirectory*[2]; + directory[1] = nullptr; - if (count == 4) { // SRInfo - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE , pentaxSRInfoAttribs, order); - } else if (count == 2) { // SRInfo2 - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE , pentaxSRInfo2Attribs, order); - } else { - // Unknown SRInfo - delete [] directory; - directory = nullptr; - type = INVALID; + if (count == 4) { // SRInfo + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE, pentaxSRInfoAttribs, order); + } else if (count == 2) { // SRInfo2 + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE, pentaxSRInfo2Attribs, order); + } else { + // Unknown SRInfo + delete [] directory; + directory = nullptr; + type = INVALID; + } + + makerNoteKind = directory ? TABLESUBDIR : NOMK; + break; + + case 0x0206: + directory = new TagDirectory*[2]; + directory[1] = nullptr; + + if (count == 21) { // AEInfo2 + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE, pentaxAEInfo2Attribs, order); + } else if (count == 48) { // AEInfo3 + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE, pentaxAEInfo3Attribs, order); + } else if (count <= 25) { // AEInfo + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE, pentaxAEInfoAttribs, order); + } else { + // Unknown AEInfo + delete [] directory; + directory = nullptr; + type = INVALID; + } + + makerNoteKind = directory ? TABLESUBDIR : NOMK; + break; + + case 0x0207: { + // There are 2 format pentaxLensDataAttribs + int offsetFirst = 4; // LensInfo2 + + if ( strstr (model, "*ist") || strstr (model, "GX-1") || strstr (model, "K100D") || strstr (model, "K110D") ) { + offsetFirst = 3; // LensInfo + } else if ( strstr (model, "645D") ) { + offsetFirst = 13; // LensInfo3 + } else if ( strstr (model, "K-01") || strstr (model, "K-30") || strstr (model, "K-50")) { + offsetFirst = 15; // LensInfo5 + } else if ( strstr (model, "K-5") || strstr (model, "K-r") ) { + offsetFirst = 12; // LensInfo4 + } else if (!strncmp (make, "RICOH", 5)) { // all PENTAX camera model produced under the RICOH era uses LensInfo5, for now... + offsetFirst = 15; // LensInfo5 too + } + + directory = new TagDirectory*[2]; + directory[1] = nullptr; + directory[0] = new TagDirectoryTable (parent, f, valuesize, offsetFirst, BYTE, attrib->subdirAttribs, order); + makerNoteKind = TABLESUBDIR; } - - makerNoteKind = directory ? TABLESUBDIR : NOMK; break; - case 0x0206: - directory = new TagDirectory*[2]; - directory[1] = nullptr; + case 0x0239: + directory = new TagDirectory*[2]; + directory[1] = nullptr; + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE, attrib->subdirAttribs, order); + makerNoteKind = TABLESUBDIR; + break; - if (count == 21) { // AEInfo2 - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE , pentaxAEInfo2Attribs, order); - } else if (count == 48) { // AEInfo3 - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE , pentaxAEInfo3Attribs, order); - } else if (count <= 25) { // AEInfo - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE , pentaxAEInfoAttribs, order); - } else { - // Unknown AEInfo - delete [] directory; - directory = nullptr; - type = INVALID; - } - - makerNoteKind = directory ? TABLESUBDIR : NOMK; - break; - - case 0x0207: { - // There are 2 format pentaxLensDataAttribs - int offsetFirst = 4; // LensInfo2 - - if( strstr(model, "*ist") || strstr(model, "GX-1") || strstr(model, "K100D") || strstr(model, "K110D") ) { - offsetFirst = 3; // LensInfo - } else if( strstr(model, "645D") ) { - offsetFirst = 13; // LensInfo3 - } else if( strstr(model, "K-01") || strstr(model, "K-30") || strstr(model, "K-50")) { - offsetFirst = 15; // LensInfo5 - } else if( strstr(model, "K-5") || strstr(model, "K-r") ) { - offsetFirst = 12; // LensInfo4 - } else if(!strncmp(make, "RICOH", 5)) { // all PENTAX camera model produced under the RICOH era uses LensInfo5, for now... - offsetFirst = 15; // LensInfo5 too - } - - directory = new TagDirectory*[2]; - directory[1] = nullptr; - directory[0] = new TagDirectoryTable (parent, f, valuesize, offsetFirst, BYTE , attrib->subdirAttribs, order); - makerNoteKind = TABLESUBDIR; + default: + goto defsubdirs; } - break; + } else if (!strncmp (make, "Canon", 5)) { + switch ( tag ) { + case 0x0001: + case 0x0002: + case 0x0004: + case 0x0005: + case 0x0093: + case 0x0098: + case 0x00a0: + directory = new TagDirectory*[2]; + directory[1] = nullptr; + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, SSHORT, attrib->subdirAttribs, order); + makerNoteKind = TABLESUBDIR; + break; - case 0x0239: - directory = new TagDirectory*[2]; - directory[1] = nullptr; - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE , attrib->subdirAttribs, order); - makerNoteKind = TABLESUBDIR; - break; + case 0x009a: + case 0x4013: + directory = new TagDirectory*[2]; + directory[1] = nullptr; + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, LONG, attrib->subdirAttribs, order); + makerNoteKind = TABLESUBDIR; + break; - default: - goto defsubdirs; + default: + goto defsubdirs; } - } else if (!strncmp(make, "Canon", 5)) { - switch( tag ) { - case 0x0001: - case 0x0002: - case 0x0004: - case 0x0005: - case 0x0093: - case 0x0098: - case 0x00a0: - directory = new TagDirectory*[2]; - directory[1] = nullptr; - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, SSHORT , attrib->subdirAttribs, order); - makerNoteKind = TABLESUBDIR; - break; - - case 0x009a: - case 0x4013: - directory = new TagDirectory*[2]; - directory[1] = nullptr; - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, LONG , attrib->subdirAttribs, order); - makerNoteKind = TABLESUBDIR; - break; - - default: - goto defsubdirs; - } - } else if (!strncmp(make, "NIKON", 5)) { + } else if (!strncmp (make, "NIKON", 5)) { switch (tag) { - case 0x0025: { - directory = new TagDirectory*[2]; - directory[1] = nullptr; - directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE , attrib->subdirAttribs, order); - makerNoteKind = TABLESUBDIR; - break; - } + case 0x0025: { + directory = new TagDirectory*[2]; + directory[1] = nullptr; + directory[0] = new TagDirectoryTable (parent, f, valuesize, 0, BYTE, attrib->subdirAttribs, order); + makerNoteKind = TABLESUBDIR; + break; + } - default: - goto defsubdirs; + default: + goto defsubdirs; } - } else if(type == UNDEFINED) { + } else if (type == UNDEFINED) { count = 1; type = LONG; directory = new TagDirectory*[2]; @@ -1083,7 +1082,7 @@ defsubdirs: // load directories for (size_t j = 0, i = 0; j < count; j++, i++) { - int newpos = base + toInt(j * 4, LONG); + int newpos = base + toInt (j * 4, LONG); fseek (f, newpos, SEEK_SET); directory[i] = new TagDirectory (parent, f, base, attrib->subdirAttribs, order); fseek (f, pos, SEEK_SET); @@ -1101,22 +1100,22 @@ defsubdirs: } -bool Tag::parseMakerNote(FILE* f, int base, ByteOrder bom ) +bool Tag::parseMakerNote (FILE* f, int base, ByteOrder bom ) { value = nullptr; - Tag* tmake = parent->getRoot()->findTag("Make"); - std::string make( tmake ? tmake->valueToString() : ""); + Tag* tmake = parent->getRoot()->findTag ("Make"); + std::string make ( tmake ? tmake->valueToString() : ""); Tag* tmodel = parent->getRoot()->findTag ("Model"); - std::string model( tmodel ? tmodel->valueToString() : ""); + std::string model ( tmodel ? tmodel->valueToString() : ""); - if ( make.find( "NIKON" ) != std::string::npos ) { - if ( model.find("NIKON E700") != std::string::npos || - model.find("NIKON E800") != std::string::npos || - model.find("NIKON E900") != std::string::npos || - model.find("NIKON E900S") != std::string::npos || - model.find("NIKON E910") != std::string::npos || - model.find("NIKON E950") != std::string::npos ) { + if ( make.find ( "NIKON" ) != std::string::npos ) { + if ( model.find ("NIKON E700") != std::string::npos || + model.find ("NIKON E800") != std::string::npos || + model.find ("NIKON E900") != std::string::npos || + model.find ("NIKON E900S") != std::string::npos || + model.find ("NIKON E910") != std::string::npos || + model.find ("NIKON E950") != std::string::npos ) { makerNoteKind = HEADERIFD; valuesize = 8; value = new unsigned char[8]; @@ -1124,8 +1123,8 @@ bool Tag::parseMakerNote(FILE* f, int base, ByteOrder bom ) directory = new TagDirectory*[2]; directory[0] = new TagDirectory (parent, f, base, nikon2Attribs, bom); directory[1] = nullptr; - } else if ( model.find("NIKON E990") != std::string::npos || - (model.find("NIKON D1") != std::string::npos && model.size() > 8 && model.at(8) != '0')) { + } else if ( model.find ("NIKON E990") != std::string::npos || + (model.find ("NIKON D1") != std::string::npos && model.size() > 8 && model.at (8) != '0')) { makerNoteKind = IFD; directory = new TagDirectory*[2]; directory[0] = new TagDirectory (parent, f, base, nikon3Attribs, bom); @@ -1140,19 +1139,22 @@ bool Tag::parseMakerNote(FILE* f, int base, ByteOrder bom ) directory = new TagDirectory*[2]; // byte order for makernotes can be different from exif byte order. We have to get it from makernotes header ByteOrder MakerNoteOrder; - if(value[10] == 'M' && value[11] == 'M') + + if (value[10] == 'M' && value[11] == 'M') { MakerNoteOrder = rtexif::MOTOROLA; - else + } else { MakerNoteOrder = rtexif::INTEL; + } + directory[0] = new TagDirectory (parent, f, basepos + 10, nikon3Attribs, MakerNoteOrder); directory[1] = nullptr; } - } else if ( make.find( "Canon" ) != std::string::npos ) { + } else if ( make.find ( "Canon" ) != std::string::npos ) { makerNoteKind = IFD; directory = new TagDirectory*[2]; directory[0] = new TagDirectory (parent, f, base, canonAttribs, bom); directory[1] = nullptr; - } else if ( make.find( "PENTAX" ) != std::string::npos ) { + } else if ( make.find ( "PENTAX" ) != std::string::npos ) { makerNoteKind = HEADERIFD; valuesize = 6; value = new unsigned char[6]; @@ -1160,7 +1162,7 @@ bool Tag::parseMakerNote(FILE* f, int base, ByteOrder bom ) directory = new TagDirectory*[2]; directory[0] = new TagDirectory (parent, f, base, pentaxAttribs, bom); directory[1] = nullptr; - } else if ( (make.find( "RICOH" ) != std::string::npos ) && (model.find("PENTAX") != std::string::npos) ) { + } else if ( (make.find ( "RICOH" ) != std::string::npos ) && (model.find ("PENTAX") != std::string::npos) ) { makerNoteKind = HEADERIFD; valuesize = 10; value = new unsigned char[10]; @@ -1168,25 +1170,25 @@ bool Tag::parseMakerNote(FILE* f, int base, ByteOrder bom ) directory = new TagDirectory*[2]; directory[0] = new TagDirectory (parent, f, ftell (f) - 10, pentaxAttribs, bom); directory[1] = nullptr; - } else if ( make.find( "FUJIFILM" ) != std::string::npos ) { + } else if ( make.find ( "FUJIFILM" ) != std::string::npos ) { makerNoteKind = FUJI; valuesize = 12; value = new unsigned char[12]; fread (value, 1, 12, f); directory = new TagDirectory*[2]; - directory[0] = new TagDirectory (parent, f, ftell(f) - 12, fujiAttribs, INTEL); + directory[0] = new TagDirectory (parent, f, ftell (f) - 12, fujiAttribs, INTEL); directory[1] = nullptr; - } else if ( make.find( "KONICA MINOLTA" ) != std::string::npos || make.find( "Minolta" ) != std::string::npos ) { + } else if ( make.find ( "KONICA MINOLTA" ) != std::string::npos || make.find ( "Minolta" ) != std::string::npos ) { makerNoteKind = IFD; directory = new TagDirectory*[2]; directory[0] = new TagDirectory (parent, f, base, minoltaAttribs, bom); directory[1] = nullptr; - } else if ( make.find( "SONY" ) != std::string::npos ) { + } else if ( make.find ( "SONY" ) != std::string::npos ) { valuesize = 12; value = new unsigned char[12]; fread (value, 1, 12, f); - if (!strncmp((char*)value, "SONY DSC", 8)) { + if (!strncmp ((char*)value, "SONY DSC", 8)) { makerNoteKind = HEADERIFD; } else { makerNoteKind = IFD; @@ -1196,7 +1198,7 @@ bool Tag::parseMakerNote(FILE* f, int base, ByteOrder bom ) directory = new TagDirectory*[2]; directory[0] = new TagDirectory (parent, f, base, sonyAttribs, bom ); directory[1] = nullptr; - } else if ( make.find( "OLYMPUS" ) != std::string::npos ) { + } else if ( make.find ( "OLYMPUS" ) != std::string::npos ) { makerNoteKind = HEADERIFD; valuesize = 8; value = new unsigned char[12]; @@ -1204,11 +1206,11 @@ bool Tag::parseMakerNote(FILE* f, int base, ByteOrder bom ) directory = new TagDirectory*[2]; directory[1] = nullptr; - if (!strncmp((char*)value, "OLYMPUS", 7)) { + if (!strncmp ((char*)value, "OLYMPUS", 7)) { makerNoteKind = OLYMPUS2; fread (value + 8, 1, 4, f); valuesize = 12; - directory[0] = new TagDirectory (parent, f, ftell(f) - 12, olympusAttribs, value[8] == 'I' ? INTEL : MOTOROLA); + directory[0] = new TagDirectory (parent, f, ftell (f) - 12, olympusAttribs, value[8] == 'I' ? INTEL : MOTOROLA); } else { directory[0] = new TagDirectory (parent, f, base, olympusAttribs, bom); } @@ -1269,6 +1271,7 @@ Tag::~Tag () // if there are directories behind the tag, delete them if (directory) { int i = 0; + while (directory[i]) { delete directory[i++]; } @@ -1303,7 +1306,7 @@ void Tag::fromInt (int v) void Tag::fromString (const char* v, int size) { - if( value && allocOwnMemory) { + if ( value && allocOwnMemory) { delete [] value; } @@ -1315,7 +1318,7 @@ void Tag::fromString (const char* v, int size) count = valuesize; - if( allocOwnMemory ) { + if ( allocOwnMemory ) { value = new unsigned char [valuesize]; } @@ -1325,7 +1328,7 @@ void Tag::fromString (const char* v, int size) int Tag::toInt (int ofs, TagType astype) { if (attrib) { - return attrib->interpreter->toInt(this, ofs, astype); + return attrib->interpreter->toInt (this, ofs, astype); } int a; @@ -1335,39 +1338,39 @@ int Tag::toInt (int ofs, TagType astype) } switch (astype) { - //case SBYTE: return (signed char)(value[ofs]); - case SBYTE: - return int((reinterpret_cast(value))[ofs]); + //case SBYTE: return (signed char)(value[ofs]); + case SBYTE: + return int ((reinterpret_cast (value))[ofs]); - case BYTE: - return value[ofs]; + case BYTE: + return value[ofs]; - case ASCII: - return 0; + case ASCII: + return 0; - case SSHORT: - return (int)int2_to_signed(sget2 (value + ofs, getOrder())); + case SSHORT: + return (int)int2_to_signed (sget2 (value + ofs, getOrder())); - case SHORT: - return (int)sget2 (value + ofs, getOrder()); + case SHORT: + return (int)sget2 (value + ofs, getOrder()); - case SLONG: - case LONG: - return (int)sget4 (value + ofs, getOrder()); + case SLONG: + case LONG: + return (int)sget4 (value + ofs, getOrder()); - case SRATIONAL: - case RATIONAL: - a = (int)sget4 (value + ofs + 4, getOrder()); - return a == 0 ? 0 : (int)sget4 (value + ofs, getOrder()) / a; + case SRATIONAL: + case RATIONAL: + a = (int)sget4 (value + ofs + 4, getOrder()); + return a == 0 ? 0 : (int)sget4 (value + ofs, getOrder()) / a; - case FLOAT: - return (int)toDouble(ofs); + case FLOAT: + return (int)toDouble (ofs); - case UNDEFINED: - return 0; + case UNDEFINED: + return 0; - default: - return 0; // Quick fix for missing cases (INVALID, DOUBLE, OLYUNDEF, SUBDIR) + default: + return 0; // Quick fix for missing cases (INVALID, DOUBLE, OLYUNDEF, SUBDIR) } return 0; @@ -1376,7 +1379,7 @@ int Tag::toInt (int ofs, TagType astype) double Tag::toDouble (int ofs) { if (attrib) { - return attrib->interpreter->toDouble(this, ofs); + return attrib->interpreter->toDouble (this, ofs); } union IntFloat { @@ -1387,40 +1390,40 @@ double Tag::toDouble (int ofs) double ud, dd; switch (type) { - case SBYTE: - return (double)(int((reinterpret_cast(value))[ofs])); + case SBYTE: + return (double) (int ((reinterpret_cast (value))[ofs])); - case BYTE: - return (double)((int)value[ofs]); + case BYTE: + return (double) ((int)value[ofs]); - case ASCII: - return 0.0; + case ASCII: + return 0.0; - case SSHORT: - return (double)int2_to_signed(sget2 (value + ofs, getOrder())); + case SSHORT: + return (double)int2_to_signed (sget2 (value + ofs, getOrder())); - case SHORT: - return (double)((int)sget2 (value + ofs, getOrder())); + case SHORT: + return (double) ((int)sget2 (value + ofs, getOrder())); - case SLONG: - case LONG: - return (double)((int)sget4 (value + ofs, getOrder())); + case SLONG: + case LONG: + return (double) ((int)sget4 (value + ofs, getOrder())); - case SRATIONAL: - case RATIONAL: - ud = (int)sget4 (value + ofs, getOrder()); - dd = (int)sget4 (value + ofs + 4, getOrder()); - return dd == 0. ? 0. : (double)ud / (double)dd; + case SRATIONAL: + case RATIONAL: + ud = (int)sget4 (value + ofs, getOrder()); + dd = (int)sget4 (value + ofs + 4, getOrder()); + return dd == 0. ? 0. : (double)ud / (double)dd; - case FLOAT: - conv.i = sget4 (value + ofs, getOrder()); - return conv.f; // IEEE FLOATs are already C format, they just need a recast + case FLOAT: + conv.i = sget4 (value + ofs, getOrder()); + return conv.f; // IEEE FLOATs are already C format, they just need a recast - case UNDEFINED: - return 0.; + case UNDEFINED: + return 0.; - default: - return 0.; // Quick fix for missing cases (INVALID, DOUBLE, OLYUNDEF, SUBDIR) + default: + return 0.; // Quick fix for missing cases (INVALID, DOUBLE, OLYUNDEF, SUBDIR) } return 0.; @@ -1429,12 +1432,12 @@ double Tag::toDouble (int ofs) /** * @brief Create an array of the elements */ -double *Tag::toDoubleArray(int ofs) +double *Tag::toDoubleArray (int ofs) { double *values = new double[count]; for (unsigned int i = 0; i < count; ++i) { - values[i] = toDouble(ofs + i * getTypeSize(type)); + values[i] = toDouble (ofs + i * getTypeSize (type)); } return values; @@ -1444,48 +1447,48 @@ void Tag::toRational (int& num, int& denom, int ofs) { switch (type) { - case BYTE: - num = (int)value[ofs]; - denom = 1; - break; + case BYTE: + num = (int)value[ofs]; + denom = 1; + break; - case ASCII: - num = 0; - denom = 0; - break; + case ASCII: + num = 0; + denom = 0; + break; - case SSHORT: - case SHORT: - num = (int)sget2 (value + ofs, getOrder()); - denom = 1; - break; + case SSHORT: + case SHORT: + num = (int)sget2 (value + ofs, getOrder()); + denom = 1; + break; - case SLONG: - case LONG: - num = (int)sget4 (value + ofs, getOrder()); - denom = 1; - break; + case SLONG: + case LONG: + num = (int)sget4 (value + ofs, getOrder()); + denom = 1; + break; - case SRATIONAL: - case RATIONAL: - num = (int)sget4 (value + ofs, getOrder()); - denom = (int)sget4 (value + ofs + 4, getOrder()); - break; + case SRATIONAL: + case RATIONAL: + num = (int)sget4 (value + ofs, getOrder()); + denom = (int)sget4 (value + ofs + 4, getOrder()); + break; - case FLOAT: - num = 0; - denom = 0; - break; + case FLOAT: + num = 0; + denom = 0; + break; - case UNDEFINED: - num = 0; - denom = 0; - break; + case UNDEFINED: + num = 0; + denom = 0; + break; - default: - num = 0; - denom = 0; - break; // Quick fix for missing cases (INVALID, DOUBLE, OLYUNDEF, SUBDIR) + default: + num = 0; + denom = 0; + break; // Quick fix for missing cases (INVALID, DOUBLE, OLYUNDEF, SUBDIR) } } @@ -1533,41 +1536,41 @@ void Tag::toString (char* buffer, int ofs) strcat (buffer, ", "); } - char* b = buffer + strlen(buffer); + char* b = buffer + strlen (buffer); switch (type) { - case UNDEFINED: - case BYTE: - sprintf (b, "%d", value[i + ofs]); - break; + case UNDEFINED: + case BYTE: + sprintf (b, "%d", value[i + ofs]); + break; - case SSHORT: - sprintf (b, "%d", toInt(2 * i + ofs)); - break; + case SSHORT: + sprintf (b, "%d", toInt (2 * i + ofs)); + break; - case SHORT: - sprintf (b, "%u", toInt(2 * i + ofs)); - break; + case SHORT: + sprintf (b, "%u", toInt (2 * i + ofs)); + break; - case SLONG: - sprintf (b, "%d", toInt(4 * i + ofs)); - break; + case SLONG: + sprintf (b, "%d", toInt (4 * i + ofs)); + break; - case LONG: - sprintf (b, "%u", toInt(4 * i + ofs)); - break; + case LONG: + sprintf (b, "%u", toInt (4 * i + ofs)); + break; - case SRATIONAL: - case RATIONAL: - sprintf (b, "%d/%d", (int)sget4 (value + 8 * i + ofs, getOrder()), (int)sget4 (value + 8 * i + ofs + 4, getOrder())); - break; + case SRATIONAL: + case RATIONAL: + sprintf (b, "%d/%d", (int)sget4 (value + 8 * i + ofs, getOrder()), (int)sget4 (value + 8 * i + ofs + 4, getOrder())); + break; - case FLOAT: - sprintf (b, "%g", toDouble(8 * i + ofs)); - break; + case FLOAT: + sprintf (b, "%g", toDouble (8 * i + ofs)); + break; - default: - break; + default: + break; } } @@ -1588,7 +1591,7 @@ std::string Tag::nameToString (int i) } if (i > 0) { - sprintf (buffer + strlen(buffer) - 1, "[%d]", i); + sprintf (buffer + strlen (buffer) - 1, "[%d]", i); } return buffer; @@ -1633,7 +1636,7 @@ int Tag::calculateSize () } if (makerNoteKind != NOMK) { - count = directory[0]->calculateSize () / getTypeSize(type); + count = directory[0]->calculateSize () / getTypeSize (type); } if (makerNoteKind == NIKON3 || makerNoteKind == OLYMPUS2 || makerNoteKind == FUJI) { @@ -1692,7 +1695,7 @@ int Tag::write (int offs, int dataOffs, unsigned char* buffer) dataOffs += valuesize; dataOffs += directory[0]->write (dataOffs, buffer); return dataOffs; - } else if( makerNoteKind == TABLESUBDIR) { + } else if ( makerNoteKind == TABLESUBDIR) { sset4 (dataOffs, buffer + offs, parent->getOrder()); dataOffs = directory[0]->write (dataOffs, buffer); return dataOffs; @@ -1719,26 +1722,26 @@ int Tag::write (int offs, int dataOffs, unsigned char* buffer) } Tag::Tag (TagDirectory* p, const TagAttrib* attr) - : tag(attr ? attr->ID : -1), type(INVALID), count(0), value(nullptr), valuesize(0), keep(true), allocOwnMemory(true), attrib(attr), parent(p), directory(nullptr), makerNoteKind (NOMK) + : tag (attr ? attr->ID : -1), type (INVALID), count (0), value (nullptr), valuesize (0), keep (true), allocOwnMemory (true), attrib (attr), parent (p), directory (nullptr), makerNoteKind (NOMK) { } Tag::Tag (TagDirectory* p, const TagAttrib* attr, int data, TagType t) - : tag(attr ? attr->ID : -1), type(t), count(1), value(nullptr), valuesize(0), keep(true), allocOwnMemory(true), attrib(attr), parent(p), directory(nullptr), makerNoteKind (NOMK) + : tag (attr ? attr->ID : -1), type (t), count (1), value (nullptr), valuesize (0), keep (true), allocOwnMemory (true), attrib (attr), parent (p), directory (nullptr), makerNoteKind (NOMK) { initInt (data, t); } Tag::Tag (TagDirectory* p, const TagAttrib* attr, unsigned char *data, TagType t) - : tag(attr ? attr->ID : -1), type(t), count(1), value(nullptr), valuesize(0), keep(true), allocOwnMemory(false), attrib(attr), parent(p), directory(nullptr), makerNoteKind (NOMK) + : tag (attr ? attr->ID : -1), type (t), count (1), value (nullptr), valuesize (0), keep (true), allocOwnMemory (false), attrib (attr), parent (p), directory (nullptr), makerNoteKind (NOMK) { initType (data, t); } Tag::Tag (TagDirectory* p, const TagAttrib* attr, const char* text) - : tag(attr ? attr->ID : -1), type(ASCII), count(1), value(nullptr), valuesize(0), keep(true), allocOwnMemory(true), attrib(attr), parent(p), directory(nullptr), makerNoteKind (NOMK) + : tag (attr ? attr->ID : -1), type (ASCII), count (1), value (nullptr), valuesize (0), keep (true), allocOwnMemory (true), attrib (attr), parent (p), directory (nullptr), makerNoteKind (NOMK) { initString (text); @@ -1746,9 +1749,9 @@ Tag::Tag (TagDirectory* p, const TagAttrib* attr, const char* text) void Tag::initType (unsigned char *data, TagType type) { - valuesize = getTypeSize(type); + valuesize = getTypeSize (type); - if( allocOwnMemory ) { + if ( allocOwnMemory ) { value = new unsigned char[valuesize]; memcpy ((char*)value, data, valuesize); } else { @@ -1781,7 +1784,7 @@ void Tag::initString (const char* text) { type = ASCII; - count = strlen(text) + 1; + count = strlen (text) + 1; valuesize = count; value = new unsigned char[valuesize]; strcpy ((char*)value, text); @@ -1872,9 +1875,9 @@ TagDirectory* ExifManager::parseCIFF (FILE* f, int base, int length) { TagDirectory* root = new TagDirectory (nullptr, ifdAttribs, INTEL); - Tag* exif = new Tag (root, lookupAttrib(ifdAttribs, "Exif")); + Tag* exif = new Tag (root, lookupAttrib (ifdAttribs, "Exif")); exif->initSubDir (); - Tag* mn = new Tag (exif->getDirectory(), lookupAttrib(exifAttribs, "MakerNote")); + Tag* mn = new Tag (exif->getDirectory(), lookupAttrib (exifAttribs, "MakerNote")); mn->initMakerNote (IFD, canonAttribs); root->addTag (exif); exif->getDirectory()->addTag (mn); @@ -1888,8 +1891,8 @@ Tag* ExifManager::saveCIFFMNTag (FILE* f, TagDirectory* root, int len, const cha int s = ftell (f); char* data = new char [len]; fread (data, len, 1, f); - TagDirectory* mn = root->getTag ("Exif")->getDirectory()->getTag("MakerNote")->getDirectory(); - Tag* cs = new Tag (mn, lookupAttrib(canonAttribs, name)); + TagDirectory* mn = root->getTag ("Exif")->getDirectory()->getTag ("MakerNote")->getDirectory(); + Tag* cs = new Tag (mn, lookupAttrib (canonAttribs, name)); cs->initUndefArray (data, len); mn->addTag (cs); fseek (f, s, SEEK_SET); @@ -1918,7 +1921,7 @@ void ExifManager::parseCIFF (FILE* f, int base, int length, TagDirectory* root) int focal_len, iso; focal_len = iso = -1; - TagDirectory* exif = root->getTag("Exif")->getDirectory(); + TagDirectory* exif = root->getTag ("Exif")->getDirectory(); time_t timestamp = time (nullptr); @@ -1932,33 +1935,33 @@ void ExifManager::parseCIFF (FILE* f, int base, int length, TagDirectory* root) fseek (f, base + get4 (f, INTEL), SEEK_SET); if ((((type >> 8) + 8) | 8) == 0x38) { - parseCIFF (f, ftell(f), len, root); // Parse a sub-table + parseCIFF (f, ftell (f), len, root); // Parse a sub-table } if (type == 0x0810) { fread (buffer, 64, 1, f); - t = new Tag (root, lookupAttrib(ifdAttribs, "Artist")); + t = new Tag (root, lookupAttrib (ifdAttribs, "Artist")); t->initString (buffer); root->addTag (t); } if (type == 0x080a) { fread (buffer, 64, 1, f); - t = new Tag (root, lookupAttrib(ifdAttribs, "Make")); + t = new Tag (root, lookupAttrib (ifdAttribs, "Make")); t->initString (buffer); root->addTag (t); - fseek (f, strlen(buffer) - 63, SEEK_CUR); + fseek (f, strlen (buffer) - 63, SEEK_CUR); fread (buffer, 64, 1, f); - t = new Tag (root, lookupAttrib(ifdAttribs, "Model")); + t = new Tag (root, lookupAttrib (ifdAttribs, "Model")); t->initString (buffer); root->addTag (t); } if (type == 0x1818) { - ev = int_to_float(get4(f, INTEL)); - shutter = int_to_float(get4(f, INTEL)); + ev = int_to_float (get4 (f, INTEL)); + shutter = int_to_float (get4 (f, INTEL)); exptime = pow (2, -shutter); - aperture = int_to_float(get4(f, INTEL)); + aperture = int_to_float (get4 (f, INTEL)); fnumber = pow (2, aperture / 2); } @@ -1966,79 +1969,79 @@ void ExifManager::parseCIFF (FILE* f, int base, int length, TagDirectory* root) if (type == 0x102d) { Tag* t = saveCIFFMNTag (f, root, len, "CanonCameraSettings"); int mm = t->toInt (34, SHORT); - Tag* nt = new Tag (exif, lookupAttrib(exifAttribs, "MeteringMode")); + Tag* nt = new Tag (exif, lookupAttrib (exifAttribs, "MeteringMode")); switch (mm) { - case 0: - nt->initInt (5, SHORT); - break; + case 0: + nt->initInt (5, SHORT); + break; - case 1: - nt->initInt (3, SHORT); - break; + case 1: + nt->initInt (3, SHORT); + break; - case 2: - nt->initInt (1, SHORT); - break; + case 2: + nt->initInt (1, SHORT); + break; - case 3: - nt->initInt (5, SHORT); - break; + case 3: + nt->initInt (5, SHORT); + break; - case 4: - nt->initInt (6, SHORT); - break; + case 4: + nt->initInt (6, SHORT); + break; - case 5: - nt->initInt (2, SHORT); - break; + case 5: + nt->initInt (2, SHORT); + break; } exif->addTag (nt); - nt = new Tag (exif, lookupAttrib(exifAttribs, "MaxApertureValue")); - nt->initRational (t->toInt(52, SHORT), 32); + nt = new Tag (exif, lookupAttrib (exifAttribs, "MaxApertureValue")); + nt->initRational (t->toInt (52, SHORT), 32); exif->addTag (nt); - int em = t->toInt(40, SHORT); - nt = new Tag (exif, lookupAttrib(exifAttribs, "ExposureProgram")); + int em = t->toInt (40, SHORT); + nt = new Tag (exif, lookupAttrib (exifAttribs, "ExposureProgram")); switch (em) { - case 0: - nt->initInt (2, SHORT); - break; + case 0: + nt->initInt (2, SHORT); + break; - case 1: - nt->initInt (2, SHORT); - break; + case 1: + nt->initInt (2, SHORT); + break; - case 2: - nt->initInt (4, SHORT); - break; + case 2: + nt->initInt (4, SHORT); + break; - case 3: - nt->initInt (3, SHORT); - break; + case 3: + nt->initInt (3, SHORT); + break; - case 4: - nt->initInt (1, SHORT); - break; + case 4: + nt->initInt (1, SHORT); + break; - default: - nt->initInt (0, SHORT); - break; + default: + nt->initInt (0, SHORT); + break; } exif->addTag (nt); - nt = new Tag (exif, lookupAttrib(exifAttribs, "Flash")); + nt = new Tag (exif, lookupAttrib (exifAttribs, "Flash")); - if (t->toInt(8, SHORT) == 0) { + if (t->toInt (8, SHORT) == 0) { nt->initInt (0, SHORT); } else { nt->initInt (1, SHORT); } exif->addTag (nt); - nt = new Tag (exif, lookupAttrib(exifAttribs, "MaxApertureValue")); - nt->initRational (t->toInt(52, SHORT), 32); + nt = new Tag (exif, lookupAttrib (exifAttribs, "MaxApertureValue")); + nt->initRational (t->toInt (52, SHORT), 32); exif->addTag (nt); } @@ -2069,11 +2072,11 @@ void ExifManager::parseCIFF (FILE* f, int base, int length, TagDirectory* root) if (type == 0x102a) { saveCIFFMNTag (f, root, len, "CanonShotInfo"); - iso = pow (2, (get4(f, INTEL), get2(f, INTEL)) / 32.0 - 4) * 50; - aperture = (get2(f, INTEL), (short)get2(f, INTEL)) / 32.0f; + iso = pow (2, (get4 (f, INTEL), get2 (f, INTEL)) / 32.0 - 4) * 50; + aperture = (get2 (f, INTEL), (short)get2 (f, INTEL)) / 32.0f; fnumber = pow (2, aperture / 2); - shutter = ((short)get2(f, INTEL)) / 32.0f; - ev = ((short)get2(f, INTEL)) / 32.0f; + shutter = ((short)get2 (f, INTEL)) / 32.0f; + ev = ((short)get2 (f, INTEL)) / 32.0f; fseek (f, 34, SEEK_CUR); if (shutter > 1e6) { @@ -2108,67 +2111,67 @@ void ExifManager::parseCIFF (FILE* f, int base, int length, TagDirectory* root) } if (shutter > -999) { - t = new Tag (exif, lookupAttrib(exifAttribs, "ShutterSpeedValue")); - t->initRational ((int)(shutter * 10000), 10000); + t = new Tag (exif, lookupAttrib (exifAttribs, "ShutterSpeedValue")); + t->initRational ((int) (shutter * 10000), 10000); exif->addTag (t); } if (exptime > -999) { - t = new Tag (exif, lookupAttrib(exifAttribs, "ExposureTime")); - t->initRational ((int)(exptime * 10000), 10000); + t = new Tag (exif, lookupAttrib (exifAttribs, "ExposureTime")); + t->initRational ((int) (exptime * 10000), 10000); exif->addTag (t); } if (aperture > -999) { - t = new Tag (exif, lookupAttrib(exifAttribs, "ApertureValue")); - t->initRational ((int)(aperture * 10), 10); + t = new Tag (exif, lookupAttrib (exifAttribs, "ApertureValue")); + t->initRational ((int) (aperture * 10), 10); exif->addTag (t); } if (fnumber > -999) { - t = new Tag (exif, lookupAttrib(exifAttribs, "FNumber")); - t->initRational ((int)(fnumber * 10), 10); + t = new Tag (exif, lookupAttrib (exifAttribs, "FNumber")); + t->initRational ((int) (fnumber * 10), 10); exif->addTag (t); } if (ev > -999) { - t = new Tag (exif, lookupAttrib(exifAttribs, "ExposureBiasValue")); - t->initRational ((int)(ev * 1000), 1000); + t = new Tag (exif, lookupAttrib (exifAttribs, "ExposureBiasValue")); + t->initRational ((int) (ev * 1000), 1000); exif->addTag (t); } if (iso > 0) { - t = new Tag (exif, lookupAttrib(exifAttribs, "ISOSpeedRatings")); + t = new Tag (exif, lookupAttrib (exifAttribs, "ISOSpeedRatings")); t->initInt (iso, LONG); exif->addTag (t); } if (focal_len > 0) { - t = new Tag (exif, lookupAttrib(exifAttribs, "FocalLength")); + t = new Tag (exif, lookupAttrib (exifAttribs, "FocalLength")); t->initRational (focal_len * 32, 32); exif->addTag (t); } - if (timestamp != time(nullptr)) { + if (timestamp != time (nullptr)) { struct tm* tim = localtime (×tamp); strftime (buffer, 20, "%Y:%m:%d %H:%M:%S", tim); - t = new Tag (exif, lookupAttrib(exifAttribs, "DateTimeOriginal")); + t = new Tag (exif, lookupAttrib (exifAttribs, "DateTimeOriginal")); t->initString (buffer); exif->addTag (t); - t = new Tag (exif, lookupAttrib(exifAttribs, "DateTimeDigitized")); + t = new Tag (exif, lookupAttrib (exifAttribs, "DateTimeDigitized")); t->initString (buffer); exif->addTag (t); - t = new Tag (root, lookupAttrib(ifdAttribs, "DateTime")); + t = new Tag (root, lookupAttrib (ifdAttribs, "DateTime")); t->initString (buffer); root->addTag (t); } } static void -parse_leafdata(TagDirectory* root, ByteOrder order) +parse_leafdata (TagDirectory* root, ByteOrder order) { - Tag *leafdata = root->getTag("LeafData"); + Tag *leafdata = root->getTag ("LeafData"); if (!leafdata) { return; @@ -2190,17 +2193,17 @@ parse_leafdata(TagDirectory* root, ByteOrder order) int rotation_angle = 0; int found_count = 0; - while (pos + (int)sizeof(hdr) <= valuesize && found_count < 2) { + while (pos + (int)sizeof (hdr) <= valuesize && found_count < 2) { hdr = (char *)&value[pos]; - if (strncmp(hdr, PKTS_tag, 4) != 0) { + if (strncmp (hdr, PKTS_tag, 4) != 0) { // in a few cases the header can be offset a few bytes, don't know why // it does not seem to be some sort of alignment, it appears random, // this check takes care of it, restart if we find an offset match. int offset = 1; for (; offset <= 3; offset++) { - if (strncmp(&hdr[offset], PKTS_tag, 4) == 0) { + if (strncmp (&hdr[offset], PKTS_tag, 4) == 0) { pos += offset; break; } @@ -2213,7 +2216,7 @@ parse_leafdata(TagDirectory* root, ByteOrder order) break; } - int size = sget4((unsigned char *)&hdr[48], order); + int size = sget4 ((unsigned char *)&hdr[48], order); if (pos + size > valuesize) { break; @@ -2222,19 +2225,19 @@ parse_leafdata(TagDirectory* root, ByteOrder order) pos += 52; char *val = (char *)&value[pos]; - if (strncmp(&hdr[8], "CameraObj_ISO_speed", 19) == 0) { - iso_speed = 25 * (1 << (atoi(val) - 1)); + if (strncmp (&hdr[8], "CameraObj_ISO_speed", 19) == 0) { + iso_speed = 25 * (1 << (atoi (val) - 1)); found_count++; - } else if (strncmp(&hdr[8], "ImgProf_rotation_angle", 22) == 0) { - rotation_angle = atoi(val); + } else if (strncmp (&hdr[8], "ImgProf_rotation_angle", 22) == 0) { + rotation_angle = atoi (val); found_count++; } else { // check if this is a sub-directory, include test for that strange offset of next header if (size >= 8 && - (strncmp(val, PKTS_tag, 4) == 0 || - strncmp(&val[1], PKTS_tag, 4) == 0 || - strncmp(&val[2], PKTS_tag, 4) == 0 || - strncmp(&val[3], PKTS_tag, 4) == 0)) { + (strncmp (val, PKTS_tag, 4) == 0 || + strncmp (&val[1], PKTS_tag, 4) == 0 || + strncmp (&val[2], PKTS_tag, 4) == 0 || + strncmp (&val[3], PKTS_tag, 4) == 0)) { // start of next hdr, this is a sub-directory, we skip those for now. size = 0; } @@ -2252,35 +2255,35 @@ parse_leafdata(TagDirectory* root, ByteOrder order) root->addTagFront (exif); } - if (!exif->getDirectory()->getTag("ISOSpeedRatings")) { + if (!exif->getDirectory()->getTag ("ISOSpeedRatings")) { Tag *t = new Tag (exif->getDirectory(), exif->getDirectory()->getAttrib ("ISOSpeedRatings")); t->initInt (iso_speed, LONG); exif->getDirectory()->addTagFront (t); } - if (!root->getTag("Orientation")) { + if (!root->getTag ("Orientation")) { int orientation; switch (rotation_angle) { - case 0: - orientation = 1; - break; + case 0: + orientation = 1; + break; - case 90: - orientation = 6; - break; + case 90: + orientation = 6; + break; - case 180: - orientation = 3; - break; + case 180: + orientation = 3; + break; - case 270: - orientation = 8; - break; + case 270: + orientation = 8; + break; - default: - orientation = 1; - break; + default: + orientation = 1; + break; } Tag *t = new Tag (root, root->getAttrib ("Orientation")); @@ -2289,7 +2292,7 @@ parse_leafdata(TagDirectory* root, ByteOrder order) } // now look in ApplicationNotes tag for additional information - Tag *appnotes = root->getTag("ApplicationNotes"); + Tag *appnotes = root->getTag ("ApplicationNotes"); if (!appnotes) { return; @@ -2301,21 +2304,21 @@ parse_leafdata(TagDirectory* root, ByteOrder order) // Quick-and-dirty value extractor, no real xml parsing. // We could make it more generic, but we just get most important // values we know use to be in there. - if ((p = strstr(xmp, "xmlns:tiff")) != nullptr && - (end = strstr(p, "")) != nullptr) { + if ((p = strstr (xmp, "xmlns:tiff")) != nullptr && + (end = strstr (p, "")) != nullptr) { *end = '\0'; - while ((p = strstr(p, "')) == nullptr) { + if ((tagend = strchr (tag, '>')) == nullptr) { break; } *tagend = '\0'; char *val = &tagend[1]; - if ((p = strstr(val, "getAttrib (tag) && !root->getTag (tag)) { Tag *t = new Tag (root, root->getAttrib (tag)); - if (strcmp(tag, "Make") == 0 || - strcmp(tag, "Model") == 0) { - if (strcmp(tag, "Model") == 0) { + if (strcmp (tag, "Make") == 0 || + strcmp (tag, "Model") == 0) { + if (strcmp (tag, "Model") == 0) { // Leaf adds back serial number and camera model to the 'Model' // tag, we strip that away here so the back can be recognized // and matched against DCP profile - char *p1 = strchr(val, '('); + char *p1 = strchr (val, '('); if (p1 != nullptr) { *p1 = '\0'; @@ -2339,7 +2342,7 @@ parse_leafdata(TagDirectory* root, ByteOrder order) // Model name also contains a leading "Leaf " which we already // have in the Make name, remove that. - if (strstr(val, "Leaf ") == val) { + if (strstr (val, "Leaf ") == val) { t->initString (&val[5]); } else { t->initString (val); @@ -2365,21 +2368,21 @@ parse_leafdata(TagDirectory* root, ByteOrder order) *end = '<'; } - if ((p = strstr(xmp, "xmlns:exif")) != nullptr && - (end = strstr(p, "")) != nullptr) { + if ((p = strstr (xmp, "xmlns:exif")) != nullptr && + (end = strstr (p, "")) != nullptr) { *end = '\0'; - while ((p = strstr(p, "')) == nullptr) { + if ((tagend = strchr (tag, '>')) == nullptr) { break; } *tagend = '\0'; char *val = &tagend[1]; - if ((p = strstr(val, "initRational (num, denom); exif->getDirectory()->addTagFront (t); // we also make an "FNumber" tag since many tools don't interpret ApertureValue // according to Exif standard - t = new Tag (exif->getDirectory(), lookupAttrib(exifAttribs, "FNumber")); - double f = pow(sqrt(2.0), ((double)num / denom)); + t = new Tag (exif->getDirectory(), lookupAttrib (exifAttribs, "FNumber")); + double f = pow (sqrt (2.0), ((double)num / denom)); if (f > 10.0) { - t->initRational ((int)floor(f), 1); + t->initRational ((int)floor (f), 1); } else { - t->initRational ((int)floor(f * 10.0), 10); + t->initRational ((int)floor (f * 10.0), 10); } exif->getDirectory()->addTagFront (t); - } else if (strcmp(tag, "ShutterSpeedValue") == 0 && sscanf(val, "%d/%d", &num, &denom) == 2) { + } else if (strcmp (tag, "ShutterSpeedValue") == 0 && sscanf (val, "%d/%d", &num, &denom) == 2) { t->initRational (num, denom); exif->getDirectory()->addTagFront (t); // we also make an "ExposureTime" tag since many tools don't interpret ShutterSpeedValue // according to Exif standard - t = new Tag (exif->getDirectory(), lookupAttrib(exifAttribs, "ExposureTime")); - double f = 1.0 / pow(2.0, ((double)num / denom)); + t = new Tag (exif->getDirectory(), lookupAttrib (exifAttribs, "ExposureTime")); + double f = 1.0 / pow (2.0, ((double)num / denom)); if (f > 10.0) { - t->initRational ((int)floor(f), 1); + t->initRational ((int)floor (f), 1); } else if (f > 1.0) { - t->initRational ((int)floor(f * 10.0), 10); + t->initRational ((int)floor (f * 10.0), 10); } else if (f == 1.0) { t->initRational (1, 1); } else { @@ -2442,9 +2445,9 @@ parse_leafdata(TagDirectory* root, ByteOrder order) int idx = -1; for (int i = 1; etimes[i] > 0; i++) { - if (abs(etimes[i] - f) < diff) { + if (abs (etimes[i] - f) < diff) { idx = i; - diff = abs(etimes[i] - f); + diff = abs (etimes[i] - f); } } @@ -2453,35 +2456,35 @@ parse_leafdata(TagDirectory* root, ByteOrder order) } if (f < 2) { - t->initRational (10, (int)(10 * f)); + t->initRational (10, (int) (10 * f)); } else { t->initRational (1, (int)f); } } exif->getDirectory()->addTagFront (t); - } else if (strcmp(tag, "FocalLength") == 0 && sscanf(val, "%d/%d", &num, &denom) == 2) { + } else if (strcmp (tag, "FocalLength") == 0 && sscanf (val, "%d/%d", &num, &denom) == 2) { t->initRational (num, denom); exif->getDirectory()->addTagFront (t); - } else if (strcmp(tag, "ISOSpeedRatings") == 0) { + } else if (strcmp (tag, "ISOSpeedRatings") == 0) { char *p1 = val; - while (*p1 != '\0' && !isdigit(*p1)) { + while (*p1 != '\0' && !isdigit (*p1)) { p1++; } if (*p1 != '\0') { - t->initInt (atoi(p1), LONG); + t->initInt (atoi (p1), LONG); exif->getDirectory()->addTagFront (t); } - } else if (strcmp(tag, "DateTimeOriginal") == 0 && - sscanf(val, "%d-%d-%dT%d:%d:%dZ", - &tm.tm_year, &tm.tm_mon, - &tm.tm_mday, &tm.tm_hour, - &tm.tm_min, &tm.tm_sec) == 6) { + } else if (strcmp (tag, "DateTimeOriginal") == 0 && + sscanf (val, "%d-%d-%dT%d:%d:%dZ", + &tm.tm_year, &tm.tm_mon, + &tm.tm_mday, &tm.tm_hour, + &tm.tm_min, &tm.tm_sec) == 6) { char tstr[64]; - sprintf(tstr, "%04d:%02d:%02d %02d:%02d:%02d", tm.tm_year, tm.tm_mon, - tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); + sprintf (tstr, "%04d:%02d:%02d %02d:%02d:%02d", tm.tm_year, tm.tm_mon, + tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); t->initString (tstr); exif->getDirectory()->addTagFront (t); } else { @@ -2499,12 +2502,12 @@ parse_leafdata(TagDirectory* root, ByteOrder order) TagDirectory* ExifManager::parse (FILE* f, int base, bool skipIgnored) { - setlocale(LC_NUMERIC, "C"); // to set decimal point in sscanf + setlocale (LC_NUMERIC, "C"); // to set decimal point in sscanf // read tiff header fseek (f, base, SEEK_SET); unsigned short bo; fread (&bo, 1, 2, f); - ByteOrder order = (ByteOrder)((int)bo); + ByteOrder order = (ByteOrder) ((int)bo); get2 (f, order); int firstifd = get4 (f, order); @@ -2518,59 +2521,59 @@ TagDirectory* ExifManager::parse (FILE* f, int base, bool skipIgnored) Tag* make = root->getTag ("Make"); Tag* exif = root->getTag ("Exif"); - if (exif && !exif->getDirectory()->getTag("ISOSpeedRatings")) { - if (make && !strncmp((char*)make->getValue(), "NIKON", 5)) { - Tag* mn = exif->getDirectory()->getTag("MakerNote"); + if (exif && !exif->getDirectory()->getTag ("ISOSpeedRatings")) { + if (make && !strncmp ((char*)make->getValue(), "NIKON", 5)) { + Tag* mn = exif->getDirectory()->getTag ("MakerNote"); if (mn) { - Tag* iso = mn->getDirectory()->getTag("ISOSpeed"); + Tag* iso = mn->getDirectory()->getTag ("ISOSpeed"); if (iso) { std::string isov = iso->valueToString (); Tag* niso = new Tag (exif->getDirectory(), exif->getDirectory()->getAttrib ("ISOSpeedRatings")); - niso->initInt (atoi(isov.c_str()), SHORT); + niso->initInt (atoi (isov.c_str()), SHORT); exif->getDirectory()->addTagFront (niso); } } - } else if (make && (!strncmp((char*)make->getValue(), "Panasonic", 9) || !strncmp((char*)make->getValue(), "LEICA", 5))) { - Tag* iso = root->getTag("PanaISO"); + } else if (make && (!strncmp ((char*)make->getValue(), "Panasonic", 9) || !strncmp ((char*)make->getValue(), "LEICA", 5))) { + Tag* iso = root->getTag ("PanaISO"); if (iso) { std::string isov = iso->valueToString (); Tag* niso = new Tag (exif->getDirectory(), exif->getDirectory()->getAttrib ("ISOSpeedRatings")); - niso->initInt (atoi(isov.c_str()), SHORT); + niso->initInt (atoi (isov.c_str()), SHORT); exif->getDirectory()->addTagFront (niso); } } } - if (make && !strncmp((char*)make->getValue(), "Kodak", 5)) { + if (make && !strncmp ((char*)make->getValue(), "Kodak", 5)) { if (!exif) { // old Kodak cameras may have exif tags in IFD0, reparse and create an exif subdir fseek (f, base + firstifd, SEEK_SET); TagDirectory* exifdir = new TagDirectory (nullptr, f, base, exifAttribs, order, true); exif = new Tag (root, root->getAttrib ("Exif")); - exif->initSubDir(exifdir); + exif->initSubDir (exifdir); root->addTagFront (exif); - if (!exif->getDirectory()->getTag("ISOSpeedRatings") && exif->getDirectory()->getTag ("ExposureIndex")) { + if (!exif->getDirectory()->getTag ("ISOSpeedRatings") && exif->getDirectory()->getTag ("ExposureIndex")) { Tag* niso = new Tag (exif->getDirectory(), exif->getDirectory()->getAttrib ("ISOSpeedRatings")); niso->initInt (exif->getDirectory()->getTag ("ExposureIndex")->toInt(), SHORT); exif->getDirectory()->addTagFront (niso); } } - Tag *kodakIFD = root->getTag("KodakIFD"); + Tag *kodakIFD = root->getTag ("KodakIFD"); - if (kodakIFD && kodakIFD->getDirectory()->getTag("TextualInfo")) { - parseKodakIfdTextualInfo(kodakIFD->getDirectory()->getTag("TextualInfo"), exif); + if (kodakIFD && kodakIFD->getDirectory()->getTag ("TextualInfo")) { + parseKodakIfdTextualInfo (kodakIFD->getDirectory()->getTag ("TextualInfo"), exif); } } - parse_leafdata(root, order); + parse_leafdata (root, order); - if (make && !strncmp((char*)make->getValue(), "Hasselblad", 10)) { + if (make && !strncmp ((char*)make->getValue(), "Hasselblad", 10)) { /* Figuring out the Hasselblad model is a mess. Hasselblad raw data comes in four slightly different containers, 3FR (directly from CF card), FFF (same as 3FR but filtered through @@ -2590,20 +2593,20 @@ TagDirectory* ExifManager::parse (FILE* f, int base, bool skipIgnored) of doing so. You need Hasselblad's own software to shoot multi-shot and can only do that tethered. In single-shot mode they should be exactly the same as the single-shot models. */ - Tag *subd = root->getTag(0x14a); - Tag *iw = (subd) ? subd->getDirectory()->getTag("ImageWidth") : nullptr; + Tag *subd = root->getTag (0x14a); + Tag *iw = (subd) ? subd->getDirectory()->getTag ("ImageWidth") : nullptr; int sensorWidth = (iw) ? iw->toInt() : 0; Tag* tmodel = root->getTag ("Model"); const char *model = (tmodel) ? (const char *)tmodel->getValue() : ""; - if (strstr(model, "Hasselblad ") == model) { + if (strstr (model, "Hasselblad ") == model) { model += 11; } else { // if HxD is used in flash sync mode for example, we need to fetch model from this tag - Tag* tmodel3 = root->getTag("UniqueCameraModel"); + Tag* tmodel3 = root->getTag ("UniqueCameraModel"); const char *model3 = (tmodel3) ? (const char *)tmodel3->getValue() : ""; - if (strstr(model3, "Hasselblad ") == model3) { + if (strstr (model3, "Hasselblad ") == model3) { model = model3 + 11; } } @@ -2611,127 +2614,127 @@ TagDirectory* ExifManager::parse (FILE* f, int base, bool skipIgnored) // FIXME: due to lack of test files this Hasselblad model identification is not 100% complete // This needs checking out: CFV-39/CFV-50 3FR, H3DII vs H3D, old CF/CFH models - if (!strcmp(model, "H3D")) { + if (!strcmp (model, "H3D")) { // We can't differ between H3D and H3DII for the 22, 31 and 39 models. There's was no H3D-50 so we know that is a // H3DII-50. At the time of writing I have no test files for the H3D vs H3DII models, so there still may be a chance // to differ between them. AFAIK Adobe's DNG converter don't differ between them, and actually call the H3DII-50 // H3D-50 although Hasselblad never released such a model. switch (sensorWidth) { - case 4096: - tmodel->initString("H3D-22"); - break; + case 4096: + tmodel->initString ("H3D-22"); + break; - case 6542: - tmodel->initString("H3D-31"); - break; + case 6542: + tmodel->initString ("H3D-31"); + break; - case 7262: - tmodel->initString("H3D-39"); - break; + case 7262: + tmodel->initString ("H3D-39"); + break; - case 8282: - tmodel->initString("H3DII-50"); - break; + case 8282: + tmodel->initString ("H3DII-50"); + break; } - } else if (!strcmp(model, "H4D")) { + } else if (!strcmp (model, "H4D")) { switch (sensorWidth) { - case 6542: - tmodel->initString("H4D-31"); - break; + case 6542: + tmodel->initString ("H4D-31"); + break; - case 7410: - tmodel->initString("H4D-40"); - break; + case 7410: + tmodel->initString ("H4D-40"); + break; - case 8282: - tmodel->initString("H4D-50"); - break; + case 8282: + tmodel->initString ("H4D-50"); + break; - case 9044: - tmodel->initString("H4D-60"); - break; + case 9044: + tmodel->initString ("H4D-60"); + break; } - } else if (!strcmp(model, "H5D")) { + } else if (!strcmp (model, "H5D")) { switch (sensorWidth) { - case 7410: - tmodel->initString("H5D-40"); - break; + case 7410: + tmodel->initString ("H5D-40"); + break; - case 8282: - tmodel->initString("H5D-50"); - break; + case 8282: + tmodel->initString ("H5D-50"); + break; - case 8374: - tmodel->initString("H5D-50c"); - break; + case 8374: + tmodel->initString ("H5D-50c"); + break; - case 9044: - tmodel->initString("H5D-60"); - break; + case 9044: + tmodel->initString ("H5D-60"); + break; } - } else if (!strcmp(model, "CFV")) { + } else if (!strcmp (model, "CFV")) { switch (sensorWidth) { - case 7262: - tmodel->initString("CFV-39"); - break; + case 7262: + tmodel->initString ("CFV-39"); + break; - case 8282: - tmodel->initString("CFV-50"); - break; + case 8282: + tmodel->initString ("CFV-50"); + break; - case 8374: - tmodel->initString("CFV-50c"); - break; + case 8374: + tmodel->initString ("CFV-50c"); + break; } } // and a few special cases - Tag* tmodel3 = root->getTag("UniqueCameraModel"); + Tag* tmodel3 = root->getTag ("UniqueCameraModel"); const char *model3 = (tmodel3) ? (const char *)tmodel3->getValue() : ""; - if (strstr(model3, "Hasselblad ") == model3) { + if (strstr (model3, "Hasselblad ") == model3) { model3 = model3 + 11; } - if (!strcmp(model3, "ixpressCF132")) { - tmodel->initString("CF-22"); - } else if (!strcmp(model3, "Hasselblad96")) { - tmodel->initString("CFV"); // popularly called CFV-16, but the official name is CFV - } else if (!strcmp(model3, "Hasselblad234")) { - tmodel->initString("CFV-39"); + if (!strcmp (model3, "ixpressCF132")) { + tmodel->initString ("CF-22"); + } else if (!strcmp (model3, "Hasselblad96")) { + tmodel->initString ("CFV"); // popularly called CFV-16, but the official name is CFV + } else if (!strcmp (model3, "Hasselblad234")) { + tmodel->initString ("CFV-39"); } else if (sensorWidth == 4090) { - tmodel->initString("V96C"); + tmodel->initString ("V96C"); } // and yet some, this is for Adobe-generated DNG files - Tag* tmodel4 = root->getTag("LocalizedCameraModel"); + Tag* tmodel4 = root->getTag ("LocalizedCameraModel"); if (tmodel4) { const char *model4 = (tmodel4) ? (const char *)tmodel4->getValue() : ""; - if (strstr(model4, "Hasselblad ") == model4) { + if (strstr (model4, "Hasselblad ") == model4) { model4 = model4 + 11; } - if (!strcmp(model4, "ixpressCF132-22")) { - tmodel->initString("CF-22"); - } else if (!strcmp(model4, "Hasselblad96-16")) { - tmodel->initString("CFV"); - } else if (!strcmp(model4, "Hasselblad234-39")) { - tmodel->initString("CFV-39"); - } else if (!strcmp(model4, "H3D-50")) { + if (!strcmp (model4, "ixpressCF132-22")) { + tmodel->initString ("CF-22"); + } else if (!strcmp (model4, "Hasselblad96-16")) { + tmodel->initString ("CFV"); + } else if (!strcmp (model4, "Hasselblad234-39")) { + tmodel->initString ("CFV-39"); + } else if (!strcmp (model4, "H3D-50")) { // Adobe names H3DII-50 incorrectly as H3D-50 - tmodel->initString("H3DII-50"); - } else if (strstr(model4, "H3D-") == model4 || strstr(model4, "H4D-") == model4 || strstr(model4, "H5D-") == model4) { - tmodel->initString(model4); + tmodel->initString ("H3DII-50"); + } else if (strstr (model4, "H3D-") == model4 || strstr (model4, "H4D-") == model4 || strstr (model4, "H5D-") == model4) { + tmodel->initString (model4); } } } - if (!root->getTag("Orientation")) { - if (make && !strncmp((char*)make->getValue(), "Phase One", 9)) { + if (!root->getTag ("Orientation")) { + if (make && !strncmp ((char*)make->getValue(), "Phase One", 9)) { int orientation = 0; - Tag *iw = root->getTag("ImageWidth"); + Tag *iw = root->getTag ("ImageWidth"); if (iw) { // from dcraw, derive orientation from image width @@ -2770,7 +2773,7 @@ TagDirectory* ExifManager::parseJPEG (FILE* f) return nullptr; } - if (!memcmp(idbuff + 2, exifid, 6)) { // Exif info found + if (!memcmp (idbuff + 2, exifid, 6)) { // Exif info found tiffbase = ftell (f); return parse (f, tiffbase); } @@ -2792,18 +2795,18 @@ std::vector ExifManager::getDefaultTIFFTags (TagDirectory* forthis) std::vector defTags; defTags.reserve (12); - defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "ImageWidth"), 0, LONG)); - defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "ImageHeight"), 0, LONG)); - defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "XResolution"), 300, RATIONAL)); - defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "YResolution"), 300, RATIONAL)); - defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "ResolutionUnit"), 2, SHORT)); - defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "Software"), "RawTherapee " RTVERSION)); - defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "Orientation"), 1, SHORT)); - defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "SamplesPerPixel"), 3, SHORT)); - defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "BitsPerSample"), 8, SHORT)); - defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "PlanarConfiguration"), 1, SHORT)); - defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "PhotometricInterpretation"), 2, SHORT)); - defTags.push_back (new Tag (forthis, lookupAttrib(ifdAttribs, "Compression"), 1, SHORT)); + defTags.push_back (new Tag (forthis, lookupAttrib (ifdAttribs, "ImageWidth"), 0, LONG)); + defTags.push_back (new Tag (forthis, lookupAttrib (ifdAttribs, "ImageHeight"), 0, LONG)); + defTags.push_back (new Tag (forthis, lookupAttrib (ifdAttribs, "XResolution"), 300, RATIONAL)); + defTags.push_back (new Tag (forthis, lookupAttrib (ifdAttribs, "YResolution"), 300, RATIONAL)); + defTags.push_back (new Tag (forthis, lookupAttrib (ifdAttribs, "ResolutionUnit"), 2, SHORT)); + defTags.push_back (new Tag (forthis, lookupAttrib (ifdAttribs, "Software"), "RawTherapee " RTVERSION)); + defTags.push_back (new Tag (forthis, lookupAttrib (ifdAttribs, "Orientation"), 1, SHORT)); + defTags.push_back (new Tag (forthis, lookupAttrib (ifdAttribs, "SamplesPerPixel"), 3, SHORT)); + defTags.push_back (new Tag (forthis, lookupAttrib (ifdAttribs, "BitsPerSample"), 8, SHORT)); + defTags.push_back (new Tag (forthis, lookupAttrib (ifdAttribs, "PlanarConfiguration"), 1, SHORT)); + defTags.push_back (new Tag (forthis, lookupAttrib (ifdAttribs, "PhotometricInterpretation"), 2, SHORT)); + defTags.push_back (new Tag (forthis, lookupAttrib (ifdAttribs, "Compression"), 1, SHORT)); return defTags; } @@ -2831,7 +2834,7 @@ int ExifManager::createJPEGMarker (const TagDirectory* root, const rtengine::pro TagDirectory* cl; if (root) { - cl = (const_cast(root))->clone (nullptr); + cl = (const_cast (root))->clone (nullptr); } else { cl = new TagDirectory (nullptr, ifdAttribs, INTEL); } @@ -2874,26 +2877,31 @@ int ExifManager::createTIFFHeader (const TagDirectory* root, const rtengine::pro TagDirectory* cl; if (root) { - cl = (const_cast(root))->clone (nullptr); + cl = (const_cast (root))->clone (nullptr); // remove some unknown top level tags which produce warnings when opening a tiff - Tag *removeTag = cl->getTag(0x9003); - if(removeTag) - removeTag->setKeep(false); - removeTag = cl->getTag(0x9211); - if(removeTag) - removeTag->setKeep(false); + Tag *removeTag = cl->getTag (0x9003); + + if (removeTag) { + removeTag->setKeep (false); + } + + removeTag = cl->getTag (0x9211); + + if (removeTag) { + removeTag->setKeep (false); + } } else { cl = new TagDirectory (nullptr, ifdAttribs, HOSTORDER); } // add tiff strip data int rps = 8; - int strips = ceil((double)H / rps); - cl->replaceTag (new Tag (cl, lookupAttrib(ifdAttribs, "RowsPerStrip"), rps, LONG)); - Tag* stripBC = new Tag (cl, lookupAttrib(ifdAttribs, "StripByteCounts")); + int strips = ceil ((double)H / rps); + cl->replaceTag (new Tag (cl, lookupAttrib (ifdAttribs, "RowsPerStrip"), rps, LONG)); + Tag* stripBC = new Tag (cl, lookupAttrib (ifdAttribs, "StripByteCounts")); stripBC->initInt (0, LONG, strips); cl->replaceTag (stripBC); - Tag* stripOffs = new Tag (cl, lookupAttrib(ifdAttribs, "StripOffsets")); + Tag* stripOffs = new Tag (cl, lookupAttrib (ifdAttribs, "StripOffsets")); stripOffs->initInt (0, LONG, strips); cl->replaceTag (stripOffs); @@ -2901,7 +2909,7 @@ int ExifManager::createTIFFHeader (const TagDirectory* root, const rtengine::pro stripBC->setInt (rps * W * 3 * bps / 8, i * 4); } - int remaining = (H - rps * floor((double)H / rps)) * W * 3 * bps / 8; + int remaining = (H - rps * floor ((double)H / rps)) * W * 3 * bps / 8; if (remaining) { stripBC->setInt (remaining, (strips - 1) * 4); @@ -2910,13 +2918,13 @@ int ExifManager::createTIFFHeader (const TagDirectory* root, const rtengine::pro } if (profiledata) { - Tag* icc = new Tag (cl, lookupAttrib(ifdAttribs, "ICCProfile")); + Tag* icc = new Tag (cl, lookupAttrib (ifdAttribs, "ICCProfile")); icc->initUndefArray (profiledata, profilelen); cl->replaceTag (icc); } if (iptcdata) { - Tag* iptc = new Tag (cl, lookupAttrib(ifdAttribs, "IPTCData")); + Tag* iptc = new Tag (cl, lookupAttrib (ifdAttribs, "IPTCData")); iptc->initLongArray (iptcdata, iptclen); cl->replaceTag (iptc); } @@ -2931,10 +2939,10 @@ int ExifManager::createTIFFHeader (const TagDirectory* root, const rtengine::pro defTags[0]->setInt (W, 0, LONG); defTags[1]->setInt (H, 0, LONG); - defTags[8]->initInt(0, SHORT, 3); + defTags[8]->initInt (0, SHORT, 3); for (int i = 0; i < 3; i++) { - defTags[8]->setInt(bps, i * 2, SHORT); + defTags[8]->setInt (bps, i * 2, SHORT); } for (int i = defTags.size() - 1; i >= 0; i--) { @@ -3070,39 +3078,39 @@ short int int2_to_signed (short unsigned int i) * -mm f/- * NB: no space between separator '-'; no space between focal length and 'mm' */ -bool extractLensInfo(std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal) +bool extractLensInfo (std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal) { minFocal = 0.0; maxFocal = 0.0; maxApertureAtMinFocal = 0.0; maxApertureAtMaxFocal = 0.0; char buffer[1024]; - strcpy(buffer, fullname.c_str()); - char *pF = strstr(buffer, "f/" ); + strcpy (buffer, fullname.c_str()); + char *pF = strstr (buffer, "f/" ); - if( pF ) { - sscanf(pF + 2, "%lf-%lf", &maxApertureAtMinFocal, &maxApertureAtMaxFocal); + if ( pF ) { + sscanf (pF + 2, "%lf-%lf", &maxApertureAtMinFocal, &maxApertureAtMaxFocal); - if(maxApertureAtMinFocal > 0. && maxApertureAtMaxFocal == 0.) { + if (maxApertureAtMinFocal > 0. && maxApertureAtMaxFocal == 0.) { maxApertureAtMaxFocal = maxApertureAtMinFocal; } char *pMM = pF - 3; - while( pMM[0] != 'm' && pMM[1] != 'm' && pMM > buffer) { + while ( pMM[0] != 'm' && pMM[1] != 'm' && pMM > buffer) { pMM--; } - if( pMM[0] == 'm' && pMM[1] == 'm' ) { + if ( pMM[0] == 'm' && pMM[1] == 'm' ) { char *sp = pMM; - while( *sp != ' ' && sp > buffer ) { + while ( *sp != ' ' && sp > buffer ) { sp--; } - sscanf(sp + 1, "%lf-%lf", &minFocal, &maxFocal); + sscanf (sp + 1, "%lf-%lf", &minFocal, &maxFocal); - if(maxFocal == 0.) { + if (maxFocal == 0.) { maxFocal = minFocal; } diff --git a/rtexif/rtexif.h b/rtexif/rtexif.h index e1d8ede6e..833f6dbb5 100644 --- a/rtexif/rtexif.h +++ b/rtexif/rtexif.h @@ -54,7 +54,7 @@ const enum ByteOrder HOSTORDER = MOTOROLA; #endif enum MNKind {NOMK, IFD, HEADERIFD, NIKON3, OLYMPUS2, FUJI, TABLESUBDIR}; -bool extractLensInfo(std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal); +bool extractLensInfo (std::string &fullname, double &minFocal, double &maxFocal, double &maxApertureAtMinFocal, double &maxApertureAtMaxFocal); unsigned short sget2 (unsigned char *s, ByteOrder order); int sget4 (unsigned char *s, ByteOrder order); @@ -135,7 +135,7 @@ public: Tag* getTagP (const char* name) const; // Try to get the Tag at a given location. 'name' is a path relative to this directory (e.g. "LensInfo/FocalLength") Tag* getTag (int ID) const; virtual Tag* findTag (const char* name) const; - bool getXMPTagValue(const char* name, char* value) const; + bool getXMPTagValue (const char* name, char* value) const; void keepTag (int ID); virtual void addTag (Tag* a); @@ -197,7 +197,7 @@ protected: TagDirectory* parent; TagDirectory** directory; MNKind makerNoteKind; - bool parseMakerNote(FILE* f, int base, ByteOrder bom ); + bool parseMakerNote (FILE* f, int base, ByteOrder bom ); public: Tag (TagDirectory* parent, FILE* f, int base); // parse next tag from the file @@ -236,7 +236,7 @@ public: } signed char* getSignedValue () const { - return reinterpret_cast(value); + return reinterpret_cast (value); } const TagAttrib* getAttrib () const { @@ -334,62 +334,62 @@ public: { char buffer[1024]; t->toString (buffer); - std::string s(buffer); - std::string::size_type p1 = s.find_first_not_of(' '); + std::string s (buffer); + std::string::size_type p1 = s.find_first_not_of (' '); - if( p1 == std::string::npos ) { + if ( p1 == std::string::npos ) { return s; } else { - return s.substr(p1, s.find_last_not_of(' ') - p1 + 1); + return s.substr (p1, s.find_last_not_of (' ') - p1 + 1); } } virtual void fromString (Tag* t, const std::string& value) { if (t->getType() == SHORT || t->getType() == LONG) { - t->fromInt (atoi(value.c_str())); + t->fromInt (atoi (value.c_str())); } else { t->fromString (value.c_str()); } } // Get the value as a double - virtual double toDouble(Tag* t, int ofs = 0) + virtual double toDouble (Tag* t, int ofs = 0) { double ud, dd; switch (t->getType()) { - case SBYTE: - return double(int(t->getSignedValue()[ofs])); + case SBYTE: + return double (int (t->getSignedValue()[ofs])); - case BYTE: - return (double)((int)t->getValue()[ofs]); + case BYTE: + return (double) ((int)t->getValue()[ofs]); - case ASCII: - return 0.0; + case ASCII: + return 0.0; - case SSHORT: - return (double)int2_to_signed(sget2 (t->getValue() + ofs, t->getOrder())); + case SSHORT: + return (double)int2_to_signed (sget2 (t->getValue() + ofs, t->getOrder())); - case SHORT: - return (double)((int)sget2 (t->getValue() + ofs, t->getOrder())); + case SHORT: + return (double) ((int)sget2 (t->getValue() + ofs, t->getOrder())); - case SLONG: - case LONG: - return (double)((int)sget4 (t->getValue() + ofs, t->getOrder())); + case SLONG: + case LONG: + return (double) ((int)sget4 (t->getValue() + ofs, t->getOrder())); - case SRATIONAL: - case RATIONAL: - ud = (int)sget4 (t->getValue() + ofs, t->getOrder()); - dd = (int)sget4 (t->getValue() + ofs + 4, t->getOrder()); - return dd == 0. ? 0. : (double)ud / (double)dd; + case SRATIONAL: + case RATIONAL: + ud = (int)sget4 (t->getValue() + ofs, t->getOrder()); + dd = (int)sget4 (t->getValue() + ofs + 4, t->getOrder()); + return dd == 0. ? 0. : (double)ud / (double)dd; - case FLOAT: - return double(sget4 (t->getValue() + ofs, t->getOrder())); + case FLOAT: + return double (sget4 (t->getValue() + ofs, t->getOrder())); - case UNDEFINED: - return 0.; + case UNDEFINED: + return 0.; - default: - return 0.; // Quick fix for missing cases (INVALID, DOUBLE, OLYUNDEF, SUBDIR) + default: + return 0.; // Quick fix for missing cases (INVALID, DOUBLE, OLYUNDEF, SUBDIR) } } // Get the value as an int @@ -402,38 +402,38 @@ public: } switch (astype) { - case SBYTE: - return int(t->getSignedValue()[ofs]); + case SBYTE: + return int (t->getSignedValue()[ofs]); - case BYTE: - return t->getValue()[ofs]; + case BYTE: + return t->getValue()[ofs]; - case ASCII: - return 0; + case ASCII: + return 0; - case SSHORT: - return (int)int2_to_signed(sget2 (t->getValue() + ofs, t->getOrder())); + case SSHORT: + return (int)int2_to_signed (sget2 (t->getValue() + ofs, t->getOrder())); - case SHORT: - return (int)sget2 (t->getValue() + ofs, t->getOrder()); + case SHORT: + return (int)sget2 (t->getValue() + ofs, t->getOrder()); - case SLONG: - case LONG: - return (int)sget4 (t->getValue() + ofs, t->getOrder()); + case SLONG: + case LONG: + return (int)sget4 (t->getValue() + ofs, t->getOrder()); - case SRATIONAL: - case RATIONAL: - a = (int)sget4 (t->getValue() + ofs + 4, t->getOrder()); - return a == 0 ? 0 : (int)sget4 (t->getValue() + ofs, t->getOrder()) / a; + case SRATIONAL: + case RATIONAL: + a = (int)sget4 (t->getValue() + ofs + 4, t->getOrder()); + return a == 0 ? 0 : (int)sget4 (t->getValue() + ofs, t->getOrder()) / a; - case FLOAT: - return (int)toDouble(t, ofs); + case FLOAT: + return (int)toDouble (t, ofs); - case UNDEFINED: - return 0; + case UNDEFINED: + return 0; - default: - return 0; // Quick fix for missing cases (INVALID, DOUBLE, OLYUNDEF, SUBDIR) + default: + return 0; // Quick fix for missing cases (INVALID, DOUBLE, OLYUNDEF, SUBDIR) } return 0; @@ -470,28 +470,28 @@ protected: typedef std::pair< T, std::string> p_t; container_t choices; - virtual std::string guess(const T lensID, double focalLength, double maxApertureAtFocal, double *lensInfoArray) + virtual std::string guess (const T lensID, double focalLength, double maxApertureAtFocal, double *lensInfoArray) { it_t r; - size_t nFound = choices.count( lensID ); + size_t nFound = choices.count ( lensID ); - switch( nFound ) { - case 0: { // lens Unknown - std::ostringstream s; - s << lensID; - return s.str(); + switch ( nFound ) { + case 0: { // lens Unknown + std::ostringstream s; + s << lensID; + return s.str(); + } + + case 1: // lens found + r = choices.find ( lensID ); + return r->second; + + default: + // More than one hit: we must guess + break; } - case 1: // lens found - r = choices.find ( lensID ); - return r->second; - - default: - // More than one hit: we must guess - break; - } - - std::string bestMatch("Unknown"); + std::string bestMatch ("Unknown"); double a1, a2, f1, f2; /* FIRST TRY @@ -499,8 +499,8 @@ protected: * Get the lens info (min/man focal, min/max aperture) and compare them to the possible choice */ if (lensInfoArray) { - for ( r = choices.lower_bound( lensID ); r != choices.upper_bound(lensID); ++r ) { - if( !extractLensInfo( r->second , f1, f2, a1, a2) ) { + for ( r = choices.lower_bound ( lensID ); r != choices.upper_bound (lensID); ++r ) { + if ( !extractLensInfo ( r->second, f1, f2, a1, a2) ) { continue; } @@ -513,17 +513,17 @@ protected: // No lens found, we update the "unknown" string with the lens info values if (lensInfoArray[0] == lensInfoArray[1]) { - bestMatch += Glib::ustring::compose(" (%1mm", int(lensInfoArray[0])); + bestMatch += Glib::ustring::compose (" (%1mm", int (lensInfoArray[0])); } else { - bestMatch += Glib::ustring::compose(" (%1-%2mm", int(lensInfoArray[0]), int(lensInfoArray[1])); + bestMatch += Glib::ustring::compose (" (%1-%2mm", int (lensInfoArray[0]), int (lensInfoArray[1])); } if (lensInfoArray[2] == lensInfoArray[3]) { - bestMatch += Glib::ustring::compose(" f/%1)", Glib::ustring::format(std::fixed, std::setprecision(1), lensInfoArray[2])); + bestMatch += Glib::ustring::compose (" f/%1)", Glib::ustring::format (std::fixed, std::setprecision (1), lensInfoArray[2])); } else - bestMatch += Glib::ustring::compose(" f/%1-%2)", - Glib::ustring::format(std::fixed, std::setprecision(1), lensInfoArray[2]), - Glib::ustring::format(std::fixed, std::setprecision(1), lensInfoArray[3])); + bestMatch += Glib::ustring::compose (" f/%1-%2)", + Glib::ustring::format (std::fixed, std::setprecision (1), lensInfoArray[2]), + Glib::ustring::format (std::fixed, std::setprecision (1), lensInfoArray[3])); } /* SECOND TRY @@ -536,45 +536,46 @@ protected: std::ostringstream candidates; double deltaMin = 1000.; - for ( r = choices.lower_bound( lensID ); r != choices.upper_bound(lensID); ++r ) { + for ( r = choices.lower_bound ( lensID ); r != choices.upper_bound (lensID); ++r ) { double dif; - if( !extractLensInfo( r->second , f1, f2, a1, a2) ) { + if ( !extractLensInfo ( r->second, f1, f2, a1, a2) ) { continue; } - if( f1 == 0. || a1 == 0.) { + if ( f1 == 0. || a1 == 0.) { continue; } - if( focalLength < f1 - .5 || focalLength > f2 + 0.5 ) { + if ( focalLength < f1 - .5 || focalLength > f2 + 0.5 ) { continue; } - if( maxApertureAtFocal > 0.1) { + if ( maxApertureAtFocal > 0.1) { double lensAperture; - if( maxApertureAtFocal < a1 - 0.15 || maxApertureAtFocal > a2 + 0.15) { + + if ( maxApertureAtFocal < a1 - 0.15 || maxApertureAtFocal > a2 + 0.15) { continue; } - if( a1 == a2 || f1 == f2) { + if ( a1 == a2 || f1 == f2) { lensAperture = a1; } else { - lensAperture = exp( log(a1) + (log(a2) - log(a1)) / (log(f2) - log(f1)) * (log(focalLength) - log(f1)) ); + lensAperture = exp ( log (a1) + (log (a2) - log (a1)) / (log (f2) - log (f1)) * (log (focalLength) - log (f1)) ); } - dif = std::abs(lensAperture - maxApertureAtFocal); + dif = std::abs (lensAperture - maxApertureAtFocal); } else { dif = 0; } - if( dif < deltaMin ) { + if ( dif < deltaMin ) { deltaMin = dif; bestMatch = r->second; } - if( dif < 0.15) { - if( candidates.tellp() ) { + if ( dif < 0.15) { + if ( candidates.tellp() ) { candidates << "\n or " << r->second; } else { candidates << r->second; @@ -582,7 +583,7 @@ protected: } } - if( !candidates.tellp() ) { + if ( !candidates.tellp() ) { return bestMatch; } else { return candidates.str(); @@ -590,7 +591,7 @@ protected: } }; -inline static int getTypeSize( TagType type ) +inline static int getTypeSize ( TagType type ) { return ("11124811248484"[type < 14 ? type : 0] - '0'); } @@ -627,6 +628,6 @@ extern const TagAttrib sonyCameraSettingsAttribs3[]; //extern const TagAttrib sonyDNGMakerNote[]; extern const TagAttrib olympusAttribs[]; extern const TagAttrib kodakIfdAttribs[]; -void parseKodakIfdTextualInfo(Tag *textualInfo, Tag* exif); +void parseKodakIfdTextualInfo (Tag *textualInfo, Tag* exif); } #endif diff --git a/rtexif/sonyminoltaattribs.cc b/rtexif/sonyminoltaattribs.cc index b3b68df74..7195bf8e5 100644 --- a/rtexif/sonyminoltaattribs.cc +++ b/rtexif/sonyminoltaattribs.cc @@ -1084,17 +1084,17 @@ public: virtual std::string toString (Tag* t) { int lensID = t->toInt(); - Tag *lensInfoTag = t->getParent()->getRoot()->findTag("LensInfo"); - Tag *apertureTag = t->getParent()->getRoot()->findTag("MaxApertureValue"); - Tag *focalLengthTag = t->getParent()->getRoot()->findTag("FocalLength"); + Tag *lensInfoTag = t->getParent()->getRoot()->findTag ("LensInfo"); + Tag *apertureTag = t->getParent()->getRoot()->findTag ("MaxApertureValue"); + Tag *focalLengthTag = t->getParent()->getRoot()->findTag ("FocalLength"); double maxApertureAtFocal = 0.; double focalLength = 0.; - if( apertureTag ) { - maxApertureAtFocal = pow(2.0, apertureTag->toDouble() / 2.0); + if ( apertureTag ) { + maxApertureAtFocal = pow (2.0, apertureTag->toDouble() / 2.0); } - if( focalLengthTag ) { + if ( focalLengthTag ) { focalLength = focalLengthTag->toDouble(); } @@ -1104,9 +1104,9 @@ public: liArray = lensInfoTag->toDoubleArray(); } - std::string retval = guess( lensID, focalLength, maxApertureAtFocal, liArray); + std::string retval = guess ( lensID, focalLength, maxApertureAtFocal, liArray); - if(liArray) { + if (liArray) { delete [] liArray; } @@ -1120,104 +1120,104 @@ class SALensID2Interpreter : public IntLensInterpreter< int > public: SALensID2Interpreter () { - choices.insert(p_t(0, "Unknown E-mount lens or other lens")); - choices.insert(p_t(1, "Sony LA-EA1 Adapter")); - choices.insert(p_t(2, "Sony LA-EA2 Adapter")); - choices.insert(p_t(3, "Sony LA-EA3 Adapter")); - choices.insert(p_t(6, "Sony LA-EA4 Adapter")); - choices.insert(p_t(44, "Metabones Canon EF Smart Adapter")); - choices.insert(p_t(78, "Metabones Canon EF Smart Adapter Mark III or Other Adapter")); - choices.insert(p_t(234, "Metabones Canon EF Smart Adapter Mark IV")); - choices.insert(p_t(239, "Metabones Canon EF Speed Booster")); - choices.insert(p_t(32784, "Sony E 16mm f/2.8")); - choices.insert(p_t(32785, "Sony E 18-55mm f/3.5-5.6 OSS")); - choices.insert(p_t(32786, "Sony E 55-210mm f/4.5-6.3 OSS")); - choices.insert(p_t(32787, "Sony E 18-200mm f/3.5-6.3 OSS")); - choices.insert(p_t(32788, "Sony E 30mm f/3.5 Macro")); - choices.insert(p_t(32789, "Sony E 24mm f/1.8 ZA or Samyang AF 50mm f/1.4 FE")); - choices.insert(p_t(32789, "Samyang AF 50mm f/1.4 FE")); - choices.insert(p_t(32790, "Sony E 50mm f/1.8 OSS or Samyang AF 14mm f/2.8 FE")); - choices.insert(p_t(32790, "Samyang AF 14mm f/2.8 FE")); - choices.insert(p_t(32791, "Sony E 16-70mm f/4 ZA OSS")); - choices.insert(p_t(32792, "Sony E 10-18mm f/4 OSS")); - choices.insert(p_t(32793, "Sony E PZ 16-50mm f/3.5-5.6 OSS")); - choices.insert(p_t(32794, "Sony FE 35mm f/2.8 ZA")); - choices.insert(p_t(32795, "Sony FE 24-70mm f/4 ZA OSS")); - choices.insert(p_t(32796, "Sony FE 85mm f/1.8")); - choices.insert(p_t(32797, "Sony E 18-200mm f/3.5-6.3 OSS LE")); - choices.insert(p_t(32798, "Sony E 20mm f/2.8")); - choices.insert(p_t(32799, "Sony E 35mm f/1.8 OSS")); - choices.insert(p_t(32800, "Sony E PZ 18-105mm f/4 G OSS")); - choices.insert(p_t(32802, "Sony FE 90mm f/2.8 Macro G OSS")); - choices.insert(p_t(32803, "Sony E 18-50mm f/4-5.6")); - choices.insert(p_t(32807, "Sony E PZ 18-200mm f/3.5-6.3 OSS")); - choices.insert(p_t(32808, "Sony FE 55mm f/1.8 ZA")); - choices.insert(p_t(32810, "Sony FE 70-200mm f/4 G OSS")); - choices.insert(p_t(32811, "Sony FE 16-35mm f/4 ZA OSS")); - choices.insert(p_t(32812, "Sony FE 50mm f/2.8 Macro")); - choices.insert(p_t(32813, "Sony FE 28-70mm f/3.5-5.6 OSS")); - choices.insert(p_t(32814, "Sony FE 35mm f/1.4 ZA")); - choices.insert(p_t(32815, "Sony FE 24-240mm f/3.5-6.3 OSS")); - choices.insert(p_t(32816, "Sony FE 28mm f/2")); - choices.insert(p_t(32817, "Sony FE PZ 28-135mm f/4 G OSS")); - choices.insert(p_t(32819, "Sony FE 100mm f/2.8 STF GM OSS")); - choices.insert(p_t(32821, "Sony FE 24-70mm f/2.8 GM")); - choices.insert(p_t(32822, "Sony FE 50mm f/1.4 ZA")); - choices.insert(p_t(32823, "Sony FE 85mm f/1.4 GM")); - choices.insert(p_t(32824, "Sony FE 50mm f/1.8")); - choices.insert(p_t(32826, "Sony FE 21mm f/2.8 (SEL28F20 + SEL075UWC)")); - choices.insert(p_t(32827, "Sony FE 16mm f/3.5 Fisheye (SEL28F20 + SEL057FEC)")); - choices.insert(p_t(32828, "Sony FE 70-300mm f/4.5-5.6 G OSS")); - choices.insert(p_t(32830, "Sony FE 70-200mm f/2.8 GM OSS")); - choices.insert(p_t(33002, "Sigma 85mm f/1.4 DG HSM | A 016 (+ Metabones Ver.50)")); - choices.insert(p_t(33072, "Sony FE 70-200mm f/2.8 GM OSS + 1.4X Teleconverter")); - choices.insert(p_t(33073, "Sony FE 70-200mm f/2.8 GM OSS + 2X Teleconverter")); - choices.insert(p_t(33076, "Sony FE 100mm f/2.8 STF GM OSS (macro mode)")); - choices.insert(p_t(49201, "Zeiss Touit 12mm f/2.8")); - choices.insert(p_t(49202, "Zeiss Touit 32mm f/1.8")); - choices.insert(p_t(49203, "Zeiss Touit 50mm f/2.8 Macro")); - choices.insert(p_t(49216, "Zeiss Batis 25mm f/2")); - choices.insert(p_t(49217, "Zeiss Batis 85mm f/1.8")); - choices.insert(p_t(49218, "Zeiss Batis 18mm f/2.8")); - choices.insert(p_t(49219, "Zeiss Batis 135mm f/2.8")); - choices.insert(p_t(49232, "Zeiss Loxia 50mm f/2")); - choices.insert(p_t(49233, "Zeiss Loxia 35mm f/2")); - choices.insert(p_t(49234, "Zeiss Loxia 21mm f/2.8")); - choices.insert(p_t(49235, "Zeiss Loxia 85mm f/2.4")); - choices.insert(p_t(50480, "Sigma 30mm f/1.4 DC DN | C 016")); - choices.insert(p_t(50481, "Sigma 50mm f/1.4 DG HSM | A 014 + MC-11")); - choices.insert(p_t(50482, "Sigma 18-300mm f/3.5-6.3 DC MACRO OS HSM | C 014 + MC-11")); - choices.insert(p_t(50483, "Sigma 18-35mm f/1.8 DC HSM | A 013 + MC-11")); - choices.insert(p_t(50484, "Sigma 24-35mm f/2 DG HSM | A 015 + MC-11")); - choices.insert(p_t(50486, "Sigma 150-600mm f/5-6.3 DG OS HSM | C 015 + MC-11")); - choices.insert(p_t(50487, "Sigma 20mm f/1.4 DG HSM | A 015 + MC-11")); - choices.insert(p_t(50488, "Sigma 35mm f/1.4 DG HSM | A 012 + MC-11")); - choices.insert(p_t(50489, "Sigma 150-600mm f/5-6.3 DG OS HSM | S 014 + MC-11")); - choices.insert(p_t(50490, "Sigma 120-300mm f/2.8 DG OS HSM | S 013 + MC-11")); - choices.insert(p_t(50492, "Sigma 24-105mm f/4 DG OS HSM | A 013 + MC-11")); - choices.insert(p_t(50493, "Sigma 17-70mm f/2.8-4 DC MACRO OS HSM | C 013 + MC-11")); - choices.insert(p_t(50495, "Sigma 50-100mm f/1.8 DC HSM | A 016 + MC-11")); - choices.insert(p_t(50992, "Voigtlander SUPER WIDE-HELIAR 15mm f/4.5 III")); - choices.insert(p_t(50993, "Voigtlander HELIAR-HYPER WIDE 10mm f/5.6")); - choices.insert(p_t(50994, "Voigtlander ULTRA WIDE-HELIAR 12mm f/5.6 III")); - choices.insert(p_t(50996, "Voigtlander NOKTON 40mm f/1.2 Aspherical")); - choices.insert(p_t(51505, "Samyang AF 14mm f/2.8 FE")); + choices.insert (p_t (0, "Unknown E-mount lens or other lens")); + choices.insert (p_t (1, "Sony LA-EA1 Adapter")); + choices.insert (p_t (2, "Sony LA-EA2 Adapter")); + choices.insert (p_t (3, "Sony LA-EA3 Adapter")); + choices.insert (p_t (6, "Sony LA-EA4 Adapter")); + choices.insert (p_t (44, "Metabones Canon EF Smart Adapter")); + choices.insert (p_t (78, "Metabones Canon EF Smart Adapter Mark III or Other Adapter")); + choices.insert (p_t (234, "Metabones Canon EF Smart Adapter Mark IV")); + choices.insert (p_t (239, "Metabones Canon EF Speed Booster")); + choices.insert (p_t (32784, "Sony E 16mm f/2.8")); + choices.insert (p_t (32785, "Sony E 18-55mm f/3.5-5.6 OSS")); + choices.insert (p_t (32786, "Sony E 55-210mm f/4.5-6.3 OSS")); + choices.insert (p_t (32787, "Sony E 18-200mm f/3.5-6.3 OSS")); + choices.insert (p_t (32788, "Sony E 30mm f/3.5 Macro")); + choices.insert (p_t (32789, "Sony E 24mm f/1.8 ZA or Samyang AF 50mm f/1.4 FE")); + choices.insert (p_t (32789, "Samyang AF 50mm f/1.4 FE")); + choices.insert (p_t (32790, "Sony E 50mm f/1.8 OSS or Samyang AF 14mm f/2.8 FE")); + choices.insert (p_t (32790, "Samyang AF 14mm f/2.8 FE")); + choices.insert (p_t (32791, "Sony E 16-70mm f/4 ZA OSS")); + choices.insert (p_t (32792, "Sony E 10-18mm f/4 OSS")); + choices.insert (p_t (32793, "Sony E PZ 16-50mm f/3.5-5.6 OSS")); + choices.insert (p_t (32794, "Sony FE 35mm f/2.8 ZA")); + choices.insert (p_t (32795, "Sony FE 24-70mm f/4 ZA OSS")); + choices.insert (p_t (32796, "Sony FE 85mm f/1.8")); + choices.insert (p_t (32797, "Sony E 18-200mm f/3.5-6.3 OSS LE")); + choices.insert (p_t (32798, "Sony E 20mm f/2.8")); + choices.insert (p_t (32799, "Sony E 35mm f/1.8 OSS")); + choices.insert (p_t (32800, "Sony E PZ 18-105mm f/4 G OSS")); + choices.insert (p_t (32802, "Sony FE 90mm f/2.8 Macro G OSS")); + choices.insert (p_t (32803, "Sony E 18-50mm f/4-5.6")); + choices.insert (p_t (32807, "Sony E PZ 18-200mm f/3.5-6.3 OSS")); + choices.insert (p_t (32808, "Sony FE 55mm f/1.8 ZA")); + choices.insert (p_t (32810, "Sony FE 70-200mm f/4 G OSS")); + choices.insert (p_t (32811, "Sony FE 16-35mm f/4 ZA OSS")); + choices.insert (p_t (32812, "Sony FE 50mm f/2.8 Macro")); + choices.insert (p_t (32813, "Sony FE 28-70mm f/3.5-5.6 OSS")); + choices.insert (p_t (32814, "Sony FE 35mm f/1.4 ZA")); + choices.insert (p_t (32815, "Sony FE 24-240mm f/3.5-6.3 OSS")); + choices.insert (p_t (32816, "Sony FE 28mm f/2")); + choices.insert (p_t (32817, "Sony FE PZ 28-135mm f/4 G OSS")); + choices.insert (p_t (32819, "Sony FE 100mm f/2.8 STF GM OSS")); + choices.insert (p_t (32821, "Sony FE 24-70mm f/2.8 GM")); + choices.insert (p_t (32822, "Sony FE 50mm f/1.4 ZA")); + choices.insert (p_t (32823, "Sony FE 85mm f/1.4 GM")); + choices.insert (p_t (32824, "Sony FE 50mm f/1.8")); + choices.insert (p_t (32826, "Sony FE 21mm f/2.8 (SEL28F20 + SEL075UWC)")); + choices.insert (p_t (32827, "Sony FE 16mm f/3.5 Fisheye (SEL28F20 + SEL057FEC)")); + choices.insert (p_t (32828, "Sony FE 70-300mm f/4.5-5.6 G OSS")); + choices.insert (p_t (32830, "Sony FE 70-200mm f/2.8 GM OSS")); + choices.insert (p_t (33002, "Sigma 85mm f/1.4 DG HSM | A 016 (+ Metabones Ver.50)")); + choices.insert (p_t (33072, "Sony FE 70-200mm f/2.8 GM OSS + 1.4X Teleconverter")); + choices.insert (p_t (33073, "Sony FE 70-200mm f/2.8 GM OSS + 2X Teleconverter")); + choices.insert (p_t (33076, "Sony FE 100mm f/2.8 STF GM OSS (macro mode)")); + choices.insert (p_t (49201, "Zeiss Touit 12mm f/2.8")); + choices.insert (p_t (49202, "Zeiss Touit 32mm f/1.8")); + choices.insert (p_t (49203, "Zeiss Touit 50mm f/2.8 Macro")); + choices.insert (p_t (49216, "Zeiss Batis 25mm f/2")); + choices.insert (p_t (49217, "Zeiss Batis 85mm f/1.8")); + choices.insert (p_t (49218, "Zeiss Batis 18mm f/2.8")); + choices.insert (p_t (49219, "Zeiss Batis 135mm f/2.8")); + choices.insert (p_t (49232, "Zeiss Loxia 50mm f/2")); + choices.insert (p_t (49233, "Zeiss Loxia 35mm f/2")); + choices.insert (p_t (49234, "Zeiss Loxia 21mm f/2.8")); + choices.insert (p_t (49235, "Zeiss Loxia 85mm f/2.4")); + choices.insert (p_t (50480, "Sigma 30mm f/1.4 DC DN | C 016")); + choices.insert (p_t (50481, "Sigma 50mm f/1.4 DG HSM | A 014 + MC-11")); + choices.insert (p_t (50482, "Sigma 18-300mm f/3.5-6.3 DC MACRO OS HSM | C 014 + MC-11")); + choices.insert (p_t (50483, "Sigma 18-35mm f/1.8 DC HSM | A 013 + MC-11")); + choices.insert (p_t (50484, "Sigma 24-35mm f/2 DG HSM | A 015 + MC-11")); + choices.insert (p_t (50486, "Sigma 150-600mm f/5-6.3 DG OS HSM | C 015 + MC-11")); + choices.insert (p_t (50487, "Sigma 20mm f/1.4 DG HSM | A 015 + MC-11")); + choices.insert (p_t (50488, "Sigma 35mm f/1.4 DG HSM | A 012 + MC-11")); + choices.insert (p_t (50489, "Sigma 150-600mm f/5-6.3 DG OS HSM | S 014 + MC-11")); + choices.insert (p_t (50490, "Sigma 120-300mm f/2.8 DG OS HSM | S 013 + MC-11")); + choices.insert (p_t (50492, "Sigma 24-105mm f/4 DG OS HSM | A 013 + MC-11")); + choices.insert (p_t (50493, "Sigma 17-70mm f/2.8-4 DC MACRO OS HSM | C 013 + MC-11")); + choices.insert (p_t (50495, "Sigma 50-100mm f/1.8 DC HSM | A 016 + MC-11")); + choices.insert (p_t (50992, "Voigtlander SUPER WIDE-HELIAR 15mm f/4.5 III")); + choices.insert (p_t (50993, "Voigtlander HELIAR-HYPER WIDE 10mm f/5.6")); + choices.insert (p_t (50994, "Voigtlander ULTRA WIDE-HELIAR 12mm f/5.6 III")); + choices.insert (p_t (50996, "Voigtlander NOKTON 40mm f/1.2 Aspherical")); + choices.insert (p_t (51505, "Samyang AF 14mm f/2.8 FE")); } virtual std::string toString (Tag* t) { int lensID = t->toInt(); - Tag *lensInfoTag = t->getParent()->getRoot()->findTag("LensInfo"); - Tag *apertureTag = t->getParent()->getRoot()->findTag("MaxApertureValue"); - Tag *focalLengthTag = t->getParent()->getRoot()->findTag("FocalLength"); + Tag *lensInfoTag = t->getParent()->getRoot()->findTag ("LensInfo"); + Tag *apertureTag = t->getParent()->getRoot()->findTag ("MaxApertureValue"); + Tag *focalLengthTag = t->getParent()->getRoot()->findTag ("FocalLength"); double maxApertureAtFocal = 0.; double focalLength = 0.; - if( apertureTag ) { - maxApertureAtFocal = pow(2.0, apertureTag->toDouble() / 2.0); + if ( apertureTag ) { + maxApertureAtFocal = pow (2.0, apertureTag->toDouble() / 2.0); } - if( focalLengthTag ) { + if ( focalLengthTag ) { focalLength = focalLengthTag->toDouble(); } @@ -1227,9 +1227,9 @@ public: liArray = lensInfoTag->toDoubleArray(); } - std::string retval = guess( lensID, focalLength, maxApertureAtFocal, liArray); + std::string retval = guess ( lensID, focalLength, maxApertureAtFocal, liArray); - if(liArray) { + if (liArray) { delete [] liArray; } @@ -2002,7 +2002,7 @@ public: { double a = t->toDouble(); - if(a > 0) { + if (a > 0) { char buffer[32]; sprintf (buffer, "%.4f", a); return buffer; @@ -2023,8 +2023,8 @@ public: } // Decode the value - if(a > 0) { - return pow(2., 6. - (double(a) / 8.)); + if (a > 0) { + return pow (2., 6. - (double (a) / 8.)); } else { return 0.; } @@ -2045,8 +2045,8 @@ public: } // Decode the value - if(a) { - return int(powf(2.f, 6.f - (float(a) / 8.f)) + 0.5f); + if (a) { + return int (powf (2.f, 6.f - (float (a) / 8.f)) + 0.5f); } else { return 0; } @@ -2060,9 +2060,9 @@ public: SAFNumberInterpreter () {} virtual std::string toString (Tag* t) { - double a = double(t->toDouble()); + double a = double (t->toDouble()); - if(a) { + if (a) { char buffer[32]; sprintf (buffer, "%.1f", a / 100. ); return buffer; @@ -2083,8 +2083,8 @@ public: } // Decode the value - if(a > 0) { - return pow(2., (double(a) / 8. - 1.) / 2.); + if (a > 0) { + return pow (2., (double (a) / 8. - 1.) / 2.); } else { return 0.; } @@ -2105,8 +2105,8 @@ public: } // Decode the value - if(a) { - return int(powf(2.f, (float(a) / 8.f - 1.f) / 2.f) + 0.5f); + if (a) { + return int (powf (2.f, (float (a) / 8.f - 1.f) / 2.f) + 0.5f); } else { return 0; } @@ -2122,7 +2122,7 @@ public: { int a = t->toInt(); - if(a) { + if (a) { char buffer[32]; sprintf (buffer, "%d", a ); return buffer; @@ -2146,8 +2146,8 @@ public: } // Decode the value - if(a && a != 254) { // 254 = 'Auto' for CameraSettings3, but we might say the same for CameraSettings & CameraSettings2 (?) - return int(expf((double(a) / 8.f - 6.f) * logf(2.f)) * 100.f + 0.5f); + if (a && a != 254) { // 254 = 'Auto' for CameraSettings3, but we might say the same for CameraSettings & CameraSettings2 (?) + return int (expf ((double (a) / 8.f - 6.f) * logf (2.f)) * 100.f + 0.5f); } else { return 0; } @@ -2171,7 +2171,7 @@ public: // Get the value int a = t->getValue()[ofs]; // Decode the value - return (double(a) - 128.) / 24.; + return (double (a) - 128.) / 24.; } }; SAExposureCompSetInterpreter saExposureCompSetInterpreter; diff --git a/rtexif/stdattribs.cc b/rtexif/stdattribs.cc index ed8f97819..f82bbd832 100644 --- a/rtexif/stdattribs.cc +++ b/rtexif/stdattribs.cc @@ -332,7 +332,7 @@ public: char buffer[32]; double v = t->toDouble(); - if( v < 0. || v > 1000. ) { + if ( v < 0. || v > 1000. ) { return "undef"; } @@ -349,9 +349,9 @@ public: virtual std::string toString (Tag* t) { char buffer[32]; - double v = pow(2.0, t->toDouble() / 2.0); + double v = pow (2.0, t->toDouble() / 2.0); - if( v < 0. || v > 1000. ) { + if ( v < 0. || v > 1000. ) { return "undef"; } @@ -370,7 +370,7 @@ public: char buffer[32]; double v = t->toDouble(); - if( v < -1000. || v > 1000. ) { + if ( v < -1000. || v > 1000. ) { return "undef"; } @@ -429,7 +429,7 @@ public: char buffer[32]; double v = t->toDouble(); - if( v > 1000000. || v < 0 ) { + if ( v > 1000000. || v < 0 ) { return "undef"; } @@ -446,20 +446,22 @@ public: virtual std::string toString (Tag* t) { int count = t->getCount(); - if(count <= 8) { + + if (count <= 8) { return std::string(); } - count = std::min(count, 65535); // limit to 65535 chars to avoid crashes in case of corrupted metadata + + count = std::min (count, 65535); // limit to 65535 chars to avoid crashes in case of corrupted metadata char *buffer = new char[count - 7]; - if (!memcmp((char*)t->getValue(), "ASCII\0\0\0", 8)) { + if (!memcmp ((char*)t->getValue(), "ASCII\0\0\0", 8)) { strncpy (buffer, (char*)t->getValue() + 8, count - 8); buffer[count - 8] = '\0'; } else { buffer[0] = 0; } - std::string retVal(buffer); + std::string retVal (buffer); delete [] buffer; return retVal; } @@ -483,8 +485,8 @@ public: char colors[] = "RGB"; char buffer[1024]; - for( int i = 0; i < t->getCount(); i++) { - unsigned char c = t->toInt(i, BYTE); + for ( int i = 0; i < t->getCount(); i++) { + unsigned char c = t->toInt (i, BYTE); buffer[i] = c < 3 ? colors[c] : ' '; }