diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index e6d6e906..5429df35 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -40,6 +40,7 @@ foreach(entry ${SAMPLES}) list(APPEND APPLICATIONS ${target}) add_test( ${target}_test ${target} ) target_link_libraries( ${target} PRIVATE exiv2lib) + target_include_directories(${target} PRIVATE ${CMAKE_SOURCE_DIR}/src) # To find unused.h install( TARGETS ${target} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endforeach() @@ -80,6 +81,7 @@ if( EXPAT_FOUND ) list(APPEND APPLICATIONS geotag) target_link_libraries( geotag PRIVATE exiv2lib ${EXPAT_LIBRARIES}) target_include_directories(geotag PRIVATE ${EXPAT_INCLUDE_DIR}) + target_include_directories(geotag PRIVATE ${CMAKE_SOURCE_DIR}/src) # To find unused.h if (WIN32) target_compile_definitions(geotag PRIVATE XML_STATIC) diff --git a/samples/geotag.cpp b/samples/geotag.cpp index d190100a..13558276 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -5,6 +5,7 @@ // g++ geotag.cpp -o geotag -lexiv2 -lexpat #include +#include "unused.h" #include #include @@ -57,8 +58,6 @@ char* realpath(const char* file,char* path); #define _MAX_PATH 1024 #endif -#define UNUSED(x) (void)(x) - // prototypes class Options; int getFileType(const char* path ,Options& options); @@ -849,16 +848,16 @@ int main(int argc,const char* argv[]) } /* if ( options.verbose ) { - printf("Time Dictionary\n"); - for ( TimeDict_i it = gTimeDict.begin() ; it != gTimeDict.end() ; it++ ) { - std::string sTime = getExifTime(it->first); - Position* pPos = &it->second; - std::string sPos = Position::toExifString(pPos->lat(),false,true) - + " " - + Position::toExifString(pPos->lon(),false,true) - ; - printf("%s %s\n",sTime.c_str(), sPos.c_str()); - } + printf("Time Dictionary\n"); + for ( TimeDict_i it = gTimeDict.begin() ; it != gTimeDict.end() ; it++ ) { + std::string sTime = getExifTime(it->first); + Position* pPos = &it->second; + std::string sPos = Position::toExifString(pPos->lat(),false,true) + + " " + + Position::toExifString(pPos->lon(),false,true) + ; + printf("%s %s\n",sTime.c_str(), sPos.c_str()); + } } */ for ( size_t p = 0 ; p < gFiles.size() ; p++ ) { diff --git a/samples/xmpsample.cpp b/samples/xmpsample.cpp index b1978875..887057fe 100644 --- a/samples/xmpsample.cpp +++ b/samples/xmpsample.cpp @@ -3,6 +3,7 @@ // Sample/test for high level XMP classes. See also addmoddel.cpp #include +#include "unused.h" #include #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9be6582b..24782a8b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -143,6 +143,7 @@ set( LIBEXIV2_PRIVATE_HDR tifffwd_int.hpp tiffimage_int.hpp tiffvisitor_int.hpp + unused.h ) diff --git a/src/convert.cpp b/src/convert.cpp index 23d51d87..135b233e 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -67,10 +67,6 @@ # include #endif // EXV_HAVE_XMP_TOOLKIT -#ifndef UNUSED -#define UNUSED(x) (void)(x) -#endif - // ***************************************************************************** // local declarations namespace { diff --git a/src/unused.h b/src/unused.h new file mode 100644 index 00000000..5f928782 --- /dev/null +++ b/src/unused.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2004-2018 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. + */ + +#ifndef UNUSED_H +#define UNUSED_H + +#define UNUSED(x) (void)(x) + +#endif // UNUSED_H