Do not include kicad_curl.h (and therefore curl.h) in kicad_curl_easy.h
curl.h has constraints on Windows (because it includes winsocks2.h) and must be included before any wxxxx.h. Because only very few files need curl.h, kicad_curl.h is included only in these files
This commit is contained in:
parent
6c7c9ca50c
commit
f59e66a897
|
@ -2064,7 +2064,6 @@ void OPENGL_GAL::drawBitmapOverbar( double aLength, double aHeight )
|
|||
std::pair<VECTOR2D, float> OPENGL_GAL::computeBitmapTextSize( const UTF8& aText ) const
|
||||
{
|
||||
static const FONT_GLYPH_TYPE* defaultGlyph = LookupGlyph( '(' ); // for strange chars
|
||||
static const FONT_GLYPH_TYPE* lineGlyph = LookupGlyph( '_' ); // for overbar thickness
|
||||
|
||||
VECTOR2D textSize( 0, 0 );
|
||||
float commonOffset = std::numeric_limits<float>::max();
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
// kicad_curl_easy.h **must be** included before any wxWidgets header to avoid conflicts
|
||||
// at least on Windows/msys2
|
||||
#include <kicad_curl/kicad_curl.h>
|
||||
#include <kicad_curl/kicad_curl_easy.h>
|
||||
|
||||
#include <cstdarg>
|
||||
|
@ -72,6 +75,23 @@ static size_t stream_write_callback( void* contents, size_t size, size_t nmemb,
|
|||
}
|
||||
|
||||
|
||||
static int xferinfo( void* p, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal,
|
||||
curl_off_t ulnow )
|
||||
{
|
||||
CURL_PROGRESS* progress = (CURL_PROGRESS*) p;
|
||||
curl_off_t curtime = 0;
|
||||
|
||||
curl_easy_getinfo( progress->curl->GetCurl(), CURLINFO_TOTAL_TIME_T, &curtime );
|
||||
|
||||
if( curtime - progress->last_run_time >= progress->interval )
|
||||
{
|
||||
progress->last_run_time = curtime;
|
||||
return progress->callback( dltotal, dlnow, ultotal, ulnow );
|
||||
}
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
KICAD_CURL_EASY::KICAD_CURL_EASY() : m_headers( nullptr )
|
||||
{
|
||||
// Call KICAD_CURL::Init() from in here everytime, but only the first time
|
||||
|
@ -204,23 +224,6 @@ std::string KICAD_CURL_EASY::Escape( const std::string& aUrl )
|
|||
}
|
||||
|
||||
|
||||
int KICAD_CURL_EASY::xferinfo( void* p, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal,
|
||||
curl_off_t ulnow )
|
||||
{
|
||||
CURL_PROGRESS* progress = (CURL_PROGRESS*) p;
|
||||
curl_off_t curtime = 0;
|
||||
|
||||
curl_easy_getinfo( progress->curl->m_CURL, CURLINFO_TOTAL_TIME_T, &curtime );
|
||||
|
||||
if( curtime - progress->last_run_time >= progress->interval )
|
||||
{
|
||||
progress->last_run_time = curtime;
|
||||
return progress->callback( dltotal, dlnow, ultotal, ulnow );
|
||||
}
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
|
||||
bool KICAD_CURL_EASY::SetTransferCallback( const TRANSFER_CALLBACK& aCallback, size_t aInterval )
|
||||
{
|
||||
|
|
|
@ -25,15 +25,15 @@
|
|||
#define KICAD_CURL_EASY_H_
|
||||
|
||||
/*
|
||||
* KICAD_CURL_EASY.h must be included before wxWidgets headers because on Windows,
|
||||
* kicad_curl.h does not include curl.h, because wxWidgets ends up including windows.h
|
||||
* before winsocks2.h inside curl and curl.h causes build warnings if included before and wxxxx.h
|
||||
* curl.h, and therefore kicad_curl.h must be included before wxWidgets headers because on Windows,
|
||||
* wxWidgets ends up including windows.h before winsocks2.h
|
||||
* curl and curl.h causes build warnings if included before any wxxxx.h
|
||||
*
|
||||
* so including kicad_curl.h could be needed in a few sources
|
||||
* So kicad_curl_easy.h does not include curl.h to avoid constraints,
|
||||
* and including kicad_curl.h could be needed in a few sources
|
||||
*/
|
||||
|
||||
#include <functional>
|
||||
#include <kicad_curl/kicad_curl.h>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
@ -138,6 +138,9 @@ public:
|
|||
|
||||
bool SetOutputStream( const std::ostream* aOutput );
|
||||
|
||||
CURL* GetCurl() { return m_CURL; }
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* Function setOption
|
||||
|
@ -150,7 +153,7 @@ private:
|
|||
template <typename T>
|
||||
int setOption( int aOption, T aArg );
|
||||
|
||||
static int xferinfo( void*, curl_off_t, curl_off_t, curl_off_t, curl_off_t );
|
||||
//static int xferinfo( void*, curl_off_t, curl_off_t, curl_off_t, curl_off_t );
|
||||
|
||||
CURL* m_CURL;
|
||||
curl_slist* m_headers;
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// kicad_curl_easy.h *must be* included before any wxWidgets header to avoid conflicts
|
||||
// kicad_curl.h *must be* included before any wxWidgets header to avoid conflicts
|
||||
// at least on Windows/msys2
|
||||
#include <kicad_curl/kicad_curl.h>
|
||||
#include "kicad_curl/kicad_curl_easy.h"
|
||||
|
||||
#include "pcm.h"
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
// kicad_curl_easy.h **must be** included before any wxWidgets header to avoid conflicts
|
||||
// at least on Windows/msys2
|
||||
#include <kicad_curl/kicad_curl.h>
|
||||
#include "kicad_curl/kicad_curl_easy.h"
|
||||
|
||||
#include "pcm_task_manager.h"
|
||||
|
|
Loading…
Reference in New Issue