Merge pull request #2131 from Exiv2/mainCleanups

Include what you use + more SPDX identifiers + few other cleanups
This commit is contained in:
Luis Díaz Más 2022-03-11 21:02:45 +01:00 committed by GitHub
commit c115d4daf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
116 changed files with 356 additions and 1592 deletions

View File

@ -1,51 +1,41 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "config.h"
#include "actions.hpp"
#include "app_utils.hpp"
#include "actions.hpp"
#include "exiv2app.hpp"
#include "image.hpp"
#include "jpgimage.hpp"
#include "xmpsidecar.hpp"
#include "types.hpp"
#include "exif.hpp"
#include "config.h"
#include "easyaccess.hpp"
#include "iptc.hpp"
#include "xmp_exiv2.hpp"
#include "preview.hpp"
#include "exif.hpp"
#include "futils.hpp"
#include "i18n.h" // NLS support.
#include "i18n.h" // NLS support.
#include "image.hpp"
#include "iptc.hpp"
#include "preview.hpp"
#include "types.hpp"
#include "xmp_exiv2.hpp"
// + standard includes
#include <sys/stat.h> // for stat()
#include <sys/types.h> // for stat()
#include <filesystem>
#include <string>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <cmath>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <mutex>
#include <stdexcept>
#include <sys/types.h> // for stat()
#include <sys/stat.h> // for stat()
#include <sstream>
#ifdef EXV_HAVE_UNISTD_H
# include <unistd.h> // for stat()
#include <unistd.h> // for stat()
#endif
#if defined(_WIN32) || defined(__CYGWIN__)
# include <sys/utime.h>
#include <Windows.h>
#include <windows.h>
#include <fcntl.h>
#include <io.h>
#include <sys/utime.h>
#else
# include <utime.h>
#include <utime.h>
#endif
#if !defined(__MINGW__) && !defined(_MSC_VER)
@ -202,7 +192,7 @@ namespace Action {
}
}
} else {
_setmode(_fileno(stdout),O_BINARY);
_setmode(fileno(stdout),O_BINARY);
result = printStructure(std::cout, option, path);
}
@ -571,7 +561,7 @@ namespace Action {
std::cout << std::endl;
Exiv2::DataBuf buf(md.size());
md.copy(buf.data(), pImage->byteOrder());
Exiv2::hexdump(std::cout, buf.c_data(), static_cast<long>(buf.size()));
Exiv2::hexdump(std::cout, buf.c_data(), buf.size());
}
std::cout << std::endl;
return true;
@ -834,7 +824,7 @@ namespace Action {
bool bStdout = (Params::instance().target_ & Params::ctStdInOut) != 0;
if (bStdout) {
_setmode(_fileno(stdout), _O_BINARY);
_setmode(fileno(stdout), _O_BINARY);
}
if (Params::instance().target_ & Params::ctThumb) {
@ -1905,7 +1895,7 @@ namespace {
// if we used a temporary target, copy it to stdout
if ( rc == 0 && bStdout ) {
FILE* f = ::fopen(target.c_str(),"rb") ;
_setmode(_fileno(stdout),O_BINARY);
_setmode(fileno(stdout),O_BINARY);
if ( f ) {
char buffer[8*1024];

View File

@ -12,7 +12,6 @@
#define ACTIONS_HPP_
// *****************************************************************************
// included header files
#include "exiv2app.hpp"
#include <unordered_map>

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include <cstdlib>
#include <climits>

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef APP_UTILS_HPP_
#define APP_UTILS_HPP_

View File

@ -8,7 +8,6 @@
#include "exiv2app.hpp"
#include "convert.hpp"
#include "futils.hpp"
#include "getopt.hpp"
#include "i18n.h" // NLS support.
#include "xmp_exiv2.hpp"
@ -22,10 +21,12 @@
#include <regex>
#if defined(_WIN32) || defined(__CYGWIN__)
#include <Windows.h>
#include <windows.h>
#include <fcntl.h>
#include <io.h>
#else
#include <sys/select.h>
#include <sys/time.h>
#include <unistd.h>
#endif
@ -965,14 +966,13 @@ static int readFileToBuf(FILE* f,Exiv2::DataBuf& buf)
return nBytes;
}
//#define DEBUG
void Params::getStdin(Exiv2::DataBuf& buf)
{
// copy stdin to stdinBuf
if (stdinBuf.empty()) {
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__) || defined(_MSC_VER)
DWORD fdwMode;
_setmode(fileno(stdin), O_BINARY);
_setmode(fileno(stdin),O_BINARY);
Sleep(300);
if ( !GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &fdwMode) ) { // failed: stdin has bytes!
#else
@ -1381,7 +1381,9 @@ namespace {
if (cmdEnd == std::string::npos || keyStart == std::string::npos) {
std::string cmdLine ;
#if defined(_MSC_VER) || defined(__MINGW__)
for ( int i = 1 ; i < __argc ; i++ ) { cmdLine += std::string(" ") + formatArg(__argv[i]) ; }
for ( int i = 1 ; i < __argc ; i++ ) {
cmdLine += std::string(" ") + formatArg(__argv[i]) ;
}
#endif
throw Exiv2::Error(Exiv2::kerErrorMessage, Exiv2::toString(num)
+ ": " + _("Invalid command line:") + cmdLine);

View File

@ -1,24 +1,5 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
/*!
@file exiv2app.hpp
@brief Defines class Params, used for the command line handling of exiv2
@author Andreas Huggel (ahu)
<a href="mailto:ahuggel@gmx.net">ahuggel@gmx.net</a>
@ -35,22 +16,10 @@
#include "getopt.hpp"
// + standard includes
#include <vector>
#include <set>
#include <iostream>
#include <regex>
// stdin handler includes
#ifndef _MSC_VER
#include <cstdlib>
#include <stdio.h>
#if defined(__CYGWIN__) || defined(__MINGW__)
#include <windows.h>
#else
#include <sys/select.h>
#endif
#endif
// *****************************************************************************
// class definitions

View File

@ -1,21 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if _MSC_VER >= 1400
# pragma warning(disable : 4996)
#endif
// included header files
#include <assert.h>
#include <errno.h>
#include <filesystem>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include "getopt.hpp"
#include <cstdio>
#include <cstring>
#include <filesystem>
namespace fs = std::filesystem;
namespace Util {

View File

@ -1,28 +1,8 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef GETOPT_H
#define GETOPT_H
#include <ctype.h>
#include <stdio.h>
#include <string>
namespace Util {

View File

@ -1,24 +1,6 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
/*!
@file easyaccess.hpp
@brief Provides easy (high-level) access to some Exif meta data.
@author Carsten Pfeiffer <pfeiffer@kde.org>
@date 28-Feb-09, gis: created

View File

@ -14,8 +14,11 @@
// *****************************************************************************
#include "exiv2lib_export.h"
// included header files
#include "types.hpp"
#include "config.h"
#include <exception> // for exception
#include <sstream> // for operator<<, ostream, ostringstream, bas...
#include <string> // for basic_string, string
// *****************************************************************************
// namespace extensions

View File

@ -11,6 +11,8 @@
#include "exiv2lib_export.h"
#include "config.h"
#include <map>
#include <string>

View File

@ -9,11 +9,10 @@
#include "config.h"
#include "slice.hpp"
// + standard includes
// standard includes
#include <algorithm>
#include <limits>
#include <sstream>
#include <string>
#include <vector>
/*!
@ -26,8 +25,6 @@
#define EXV_CALL_MEMBER_FN(object, ptrToMember) ((object).*(ptrToMember))
// *****************************************************************************
// forward declarations
struct tm;
// *****************************************************************************
// namespace extensions
@ -320,7 +317,7 @@ namespace Exiv2 {
stream, prefixed with the position in the buffer adjusted by
offset.
*/
EXIV2API void hexdump(std::ostream& os, const byte* buf, long len, long offset = 0);
EXIV2API void hexdump(std::ostream& os, const byte* buf, size_t len, size_t offset = 0);
/*!
@brief Return true if str is a hex number starting with prefix followed

View File

@ -1,28 +1,9 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// addmoddel.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Sample program showing how to add, modify and delete Exif metadata.
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <iomanip>
#include <cassert>
int main(int argc, char* const argv[])
@ -122,9 +103,7 @@ try {
// *************************************************************************
// Finally, write the remaining Exif data to the image file
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
assert(image.get() != 0);
auto image = Exiv2::ImageFactory::open(file);
image->setExifData(exifData);
image->writeMetadata();

View File

@ -1,23 +1,4 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// con-test.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Tester application for testing the http/https/ftp/ssh/sftp connection
#include <exiv2/exiv2.hpp>

View File

@ -1,28 +1,9 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// convert-test.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Conversion test driver - make sure you have a copy of the input file around!
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <iomanip>
#include <cassert>
int main(int argc, char* const argv[])
@ -38,8 +19,7 @@ try {
return 1;
}
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
assert(image.get() != 0);
auto image = Exiv2::ImageFactory::open(argv[1]);
image->readMetadata();
Exiv2::XmpData xmpData;

View File

@ -1,23 +1,4 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// easyaccess-test.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Sample program using high-level metadata access functions
#include <exiv2/exiv2.hpp>
@ -82,8 +63,7 @@ try {
return 1;
}
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
assert (image.get() != 0);
auto image = Exiv2::ImageFactory::open(argv[1]);
image->readMetadata();
Exiv2::ExifData& ed = image->exifData();

View File

@ -1,26 +1,5 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
/*
Abstract : Sample program showing how to set the Exif comment of an image,
Exif.Photo.UserComment
*/
// SPDX-License-Identifier: GPL-2.0-or-later
// Abstract : Sample program showing how to set the Exif comment of an image, Exif.Photo.UserComment
#include <exiv2/exiv2.hpp>
#include <iostream>
@ -41,8 +20,7 @@ try {
return 1;
}
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
assert (image.get() != 0);
auto image = Exiv2::ImageFactory::open(argv[1]);
image->readMetadata();
Exiv2::ExifData &exifData = image->exifData();
@ -58,14 +36,10 @@ try {
Following are a few examples of valid comments. The last one is written to
the file.
*/
exifData["Exif.Photo.UserComment"]
= "charset=Unicode A Unicode Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"]
= "charset=Undefined An undefined Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"]
= "Another undefined Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"]
= "charset=Ascii An ASCII Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"] = "charset=Unicode A Unicode Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"] = "charset=Undefined An undefined Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"] = "Another undefined Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"] = "charset=Ascii An ASCII Exif comment added with Exiv2";
std::cout << "Writing user comment '"
<< exifData["Exif.Photo.UserComment"]

View File

@ -1,28 +1,7 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <iomanip>
#include <string>
#include <cassert>
void write(const std::string& file, Exiv2::ExifData& ed);
void print(const std::string& file);
@ -44,8 +23,8 @@ try {
}
std::string file(argv[1]);
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
assert (image.get() != 0);
auto image = Exiv2::ImageFactory::open(file);
assert (image);
image->readMetadata();
Exiv2::ExifData &ed = image->exifData();
@ -117,16 +96,14 @@ catch (Exiv2::AnyError& e) {
void write(const std::string& file, Exiv2::ExifData& ed)
{
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
assert (image.get() != 0);
auto image = Exiv2::ImageFactory::open(file);
image->setExifData(ed);
image->writeMetadata();
}
void print(const std::string& file)
{
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
assert (image.get() != 0);
auto image = Exiv2::ImageFactory::open(file);
image->readMetadata();
Exiv2::ExifData &ed = image->exifData();

View File

@ -1,28 +1,9 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// exifdata.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Sample program to format exif data in various external formats
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <string>
@ -203,8 +184,7 @@ int main(int argc,const char* argv[])
}
if ( !result ) try {
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
assert(image.get() != 0);
auto image = Exiv2::ImageFactory::open(file);
image->readMetadata();
Exiv2::ExifData &exifData = image->exifData();

View File

@ -1,28 +1,7 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <iomanip>
#include <set>
#include <cassert>
#include <regex>
// copied from src/tiffvisitor_int.cpp
@ -85,8 +64,7 @@ try {
return rc;
}
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
assert(image.get() != 0);
auto image = Exiv2::ImageFactory::open(file);
image->readMetadata();
Exiv2::ExifData &exifData = image->exifData();

View File

@ -1,30 +1,9 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// exifvalue.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Sample program to print value of an exif key in an image
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <string>
int main(int argc, char* const argv[])
{
@ -42,8 +21,7 @@ int main(int argc, char* const argv[])
const char* file = argv[1];
const char* key = argv[2];
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
assert(image.get() != 0);
auto image = Exiv2::ImageFactory::open(file);
image->readMetadata();
Exiv2::ExifData &exifData = image->exifData();

View File

@ -1,45 +1,21 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// exiv2json.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Sample program to print metadata in JSON format
#include <exiv2/exiv2.hpp>
#include "Jzon.h"
#include <filesystem>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <cassert>
#include <cstdlib>
#include <filesystem>
#include <iostream>
#include "Jzon.h"
#if defined(__MINGW32__) || defined(__MINGW64__)
# ifndef __MINGW__
# define __MINGW__
# endif
#ifndef __MINGW__
#define __MINGW__
#endif
#endif
struct Token {

View File

@ -1,46 +1,15 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// geotag.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Sample program to read gpx files and update images with GPS tags
// g++ geotag.cpp -o geotag -lexiv2 -lexpat
#include <exiv2/exiv2.hpp>
#include "unused.h"
#include <expat.h>
#include <filesystem>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <stdio.h>
#include <cstdlib>
#include <time.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <expat.h>
#include <vector>
#include <string>
#include <algorithm>
#include <filesystem>
#include <iostream>
#if defined(__MINGW32__) || defined(__MINGW64__)
# ifndef __MINGW__
@ -419,14 +388,13 @@ time_t parseTime(const char* arg,bool bAdjust)
// West of GMT is negative (PDT = Pacific Daylight = -07:00 == -25200 seconds
int timeZoneAdjust()
{
time_t now = time(nullptr);
[[maybe_unused]] time_t now = time(nullptr);
int offset;
#if defined(_MSC_VER) || defined(__MINGW__)
TIME_ZONE_INFORMATION TimeZoneInfo;
GetTimeZoneInformation( &TimeZoneInfo );
offset = - (((int)TimeZoneInfo.Bias + (int)TimeZoneInfo.DaylightBias) * 60);
UNUSED(now);
#elif defined(__CYGWIN__)
struct tm lcopy = *localtime(&now);
time_t gmt = timegm(&lcopy) ; // timegm modifies lcopy

View File

@ -1,23 +1,5 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// getopt-test.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Sample program to test getopt()
// Command:
// $ getopt-test -v pr -P EIXxgklnycsvth file1 file2
@ -48,8 +30,6 @@
#include <unistd.h>
#endif
#include <iostream>
#include <iomanip>
#include <cassert>
#define Safe(x) (x?x:"unknown")
const char* optstring = ":hVvqfbuktTFa:Y:O:D:r:p:P:d:e:i:c:m:M:l:S:g:K:n:Q:";

View File

@ -1,22 +1,4 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
/*
670 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ gcc ../src/ini.cpp ini-test.cpp -lstdc++ -o ini-test

View File

@ -1,29 +1,7 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// *****************************************************************************
// included header files
// SPDX-License-Identifier: GPL-2.0-or-later
#include <exiv2/exiv2.hpp>
#include <cstdio> // for EOF
#include <cstring>
#include <iostream>
#include <stdio.h>
using Exiv2::byte;
using Exiv2::BasicIo;
@ -71,7 +49,7 @@ int main(int argc, char* const argv[])
std::vector<Exiv2::byte> bytes (blocksize);
// copy fileIn from a remote location.
BasicIo::UniquePtr io = Exiv2::ImageFactory::createIo(fr);
auto io = Exiv2::ImageFactory::createIo(fr);
if ( io->open() != 0 ) {
Error(Exiv2::kerFileOpenFailed, io->path(), "rb", strError());
}

View File

@ -1,29 +1,9 @@
// ***************************************************************** -*- C++ -*-
// iptceasy.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// The quickest way to access, set or modify IPTC metadata.
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <iomanip>
#include <cassert>
int main(int argc, char* const argv[])
try {
@ -57,9 +37,7 @@ try {
std::cout << "Time sent: " << iptcData["Iptc.Envelope.TimeSent"] << "\n";
// Open image file
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
assert (image.get() != 0);
auto image = Exiv2::ImageFactory::open(file);
// Set IPTC data and write it to the file
image->setIptcData(iptcData);
image->writeMetadata();

View File

@ -1,29 +1,9 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// iptcprint.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Sample program to print the IPTC metadata of an image
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <iomanip>
#include <cassert>
int main(int argc, char* const argv[])
try {
@ -38,8 +18,7 @@ try {
return 1;
}
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
assert (image.get() != 0);
auto image = Exiv2::ImageFactory::open(argv[1]);
image->readMetadata();
Exiv2::IptcData &iptcData = image->iptcData();

View File

@ -1,27 +1,8 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <iomanip>
#include <cassert>
using namespace Exiv2;
@ -48,8 +29,7 @@ int main(int argc, char* const argv[])
return 1;
}
Image::UniquePtr image = ImageFactory::open(argv[1]);
assert (image.get() != 0);
auto image = ImageFactory::open(argv[1]);
image->readMetadata();
// Process commands

View File

@ -1,27 +1,8 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <string>
#include <cstring>
using namespace Exiv2;

View File

@ -1,24 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// ***************************************************************** -*- C++ -*-
// Test for large (>65535 bytes) IPTC buffer
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#include <exiv2/exiv2.hpp>
#include <cassert>
@ -45,7 +28,8 @@ int main(int argc, char* const argv[])
if (io.open() != 0) {
throw Exiv2::Error(Exiv2::kerDataSourceOpenFailed, io.path(), Exiv2::strError());
}
Exiv2::DataBuf buf(static_cast<long>(io.size()));
Exiv2::DataBuf buf(io.size());
std::cout << "Reading " << buf.size() << " bytes from " << data << "\n";
const size_t readBytes = io.read(buf.data(), buf.size());
if (readBytes != buf.size() || io.error() || io.eof()) {
@ -53,8 +37,7 @@ int main(int argc, char* const argv[])
}
// Read metadata from file
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
assert(image.get() != 0);
auto image = Exiv2::ImageFactory::open(file);
image->readMetadata();
// Set Preview field to the content of the data file

View File

@ -1,26 +1,7 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <fstream>
#include <cassert>
// include local header files which are not part of libexiv2
#include "getopt.hpp"
@ -53,12 +34,10 @@ try {
auto memIo = std::make_unique<Exiv2::MemIo>();
memIo->transfer(fileIo);
Exiv2::Image::UniquePtr readImg = Exiv2::ImageFactory::open(std::move(memIo));
assert(readImg.get() != 0);
auto readImg = Exiv2::ImageFactory::open(std::move(memIo));
readImg->readMetadata();
Exiv2::Image::UniquePtr writeImg = Exiv2::ImageFactory::open(params.write_);
assert(writeImg.get() != 0);
auto writeImg = Exiv2::ImageFactory::open(params.write_);
if (params.preserve_) {
writeImg->readMetadata();
}

View File

@ -1,28 +1,9 @@
// ***************************************************************** -*- C++ -*-
// mmap-test.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Simple mmap tests
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <cstring>
using namespace Exiv2;
@ -47,8 +28,7 @@ try {
}
// Map it to memory
const Exiv2::byte* pData = file.mmap();
auto size = static_cast<long>(file.size());
DataBuf buf(size);
DataBuf buf(file.size());
// Read from the memory mapped region
buf.copyBytes(0, pData, buf.size());
// Reopen file in write mode and write to it

View File

@ -1,24 +1,5 @@
// ***************************************************************** -*- C++ -*-
// mrwthumb.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Sample program to extract a Minolta thumbnail from the makernote
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#include <exiv2/exiv2.hpp>
#include <cassert>
@ -38,8 +19,7 @@ int main(int argc, char* const argv[])
return 1;
}
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
assert(image.get() != 0);
auto image = Exiv2::ImageFactory::open(argv[1]);
image->readMetadata();
Exiv2::ExifData& exifData = image->exifData();

View File

@ -1,30 +1,10 @@
// ***************************************************************** -*- C++ -*-
// path-test.cpp
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
#include <exiv2/exiv2.hpp>
#include <filesystem>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
namespace fs = std::filesystem;

View File

@ -1,29 +1,9 @@
// ***************************************************************** -*- C++ -*-
// prevtest.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Test access to preview images
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#include <exiv2/exiv2.hpp>
#include <string>
#include <iostream>
#include <cassert>
int main(int argc, char* const argv[])
try {
@ -39,8 +19,7 @@ try {
}
std::string filename(argv[1]);
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(filename);
assert(image.get() != 0);
auto image = Exiv2::ImageFactory::open(filename);
image->readMetadata();
Exiv2::PreviewManager loader(*image);

View File

@ -1,26 +1,7 @@
// ***************************************************************** -*- C++ -*-
// remotetest.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Tester application for testing remote i/o.
// It makes some modifications on the metadata of remote file, reads new metadata from that file
// and reset the metadata back to the original status.
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#include <exiv2/exiv2.hpp>
#include <iostream>
@ -63,15 +44,13 @@ try {
Exiv2::ExifKey key("Exif.Image.DateTime");
exifData.add(key, v.get());
Exiv2::Image::UniquePtr writeTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps);
assert(writeTest.get() != 0);
auto writeTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps);
writeTest->setExifData(exifData);
writeTest->writeMetadata();
// read the result to make sure everything fine
std::cout << "Print out the new metadata ...\n";
Exiv2::Image::UniquePtr readTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps);
assert(readTest.get() != 0);
auto readTest = Exiv2::ImageFactory::open(file, useCurlFromExiv2TestApps);
readTest->readMetadata();
Exiv2::ExifData &exifReadData = readTest->exifData();
if (exifReadData.empty()) {

View File

@ -1,28 +1,9 @@
// ***************************************************************** -*- C++ -*-
// stringto-test.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Test conversions from string to long, float and Rational types.
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <iomanip>
static constexpr const char* testcases[] = {
// bool

View File

@ -1,27 +1,8 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <string>
#include <sstream>
using namespace Exiv2;

View File

@ -1,24 +1,4 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// tiff-test.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// First and very simple TIFF write test.
#include <exiv2/exiv2.hpp>

View File

@ -1,25 +1,4 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// ***************************************************************** -*- C++ -*-
// werror-test.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Simple tests for the wide-string error class WError
#include <exiv2/exiv2.hpp>

View File

@ -1,30 +1,8 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <utility>
#include <cassert>
// *****************************************************************************
// local declarations
@ -170,8 +148,7 @@ void testCase(const std::string& file1,
ExifKey ek(key);
//Open first image
Image::UniquePtr image1 = ImageFactory::open(file1);
assert(image1.get() != 0);
auto image1 = ImageFactory::open(file1);
// Load existing metadata
std::cerr << "---> Reading file " << file1 << "\n";
@ -186,8 +163,7 @@ void testCase(const std::string& file1,
pos->setValue(value);
// Open second image
Image::UniquePtr image2 = ImageFactory::open(file2);
assert(image2.get() != 0);
auto image2 = ImageFactory::open(file2);
image2->setExifData(image1->exifData());

View File

@ -1,28 +1,7 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// SPDX-License-Identifier: GPL-2.0-or-later
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <iomanip>
#include <string>
#include <cassert>
void write(const std::string& file, Exiv2::ExifData& ed);
void print(const std::string& file);
@ -48,19 +27,19 @@ int main(int argc, char* const argv[])
Exiv2::ExifData ed1;
ed1["Exif.Image.Model"] = "Test 1";
Exiv2::Value::UniquePtr v1 = Exiv2::Value::create(Exiv2::unsignedShort);
auto v1 = Exiv2::Value::create(Exiv2::unsignedShort);
v1->read("160 161 162 163");
ed1.add(Exiv2::ExifKey("Exif.Image.SamplesPerPixel"), v1.get());
Exiv2::Value::UniquePtr v2 = Exiv2::Value::create(Exiv2::signedLong);
auto v2 = Exiv2::Value::create(Exiv2::signedLong);
v2->read("-2 -1 0 1");
ed1.add(Exiv2::ExifKey("Exif.Image.XResolution"), v2.get());
Exiv2::Value::UniquePtr v3 = Exiv2::Value::create(Exiv2::signedRational);
auto v3 = Exiv2::Value::create(Exiv2::signedRational);
v3->read("-2/3 -1/3 0/3 1/3");
ed1.add(Exiv2::ExifKey("Exif.Image.YResolution"), v3.get());
Exiv2::Value::UniquePtr v4 = Exiv2::Value::create(Exiv2::undefined);
auto v4 = Exiv2::Value::create(Exiv2::undefined);
v4->read("255 254 253 252");
ed1.add(Exiv2::ExifKey("Exif.Image.WhitePoint"), v4.get());
@ -87,8 +66,7 @@ int main(int argc, char* const argv[])
print(file);
std::cout <<"\n----- Non-intrusive writing of special Canon MakerNote tags\n";
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
assert(image.get() != 0);
auto image = Exiv2::ImageFactory::open(file);
image->readMetadata();
Exiv2::ExifData& rEd = image->exifData();
@ -219,8 +197,7 @@ catch (Exiv2::AnyError& e) {
void write(const std::string& file, Exiv2::ExifData& ed)
{
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
assert(image.get() != 0);
auto image = Exiv2::ImageFactory::open(file);
image->setExifData(ed);
image->writeMetadata();
@ -228,8 +205,7 @@ void write(const std::string& file, Exiv2::ExifData& ed)
void print(const std::string& file)
{
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(file);
assert(image.get() != 0);
auto image = Exiv2::ImageFactory::open(file);
image->readMetadata();
Exiv2::ExifData &ed = image->exifData();

View File

@ -1,29 +1,8 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// xmpdump.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Sample program to dump the XMP packet of an image
#include <exiv2/exiv2.hpp>
#include <cassert>
#include <iostream>
#include <string>
int main(int argc, char* const argv[])
{
@ -39,8 +18,7 @@ int main(int argc, char* const argv[])
return 1;
}
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
assert(image.get() != 0);
auto image = Exiv2::ImageFactory::open(argv[1]);
image->readMetadata();
const std::string& xmpPacket = image->xmpPacket();

View File

@ -1,29 +1,8 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// xmpparse.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Read an XMP packet from a file, parse it and print all (known) properties.
#include <exiv2/exiv2.hpp>
#include <string>
#include <iostream>
#include <iomanip>
int main(int argc, char* const argv[])
try {
@ -37,6 +16,7 @@ try {
std::cout << "Usage: " << argv[0] << " file\n";
return 1;
}
Exiv2::DataBuf buf = Exiv2::readFile(argv[1]);
std::string xmpPacket;
xmpPacket.assign(buf.c_str(), buf.size());

View File

@ -1,29 +1,8 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// xmpparser-test.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Read an XMP packet from a file, parse and re-serialize it.
#include <exiv2/exiv2.hpp>
#include <string>
#include <iostream>
#include <iomanip>
int main(int argc, char* const argv[])
try {

View File

@ -1,30 +1,5 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// xmpprint.cpp
// Read an XMP from a video or graphic file, parse it and print
// all (known) properties.
// ========================================================================
// Linux standalone compilation :
// g++ -o xmpprint xmpprint.cpp `pkg-config --cflags --libs exiv2`
// ========================================================================
// SPDX-License-Identifier: GPL-2.0-or-later
// Read an XMP from a video or graphic file, parse it and print all (known) properties.
#include <exiv2/exiv2.hpp>
#include <string>
@ -48,8 +23,7 @@ int main(int argc, char** argv)
return 1;
}
Exiv2::Image::UniquePtr image = Exiv2::ImageFactory::open(argv[1]);
assert (image.get() != 0);
auto image = Exiv2::ImageFactory::open(argv[1]);
image->readMetadata();
Exiv2::XmpData &xmpData = image->xmpData();

View File

@ -1,33 +1,11 @@
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
// xmpsample.cpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Sample/test for high level XMP classes. See also addmoddel.cpp
#include <exiv2/exiv2.hpp>
#include "unused.h"
#include <string>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <iostream>
bool isEqual(float a, float b)
{
@ -77,26 +55,22 @@ try {
assert(xmpData["Xmp.dc.one"].toInt64() == -1);
assert(xmpData["Xmp.dc.one"].value().ok());
const Exiv2::Value &getv1 = xmpData["Xmp.dc.one"].value();
UNUSED(getv1);
[[maybe_unused]] const Exiv2::Value &getv1 = xmpData["Xmp.dc.one"].value();
assert(isEqual(getv1.toFloat(), -1));
assert(getv1.ok());
assert(getv1.toRational() == Exiv2::Rational(-1, 1));
assert(getv1.ok());
const Exiv2::Value &getv2 = xmpData["Xmp.dc.two"].value();
UNUSED(getv2);
[[maybe_unused]] const Exiv2::Value &getv2 = xmpData["Xmp.dc.two"].value();
assert(isEqual(getv2.toFloat(), 3.1415f));
assert(getv2.ok());
assert(getv2.toInt64() == 3);
assert(getv2.ok());
Exiv2::Rational R = getv2.toRational();
UNUSED(R);
[[maybe_unused]] Exiv2::Rational R = getv2.toRational();
assert(getv2.ok());
assert(isEqual(static_cast<float>(R.first) / R.second, 3.1415f ));
const Exiv2::Value &getv3 = xmpData["Xmp.dc.three"].value();
UNUSED(getv3);
[[maybe_unused]] const Exiv2::Value &getv3 = xmpData["Xmp.dc.three"].value();
assert(isEqual(getv3.toFloat(), 5.0f/7.0f));
assert(getv3.ok());
assert(getv3.toInt64() == 0); // long(5.0 / 7.0)
@ -104,8 +78,7 @@ try {
assert(getv3.toRational() == Exiv2::Rational(5, 7));
assert(getv3.ok());
const Exiv2::Value &getv6 = xmpData["Xmp.dc.six"].value();
UNUSED(getv6);
[[maybe_unused]] const Exiv2::Value &getv6 = xmpData["Xmp.dc.six"].value();
assert(getv6.toInt64() == 0);
assert(getv6.ok());
assert(getv6.toFloat() == 0.0f);
@ -117,8 +90,7 @@ try {
getv7.toInt64(); // this should fail
assert(!getv7.ok());
const Exiv2::Value &getv8 = xmpData["Xmp.dc.eight"].value();
UNUSED(getv8);
[[maybe_unused]] const Exiv2::Value &getv8 = xmpData["Xmp.dc.eight"].value();
assert(getv8.toInt64() == 1);
assert(getv8.ok());
assert(getv8.toFloat() == 1.0f);
@ -136,7 +108,7 @@ try {
// properties and language alternatives.
// Add a simple XMP property in a known namespace
Exiv2::Value::UniquePtr v = Exiv2::Value::create(Exiv2::xmpText);
auto v = Exiv2::Value::create(Exiv2::xmpText);
v->read("image/jpeg");
xmpData.add(Exiv2::XmpKey("Xmp.dc.format"), v.get());

View File

@ -34,8 +34,6 @@ add_library( exiv2lib_int OBJECT
tiffimage_int.cpp tiffimage_int.hpp
tiffvisitor_int.cpp tiffvisitor_int.hpp
tifffwd_int.hpp
timegm.h
unused.h
utils.hpp utils.cpp
)
@ -96,6 +94,7 @@ add_library( exiv2lib
error.cpp
exif.cpp
futils.cpp
fff.h
gifimage.cpp
http.cpp
image.cpp

View File

@ -14,9 +14,7 @@
// + standard includes
#include <fcntl.h> // _O_BINARY in FileIo::FileIo
#include <sys/stat.h> // for stat, chmod
#include <sys/types.h> // for stat, chmod
#include <cassert>
#include <cstdio> // for remove, rename
#include <cstdlib> // for alloc, realloc, free
#include <cstring> // std::memcpy
@ -24,8 +22,6 @@
#include <filesystem>
#include <fstream> // write the temporary file
#include <iostream>
#include <memory>
#include <string>
#ifdef EXV_HAVE_SYS_MMAN_H
# include <sys/mman.h> // for mmap and munmap

View File

@ -14,7 +14,6 @@
#include "tiffimage.hpp"
#include "tiffimage_int.hpp"
#include "types.hpp"
#include "unused.h"
// + standard includes
#include <cassert>

View File

@ -4,8 +4,6 @@
Author(s): Marco Piovanelli, Ovolab (marco)
History: 05-Mar-2007, marco: created
*/
// included header files
#include "config.h"
#include "basicio.hpp"
#include "bmpimage.hpp"
@ -15,8 +13,8 @@
// + standard includes
#include <cstring>
#include <iostream>
#include <string>
#include <iostream>
// *****************************************************************************
// class member definitions

View File

@ -20,10 +20,6 @@
#include <string>
#include <sstream>
#include <iomanip>
#include <ios>
#include <algorithm>
#include <cassert>
#include <cstring>
#include <cmath>
// *****************************************************************************

View File

@ -17,7 +17,6 @@
// *****************************************************************************
// included header files
#include "tags.hpp"
#include "types.hpp"
// *****************************************************************************
// namespace extensions

View File

@ -12,10 +12,8 @@
#include "i18n.h" // NLS support.
// + standard includes
#include <string>
#include <sstream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <vector>

View File

@ -16,17 +16,10 @@
#include "xmp_exiv2.hpp"
#include "futils.hpp"
#include "convert.hpp"
#include "unused.h"
// + standard includes
#include <stdio.h> // for snprintf (C99)
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <ios>
#include <iostream>
#include <sstream>
#include <utility>
#if defined WIN32 && !defined __CYGWIN__
# include <windows.h>

View File

@ -1,23 +1,17 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "config.h"
#include "cr2image.hpp"
#include "tiffimage.hpp"
#include "config.h"
#include "cr2header_int.hpp"
#include "tiffcomposite_int.hpp"
#include "tiffimage_int.hpp"
#include "image.hpp"
#include "error.hpp"
#include "futils.hpp"
#include "i18n.h" // NLS support.
#include "image.hpp"
#include "tiffcomposite_int.hpp"
#include "tiffimage_int.hpp"
// + standard includes
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
// *****************************************************************************
// class member definitions

View File

@ -11,20 +11,9 @@
#include "crwimage_int.hpp"
#include "error.hpp"
#include "futils.hpp"
#include "value.hpp"
#include "tags.hpp"
#include "tags_int.hpp"
// + standard includes
#include <iostream>
#include <iomanip>
#include <stack>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
// *****************************************************************************
// class member definitions

View File

@ -3,7 +3,6 @@
#include "crwimage_int.hpp"
#include "canonmn_int.hpp"
#include "i18n.h" // NLS support.
#include "unused.h"
#include "error.hpp"
#include "enforce.hpp"
@ -592,8 +591,7 @@ namespace Exiv2::Internal {
{
CrwDirs crwDirs;
CrwMap::loadStack(crwDirs, crwDir);
uint16_t rootDirectory = crwDirs.top().crwDir_;
UNUSED(rootDirectory);
[[maybe_unused]] uint16_t rootDirectory = crwDirs.top().crwDir_;
assert(rootDirectory == 0x0000);
crwDirs.pop();
if (!pRootDir_) {
@ -671,8 +669,7 @@ namespace Exiv2::Internal {
if (pRootDir_) {
CrwDirs crwDirs;
CrwMap::loadStack(crwDirs, crwDir);
uint16_t rootDirectory = crwDirs.top().crwDir_;
UNUSED(rootDirectory);
[[maybe_unused]] uint16_t rootDirectory = crwDirs.top().crwDir_;
assert(rootDirectory == 0x0000);
crwDirs.pop();
pRootDir_->remove(crwDirs, crwTagId);

View File

@ -9,11 +9,8 @@
#include "datasets.hpp"
#include "error.hpp"
#include "types.hpp"
#include "value.hpp"
#include "metadatum.hpp"
#include "i18n.h" // NLS support.
#include <iostream>
#include <iomanip>
#include <regex>
#include <sstream>

View File

@ -2,6 +2,7 @@
// included header files
#include "error.hpp"
#include "types.hpp"
#include "i18n.h" // NLS support.
// + standard includes

View File

@ -8,28 +8,25 @@
*/
// *****************************************************************************
// included header files
#include "config.h"
#include "exif.hpp"
#include "basicio.hpp"
#include "config.h"
#include "error.hpp"
#include "metadatum.hpp"
#include "tags.hpp"
#include "tags_int.hpp"
#include "value.hpp"
#include "types.hpp"
#include "error.hpp"
#include "basicio.hpp"
#include "tiffcomposite_int.hpp" // for Tag::root
#include "tiffimage.hpp"
#include "tiffimage_int.hpp"
#include "tiffcomposite_int.hpp" // for Tag::root
#include "types.hpp"
#include "value.hpp"
// + standard includes
#include <iostream>
#include <sstream>
#include <utility>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <utility>
// *****************************************************************************
namespace {

View File

@ -11,15 +11,9 @@
#include "types.hpp"
#include "fujimn_int.hpp"
#include "tags_int.hpp"
#include "value.hpp"
#include "i18n.h" // NLS support.
// + standard includes
#include <string>
#include <sstream>
#include <iomanip>
#include <cassert>
#include <cstring>
// *****************************************************************************
// class member definitions

View File

@ -1,16 +1,16 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "config.h"
#include "futils.hpp"
#include "datasets.hpp"
#include "config.h"
#include "enforce.hpp"
#include "image_int.hpp"
#include "error.hpp"
// + standard includes
#include <algorithm>
#include <array>
#include <cstring>
#include <filesystem>
#include <sstream>
#include <stdexcept>
@ -26,13 +26,9 @@ namespace fs = std::filesystem;
#include <psapi.h> // For access to GetModuleFileNameEx
#endif
#if defined(_MSC_VER)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#elif defined(__APPLE__)
#if defined(EXV_HAVE_LIBPROC_H)
#if defined(__APPLE__) && defined(EXV_HAVE_LIBPROC_H)
#include <libproc.h>
#endif
#endif
#if defined(__FreeBSD__)
#include <sys/mount.h>

View File

@ -1,9 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "config.h"
#include "gifimage.hpp"
#include "config.h"
#include "error.hpp"
#include "futils.hpp"
@ -16,7 +16,7 @@ namespace Exiv2 {
GifImage::GifImage(BasicIo::UniquePtr io)
: Image(ImageType::gif, mdNone, std::move(io))
{
} // GifImage::GifImage
}
std::string GifImage::mimeType() const
{

View File

@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "helper_functions.hpp"
#include <string.h>
#include <cstring>
std::string string_from_unterminated(const char* data, size_t data_length)
{

View File

@ -1,44 +1,21 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW__) || defined(__MINGW64__) || defined(__MINGW32__)
#include "config.h"
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW__)
#define __USE_W32_SOCKETS
#include <winsock2.h>
#endif
#include "config.h"
#include "datasets.hpp"
#include "http.hpp"
#include "futils.hpp"
#include <sys/types.h>
#include <stdio.h>
#include <array>
#include <cstdlib>
#include <time.h>
#include <sys/stat.h>
#include <string.h>
#define SLEEP 1000
#define SNOOZE 0
#ifdef __MINGW__
#define fopen_S(f,n,a) f=fopen(n,a)
#endif
////////////////////////////////////////
// platform specific code
#if defined(WIN32) || defined(_MSC_VER) || defined(__MINGW__)
#include <string.h>
#include <io.h>
#if !defined(__MINGW__) && !defined(__CYGWIN__)
#define write _write
#define read _read
#define close _close
#define strdup _strdup
#define stat _stat
#define fopen_S(f,n,a) fopen_s(&f,n,a)
#endif
#else
////////////////////////////////////////
// Unix or Mac
@ -46,11 +23,8 @@
#define closesocket close
#include <unistd.h>
#include <strings.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/uio.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@ -98,8 +72,8 @@ static constexpr std::array<const char*, 2> blankLines{
"\n\n", // this is commonly sent by CGI scripts
};
static constexpr int snooze = SNOOZE;
static int sleep_ = SLEEP;
static constexpr int snooze = 0;
static int sleep_ = 1000;
static int forgive(int n,int& err)
{

View File

@ -1,63 +1,49 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "config.h"
#include "image.hpp"
#include "image_int.hpp"
#include "error.hpp"
#include "config.h"
#include "enforce.hpp"
#include "error.hpp"
#include "futils.hpp"
#include "image_int.hpp"
#include "safe_op.hpp"
#include "slice.hpp"
#ifdef EXV_ENABLE_BMFF
#ifdef EXV_ENABLE_BMFF
#include "bmffimage.hpp"
#endif// EXV_ENABLE_BMFF
#endif // EXV_ENABLE_BMFF
#include "cr2image.hpp"
#include "crwimage.hpp"
#include "epsimage.hpp"
#include "jpgimage.hpp"
#include "mrwimage.hpp"
#ifdef EXV_HAVE_LIBZ
# include "pngimage.hpp"
#endif// EXV_HAVE_LIBZ
#include "rafimage.hpp"
#include "tiffimage.hpp"
#include "tiffimage_int.hpp"
#include "tiffcomposite_int.hpp"
#include "tiffvisitor_int.hpp"
#include "webpimage.hpp"
#include "orfimage.hpp"
#include "gifimage.hpp"
#include "psdimage.hpp"
#include "tgaimage.hpp"
#ifdef EXV_HAVE_LIBZ
#include "pngimage.hpp"
#endif // EXV_HAVE_LIBZ
#include "bmpimage.hpp"
#include "gifimage.hpp"
#include "jp2image.hpp"
#include "nikonmn_int.hpp"
#include "rw2image.hpp"
#include "orfimage.hpp"
#include "pgfimage.hpp"
#include "psdimage.hpp"
#include "rafimage.hpp"
#include "rw2image.hpp"
#include "tags_int.hpp"
#include "tgaimage.hpp"
#include "tiffimage.hpp"
#include "webpimage.hpp"
#include "xmpsidecar.hpp"
// + standard includes
#include <cerrno>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <limits>
#include <set>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef _MSC_VER
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#ifdef EXV_HAVE_UNISTD_H
# include <unistd.h> // stat
#endif
// *****************************************************************************
namespace {

View File

@ -2,10 +2,12 @@
#include "image_int.hpp"
#include <cassert>
#include <cstdarg>
#include <cstddef>
#include <cstring>
#include <cstdio>
#include <cstring>
#include <vector>
namespace Exiv2::Internal {
std::string stringFormat(const char* format, ...)

View File

@ -5,9 +5,11 @@
// *****************************************************************************
// included header files
#include "types.hpp"
#include "slice.hpp" // for Slice
// + standard includes
#include <cstddef> // for size_t
#include <cstdint> // for int32_t
#include <ostream> // for ostream, basic_ostream::put
#include <string>
#if (defined(__GNUG__) || defined(__GNUC__)) || defined(__clang__)

View File

@ -7,7 +7,6 @@
//
// https://github.com/benhoyt/inih
#include "config.h"
#include "ini.hpp"
#include <algorithm>
@ -17,13 +16,7 @@
using std::string;
using namespace Exiv2;
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <cstring>
#if !INI_USE_STACK
#include <cstdlib>

View File

@ -2,18 +2,17 @@
// included header files
#include "iptc.hpp"
#include "types.hpp"
#include "error.hpp"
#include "enforce.hpp"
#include "value.hpp"
#include "datasets.hpp"
#include "jpgimage.hpp"
#include "enforce.hpp"
#include "error.hpp"
#include "image_int.hpp"
#include "types.hpp"
#include "value.hpp"
// + standard includes
#include <iostream>
#include <algorithm>
#include <fstream> // write the temporary file
#include <iostream>
// *****************************************************************************
namespace {

View File

@ -14,13 +14,8 @@
#include "types.hpp"
#include "safe_op.hpp"
// + standard includes
#include <array>
#include <string>
#include <cstring>
#include <iostream>
#include <cassert>
#include <cstdio>
// JPEG-2000 box types
const uint32_t kJp2BoxTypeJp2Header = 0x6a703268; // 'jp2h'

View File

@ -4,7 +4,6 @@
#include "config.h"
#include "jpgimage.hpp"
#include "tiffimage.hpp"
#include "image_int.hpp"
#include "error.hpp"
#include "futils.hpp"
@ -22,12 +21,6 @@
#include "fff.h"
// + standard includes
#include <algorithm> // for EOF
#include <cstdio> // for EOF
#include <cstring>
#include <cassert>
#include <stdexcept>
#include <iostream>
// *****************************************************************************

View File

@ -11,31 +11,20 @@
#include "ini.hpp"
#include "tiffcomposite_int.hpp"
#include "tiffvisitor_int.hpp"
#include "tiffimage.hpp"
#include "tiffimage_int.hpp"
#include "utils.hpp"
// + standard includes
#include <array>
#include <filesystem>
#include <fstream>
#include <iostream>
namespace fs = std::filesystem;
#if defined(__MINGW32__) || defined(__MINGW64__)
#ifndef __MINGW__
#define __MINGW__ 1
#endif
#endif
#if !defined(_MSC_VER) && !defined(__MINGW__)
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#else
#include <windows.h>
#include <direct.h> // _getcwd
#include <shlobj.h>
# ifndef CSIDL_PROFILE
# define CSIDL_PROFILE 40

View File

@ -5,13 +5,14 @@
// *****************************************************************************
// included header files
#include "tifffwd_int.hpp"
#include "tags_int.hpp"
#include "types.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2::Internal {
class IoWrapper;
class TiffComponent;
// *****************************************************************************
// function prototypes
/*!

View File

@ -1,15 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "metadatum.hpp"
// + standard includes
#include <iostream>
#include <iomanip>
// *****************************************************************************
// class member definitions
namespace Exiv2 {
Key::UniquePtr Key::clone() const

View File

@ -7,16 +7,10 @@
#include "value.hpp"
#include "exif.hpp"
#include "i18n.h" // NLS support.
#include "datasets.hpp"
#include <string>
#include <sstream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <stdio.h> // popen to call exiftool
#include <string.h>
#include <cstdio> // popen to call exiftool
// *****************************************************************************
// class member definitions
@ -2186,7 +2180,7 @@ namespace Exiv2::Internal {
uint32_t id_; //!< Lens id
PrintFct fct_; //!< Pretty-print function
//! Comparison operator for find template
bool operator==(long id) const { return id_ == id; }
bool operator==(uint32_t id) const { return id_ == id; }
};
//! List of lens ids which require special treatment from printMinoltaSonyLensID

View File

@ -6,10 +6,6 @@
// *****************************************************************************
// included header files
#include "tags.hpp"
#include "types.hpp"
// + standard includes
#include <iosfwd>
// *****************************************************************************
// namespace extensions

View File

@ -1,30 +1,24 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "config.h"
#include "mrwimage.hpp"
#include "tiffimage.hpp"
#include "image.hpp"
#include "basicio.hpp"
#include "error.hpp"
#include "config.h"
#include "enforce.hpp"
#include "error.hpp"
#include "futils.hpp"
#include "image.hpp"
#include "tiffimage.hpp"
// + standard includes
#include <string>
#include <cstring>
#include <iostream>
#include <cassert>
// *****************************************************************************
// class member definitions
namespace Exiv2 {
MrwImage::MrwImage(BasicIo::UniquePtr io, bool /*create*/)
: Image(ImageType::mrw, mdExif | mdIptc | mdXmp, std::move(io))
{
} // MrwImage::MrwImage
}
std::string MrwImage::mimeType() const
{

View File

@ -1,24 +1,16 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "types.hpp"
#include "nikonmn_int.hpp"
#include "value.hpp"
#include "image.hpp"
#include "tags_int.hpp"
#include "exif.hpp"
#include "i18n.h" // NLS support.
#include "makernote_int.hpp"
#include "error.hpp"
#include "i18n.h" // NLS support.
#include "tags_int.hpp"
#include "value.hpp"
// + standard includes
#include <string>
#include <sstream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <math.h> //for log, pow, abs
#include <cmath>
#include <limits>
// *****************************************************************************
// class member definitions

View File

@ -18,12 +18,6 @@
// *****************************************************************************
// included header files
#include "tags.hpp"
#include "types.hpp"
// + standard includes
#include <string>
#include <iosfwd>
#include <memory>
// *****************************************************************************
// namespace extensions

View File

@ -2,20 +2,13 @@
// *****************************************************************************
// included header files
#include "types.hpp"
#include "olympusmn_int.hpp"
#include "value.hpp"
#include "image.hpp"
#include "tags_int.hpp"
#include "makernote_int.hpp"
#include "i18n.h" // NLS support.
// + standard includes
#include <string>
#include <sstream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include "exif.hpp"
#include "i18n.h" // NLS support.
#include "makernote_int.hpp"
#include "tags_int.hpp"
#include "value.hpp"
// *****************************************************************************
// class member definitions

View File

@ -13,12 +13,9 @@
// *****************************************************************************
// included header files
#include "tags.hpp"
#include "types.hpp"
// + standard includes
#include <string>
#include <iosfwd>
#include <memory>
// *****************************************************************************
// namespace extensions

View File

@ -1,23 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "config.h"
#include "orfimage.hpp"
#include "orfimage_int.hpp"
#include "tiffimage.hpp"
#include "tiffcomposite_int.hpp"
#include "tiffimage_int.hpp"
#include "image.hpp"
#include "basicio.hpp"
#include "config.h"
#include "error.hpp"
#include "futils.hpp"
#include "image.hpp"
#include "orfimage_int.hpp"
#include "tiffcomposite_int.hpp"
#include "tiffimage.hpp"
#include "tiffimage_int.hpp"
// + standard includes
#include <string>
#include <cstring>
#include <iostream>
#include <cassert>
// *****************************************************************************
// class member definitions

View File

@ -6,7 +6,6 @@
// *****************************************************************************
// included header files
#include "tiffimage_int.hpp"
#include "types.hpp"
// *****************************************************************************
// namespace extensions

View File

@ -8,11 +8,8 @@
#include "i18n.h" // NLS support.
// + standard includes
#include <string>
#include <sstream>
#include <iomanip>
#include <cassert>
#include <cstring>
// *****************************************************************************
// class member definitions

View File

@ -6,7 +6,6 @@
// *****************************************************************************
// included header files
#include "tags.hpp"
#include "types.hpp"
// *****************************************************************************
// namespace extensions

View File

@ -7,12 +7,8 @@
#include "value.hpp"
#include "exif.hpp"
#include "tags.hpp"
#include "metadatum.hpp"
#include "i18n.h" // NLS support.
// + standard includes
#include <string>
// *****************************************************************************
// class member definitions
namespace Exiv2::Internal {

View File

@ -1,22 +1,16 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "config.h"
#include "pgfimage.hpp"
#include "image.hpp"
#include "pngimage.hpp"
#include "basicio.hpp"
#include "config.h"
#include "enforce.hpp"
#include "error.hpp"
#include "futils.hpp"
#include "image.hpp"
// + standard includes
#include <cstdio> // for EOF
#include <string>
#include <cstring>
#include <iostream>
#include <cassert>
// Signature from front of PGF file
const unsigned char pgfSignature[3] = { 0x50, 0x47, 0x46 };

View File

@ -24,7 +24,6 @@
#include <cstring>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
/*

View File

@ -3,28 +3,23 @@
// included header files
#include "config.h"
#ifdef EXV_HAVE_LIBZ
#include "pngchunk_int.hpp"
#include "pngimage.hpp"
#include "jpgimage.hpp"
#include "tiffimage.hpp"
#ifdef EXV_HAVE_LIBZ
#include <zlib.h> // To uncompress IccProfiles
#include "basicio.hpp"
#include "enforce.hpp"
#include "error.hpp"
#include "futils.hpp"
#include "image.hpp"
#include "image_int.hpp"
#include "basicio.hpp"
#include "error.hpp"
#include "enforce.hpp"
#include "futils.hpp"
#include "jpgimage.hpp"
#include "pngchunk_int.hpp"
#include "pngimage.hpp"
#include "tiffimage.hpp"
#include "types.hpp"
// + standard includes
#include <algorithm>
#include <array>
#include <string>
#include <cstring>
#include <iostream>
#include <cassert>
#include <zlib.h> // To uncompress IccProfiles
// Signature from front of PNG file
const unsigned char pngSignature[8] = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };

View File

@ -1,26 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "config.h"
#include <algorithm>
#include <array>
#include <climits>
#include <string>
#include "preview.hpp"
#include "futils.hpp"
#include "enforce.hpp"
#include "safe_op.hpp"
#include "config.h"
#include "enforce.hpp"
#include "futils.hpp"
#include "image.hpp"
#include "cr2image.hpp"
#include "jpgimage.hpp"
#include "safe_op.hpp"
#include "tiffimage.hpp"
#include "tiffimage_int.hpp"
#include "unused.h"
// *****************************************************************************
#include <climits>
namespace {
using namespace Exiv2;

View File

@ -2,22 +2,17 @@
// included header files
#include "properties.hpp"
#include "tags_int.hpp"
#include "error.hpp"
#include "i18n.h" // NLS support.
#include "metadatum.hpp"
#include "tags_int.hpp"
#include "types.hpp"
#include "value.hpp"
#include "metadatum.hpp"
#include "i18n.h" // NLS support.
#include "xmp_exiv2.hpp"
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <cctype>
// *****************************************************************************
namespace {
//! Struct used in the lookup table for pretty print functions

View File

@ -1,25 +1,17 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "config.h"
#include "psdimage.hpp"
#include "jpgimage.hpp"
#include "image.hpp"
#include "basicio.hpp"
#include "config.h"
#include "enforce.hpp"
#include "error.hpp"
#include "futils.hpp"
#include "image.hpp"
#include "jpgimage.hpp"
#include "safe_op.hpp"
#include "enforce.hpp"
// + standard includes
#include <string>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <memory>
// Todo: Consolidate with existing code in struct Photoshop (jpgimage.hpp):
// Extend this helper to a proper class with all required functionality,

View File

@ -1,23 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "config.h"
#include "rafimage.hpp"
#include "tiffimage.hpp"
#include "image_int.hpp"
#include "image.hpp"
#include "basicio.hpp"
#include "config.h"
#include "enforce.hpp"
#include "error.hpp"
#include "futils.hpp"
#include "enforce.hpp"
#include "image.hpp"
#include "image_int.hpp"
#include "safe_op.hpp"
#include "tiffimage.hpp"
// +standard includes
#include <string>
#include <cstring>
#include <iostream>
#include <cassert>
// *****************************************************************************
// class member definitions

View File

@ -1,20 +1,20 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// included header files
#include "config.h"
#include "rw2image.hpp"
#include "config.h"
#include "error.hpp"
#include "futils.hpp"
#include "image.hpp"
#include "preview.hpp"
#include "rw2image_int.hpp"
#include "tiffcomposite_int.hpp"
#include "tiffimage_int.hpp"
#include "image.hpp"
#include "preview.hpp"
#include "error.hpp"
#include "futils.hpp"
// + standard includes
#ifdef EXIV2_DEBUG_MESSAGES
# include <iostream>
#include <iostream>
#endif
// *****************************************************************************

View File

@ -212,38 +212,7 @@ namespace Safe
#undef SPECIALIZE_builtin_add_overflow
#endif // __GNUC__ >= 5 || __clang_major >= 3
#elif defined(_MSC_VER)
// intrinsics are not in available in MSVC 2005 and earlier
#if _MSC_VER >= 1400
/*!
* This macro pastes a specialization of builtin_add_overflow using MSVC's
* U(Int/Long/LongLong)Add.
*
* The add function is implemented by forwarding the parameters to the
* intrinsic. As MSVC's intrinsics return S_OK on success, this specialization
* returns whether the intrinsics return value does not equal S_OK. This ensures
* a uniform interface of the add function (false is returned when no overflow
* occurs, true on overflow).
*
* The intrinsics are documented here:
* https://msdn.microsoft.com/en-us/library/windows/desktop/ff516460(v=vs.85).aspx
*/
#define SPECIALIZE_builtin_add_overflow_WIN(type, builtin_name) \
template <> \
inline bool builtin_add_overflow(type summand_1, type summand_2, type& result) \
{ \
return builtin_name(summand_1, summand_2, &result) != S_OK; \
}
SPECIALIZE_builtin_add_overflow_WIN(unsigned int, UIntAdd);
SPECIALIZE_builtin_add_overflow_WIN(unsigned long, ULongAdd);
SPECIALIZE_builtin_add_overflow_WIN(unsigned long long, ULongLongAdd);
#undef SPECIALIZE_builtin_add_overflow_WIN
#endif // _MSC_VER >= 1400
#endif // defined(_MSC_VER)
#endif
} // namespace Internal

View File

@ -8,11 +8,8 @@
#include "i18n.h" // NLS support.
// + standard includes
#include <string>
#include <sstream>
#include <iomanip>
#include <cassert>
#include <cstring>
// *****************************************************************************
// class member definitions

View File

@ -6,7 +6,6 @@
// *****************************************************************************
// included header files
#include "tags.hpp"
#include "types.hpp"
// *****************************************************************************
// namespace extensions

Some files were not shown because too many files have changed in this diff Show More