Project

General

Profile

Bug #855 ยป main.cpp

small test program that segfaults with part0.jpg from the link - Tobias E., 07 Oct 2012 04:08

 
1
#include <exiv2/easyaccess.hpp>
2
#include <exiv2/image.hpp>
3
#include <exiv2/exif.hpp>
4

    
5
int main(int argc, char **argv){
6
	char *filename;
7
	Exiv2::Image::AutoPtr image;
8
	Exiv2::ExifData::const_iterator pos;
9

    
10
	if(argc < 2) return 0;
11
	filename = argv[1];
12

    
13
	image = Exiv2::ImageFactory::open(filename);
14
	if(image.get() == 0) return 0;
15
	image->readMetadata();
16

    
17
	Exiv2::ExifData &exifData = image->exifData();
18

    
19
	if ( (pos=Exiv2::focalLength(exifData)) != exifData.end() ){
20
		float focalLength = pos->toFloat();
21
	}
22

    
23
	return 1;
24
}
    (1-1/1)