mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Build for embedded systems
This commit is contained in:
@@ -41,6 +41,8 @@
|
||||
//M*/
|
||||
|
||||
#include "exif.hpp"
|
||||
#include "opencv2/core/cvdef.h"
|
||||
#include "opencv2/core/base.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -79,14 +81,15 @@ ExifReader::~ExifReader()
|
||||
*/
|
||||
bool ExifReader::parse()
|
||||
{
|
||||
try {
|
||||
CV_TRY {
|
||||
m_exif = getExif();
|
||||
if( !m_exif.empty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (ExifParsingError&) {
|
||||
} CV_CATCH (ExifParsingError, e) {
|
||||
CV_UNUSED(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -150,11 +153,11 @@ std::map<int, ExifEntry_t > ExifReader::getExif()
|
||||
case COM:
|
||||
bytesToSkip = getFieldSize();
|
||||
if (bytesToSkip < markerSize) {
|
||||
throw ExifParsingError();
|
||||
CV_THROW (ExifParsingError());
|
||||
}
|
||||
m_stream.seekg( static_cast<long>( bytesToSkip - markerSize ), m_stream.cur );
|
||||
if ( m_stream.fail() ) {
|
||||
throw ExifParsingError();
|
||||
CV_THROW (ExifParsingError());
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -165,12 +168,12 @@ std::map<int, ExifEntry_t > ExifReader::getExif()
|
||||
case APP1: //actual Exif Marker
|
||||
exifSize = getFieldSize();
|
||||
if (exifSize <= offsetToTiffHeader) {
|
||||
throw ExifParsingError();
|
||||
CV_THROW (ExifParsingError());
|
||||
}
|
||||
m_data.resize( exifSize - offsetToTiffHeader );
|
||||
m_stream.seekg( static_cast<long>( offsetToTiffHeader ), m_stream.cur );
|
||||
if ( m_stream.fail() ) {
|
||||
throw ExifParsingError();
|
||||
CV_THROW (ExifParsingError());
|
||||
}
|
||||
m_stream.read( reinterpret_cast<char*>(&m_data[0]), exifSize - offsetToTiffHeader );
|
||||
count = m_stream.gcount();
|
||||
@@ -415,7 +418,7 @@ std::string ExifReader::getString(const size_t offset) const
|
||||
dataOffset = getU32( offset + 8 );
|
||||
}
|
||||
if (dataOffset > m_data.size() || dataOffset + size > m_data.size()) {
|
||||
throw ExifParsingError();
|
||||
CV_THROW (ExifParsingError());
|
||||
}
|
||||
std::vector<uint8_t>::const_iterator it = m_data.begin() + dataOffset;
|
||||
std::string result( it, it + size ); //copy vector content into result
|
||||
@@ -432,7 +435,7 @@ std::string ExifReader::getString(const size_t offset) const
|
||||
uint16_t ExifReader::getU16(const size_t offset) const
|
||||
{
|
||||
if (offset + 1 >= m_data.size())
|
||||
throw ExifParsingError();
|
||||
CV_THROW (ExifParsingError());
|
||||
|
||||
if( m_format == INTEL )
|
||||
{
|
||||
@@ -450,7 +453,7 @@ uint16_t ExifReader::getU16(const size_t offset) const
|
||||
uint32_t ExifReader::getU32(const size_t offset) const
|
||||
{
|
||||
if (offset + 3 >= m_data.size())
|
||||
throw ExifParsingError();
|
||||
CV_THROW (ExifParsingError());
|
||||
|
||||
if( m_format == INTEL )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user