Skip to content

Commit 9b4118a

Browse files
committed
Initialize member variables
Silences sporadic warnings from clang/GCC
1 parent 7d7d456 commit 9b4118a

File tree

1 file changed

+130
-100
lines changed

1 file changed

+130
-100
lines changed

exif.h

Lines changed: 130 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -90,115 +90,145 @@ class EXIFInfo {
9090
}
9191

9292
// Data fields filled out by parseFrom()
93-
char ByteAlign; // 0 = Motorola byte alignment, 1 = Intel
94-
std::string ImageDescription; // Image description
95-
std::string Make; // Camera manufacturer's name
96-
std::string Model; // Camera model
97-
unsigned short Orientation; // Image orientation
98-
// 1: Horizontal (normal)
99-
// 2: Mirror horizontal
100-
// 3: Rotate 180
101-
// 4: Mirror vertical
102-
// 5: Mirror horizontal and rotate 270 CW
103-
// 6: Rotate 90 CW
104-
// 7: Mirror horizontal and rotate 90 CW
105-
// 8: Rotate 270 CW
106-
unsigned short BitsPerSample; // Number of bits per component
107-
double XResolution; // Num pixels per <ResolutionUnit> - 72dpi by default
108-
double YResolution; // Num pixels per <ResolutionUnit> - 72dpi by default
109-
unsigned short ResolutionUnit; // Units for <XResolution> and <YResolution>
110-
// 1: (unused)
111-
// 2: inches (default)
112-
// 3: centimetres
113-
std::string Software; // Software used
114-
std::string DateTime; // File change date and time
93+
char ByteAlign{1}; // 0 = Motorola byte alignment, 1 = Intel
94+
std::string ImageDescription; // Image description
95+
std::string Make; // Camera manufacturer's name
96+
std::string Model; // Camera model
97+
unsigned short Orientation{1}; // Image orientation
98+
// 1: Horizontal (normal)
99+
// 2: Mirror horizontal
100+
// 3: Rotate 180
101+
// 4: Mirror vertical
102+
// 5: Mirror horizontal and rotate 270 CW
103+
// 6: Rotate 90 CW
104+
// 7: Mirror horizontal and rotate 90 CW
105+
// 8: Rotate 270 CW
106+
unsigned short BitsPerSample{8}; // Number of bits per component
107+
double XResolution{72}; // Num pixels per <ResolutionUnit> - 72dpi by default
108+
double YResolution{72}; // Num pixels per <ResolutionUnit> - 72dpi by default
109+
unsigned short ResolutionUnit{3}; // Units for <XResolution> and
110+
// <YResolution> 1: (unused) 2: inches
111+
// (default) 3: centimetres
112+
std::string Software; // Software used
113+
std::string DateTime; // File change date and time
115114
std::string DateTimeOriginal; // Original file date and time (may not exist)
116115
std::string DateTimeDigitized; // Digitization date and time (may not exist)
117116
std::string
118117
SubSecTimeOriginal; // Sub-second time that original picture was taken
119118
std::string Copyright; // File copyright information
120-
double ExposureTime; // Exposure time in seconds
121-
double FNumber; // F/stop
122-
unsigned short ExposureProgram; // Exposure program
123-
// 0: Not defined
124-
// 1: Manual
125-
// 2: Normal program
126-
// 3: Aperture priority
127-
// 4: Shutter priority
128-
// 5: Creative program
129-
// 6: Action program
130-
// 7: Portrait mode
131-
// 8: Landscape mode
132-
unsigned short ExposureMode; // Exposure mode
133-
// 0: Auto
134-
// 1: Manual
135-
// 2: Auto bracket
136-
unsigned short WhiteBalance; // 0 = Auto
137-
// 1 = Manual
138-
unsigned short ISOSpeedRatings; // ISO speed
139-
double ShutterSpeedValue; // Shutter speed (reciprocal of exposure time)
140-
double ExposureBiasValue; // Exposure bias value in EV
141-
double SubjectDistance; // Distance to focus point in meters
142-
double FocalLength; // Focal length of lens in millimeters
143-
unsigned short FocalLengthIn35mm; // Focal length in 35mm film
144-
unsigned short
145-
FlashUnmodified; // The raw data from the field (Not an EXIF field name)
146-
// The other three fields don't cover all possibilities
147-
// for the flash info (e.g. 0x08 "On, Did not fire")
148-
char Flash; // 0 = no flash, 1 = flash used
149-
unsigned short FlashReturnedLight; // Flash returned light status
150-
// 0: No strobe return detection function
151-
// 1: Reserved
152-
// 2: Strobe return light not detected
153-
// 3: Strobe return light detected
154-
unsigned short FlashMode; // Flash mode
155-
// 0: Unknown
156-
// 1: Compulsory flash firing
157-
// 2: Compulsory flash suppression
158-
// 3: Automatic mode
159-
unsigned short MeteringMode; // Metering mode
160-
// 1: average
161-
// 2: center weighted average
162-
// 3: spot
163-
// 4: multi-spot
164-
// 5: multi-segment
165-
unsigned short ColorSpace; // 0x1 = sRGB
166-
// 0x2 = Adobe RGB
167-
// 0xfffd = Wide Gamut RGB
168-
// 0xfffe = ICC Profile
169-
// 0xffff = Uncalibrated
170-
unsigned ImageWidth; // Image width reported in EXIF data
171-
unsigned ImageHeight; // Image height reported in EXIF data
172-
struct Geolocation_t { // GPS information embedded in file
173-
double Latitude; // Image latitude expressed as decimal
174-
double Longitude; // Image longitude expressed as decimal
175-
double Altitude; // Altitude in meters, relative to sea level
176-
char AltitudeRef; // 0 = above sea level, -1 = below sea level
177-
double DOP; // GPS degree of precision (DOP)
119+
double ExposureTime{
120+
std::numeric_limits<double>::max()}; // Exposure time in seconds
121+
double FNumber{std::numeric_limits<double>::max()}; // F/stop
122+
unsigned short ExposureProgram{0}; // Exposure program
123+
// 0: Not defined
124+
// 1: Manual
125+
// 2: Normal program
126+
// 3: Aperture priority
127+
// 4: Shutter priority
128+
// 5: Creative program
129+
// 6: Action program
130+
// 7: Portrait mode
131+
// 8: Landscape mode
132+
unsigned short ExposureMode{
133+
std::numeric_limits<unsigned short>::max()}; // Exposure mode
134+
// 0: Auto
135+
// 1: Manual
136+
// 2: Auto bracket
137+
unsigned short WhiteBalance{
138+
std::numeric_limits<unsigned short>::max()}; // 0 = Auto
139+
// 1 = Manual
140+
unsigned short ISOSpeedRatings{
141+
std::numeric_limits<unsigned short>::max()}; // ISO speed
142+
double ShutterSpeedValue{
143+
std::numeric_limits<double>::max()}; // Shutter speed (reciprocal of
144+
// exposure time)
145+
double ExposureBiasValue{
146+
std::numeric_limits<double>::max()}; // Exposure bias value in EV
147+
double SubjectDistance{
148+
std::numeric_limits<double>::max()}; // Distance to focus point in meters
149+
double FocalLength{
150+
std::numeric_limits<double>::max()}; // Focal length of lens in
151+
// millimeters
152+
unsigned short FocalLengthIn35mm{
153+
std::numeric_limits<unsigned short>::max()}; // Focal length in 35mm film
154+
unsigned short FlashUnmodified{
155+
std::numeric_limits<unsigned short>::
156+
max()}; // The raw data from the field (Not an EXIF field name)
157+
// The other three fields don't cover all possibilities
158+
// for the flash info (e.g. 0x08 "On, Did not fire")
159+
char Flash{std::numeric_limits<char>::max()}; // 0 = no flash, 1 = flash used
160+
unsigned short FlashReturnedLight{std::numeric_limits<
161+
unsigned short>::max()}; // Flash returned light status
162+
// 0: No strobe return detection function
163+
// 1: Reserved
164+
// 2: Strobe return light not detected
165+
// 3: Strobe return light detected
166+
unsigned short FlashMode{
167+
std::numeric_limits<unsigned short>::max()}; // Flash mode
168+
// 0: Unknown
169+
// 1: Compulsory flash
170+
// firing 2: Compulsory
171+
// flash suppression 3:
172+
// Automatic mode
173+
unsigned short MeteringMode{0}; // Metering mode
174+
// 1: average
175+
// 2: center weighted average
176+
// 3: spot
177+
// 4: multi-spot
178+
// 5: multi-segment
179+
unsigned short ColorSpace{
180+
std::numeric_limits<unsigned short>::max()}; // 0x1 = sRGB
181+
// 0x2 = Adobe RGB
182+
// 0xfffd = Wide Gamut RGB
183+
// 0xfffe = ICC Profile
184+
// 0xffff = Uncalibrated
185+
unsigned ImageWidth{
186+
std::numeric_limits<unsigned int>::max()}; // Image width reported in
187+
// EXIF data
188+
unsigned ImageHeight{
189+
std::numeric_limits<unsigned int>::max()}; // Image height reported in
190+
// EXIF data
191+
struct Geolocation_t { // GPS information embedded in file
192+
double Latitude{
193+
std::numeric_limits<double>::max()}; // Image latitude expressed as
194+
// decimal
195+
double Longitude{
196+
std::numeric_limits<double>::max()}; // Image longitude expressed as
197+
// decimal
198+
double Altitude{
199+
std::numeric_limits<double>::max()}; // Altitude in meters, relative to
200+
// sea level
201+
char AltitudeRef{0}; // 0 = above sea level, -1 = below sea level
202+
double DOP{
203+
std::numeric_limits<double>::max()}; // GPS degree of precision (DOP)
178204
struct Coord_t {
179-
double degrees;
180-
double minutes;
181-
double seconds;
182-
char direction;
205+
double degrees{std::numeric_limits<double>::max()};
206+
double minutes{std::numeric_limits<double>::max()};
207+
double seconds{std::numeric_limits<double>::max()};
208+
char direction{'?'};
183209
} LatComponents,
184210
LonComponents; // Latitude, Longitude expressed in deg/min/sec
185211
} GeoLocation;
186-
struct LensInfo_t { // Lens information
187-
double FStopMin; // Min aperture (f-stop)
188-
double FStopMax; // Max aperture (f-stop)
189-
double FocalLengthMin; // Min focal length (mm)
190-
double FocalLengthMax; // Max focal length (mm)
191-
double FocalPlaneXResolution; // Focal plane X-resolution
192-
double FocalPlaneYResolution; // Focal plane Y-resolution
193-
unsigned short
194-
FocalPlaneResolutionUnit; // Focal plane resolution unit
195-
// 1: No absolute unit of measurement.
196-
// 2: Inch.
197-
// 3: Centimeter.
198-
// 4: Millimeter.
199-
// 5: Micrometer.
200-
std::string Make; // Lens manufacturer
201-
std::string Model; // Lens model
212+
struct LensInfo_t { // Lens information
213+
double FStopMin{
214+
std::numeric_limits<double>::max()}; // Min aperture (f-stop)
215+
double FStopMax{
216+
std::numeric_limits<double>::max()}; // Max aperture (f-stop)
217+
double FocalLengthMin{
218+
std::numeric_limits<double>::max()}; // Min focal length (mm)
219+
double FocalLengthMax{
220+
std::numeric_limits<double>::max()}; // Max focal length (mm)
221+
double FocalPlaneXResolution{
222+
std::numeric_limits<double>::max()}; // Focal plane X-resolution
223+
double FocalPlaneYResolution{
224+
std::numeric_limits<double>::max()}; // Focal plane Y-resolution
225+
unsigned short FocalPlaneResolutionUnit{2}; // Focal plane resolution unit
226+
// 1: No absolute unit of
227+
// measurement. 2: Inch. 3:
228+
// Centimeter. 4: Millimeter.
229+
// 5: Micrometer.
230+
std::string Make; // Lens manufacturer
231+
std::string Model; // Lens model
202232
} LensInfo;
203233

204234
EXIFInfo() { clear(); }

0 commit comments

Comments
 (0)