From 9da2aed5d22e872d2e8ce0589af1dcaaa9b614bd Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Fri, 2 Apr 2021 16:58:20 +0100 Subject: [PATCH] Use the documented 5 line prolog in every sample application. Tidy up sample prologs and header code. --- samples/Jzon.cpp | 19 ------------------- samples/addmoddel.cpp | 25 ++++++++++++++++++++++++- samples/conntest.cpp | 23 +++++++++++++++++++++-- samples/convert-test.cpp | 22 +++++++++++++++++++++- samples/easyaccess-test.cpp | 23 +++++++++++++++++++++-- samples/exifcomment.cpp | 26 ++++++++++++++++++++++---- samples/exifdata-test.cpp | 29 ++++++++++++++++++++--------- samples/exifdata.cpp | 22 +++++++++++++++++++++- samples/exifprint.cpp | 24 +++++++++++++++++++++--- samples/exifvalue.cpp | 22 +++++++++++++++++++++- samples/exiv2json.cpp | 22 +++++++++++++++++++++- samples/geotag.cpp | 11 ++++++----- samples/getopt-test.cpp | 3 +++ samples/httptest.cpp | 4 +++- samples/ini-test.cpp | 7 +++---- samples/iotest.cpp | 4 +++- samples/iptceasy.cpp | 4 +++- samples/iptcprint.cpp | 9 +++++---- samples/iptctest.cpp | 7 ++++--- samples/key-test.cpp | 7 ++++--- samples/largeiptc-test.cpp | 4 +++- samples/metacopy.cpp | 6 +++--- samples/mmap-test.cpp | 4 +++- samples/mrwthumb.cpp | 8 ++++---- samples/mt-test.cpp | 3 +++ samples/path-test.cpp | 4 +++- samples/prevtest.cpp | 4 +++- samples/remotetest.cpp | 4 +++- samples/stringto-test.cpp | 4 +++- samples/taglist.cpp | 4 +++- samples/tiff-test.cpp | 3 +++ samples/tiffaddpath-test.cpp | 5 +++-- samples/toexv.cpp | 8 ++++---- samples/werror-test.cpp | 4 +++- samples/write-test.cpp | 7 ++++--- samples/write2-test.cpp | 7 ++++--- samples/xmpdump.cpp | 4 +++- samples/xmpparse.cpp | 4 +++- samples/xmpparser-test.cpp | 4 +++- samples/xmpprint.cpp | 4 +++- samples/xmpsample.cpp | 3 +++ src/bmffimage.cpp | 12 +++++------- src/exiv2.cpp | 15 +++------------ 43 files changed, 322 insertions(+), 116 deletions(-) diff --git a/samples/Jzon.cpp b/samples/Jzon.cpp index 6f52a106..3d0f3a29 100644 --- a/samples/Jzon.cpp +++ b/samples/Jzon.cpp @@ -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. - */ - /* Copyright (c) 2013 Johannes Häggqvist diff --git a/samples/addmoddel.cpp b/samples/addmoddel.cpp index e171eddb..8186e769 100644 --- a/samples/addmoddel.cpp +++ b/samples/addmoddel.cpp @@ -1,15 +1,38 @@ // ***************************************************************** -*- 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 // Sample program showing how to add, modify and delete Exif metadata. #include - #include #include #include int main(int argc, char* const argv[]) try { + Exiv2::XmpParser::initialize(); + ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif + if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; return 1; diff --git a/samples/conntest.cpp b/samples/conntest.cpp index f67b5c1c..a0c99f5b 100644 --- a/samples/conntest.cpp +++ b/samples/conntest.cpp @@ -1,13 +1,29 @@ // ***************************************************************** -*- 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 // Tester application for testing the http/https/ftp/ssh/sftp connection #include - #ifdef EXV_USE_CURL #include #endif - #include #include @@ -116,6 +132,9 @@ int main(int argc,const char** argv) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc < 2) { std::cout << "Usage: " << argv[0] << " url {-http1_0}" << std::endl; diff --git a/samples/convert-test.cpp b/samples/convert-test.cpp index 30b05cba..4bde64a1 100644 --- a/samples/convert-test.cpp +++ b/samples/convert-test.cpp @@ -1,9 +1,26 @@ // ***************************************************************** -*- 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 // Conversion test driver - make sure you have a copy of the input file around! #include - #include #include #include @@ -12,6 +29,9 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/easyaccess-test.cpp b/samples/easyaccess-test.cpp index ef505936..96195397 100644 --- a/samples/easyaccess-test.cpp +++ b/samples/easyaccess-test.cpp @@ -1,10 +1,26 @@ // ***************************************************************** -*- 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 // Sample program using high-level metadata access functions -// included header files #include - #include #include #include @@ -57,6 +73,9 @@ int main(int argc, char **argv) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/exifcomment.cpp b/samples/exifcomment.cpp index 08724a46..bfaa7838 100644 --- a/samples/exifcomment.cpp +++ b/samples/exifcomment.cpp @@ -1,12 +1,27 @@ // ***************************************************************** -*- 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 - - File: exifcomment.cpp */ -// ***************************************************************************** -// included header files + #include #include #include @@ -17,6 +32,9 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/exifdata-test.cpp b/samples/exifdata-test.cpp index eed3b9cb..c177c363 100644 --- a/samples/exifdata-test.cpp +++ b/samples/exifdata-test.cpp @@ -1,16 +1,24 @@ // ***************************************************************** -*- C++ -*- /* - Abstract : ExifData assignment and copy construction unit tests - - File : exifdata-test.cpp - Author(s): Andreas Huggel (ahu) - History : 20-Feb-05, ahu: created - + * 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 -#include +#include #include #include #include @@ -26,6 +34,9 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/exifdata.cpp b/samples/exifdata.cpp index fb038679..b737da6c 100644 --- a/samples/exifdata.cpp +++ b/samples/exifdata.cpp @@ -1,9 +1,26 @@ // ***************************************************************** -*- 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 // Sample program to format exif data in various external formats #include - #include #include #include @@ -154,6 +171,9 @@ int main(int argc,const char* argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif format_t formats; formats["wolf"] = wolf; diff --git a/samples/exifprint.cpp b/samples/exifprint.cpp index 19c521d9..d6849507 100644 --- a/samples/exifprint.cpp +++ b/samples/exifprint.cpp @@ -1,9 +1,24 @@ // ***************************************************************** -*- C++ -*- -// exifprint.cpp -// Sample program to print the Exif metadata of an image +/* + * 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 - #include #include #include @@ -31,6 +46,9 @@ int _tmain(int argc, _tchar* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif const _tchar* prog = argv[0]; const _tchar* file = argv[1]; diff --git a/samples/exifvalue.cpp b/samples/exifvalue.cpp index 000cbb4a..c43c2e84 100644 --- a/samples/exifvalue.cpp +++ b/samples/exifvalue.cpp @@ -1,9 +1,26 @@ // ***************************************************************** -*- 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 // Sample program to print value of an exif key in an image #include - #include #include #include @@ -13,6 +30,9 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 3) { std::cerr << "Usage: " << argv[0] << " file key\n"; diff --git a/samples/exiv2json.cpp b/samples/exiv2json.cpp index 783d8060..3e9752dc 100644 --- a/samples/exiv2json.cpp +++ b/samples/exiv2json.cpp @@ -1,4 +1,22 @@ // ***************************************************************** -*- 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 // Sample program to print metadata in JSON format @@ -12,7 +30,6 @@ #include #include #include - #include #include #include @@ -270,6 +287,9 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif try { if (argc < 2 || argc > 3) { diff --git a/samples/geotag.cpp b/samples/geotag.cpp index 3c93ddf0..f5063805 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -1,9 +1,4 @@ // ***************************************************************** -*- C++ -*- -// geotag.cpp -// Sample program to read gpx files and update images with GPS tags - -// g++ geotag.cpp -o geotag -lexiv2 -lexpat - /* * Copyright (C) 2004-2021 Exiv2 authors * This program is part of the Exiv2 distribution. @@ -22,6 +17,9 @@ * 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 +// Sample program to read gpx files and update images with GPS tags +// g++ geotag.cpp -o geotag -lexiv2 -lexpat #include #include "unused.h" @@ -785,6 +783,9 @@ int main(int argc,const char* argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif int result=0; const char* program = argv[0]; diff --git a/samples/getopt-test.cpp b/samples/getopt-test.cpp index 024c3a61..01a36185 100644 --- a/samples/getopt-test.cpp +++ b/samples/getopt-test.cpp @@ -103,6 +103,9 @@ int main(int argc, char** const argv) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif int n; diff --git a/samples/httptest.cpp b/samples/httptest.cpp index 30aa21fc..46471e22 100644 --- a/samples/httptest.cpp +++ b/samples/httptest.cpp @@ -23,7 +23,6 @@ */ #include - #include #include @@ -40,6 +39,9 @@ int main(int argc,const char** argv) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if ( argc < 2 ) { std::cout << "usage : " << argv[0] << " [key value]+" << std::endl; diff --git a/samples/ini-test.cpp b/samples/ini-test.cpp index 1c62c364..22def49d 100644 --- a/samples/ini-test.cpp +++ b/samples/ini-test.cpp @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. */ - /* 670 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ gcc ../src/ini.cpp ini-test.cpp -lstdc++ -o ini-test 671 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ ./ini-test @@ -27,17 +26,17 @@ Config loaded from : 'initest.ini' version=6, name=Bob Smith, email=bob@smith.co 672 rmills@rmillsmbp:~/gnu/exiv2/trunk/samples $ */ - // Example that shows simple usage of the INIReader class - #include - #include int main() { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif int result = 0 ; const char* ini = "ini-test.ini"; diff --git a/samples/iotest.cpp b/samples/iotest.cpp index 43894042..04e5460b 100644 --- a/samples/iotest.cpp +++ b/samples/iotest.cpp @@ -20,7 +20,6 @@ // ***************************************************************************** // included header files #include - #include // for EOF #include #include @@ -42,6 +41,9 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif try { if (argc < 4 || argc > 6 ) { diff --git a/samples/iptceasy.cpp b/samples/iptceasy.cpp index 1447d3d6..6636c00a 100644 --- a/samples/iptceasy.cpp +++ b/samples/iptceasy.cpp @@ -21,7 +21,6 @@ */ #include - #include #include #include @@ -30,6 +29,9 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/iptcprint.cpp b/samples/iptcprint.cpp index 93257131..9d0b88ab 100644 --- a/samples/iptcprint.cpp +++ b/samples/iptcprint.cpp @@ -1,6 +1,4 @@ // ***************************************************************** -*- C++ -*- -// iptcprint.cpp -// Sample program to print the IPTC metadata of an image /* * Copyright (C) 2004-2021 Exiv2 authors * This program is part of the Exiv2 distribution. @@ -19,18 +17,21 @@ * 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 +// Sample program to print the IPTC metadata of an image #include - #include #include #include int main(int argc, char* const argv[]) try { - Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/iptctest.cpp b/samples/iptctest.cpp index c8b01887..d9124e26 100644 --- a/samples/iptctest.cpp +++ b/samples/iptctest.cpp @@ -17,10 +17,8 @@ * 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 -#include +#include #include #include #include @@ -38,6 +36,9 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif try { diff --git a/samples/key-test.cpp b/samples/key-test.cpp index 071424ec..491c4628 100644 --- a/samples/key-test.cpp +++ b/samples/key-test.cpp @@ -17,10 +17,8 @@ * 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 -#include +#include #include #include #include @@ -31,6 +29,9 @@ int main() { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif int tc = 0; int rc = 0; diff --git a/samples/largeiptc-test.cpp b/samples/largeiptc-test.cpp index 54d368ed..7414c509 100644 --- a/samples/largeiptc-test.cpp +++ b/samples/largeiptc-test.cpp @@ -21,7 +21,6 @@ */ #include - #include #include @@ -30,6 +29,9 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 3) { std::cout << "Usage: " << argv[0] << " image datafile\n"; diff --git a/samples/metacopy.cpp b/samples/metacopy.cpp index 63f9d63e..bc7a25ab 100644 --- a/samples/metacopy.cpp +++ b/samples/metacopy.cpp @@ -17,10 +17,7 @@ * 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 #include - #include #include #include @@ -36,6 +33,9 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif // Handle command line arguments Params params; diff --git a/samples/mmap-test.cpp b/samples/mmap-test.cpp index 182eacf2..f1eb53b0 100644 --- a/samples/mmap-test.cpp +++ b/samples/mmap-test.cpp @@ -21,7 +21,6 @@ */ #include - #include #include @@ -31,6 +30,9 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/mrwthumb.cpp b/samples/mrwthumb.cpp index c1bbab78..8f8a7632 100644 --- a/samples/mrwthumb.cpp +++ b/samples/mrwthumb.cpp @@ -20,10 +20,7 @@ * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. */ -#include "error.hpp" -#include "exif.hpp" -#include "image.hpp" - +#include #include #include @@ -31,6 +28,9 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif try { if (argc != 2) { diff --git a/samples/mt-test.cpp b/samples/mt-test.cpp index b3e72080..bf4ed5c6 100644 --- a/samples/mt-test.cpp +++ b/samples/mt-test.cpp @@ -82,6 +82,9 @@ int main(int argc,const char* argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif int result = 0; diff --git a/samples/path-test.cpp b/samples/path-test.cpp index f71f6154..e84f56da 100644 --- a/samples/path-test.cpp +++ b/samples/path-test.cpp @@ -20,7 +20,6 @@ */ #include - #include #include #include @@ -32,6 +31,9 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/prevtest.cpp b/samples/prevtest.cpp index fb178bb3..5e106afd 100644 --- a/samples/prevtest.cpp +++ b/samples/prevtest.cpp @@ -21,7 +21,6 @@ */ #include - #include #include #include @@ -30,6 +29,9 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/remotetest.cpp b/samples/remotetest.cpp index 2ca331ea..7444d57e 100644 --- a/samples/remotetest.cpp +++ b/samples/remotetest.cpp @@ -23,7 +23,6 @@ */ #include - #include #include #include @@ -32,6 +31,9 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc < 2) { std::cout << "Usage: " << argv[0] << " file {--nocurl | --curl}\n\n"; diff --git a/samples/stringto-test.cpp b/samples/stringto-test.cpp index 69bbb102..13f32361 100644 --- a/samples/stringto-test.cpp +++ b/samples/stringto-test.cpp @@ -21,7 +21,6 @@ */ #include - #include #include @@ -60,6 +59,9 @@ int main() { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif std::cout << std::setfill(' '); diff --git a/samples/taglist.cpp b/samples/taglist.cpp index d761b165..b08cc1f1 100644 --- a/samples/taglist.cpp +++ b/samples/taglist.cpp @@ -19,7 +19,6 @@ */ #include - #include #include #include @@ -30,6 +29,9 @@ int main(int argc, char* argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif int rc = EXIT_SUCCESS; std::ostringstream out; diff --git a/samples/tiff-test.cpp b/samples/tiff-test.cpp index e22990d2..9d147a3e 100644 --- a/samples/tiff-test.cpp +++ b/samples/tiff-test.cpp @@ -40,6 +40,9 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/tiffaddpath-test.cpp b/samples/tiffaddpath-test.cpp index b122a171..60559ec0 100644 --- a/samples/tiffaddpath-test.cpp +++ b/samples/tiffaddpath-test.cpp @@ -20,9 +20,7 @@ // tiffaddpath-test.cpp // Test driver to test adding new tags to a TIFF composite structure - #include - #include "tiffcomposite_int.hpp" #include "makernote2_int.hpp" #include "tiffimage_int.hpp" @@ -84,6 +82,9 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 3) { std::cout << "Usage: " << argv[0] << " tag group\n" diff --git a/samples/toexv.cpp b/samples/toexv.cpp index 255eaa64..3353bf64 100644 --- a/samples/toexv.cpp +++ b/samples/toexv.cpp @@ -18,14 +18,11 @@ * 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 -#include +#include #include #include #include - #include "utils.hpp" #include "toexv.hpp" @@ -44,6 +41,9 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif try { // Handle command line arguments diff --git a/samples/werror-test.cpp b/samples/werror-test.cpp index 8fac3b73..a299b9e7 100644 --- a/samples/werror-test.cpp +++ b/samples/werror-test.cpp @@ -23,13 +23,15 @@ // Simple tests for the wide-string error class WError #include - #include int main() { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif try { throw Exiv2::Error(Exiv2::kerGeneralError, "ARG1", "ARG2", "ARG3"); diff --git a/samples/write-test.cpp b/samples/write-test.cpp index 0016feaa..b4b6a1ab 100644 --- a/samples/write-test.cpp +++ b/samples/write-test.cpp @@ -17,10 +17,8 @@ * 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 -#include +#include #include #include #include @@ -46,6 +44,9 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif try { diff --git a/samples/write2-test.cpp b/samples/write2-test.cpp index d95609d4..854b7a2d 100644 --- a/samples/write2-test.cpp +++ b/samples/write2-test.cpp @@ -17,10 +17,8 @@ * 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 -#include +#include #include #include #include @@ -35,6 +33,9 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif try { if (argc != 2) { diff --git a/samples/xmpdump.cpp b/samples/xmpdump.cpp index fff3e62b..f8172c57 100644 --- a/samples/xmpdump.cpp +++ b/samples/xmpdump.cpp @@ -21,7 +21,6 @@ // xmpdump.cpp // Sample program to dump the XMP packet of an image #include - #include #include #include @@ -30,6 +29,9 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif try { if (argc != 2) { diff --git a/samples/xmpparse.cpp b/samples/xmpparse.cpp index af812041..68719026 100644 --- a/samples/xmpparse.cpp +++ b/samples/xmpparse.cpp @@ -21,7 +21,6 @@ // Read an XMP packet from a file, parse it and print all (known) properties. #include - #include #include #include @@ -30,6 +29,9 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/xmpparser-test.cpp b/samples/xmpparser-test.cpp index 29805f0a..2e96d4bb 100644 --- a/samples/xmpparser-test.cpp +++ b/samples/xmpparser-test.cpp @@ -21,7 +21,6 @@ // Read an XMP packet from a file, parse and re-serialize it. #include - #include #include #include @@ -30,6 +29,9 @@ int main(int argc, char* const argv[]) try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif if (argc != 2) { std::cout << "Usage: " << argv[0] << " file\n"; diff --git a/samples/xmpprint.cpp b/samples/xmpprint.cpp index bb704bb4..51077d9a 100644 --- a/samples/xmpprint.cpp +++ b/samples/xmpprint.cpp @@ -27,7 +27,6 @@ // ======================================================================== #include - #include #include #include @@ -37,6 +36,9 @@ int main(int argc, char** argv) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif try { diff --git a/samples/xmpsample.cpp b/samples/xmpsample.cpp index 4b24b787..f10ea3a3 100644 --- a/samples/xmpsample.cpp +++ b/samples/xmpsample.cpp @@ -39,6 +39,9 @@ int main() try { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXIV2_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif // The XMP property container Exiv2::XmpData xmpData; diff --git a/src/bmffimage.cpp b/src/bmffimage.cpp index b9ad9436..d7dd71f0 100644 --- a/src/bmffimage.cpp +++ b/src/bmffimage.cpp @@ -85,16 +85,14 @@ namespace Exiv2 { static bool enabled = false; +#ifdef EXV_ENABLE_BMFF EXIV2API bool enableBMFF(bool enable) { -#ifdef EXV_ENABLE_BMFF - enabled = enable; - return true; -#else - UNUSED(enable); - return false; -#endif // EXV_ENABLE_BMFF + bool result = enabled; + enabled = enable ; + return result ; } +#endif // EXV_ENABLE_BMFF std::string Iloc::toString() const { diff --git a/src/exiv2.cpp b/src/exiv2.cpp index 7012f736..22ccafc4 100644 --- a/src/exiv2.cpp +++ b/src/exiv2.cpp @@ -17,15 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. */ -/* - Abstract: Command line program to display and manipulate image metadata. - File: exiv2.cpp - Author(s): Andreas Huggel (ahu) - History: 10-Dec-03, ahu: created - */ -// ***************************************************************************** -// included header files #include // include local header files which are not part of libexiv2 @@ -128,6 +120,9 @@ int main(int argc, char* const argv[]) { Exiv2::XmpParser::initialize(); ::atexit(Exiv2::XmpParser::terminate); +#ifdef EXV_ENABLE_BMFF + Exiv2::enableBMFF(); +#endif #ifdef EXV_ENABLE_NLS setlocale(LC_ALL, ""); @@ -136,10 +131,6 @@ int main(int argc, char* const argv[]) textdomain(EXV_PACKAGE_NAME); #endif -#ifdef EXV_ENABLE_BMFF - Exiv2::enableBMFF(); -#endif - // Handle command line arguments Params& params = Params::instance(); if (params.getopt(argc, argv)) {