Merge branch '0.27-maintenance' into http_iotest_0.27
This commit is contained in:
commit
7e55f5d5be
@ -90,13 +90,8 @@ if( EXIV2_BUILD_UNIT_TESTS )
|
||||
)
|
||||
endif()
|
||||
|
||||
# Run a reduced test suite on UNIX #902
|
||||
set (TEST alltest)
|
||||
if ( CMAKE_HOST_SOLARIS OR CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" )
|
||||
set (TEST unixtest)
|
||||
endif()
|
||||
add_custom_target(version_test
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" ./version_test.sh
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make version_test
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/test"
|
||||
)
|
||||
|
||||
@ -106,14 +101,14 @@ if( EXIV2_BUILD_SAMPLES )
|
||||
if( EXIV2_BUILD_UNIT_TESTS )
|
||||
add_custom_target(tests
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make unit_test
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make ${TEST}
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make bash_tests
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make python_tests
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make version_test
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/test"
|
||||
)
|
||||
else()
|
||||
add_custom_target(tests
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make ${TEST}
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make bash_tests
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make python_tests
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make version_test
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/test"
|
||||
@ -124,7 +119,7 @@ if( EXIV2_BUILD_SAMPLES )
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/test"
|
||||
)
|
||||
add_custom_target(bash_tests
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make ${TEST}
|
||||
COMMAND env EXIV2_BINDIR="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" make bash_tests
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/test"
|
||||
)
|
||||
add_subdirectory( samples )
|
||||
|
||||
77
README.md
77
README.md
@ -31,6 +31,8 @@
|
||||
1. [Running tests on a UNIX-like system](#4-1)
|
||||
2. [Running tests on Visual Studio builds](#4-2)
|
||||
3. [Unit tests](#4-3)
|
||||
4. [Python tests](#4-4)
|
||||
5. [Test Summary](#4-5)
|
||||
5. [Platform Notes](#5)
|
||||
1. [Linux](#5-1)
|
||||
2. [macOS](#5-2)
|
||||
@ -701,7 +703,7 @@ You will find that 3 tests fail at the end of the test suite. It is safe to ign
|
||||
|
||||
### 2.17 Building with C++11 and other compilers
|
||||
|
||||
Exiv2 uses the default compiler for your system. Exiv2 v0.27 was written to the C++ 1998 standard and uses auto\_ptr. The C++11 and C++14 compilers will issue deprecation warnings about auto\_ptr. As _auto\_ptr support has been removed from C++17, you cannot build Exiv2 v0.27 with C++17 or later compilers._ Exiv2 v0.28 and later do not use auto\_ptr and will build with modern Standard C++ Compilers.
|
||||
Exiv2 uses the default compiler for your system. Exiv2 v0.27 was written to the C++ 1998 standard and uses auto\_ptr. The C++11 and C++14 compilers will issue deprecation warnings about auto\_ptr. As _auto\_ptr support has been removed from C++17, you cannot build Exiv2 v0.27 with C++17 or later compilers._ Exiv2 v0.28 and later do not use auto\_ptr and will build with all modern C++ Standard Compilers.
|
||||
|
||||
To generate a build with C++11:
|
||||
|
||||
@ -789,7 +791,7 @@ The Variables EXIV2\_PORT or EXIV2\_HTTP can be set to None to skip http tests.
|
||||
|
||||
### 4.1 Running tests on a UNIX-like system
|
||||
|
||||
You can run the suite directly from the build:
|
||||
You can run tests directly from the build:
|
||||
|
||||
```bash
|
||||
$ cmake .. -G "Unix Makefiles"
|
||||
@ -805,11 +807,11 @@ You can run individual tests in the `test` directory using the environment varia
|
||||
```bash
|
||||
$ cd <exiv2dir>/build
|
||||
$ cd ../test
|
||||
$ env EXIV2_BINDIR=${PWD}/../build/bin ./icc-test.sh
|
||||
$ ./icc-test.sh
|
||||
ICC jpg md5 webp md5 png md5 jpg md5
|
||||
all testcases passed.
|
||||
|
||||
$ env EXIV2_BINDIR=${PWD}/../build/bin make python_tests
|
||||
$ make python_tests
|
||||
... lots of output ...
|
||||
test_run (tiff_test.test_tiff_test_program.TestTiffTestProg) ... ok
|
||||
----------------------------------------------------------------------
|
||||
@ -850,7 +852,7 @@ $ make tests
|
||||
$ make python_tests
|
||||
$ ./icc-test.sh
|
||||
```
|
||||
##### Running tests suite from cmd.exe
|
||||
##### Running tests from cmd.exe
|
||||
|
||||
You can build with Visual Studio using Conan. The is described in detail in [README-CONAN.md](README-CONAN.md)
|
||||
|
||||
@ -875,15 +877,16 @@ c:\...\exiv2\build>copy c:\Python37\python.exe c:\Python37\python3.exe
|
||||
You must set the environment strings EXIV2\_BINDIR, EXIV2\_EXT and modify PATH. You will need a DOS Python3 interpreter on your path, and you'll need the bash interpreter. By careful to ensure the DOS python3.exe is found before the MingW/msys2 python3.
|
||||
|
||||
```
|
||||
c:\...\exiv2\build>set EXIV2_BINDIR=%CD%
|
||||
c:\...\exiv2\build>set EXIV2_EXT=.exe
|
||||
c:\...\exiv2\build>cd bin
|
||||
c:\...\exiv2\build\bin>set EXIV2_BINDIR=%CD%
|
||||
c:\...\exiv2\build\bin>set EXIV2_EXT=.exe
|
||||
c:\...\exiv2\build\bin>set "PATH=c:\Python37;c:\Python37\Scripts;c:\msys64\usr\bin;%PATH%"
|
||||
```
|
||||
|
||||
Move to the test directory and use make (which is in c:\msys64\usr\bin) to drive the test procedures. You cannot run the tests in the build directory because there is no Makefile in the build directory.
|
||||
|
||||
```
|
||||
c:\...\exiv2\build>cd ..\test
|
||||
c:\...\exiv2\build\bin>cd ..\..\test
|
||||
c:\...\exiv2\test>make bash_tests
|
||||
...
|
||||
c:\...\exiv2\test>make python_tests # or unit_test or version_test
|
||||
@ -942,6 +945,61 @@ The code for the unit tests is in `<exiv2dir>/unitTests`. To include unit tests
|
||||
|
||||
There is a discussion on the web about installing GTest: [https://github.com/Exiv2/exiv2/issues/575](https://github.com/Exiv2/exiv2/issues/575)
|
||||
|
||||
[TOC](#TOC)
|
||||
<div id="4-4">
|
||||
|
||||
### 4.4 Python tests
|
||||
|
||||
You can run the python tests from the build or test directory:
|
||||
|
||||
```bash
|
||||
$ cd <exiv2dir>/build (or cd <exiv2dir>/test)
|
||||
$ make python_tests
|
||||
```
|
||||
|
||||
If you wish to run in verbose mode:
|
||||
|
||||
```bash
|
||||
$ cd <exiv2dir>/build (or cd <exiv2dir>/test)
|
||||
$ make python_tests VERBOSE=1
|
||||
```
|
||||
|
||||
The python tests are stored in the directory `tests` and you can run them all with the command:
|
||||
|
||||
```bash
|
||||
$ cd <exiv2dir>/tests
|
||||
$ python3 runner.py
|
||||
```
|
||||
|
||||
You can run them individually with the commands such as:
|
||||
|
||||
```bash
|
||||
$ cd <exiv2dir>/tests
|
||||
$ python3 runner.py --verbose bugfixes/redmine/test_issue_841.py # or $(find . -name "*841*.py")
|
||||
```
|
||||
|
||||
You may wish to get a brief summary of failures with commands such as:
|
||||
|
||||
```bash
|
||||
$ cd <exiv2dir>/build ( or cd <exiv2dir>/test)
|
||||
$ make python_tests 2>&1 | grep FAIL
|
||||
```
|
||||
|
||||
[TOC](#TOC)
|
||||
<div id="4-5">
|
||||
|
||||
### 4.5 Test Summary
|
||||
|
||||
| *Tests* | Unix Style Platforms _(bash)_ | Visual Studio _(cmd.exe)_ |
|
||||
|:-- |:--- |:-- |
|
||||
| | $ cd \<exiv2dir\>/build or $ cd \<exiv2dir\>/test | \> cd \<exiv2dir\>/build |
|
||||
| all | $ make tests | \> cmake --build . --config Release --target tests |
|
||||
| bash | $ make bash_tests | \> cmake --build . --config Release --target bash_tests |
|
||||
| python | $ make python_tests | \> cmake --build . --config Release --target python_tests |
|
||||
| unit | $ make unit_test | \> cmake --build . --config Release --target unit_test |
|
||||
| version | $ make version_test | \> cmake --build . --config Release --target version_test |
|
||||
|
||||
|
||||
[TOC](#TOC)
|
||||
<div id="5">
|
||||
|
||||
@ -1205,4 +1263,5 @@ $ sudo pkg install developer/gcc-7
|
||||
|
||||
[TOC](#TOC)
|
||||
|
||||
Written by Robin Mills<br>robin@clanmills.com<br>Updated: 2020-05-14
|
||||
Written by Robin Mills<br>robin@clanmills.com<br>Updated: 2020-05-12
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH EXIV2 1 "April 30, 2020"
|
||||
.TH EXIV2 1 "May 12, 2020"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
@ -132,7 +132,7 @@ exiv2 [ opt [arg] ]+ [ act ] file ...
|
||||
.sp 1
|
||||
option [arg] long option description
|
||||
-a tim --adjust Modify time stamps. [+|-]HH[:MM[:SS[.mmm]]]
|
||||
-b --binary Show large binary values (default is to suppress them).
|
||||
-b --binary Show large binary values (default is to restrict them).
|
||||
-c txt --comment JPEG comment string to set in the image ('modify' action). ...
|
||||
-d tgt --delete Delete target(s) for the 'delete' action. ...
|
||||
-D +-n --days Time adjustment by a positive or negative number of days ...
|
||||
@ -211,7 +211,7 @@ or 'm'(ute). The default log-level is 'w'. \fB\-Qm\fP is equivalent
|
||||
to \fB\-q\fP. All log messages are written to standard error.
|
||||
.TP
|
||||
.B \-b
|
||||
Show large binary values (default is to suppress them).
|
||||
The output from large binary values is to restricted by default. When outputting the value of a large value such as MakerNote, the default behaviour is to restrict the data and end with "...". The option --binary enables you to see all the data.
|
||||
.TP
|
||||
.B \-u
|
||||
Show unknown tags (default is to suppress tags which don't have a name).
|
||||
@ -543,13 +543,13 @@ $ exiv2 -M'set Exif.Photo.UserComment charset=Ascii My photo' x.jpg
|
||||
$ exiv2 -pa --grep UserComment x.jpg
|
||||
Exif.Photo.UserComment Undefined 16 My photo
|
||||
$ exiv2 -pv --grep UserComment x.jpg
|
||||
0x9286 Photo UserComment Undefined 16 charset="Ascii" My photo
|
||||
0x9286 Photo UserComment Undefined 16 charset=Ascii My photo
|
||||
|
||||
$ exiv2 -M'set Exif.Photo.UserComment charset=Unicode \\u0052\\u006f\\u0062\\u0069\\u006e' x.jpg
|
||||
$ exiv2 -pa --grep UserComment x.jpg
|
||||
Exif.Photo.UserComment Undefined 18 Robin
|
||||
$ exiv2 -pv --grep UserComment x.jpg
|
||||
0x9286 Photo UserComment Undefined 18 charset="Unicode" Robin
|
||||
0x9286 Photo UserComment Undefined 18 charset=Unicode Robin
|
||||
|
||||
$ exiv2 -M'set Exif.GPSInfo.GPSProcessingMethod HYBRID-FIX' x.jpg
|
||||
$ exiv2 -pa --grep ProcessingMethod x.jpg
|
||||
|
||||
@ -132,7 +132,7 @@ void print(const std::string& file)
|
||||
<< std::dec << std::setw(3)
|
||||
<< std::setfill(' ') << std::right
|
||||
<< i->count() << " "
|
||||
<< std::dec << i->value()
|
||||
<< std::dec << i->toString()
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ try {
|
||||
<< std::dec << std::setw(3)
|
||||
<< std::setfill(' ') << std::right
|
||||
<< i->count() << " "
|
||||
<< std::dec << i->value()
|
||||
<< std::dec << i->toString()
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ try {
|
||||
<< std::dec << std::setw(3)
|
||||
<< std::setfill(' ') << std::right
|
||||
<< md->count() << " "
|
||||
<< std::dec << md->value()
|
||||
<< std::dec << md->toString()
|
||||
<< std::endl;
|
||||
}
|
||||
Exiv2::XmpParser::terminate();
|
||||
|
||||
@ -43,7 +43,7 @@ try {
|
||||
<< std::dec << std::setw(3)
|
||||
<< std::setfill(' ') << std::right
|
||||
<< md->count() << " "
|
||||
<< std::dec << md->value()
|
||||
<< std::dec << md->toString()
|
||||
<< std::endl;
|
||||
}
|
||||
filename += "-new";
|
||||
|
||||
@ -55,7 +55,7 @@ int main(int argc, char** argv)
|
||||
<< std::dec << std::setw(3)
|
||||
<< std::setfill(' ') << std::right
|
||||
<< md->count() << " "
|
||||
<< std::dec << md->value()
|
||||
<< std::dec << md->toString()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
||||
@ -606,6 +606,16 @@ namespace Action {
|
||||
return result ;
|
||||
}
|
||||
|
||||
static void binaryOutput(bool suppressLong,const std::ostringstream& os)
|
||||
{
|
||||
const int dots = 100;
|
||||
if ( suppressLong && os.str().length() > dots ) {
|
||||
std::cout << os.str().substr(0,dots) << " ..." ;
|
||||
} else {
|
||||
std::cout << os.str();
|
||||
}
|
||||
}
|
||||
|
||||
bool Print::printMetadatum(const Exiv2::Metadatum& md, const Exiv2::Image* pImage)
|
||||
{
|
||||
if (!grepTag(md.key()))
|
||||
@ -689,75 +699,30 @@ namespace Action {
|
||||
if (!first)
|
||||
std::cout << " ";
|
||||
first = false;
|
||||
if (md.size() > 128 && Params::instance().binary_ &&
|
||||
(md.typeId() == Exiv2::undefined || md.typeId() == Exiv2::unsignedByte ||
|
||||
md.typeId() == Exiv2::signedByte)) {
|
||||
std::cout << _("(Binary value suppressed)") << std::endl;
|
||||
return true;
|
||||
}
|
||||
bool done = false;
|
||||
// handle `comment` typeIDs
|
||||
// $ bin/taglist | grep '\tComment,' | cut -d, -f 5
|
||||
// Exif.Photo.UserComment
|
||||
// Exif.GPSInfo.GPSProcessingMethod
|
||||
// Exif.GPSInfo.GPSAreaInformation
|
||||
if( md.key() == "Exif.Photo.UserComment"
|
||||
|| md.key() == "Exif.GPSInfo.GPSProcessingMethod"
|
||||
|| md.key() == "Exif.GPSInfo.GPSAreaInformation"
|
||||
) {
|
||||
const Exiv2::CommentValue* pcv = dynamic_cast<const Exiv2::CommentValue*>(&md.value());
|
||||
if (pcv) {
|
||||
Exiv2::CommentValue::CharsetId csId = pcv->charsetId();
|
||||
if (csId != Exiv2::CommentValue::undefined) {
|
||||
std::cout << "charset=\"" << Exiv2::CommentValue::CharsetInfo::name(csId) << "\" ";
|
||||
}
|
||||
std::cout << pcv->comment(Params::instance().charset_.c_str());
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
if (!done) {
|
||||
// #1114 - show negative values for SByte
|
||||
if (md.typeId() != Exiv2::signedByte) {
|
||||
std::cout << std::dec << md.value();
|
||||
} else {
|
||||
int value = md.value().toLong();
|
||||
std::cout << std::dec << (value < 128 ? value : value - 256);
|
||||
std::ostringstream os;
|
||||
// #1114 - show negative values for SByte
|
||||
if (md.typeId() == Exiv2::signedByte) {
|
||||
for ( int c = 0 ; c < md.value().count() ; c++ ) {
|
||||
int value = md.value().toLong(c);
|
||||
os << (c?" ":"") << std::dec << (value < 128 ? value : value - 256);
|
||||
}
|
||||
} else {
|
||||
os << std::dec << md.value();
|
||||
}
|
||||
binaryOutput(Params::instance().binary_,os);
|
||||
}
|
||||
if (Params::instance().printItems_ & Params::prTrans) {
|
||||
if (!first)
|
||||
std::cout << " ";
|
||||
first = false;
|
||||
if (Params::instance().binary_ &&
|
||||
(md.typeId() == Exiv2::undefined || md.typeId() == Exiv2::unsignedByte ||
|
||||
md.typeId() == Exiv2::signedByte) &&
|
||||
md.size() > 128) {
|
||||
std::cout << _("(Binary value suppressed)") << std::endl;
|
||||
return true;
|
||||
}
|
||||
bool done = false;
|
||||
if (0 == strcmp(md.key().c_str(), "Exif.Photo.UserComment")) {
|
||||
const Exiv2::CommentValue* pcv = dynamic_cast<const Exiv2::CommentValue*>(&md.value());
|
||||
if (pcv) {
|
||||
std::cout << pcv->comment(Params::instance().charset_.c_str());
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
if (!done)
|
||||
std::cout << std::dec << md.print(&pImage->exifData());
|
||||
std::ostringstream os;
|
||||
os << std::dec << md.print(&pImage->exifData());
|
||||
binaryOutput(Params::instance().binary_,os) ;
|
||||
}
|
||||
if (Params::instance().printItems_ & Params::prHex) {
|
||||
if (!first)
|
||||
std::cout << std::endl;
|
||||
first = false;
|
||||
if (Params::instance().binary_ &&
|
||||
(md.typeId() == Exiv2::undefined || md.typeId() == Exiv2::unsignedByte ||
|
||||
md.typeId() == Exiv2::signedByte) &&
|
||||
md.size() > 128) {
|
||||
std::cout << _("(Binary value suppressed)") << std::endl;
|
||||
return true;
|
||||
}
|
||||
Exiv2::DataBuf buf(md.size());
|
||||
md.copy(buf.pData_, pImage->byteOrder());
|
||||
Exiv2::hexdump(std::cout, buf.pData_, buf.size_);
|
||||
|
||||
17
src/exif.cpp
17
src/exif.cpp
@ -219,10 +219,19 @@ namespace Exiv2 {
|
||||
std::ostream& Exifdatum::write(std::ostream& os, const ExifData* pMetadata) const
|
||||
{
|
||||
if (value().count() == 0) return os;
|
||||
PrintFct fct = printValue;
|
||||
const TagInfo* ti = Internal::tagInfo(tag(), static_cast<IfdId>(ifdId()));
|
||||
if (ti != 0) fct = ti->printFct_;
|
||||
return fct(os, value(), pMetadata);
|
||||
|
||||
PrintFct fct = printValue;
|
||||
const TagInfo* ti = Internal::tagInfo(tag(), static_cast<IfdId>(ifdId()));
|
||||
// be careful with comments (User.Photo.UserComment, GPSAreaInfo etc).
|
||||
if ( ti ) {
|
||||
fct = ti->printFct_;
|
||||
if ( ti->typeId_ == comment ) {
|
||||
os << value().toString();
|
||||
fct=NULL;
|
||||
}
|
||||
}
|
||||
if ( fct ) fct(os, value(), pMetadata);
|
||||
return os;
|
||||
}
|
||||
|
||||
const Value& Exifdatum::value() const
|
||||
|
||||
@ -1562,7 +1562,7 @@ namespace Exiv2 {
|
||||
N_("A tag for Exif users to write keywords or comments on the image "
|
||||
"besides those in <ImageDescription>, and without the "
|
||||
"character code limitations of the <ImageDescription> tag."),
|
||||
exifId, userInfo, comment, 0, print0x9286),
|
||||
exifId, userInfo, comment, 0, printValue),
|
||||
TagInfo(0x9290, "SubSecTime", N_("Sub-seconds Time"),
|
||||
N_("A tag used to record fractions of seconds for the <DateTime> tag."),
|
||||
exifId, dateTime, asciiString, 0, printValue),
|
||||
@ -1913,11 +1913,11 @@ namespace Exiv2 {
|
||||
TagInfo(0x001b, "GPSProcessingMethod", N_("GPS Processing Method"),
|
||||
N_("A character string recording the name of the method used for location finding. "
|
||||
"The string encoding is defined using the same scheme as UserComment."),
|
||||
gpsId, gpsTags, comment, 0, print0x9286),
|
||||
gpsId, gpsTags, comment, 0, printValue),
|
||||
TagInfo(0x001c, "GPSAreaInformation", N_("GPS Area Information"),
|
||||
N_("A character string recording the name of the GPS area."
|
||||
"The string encoding is defined using the same scheme as UserComment."),
|
||||
gpsId, gpsTags, comment, 0, print0x9286),
|
||||
gpsId, gpsTags, comment, 0, printValue),
|
||||
TagInfo(0x001d, "GPSDateStamp", N_("GPS Date Stamp"),
|
||||
N_("A character string recording date and time information relative to UTC "
|
||||
"(Coordinated Universal Time). The format is \"YYYY:MM:DD.\"."),
|
||||
@ -2642,18 +2642,6 @@ namespace Exiv2 {
|
||||
return os;
|
||||
}
|
||||
|
||||
std::ostream& print0x9286(std::ostream& os, const Value& value, const ExifData*)
|
||||
{
|
||||
const CommentValue* pcv = dynamic_cast<const CommentValue*>(&value);
|
||||
if (pcv) {
|
||||
os << pcv->comment();
|
||||
}
|
||||
else {
|
||||
os << value;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
//! ColorSpace, tag 0xa001
|
||||
extern const TagDetails exifColorSpace[] = {
|
||||
{ 1, N_("sRGB") },
|
||||
|
||||
@ -404,8 +404,6 @@ namespace Exiv2 {
|
||||
std::ostream& print0x9208(std::ostream& os, const Value& value, const ExifData*);
|
||||
//! Print the actual focal length of the lens
|
||||
std::ostream& print0x920a(std::ostream& os, const Value& value, const ExifData*);
|
||||
//! Print the user comment
|
||||
std::ostream& print0x9286(std::ostream& os, const Value& value, const ExifData*);
|
||||
//! Print color space
|
||||
std::ostream& print0xa001(std::ostream& os, const Value& value, const ExifData*);
|
||||
//! Print sensing method
|
||||
|
||||
@ -550,11 +550,23 @@ namespace Exiv2 {
|
||||
{
|
||||
CharsetId csId = charsetId();
|
||||
if (csId != undefined) {
|
||||
os << "charset=\"" << CharsetInfo::name(csId) << "\" ";
|
||||
os << "charset=" << CharsetInfo::name(csId) << " ";
|
||||
}
|
||||
return os << comment();
|
||||
}
|
||||
|
||||
// test string for printable ascii-7 (' ' .. '~')
|
||||
static bool isBinary(const std::string& s)
|
||||
{
|
||||
bool result = false ;
|
||||
size_t i = 0;
|
||||
while ( !result && i < s.length() ) {
|
||||
unsigned char c = (unsigned char) s[i++];
|
||||
result = c < 32 || c > 127 ;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string CommentValue::comment(const char* encoding) const
|
||||
{
|
||||
std::string c;
|
||||
@ -565,6 +577,12 @@ namespace Exiv2 {
|
||||
if (charsetId() == unicode) {
|
||||
const char* from = encoding == 0 || *encoding == '\0' ? detectCharset(c) : encoding;
|
||||
convertStringCharset(c, from, "UTF-8");
|
||||
} else {
|
||||
// charset=undefined reports "binary comment" if it contains non-printable bytes
|
||||
// this is to ensure no binary bytes in the output stream.
|
||||
if ( isBinary(c) ) {
|
||||
c = "binary comment" ;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
@ -505,7 +505,7 @@ namespace Exiv2 {
|
||||
enforce(filesize_u32 <= io_->size(), Exiv2::kerCorruptedMetadata);
|
||||
|
||||
// Check that `filesize_u32` is safe to cast to `long`.
|
||||
enforce(filesize_u32 <= static_cast<size_t>(std::numeric_limits<long>::max()),
|
||||
enforce(filesize_u32 <= static_cast<size_t>(std::numeric_limits<unsigned int>::max()),
|
||||
Exiv2::kerCorruptedMetadata);
|
||||
|
||||
WebPImage::decodeChunks(static_cast<long>(filesize_u32));
|
||||
@ -530,7 +530,7 @@ namespace Exiv2 {
|
||||
const uint32_t size_u32 = Exiv2::getULong(size_buff, littleEndian);
|
||||
|
||||
// Check that `size_u32` is safe to cast to `long`.
|
||||
enforce(size_u32 <= static_cast<size_t>(std::numeric_limits<long>::max()),
|
||||
enforce(size_u32 <= static_cast<size_t>(std::numeric_limits<unsigned int>::max()),
|
||||
Exiv2::kerCorruptedMetadata);
|
||||
const long size = static_cast<long>(size_u32);
|
||||
|
||||
|
||||
@ -72,29 +72,24 @@ SVN = svn://dev.exiv2.org/svn/testdata/trunk
|
||||
|
||||
##
|
||||
# Add test drivers to this list
|
||||
TESTS1 = addmoddel.sh \
|
||||
TESTS = addmoddel.sh \
|
||||
conversions.sh \
|
||||
exifdata-test.sh \
|
||||
exiv2-test.sh \
|
||||
geotag-test.sh \
|
||||
icc-test.sh \
|
||||
iso65k-test.sh \
|
||||
modify-test.sh \
|
||||
path-test.sh \
|
||||
stringto-test.sh \
|
||||
webp-test.sh \
|
||||
write2-test.sh \
|
||||
|
||||
# the following tests are broken on UNIX
|
||||
# You can manually run all the tests: `cd <exiv2dir>/test ; env EXIV2_BINDIR=$PWD/../build/bin make test`
|
||||
# You can manually run a single test: `cd <exiv2dir>/test ; env EXIV2_BINDIR=$PWD/../build/bin ./iotest.sh`
|
||||
# Or: make iotest
|
||||
TESTS2 = exifdata-test.sh \
|
||||
exiv2-test.sh \
|
||||
imagetest.sh \
|
||||
iotest.sh \
|
||||
iptctest.sh \
|
||||
iso65k-test.sh \
|
||||
modify-test.sh \
|
||||
path-test.sh \
|
||||
preview-test.sh \
|
||||
stringto-test.sh \
|
||||
tiff-test.sh \
|
||||
webp-test.sh \
|
||||
write-test.sh \
|
||||
write2-test.sh \
|
||||
xmpparser-test.sh
|
||||
|
||||
# video tests
|
||||
@ -136,30 +131,29 @@ xmpparser-test:
|
||||
|
||||
version_test \
|
||||
unit_test :
|
||||
@echo
|
||||
@echo ---- Running $@ ----
|
||||
@echo
|
||||
-@./$@.sh
|
||||
|
||||
bash_tests:
|
||||
-@if [ -e $$EXIV2_BINDIR/../Makefile ]; then \
|
||||
-@./$@.sh ; \
|
||||
else \
|
||||
make alltest ; \
|
||||
fi
|
||||
|
||||
tests:
|
||||
-@if [ -e $$EXIV2_BINDIR/../Makefile ]; then \
|
||||
-@./$@.sh ; \
|
||||
else \
|
||||
make unit_test ; make alltest ; make python_tests ; make version_test ; \
|
||||
make unit_test ; \
|
||||
make bash_tests ; \
|
||||
make python_tests ; \
|
||||
make version_test ; \
|
||||
fi
|
||||
|
||||
|
||||
alltest:
|
||||
bash_tests:
|
||||
@echo
|
||||
@echo ---- Running bash tests: ALL ----
|
||||
@echo ---- Running bash_tests ----
|
||||
@echo
|
||||
mkdir -p tmp
|
||||
@mkdir -p tmp
|
||||
@rm -rf tmp/test-failed
|
||||
@list='$(TESTS1) $(TESTS2)'; for p in $$list; do \
|
||||
@list='$(TESTS)'; for p in $$list; do \
|
||||
echo Running $$p ...; \
|
||||
./$$p; \
|
||||
rc=$$?; \
|
||||
@ -168,25 +162,13 @@ alltest:
|
||||
done
|
||||
@if [ -e tmp/test-failed ]; then echo ; echo '***' FAILED ; cat tmp/test-failed ; echo '***' ; fi
|
||||
|
||||
unixtest:
|
||||
@echo
|
||||
@echo ---- Running bash tests: UNIX subset ----
|
||||
@echo
|
||||
mkdir -p tmp
|
||||
@rm -rf tmp/test-failed
|
||||
@list='$(TESTS1)'; for p in $$list; do \
|
||||
echo Running $$p ...; \
|
||||
./$$p; \
|
||||
rc=$$?; \
|
||||
if [ $$rc -ne 0 ]; then echo '***' ; echo '***' $$p result = $$rc ; echo '***' ; fi ; \
|
||||
if [ $$rc -ne 0 ]; then echo '***' $$p result = $$rc >> tmp/test-failed ; fi ; \
|
||||
done
|
||||
@if [ -e tmp/test-failed ]; then echo '***' FAILED ; cat tmp/test-failed ; echo '***' ; fi
|
||||
|
||||
python_tests:
|
||||
@echo
|
||||
@echo ---- Running python_tests ----
|
||||
@echo
|
||||
-( cd ../tests ; if [ ! -z $$VERBOSE ]; then verbose=--verbose ;fi ; python3 runner.py $$verbose )
|
||||
|
||||
|
||||
testv:
|
||||
@for t in /video ; do \
|
||||
if [ ! -e data/$$t ]; then \
|
||||
|
||||
@ -69,7 +69,7 @@ fi
|
||||
grep x-default l.xmp
|
||||
copyTestFile $IMG l.jpg
|
||||
runTest exiv2 -iX l.jpg
|
||||
runTest exiv2 -px l.jpg
|
||||
runTest exiv2 -px -b l.jpg
|
||||
runTest exiv2 -PEkycv l.jpg
|
||||
runTest exiv2 -pi l.jpg
|
||||
|
||||
|
||||
@ -42,9 +42,9 @@ Iptc.Application2.Caption String 20 How to fix this mess
|
||||
Testcase 6
|
||||
==========
|
||||
Exif.Image.ExifTag Long 1 26
|
||||
Exif.Photo.UserComment Undefined 59 charset="Jis" This is a JIS encoded Exif user comment. Or was it?
|
||||
Exif.Photo.UserComment Undefined 59 charset=Jis This is a JIS encoded Exif user comment. Or was it?
|
||||
Xmp.exif.UserComment LangAlt 1 lang="x-default" This is a JIS encoded Exif user comment. Or was it?
|
||||
Exif.Photo.UserComment Undefined 110 charset="Unicode" This is a JIS encoded Exif user comment. Or was it?
|
||||
Exif.Photo.UserComment Undefined 110 charset=Unicode This is a JIS encoded Exif user comment. Or was it?
|
||||
File 1/1: m.xmp
|
||||
m.xmp: No IPTC data found in the file
|
||||
|
||||
@ -52,7 +52,7 @@ Testcase 7
|
||||
==========
|
||||
Xmp.exif.UserComment LangAlt 1 lang="x-default" This is a JIS encoded Exif user comment. Or was it?
|
||||
Exif.Image.ExifTag Long 1 26
|
||||
Exif.Photo.UserComment Undefined 110 charset="Unicode" This is a JIS encoded Exif user comment. Or was it?
|
||||
Exif.Photo.UserComment Undefined 110 charset=Unicode This is a JIS encoded Exif user comment. Or was it?
|
||||
File 1/1: n.jpg
|
||||
n.jpg: No IPTC data found in the file
|
||||
|
||||
|
||||
@ -267,7 +267,7 @@ Exif.Canon.FileNumber 0x0008 Makernote Long 1
|
||||
Exif.Canon.OwnerName 0x0009 Makernote Ascii 32 Andreas Huggel
|
||||
Exif.Canon.ModelID 0x0010 Makernote Long 1 17891328
|
||||
Exif.Canon.CameraInfo 0x000d Makernote Short 21 42 3 32769 378 32769 0 0 0 259 2 0 10 0 0 0 57 198 5 0 0 0
|
||||
Exif.Photo.UserComment 0x9286 Exif Undefined 264 | ||||