Fix in largeiptc-test
This commit is contained in:
parent
235087af4e
commit
215099e977
@ -3,11 +3,12 @@
|
||||
|
||||
#include <exiv2/exiv2.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char* const argv[])
|
||||
try {
|
||||
{
|
||||
try {
|
||||
Exiv2::XmpParser::initialize();
|
||||
::atexit(Exiv2::XmpParser::terminate);
|
||||
|
||||
@ -23,10 +24,12 @@ try {
|
||||
if (io.open() != 0) {
|
||||
throw Exiv2::Error(Exiv2::kerDataSourceOpenFailed, io.path(), Exiv2::strError());
|
||||
}
|
||||
Exiv2::DataBuf buf((long)io.size());
|
||||
Exiv2::DataBuf buf(static_cast<long>(io.size()));
|
||||
std::cout << "Reading " << buf.size_ << " bytes from " << data << "\n";
|
||||
io.read(buf.pData_, buf.size_);
|
||||
if (io.error() || !io.eof()) throw Exiv2::Error(Exiv2::kerFailedToReadImageData);
|
||||
long readBytes = io.read(buf.pData_, buf.size_);
|
||||
if (readBytes != buf.size_ || io.error() || io.eof()) {
|
||||
throw Exiv2::Error(Exiv2::kerFailedToReadImageData);
|
||||
}
|
||||
|
||||
// Read metadata from file
|
||||
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(file);
|
||||
@ -65,8 +68,8 @@ try {
|
||||
image->writeMetadata();
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exiv2::AnyError& e) {
|
||||
} catch (Exiv2::AnyError& e) {
|
||||
std::cout << "Caught Exiv2 exception '" << e << "'\n";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user