From 3c42fdddebe892ef2af5421e91ac71ea4dd65e3e Mon Sep 17 00:00:00 2001 From: clanmills Date: Fri, 31 Aug 2018 19:50:43 +0100 Subject: [PATCH] Fix include to include exiv2/config.h (and consequential changes) Fix cltest.cpp and version.cpp to report MSVC 2017 in which _MSC_VER == 1910 --- cmake/config.h.cmake | 2 +- contrib/cmake/msvc/cltest.cpp | 2 ++ include/exiv2/exiv2.hpp | 1 + samples/getopt-test.cpp | 6 ++++-- samples/metacopy.cpp | 1 + src/exiv2.cpp | 4 +++- src/version.cpp | 2 ++ 7 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake index 5c7a9840..941bf651 100644 --- a/cmake/config.h.cmake +++ b/cmake/config.h.cmake @@ -1,4 +1,4 @@ -// File generated by cmake from config/config.h.cmake. +// File generated by cmake from cmake/config.h.cmake. #pragma once #ifndef _EXV_CONF_H_ diff --git a/contrib/cmake/msvc/cltest.cpp b/contrib/cmake/msvc/cltest.cpp index 3531ebb9..9749608c 100644 --- a/contrib/cmake/msvc/cltest.cpp +++ b/contrib/cmake/msvc/cltest.cpp @@ -5,6 +5,8 @@ int main(int,const char**) const char* vs[] = { "unknown" , "2005", "2008", "2010", "2012", "2013", "2015","2017" }; int v = (_MSC_VER-1300)/100; if ( v < 0 || v >= (sizeof(vs)/sizeof(vs[0])) ) v = 0; + if ( v == 6 && _MSC_VER >= 1910 ) v++ ; // 2017 _MSC_VAR == 1910! + fprintf(stderr,"_%s = %d (%s) sizeof(void*) = %d\n","MSC_VER",_MSC_VER,vs[v],(int)sizeof(void*)); return 0; } diff --git a/include/exiv2/exiv2.hpp b/include/exiv2/exiv2.hpp index ae07d0a8..04edae34 100644 --- a/include/exiv2/exiv2.hpp +++ b/include/exiv2/exiv2.hpp @@ -30,6 +30,7 @@ // ***************************************************************************** // included header files +#include "exiv2/config.h" #include "exiv2/datasets.hpp" #include "exiv2/basicio.hpp" #include "exiv2/bmpimage.hpp" diff --git a/samples/getopt-test.cpp b/samples/getopt-test.cpp index b8ba9878..96a82b4a 100644 --- a/samples/getopt-test.cpp +++ b/samples/getopt-test.cpp @@ -22,7 +22,10 @@ // Params::getopt() rc = 0 #include + +// getopt.{cpp|hpp} is not part of libexiv2 #include "getopt.hpp" + #ifdef EXV_HAVE_UNISTD_H #include #endif @@ -33,7 +36,6 @@ #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:"; - // ***************************************************************************** // class Params class Params : public Util::Getopt { @@ -83,7 +85,7 @@ int main(int argc, char** const argv) { int n; -#if EXV_HAVE_UNISTD_H +#ifdef EXV_HAVE_UNISTD_H std::cout << "standard getopt()" << std::endl; do { n = ::getopt(argc,argv,::optstring); diff --git a/samples/metacopy.cpp b/samples/metacopy.cpp index a4b1c93f..c3481da8 100644 --- a/samples/metacopy.cpp +++ b/samples/metacopy.cpp @@ -33,6 +33,7 @@ #include #include +// include local header files which are not part of libexiv2 #include "getopt.hpp" #include "metacopy.hpp" diff --git a/src/exiv2.cpp b/src/exiv2.cpp index a0fb063b..0bc99868 100644 --- a/src/exiv2.cpp +++ b/src/exiv2.cpp @@ -27,9 +27,11 @@ */ // ***************************************************************************** // included header files -#include "config.h" +#include +// include local header files which are not part of libexiv2 #include "exiv2app.hpp" +#include "getopt.hpp" #include "actions.hpp" #include "utils.hpp" #include "convert.hpp" diff --git a/src/version.cpp b/src/version.cpp index 8329f09b..1155edb6 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -200,6 +200,8 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) // 7.10 = 2003 8.00 = 2005 etc 12.00 = 2013 13.00 = 2015 (yet the installer labels it as 14.0!) size_t edition = (_MSC_VER-600)/100; const char* editions[] = { "0","1","2","3","4","5","6","2003", "2005", "2008", "2010", "2012","2013","2015","2017"}; + if ( edition == 13 && _MSC_VER >= 1910 ) edition++ ; // 2017 _MSC_VAR == 1910! + if ( edition > lengthof(editions) ) edition = 0 ; if ( edition ) sprintf(version+::strlen(version)," (%s/%s)",editions[edition],bits==64?"x64":"x86"); #define __VERSION__ version