From 6ea6c7219a64bdff0a222a9bf4f1af5f121daf03 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 4 Sep 2017 12:05:08 +0200 Subject: [PATCH] Avoid including curl.h in dialog about (including curl.h creates constraints with wxWidgets especially on Windows) and remove duplicate code. --- common/dialog_about/dialog_about.cpp | 12 ++++++++---- common/kicad_curl/kicad_curl.cpp | 10 ++++++++++ include/kicad_curl/kicad_curl_easy.h | 19 +++---------------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/common/dialog_about/dialog_about.cpp b/common/dialog_about/dialog_about.cpp index d33dc90351..0e4d881c0c 100644 --- a/common/dialog_about/dialog_about.cpp +++ b/common/dialog_about/dialog_about.cpp @@ -24,12 +24,16 @@ #include +#include // kicad_curl.h must be included before wx headers, to avoid // conflicts for some defines, at least on Windows #ifdef BUILD_GITHUB_PLUGIN -#include -#include +// kicad_curl.h can create conflicts for some defines, at least on Windows +// so we are using here 2 proxy functions to know Curl version to avoid +// including kicad_curl.h to know Curl version +extern std::string GetKicadCurlVersion(); +extern std::string GetCurlLibVersion(); #endif #include @@ -426,7 +430,7 @@ void DIALOG_ABOUT::buildVersionInfoData( wxString& aMsg, bool aFormatHtml ) aMsg << indent4 << wxGetLibraryVersionInfo().GetVersionString() << eol; #ifdef BUILD_GITHUB_PLUGIN - aMsg << indent4 << KICAD_CURL::GetVersion() << eol; + aMsg << indent4 << GetKicadCurlVersion() << eol; #endif aMsg << "Platform: " << wxGetOsDescription() << ", " << platform.GetArchName() << ", " @@ -453,7 +457,7 @@ void DIALOG_ABOUT::buildVersionInfoData( wxString& aMsg, bool aFormatHtml ) << ( BOOST_VERSION % 100 ) << eol; #ifdef BUILD_GITHUB_PLUGIN - aMsg << indent4 << "Curl: " << LIBCURL_VERSION << eol; + aMsg << indent4 << "Curl: " << GetCurlLibVersion() << eol; #endif aMsg << indent4 << "Compiler: "; diff --git a/common/kicad_curl/kicad_curl.cpp b/common/kicad_curl/kicad_curl.cpp index fb4413c9e0..79f29a8e3f 100644 --- a/common/kicad_curl/kicad_curl.cpp +++ b/common/kicad_curl/kicad_curl.cpp @@ -222,3 +222,13 @@ std::string KICAD_CURL::GetSimpleVersion() return res; } + +std::string GetKicadCurlVersion() +{ + return KICAD_CURL::GetVersion(); +} + +std::string GetCurlLibVersion() +{ + return LIBCURL_VERSION; +} diff --git a/include/kicad_curl/kicad_curl_easy.h b/include/kicad_curl/kicad_curl_easy.h index 80d427c705..245db8f09a 100644 --- a/include/kicad_curl/kicad_curl_easy.h +++ b/include/kicad_curl/kicad_curl_easy.h @@ -26,25 +26,12 @@ /* * KICAD_CURL_EASY.h must included before wxWidgets because on Windows, - * wxWidgets ends up including windows.h before winsocks2.h inside curl - * this causes build warnings - * Because we are before wx, we must explicitly define we are building with unicode - * wxWidgets defaults to supporting unicode now, so this should be safe. + * because kicad_curl.h includes curl.h, wxWidgets ends up including windows.h + * before winsocks2.h inside curl and this causes build warnings */ -#if defined(WIN32) - #ifndef UNICODE - # define UNICODE - #endif - #ifndef _UNICODE - # define _UNICODE - #endif -#endif - - -#include -#include #include +#include /**