diff --git a/CMakeLists.txt b/CMakeLists.txt index 687bd35112..e1f31913e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,8 +186,27 @@ if (MSVC) target_include_directories(openspace-core PUBLIC ${OPENSPACE_EXT_DIR}/vld) end_dependency() endif () -endif () + option(OPENSPACE_VTUNE_ENABLED "Include VTune support" OFF) + set(OPENSPACE_VTUNE_PATH "C:/Program Files (x86)/IntelSWTools/VTune Amplifier 2019" CACHE STRING "Path to VTune installation") + if (OPENSPACE_VTUNE_ENABLED) + begin_dependency("Intel VTune") + target_compile_definitions(openspace-core PUBLIC "OPENSPACE_HAS_VTUNE") + target_include_directories(openspace-core PUBLIC "${OPENSPACE_VTUNE_PATH}/include") + target_link_libraries(openspace-core "${OPENSPACE_VTUNE_PATH}/lib64/libittnotify.lib") + end_dependency() + endif () + + option(OPENSPACE_NVTOOLS_ENABLED "Include support for Nvidia Tools Extensions" OFF) + set(OPENSPACE_NVTOOLS_PATH "C:/Program Files/NVIDIA Corporation/NvToolsExt") + if (OPENSPACE_NVTOOLS_ENABLED) + begin_dependency("Nvidia Tools Extension") + target_compile_definitions(openspace-core PUBLIC "OPENSPACE_HAS_NVTOOLS") + target_include_directories(openspace-core PUBLIC "${OPENSPACE_NVTOOLS_PATH}/include") + end_dependency() + endif () + +endif () ########################################################################################## # Tests # diff --git a/apps/OpenSpace/CMakeLists.txt b/apps/OpenSpace/CMakeLists.txt index fa95613d56..0886e108c8 100644 --- a/apps/OpenSpace/CMakeLists.txt +++ b/apps/OpenSpace/CMakeLists.txt @@ -176,3 +176,7 @@ if (MSVC) target_link_libraries(OpenSpace Dbghelp.lib) end_header() endif () + +if (OPENSPACE_NVTOOLS_ENABLED) + target_link_libraries(OpenSpace "${OPENSPACE_NVTOOLS_PATH}/lib/x64/nvToolsExt64_1.lib") +endif () diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index 56355f5138..5af78a0977 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -63,6 +63,18 @@ #include "SpoutLibrary.h" #endif // OPENSPACE_HAS_SPOUT +#ifdef OPENSPACE_HAS_VTUNE +#include + +// If this is set to 'true', it will disable all frame markers in this file and expect +// you to place them in the code you actually want to inspect +constexpr const bool EnableDetailedVtune = false; +#endif // OPENSPACE_HAS_VTUNE + +#ifdef OPENSPACE_HAS_NVTOOLS +#include "nvToolsExt.h" +#endif // OPENSPACE_HAS_NVTOOLS + namespace { constexpr const char* _loggerCat = "main"; @@ -76,6 +88,26 @@ sgct::SharedVector _synchronizationBuffer; sgct::SGCTWindow* FirstOpenVRWindow = nullptr; #endif +#ifdef OPENSPACE_HAS_VTUNE + +struct { + __itt_domain* init; + __itt_domain* preSync; + __itt_domain* postSyncPreDraw; + __itt_domain* render; + __itt_domain* draw2D; + __itt_domain* postDraw; + __itt_domain* keyboard; + __itt_domain* mouseButton; + __itt_domain* mousePos; + __itt_domain* mouseScroll; + __itt_domain* character; + __itt_domain* encode; + __itt_domain* decode; +} _vTune; + +#endif // OPENSPACE_HAS_VTUNE + // // SPOUT-support // @@ -219,6 +251,11 @@ std::pair supportedOpenGLVersion() { // Init function // void mainInitFunc() { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.init, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE LTRACE("main::mainInitFunc(begin)"); LDEBUG("Initializing OpenSpace Engine started"); @@ -334,12 +371,23 @@ void mainInitFunc() { } LTRACE("main::mainInitFunc(end)"); +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.init, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } void mainPreSyncFunc() { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.preSync, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE LTRACE("main::mainPreSyncFunc(begin)"); + openspace::global::openSpaceEngine.preSynchronization(); // Query joystick status @@ -419,12 +467,26 @@ void mainPreSyncFunc() { } LTRACE("main::mainPreSyncFunc(end)"); +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.preSync, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } void mainPostSyncPreDrawFunc() { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.postSyncPreDraw, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE +#ifdef OPENSPACE_HAS_NVTOOLS + nvtxRangePush("postSyncPreDraw"); +#endif // OPENSPACE_HAS_NVTOOLS LTRACE("main::postSynchronizationPreDraw(begin)"); + openspace::global::openSpaceEngine.postSynchronizationPreDraw(); #ifdef OPENVR_SUPPORT @@ -435,11 +497,28 @@ void mainPostSyncPreDrawFunc() { #endif // OPENVR_SUPPORT LTRACE("main::postSynchronizationPreDraw(end)"); + +#ifdef OPENSPACE_HAS_NVTOOLS + nvtxRangePop(); +#endif // OPENSPACE_HAS_NVTOOLS +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.postSyncPreDraw, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } void mainRenderFunc() { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.render, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE +#ifdef OPENSPACE_HAS_NVTOOLS + nvtxRangePush("render"); +#endif // OPENSPACE_HAS_NVTOOLS LTRACE("main::mainRenderFunc(begin)"); glm::mat4 viewMatrix = SgctEngine->getCurrentViewMatrix() * @@ -465,12 +544,26 @@ void mainRenderFunc() { catch (const ghoul::RuntimeError& e) { LERRORC(e.component, e.message); } + LTRACE("main::mainRenderFunc(end)"); +#ifdef OPENSPACE_HAS_NVTOOLS + nvtxRangePop(); +#endif // OPENSPACE_HAS_NVTOOLS +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.render, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } void mainDraw2DFunc() { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.draw2D, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE LTRACE("main::mainDraw2DFunc(begin)"); try { @@ -486,11 +579,21 @@ void mainDraw2DFunc() { glDisable(GL_DEPTH_TEST); LTRACE("main::mainDraw2DFunc(end)"); +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.draw2D, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } void mainPostDrawFunc() { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.postDraw, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE LTRACE("main::mainPostDrawFunc(begin)"); #ifdef OPENVR_SUPPORT @@ -531,73 +634,162 @@ void mainPostDrawFunc() { #endif // OPENSPACE_HAS_SPOUT LTRACE("main::mainPostDrawFunc(end)"); +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.postDraw, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } void mainKeyboardCallback(int key, int, int action, int mods) { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.keyboard, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE LTRACE("main::mainKeyboardCallback(begin)"); + openspace::global::openSpaceEngine.keyboardCallback( openspace::Key(key), openspace::KeyModifier(mods), openspace::KeyAction(action) ); + LTRACE("main::mainKeyboardCallback(begin)"); +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.keyboard, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } void mainMouseButtonCallback(int key, int action, int modifiers) { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.mouseButton, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE LTRACE("main::mainMouseButtonCallback(begin)"); + openspace::global::openSpaceEngine.mouseButtonCallback( openspace::MouseButton(key), openspace::MouseAction(action), openspace::KeyModifier(modifiers) ); + LTRACE("main::mainMouseButtonCallback(end)"); +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.mouseButton, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } void mainMousePosCallback(double x, double y) { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.mousePos, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE + openspace::global::openSpaceEngine.mousePositionCallback(x, y); + +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.mousePos, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } void mainMouseScrollCallback(double posX, double posY) { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.mouseScroll, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE LTRACE("main::mainMouseScrollCallback(begin"); + openspace::global::openSpaceEngine.mouseScrollWheelCallback(posX, posY); + LTRACE("main::mainMouseScrollCallback(end)"); +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.mouseScroll, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } void mainCharCallback(unsigned int codepoint, int mods) { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.character, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE + openspace::global::openSpaceEngine.charCallback( codepoint, openspace::KeyModifier(mods) ); + +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.character, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } void mainEncodeFun() { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.encode, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE LTRACE("main::mainEncodeFun(begin)"); + std::vector data = openspace::global::openSpaceEngine.encode(); _synchronizationBuffer.setVal(std::move(data)); sgct::SharedData::instance()->writeVector(&_synchronizationBuffer); + LTRACE("main::mainEncodeFun(end)"); +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.encode, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } void mainDecodeFun() { +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_begin_v3(_vTune.decode, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE LTRACE("main::mainDecodeFun(begin)"); + sgct::SharedData::instance()->readVector(&_synchronizationBuffer); std::vector data = _synchronizationBuffer.getVal(); openspace::global::openSpaceEngine.decode(std::move(data)); + LTRACE("main::mainDecodeFun(end)"); +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + __itt_frame_end_v3(_vTune.decode, nullptr); + } +#endif // OPENSPACE_HAS_VTUNE } @@ -822,6 +1014,25 @@ int main(int argc, char** argv) { SetUnhandledExceptionFilter(generateMiniDump); #endif // WIN32 +#ifdef OPENSPACE_HAS_VTUNE + if (EnableDetailedVtune) { + _vTune.init = __itt_domain_create("init"); + _vTune.preSync = __itt_domain_create("preSync"); + _vTune.postSyncPreDraw = __itt_domain_create("postSyncPreDraw"); + _vTune.render = __itt_domain_create("render"); + _vTune.draw2D = __itt_domain_create("draw2D"); + _vTune.postDraw = __itt_domain_create("postDraw"); + _vTune.keyboard = __itt_domain_create("keyboard"); + _vTune.mouseButton = __itt_domain_create("mouseButton"); + _vTune.mousePos = __itt_domain_create("mousePos"); + _vTune.mouseScroll = __itt_domain_create("mouseScroll"); + _vTune.character = __itt_domain_create("character"); + _vTune.encode = __itt_domain_create("encode"); + _vTune.decode = __itt_domain_create("decode"); + } +#endif // OPENSPACE_HAS_VTUNE + + // Initialize the LogManager and add the console log as this will be used every time // and we need a fall back if something goes wrong between here and when we add the // logs from the configuration file. If the user requested as specific loglevel in the diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt index 0489724bfb..5d2bbafadf 100644 --- a/modules/globebrowsing/CMakeLists.txt +++ b/modules/globebrowsing/CMakeLists.txt @@ -123,7 +123,7 @@ if (WIN32) PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal_i.lib ) - register_external_libraries("${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal203.dll") + register_external_libraries("${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal241.dll") else (WIN32) find_package(GDAL REQUIRED) diff --git a/modules/globebrowsing/ext/gdal/include/cpl_alibaba_oss.h b/modules/globebrowsing/ext/gdal/include/cpl_alibaba_oss.h index b0d999f2e5..29151a0e75 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_alibaba_oss.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_alibaba_oss.h @@ -1,5 +1,5 @@ /********************************************************************** - * $Id: cpl_alibaba_oss.h e648607661fdd5cbc6bb778c17c20c3e7979a734 2018-04-04 19:27:08 +0200 Even Rouault $ + * $Id: cpl_alibaba_oss.h c39d156816d937c3139360b11786c769aeabd21e 2018-05-05 19:48:08 +0200 Even Rouault $ * * Name: cpl_alibaba_oss.h * Project: CPL - Common Portability Library @@ -45,14 +45,16 @@ class VSIOSSHandleHelper final: public IVSIS3LikeHandleHelper { - CPLString m_osURL; - CPLString m_osSecretAccessKey; - CPLString m_osAccessKeyId; - CPLString m_osEndpoint; - CPLString m_osBucket; - CPLString m_osObjectKey; - bool m_bUseHTTPS; - bool m_bUseVirtualHosting; + CPL_DISALLOW_COPY_ASSIGN(VSIOSSHandleHelper) + + CPLString m_osURL{}; + CPLString m_osSecretAccessKey{}; + CPLString m_osAccessKeyId{}; + CPLString m_osEndpoint{}; + CPLString m_osBucket{}; + CPLString m_osObjectKey{}; + bool m_bUseHTTPS = false; + bool m_bUseVirtualHosting = false; void RebuildURL() override; @@ -104,9 +106,9 @@ class VSIOSSHandleHelper final: public IVSIS3LikeHandleHelper class VSIOSSUpdateParams { public: - CPLString m_osEndpoint; + CPLString m_osEndpoint{}; - VSIOSSUpdateParams() {} + VSIOSSUpdateParams() = default; explicit VSIOSSUpdateParams(const VSIOSSHandleHelper* poHelper) : m_osEndpoint(poHelper->GetEndpoint()) {} diff --git a/modules/globebrowsing/ext/gdal/include/cpl_auto_close.h b/modules/globebrowsing/ext/gdal/include/cpl_auto_close.h new file mode 100644 index 0000000000..a3d422e68d --- /dev/null +++ b/modules/globebrowsing/ext/gdal/include/cpl_auto_close.h @@ -0,0 +1,85 @@ +/********************************************************************** + * $Id: cpl_auto_close.h 928c6bcbd3901094d5680a73a623acc194f55afc 2018-10-07 18:11:27 +0800 小旋风 $ + * + * Name: cpl_auto_close.h + * Project: CPL - Common Portability Library + * Purpose: CPL Auto Close handling + * Author: Liu Yimin, ymwh@foxmail.com + * + ********************************************************************** + * Copyright (c) 2018, Liu Yimin + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + ****************************************************************************/ + +#ifndef CPL_AUTO_CLOSE_H_INCLUDED +#define CPL_AUTO_CLOSE_H_INCLUDED + +#if defined(__cplusplus) +#include + +/************************************************************************/ +/* CPLAutoClose */ +/************************************************************************/ + +/** + * The class use the destructor to automatically close the resource. + * Example: + * GDALDatasetH hDset = GDALOpen(path,GA_ReadOnly); + * CPLAutoClose autoclosehDset(hDset,GDALClose); + * Or: + * GDALDatasetH hDset = GDALOpen(path,GA_ReadOnly); + * CPL_AUTO_CLOSE_WARP(hDset,GDALClose); + */ +template +class CPLAutoClose { + static_assert( !std::is_const<_Ty>::value && std::is_pointer<_Ty>::value, + "_Ty must is pointer type,_Dx must is function type"); + private: + _Ty& m_ResourcePtr; + _Dx m_CloseFunc; + private: + CPLAutoClose(const CPLAutoClose&) = delete; + void operator=(const CPLAutoClose&) = delete; + public: + /** + * @brief Constructor. + * @param ptr Pointer to the resource object. + * @param dt Resource release(close) function. + */ + explicit CPLAutoClose(_Ty& ptr,_Dx dt) : + m_ResourcePtr(ptr), + m_CloseFunc(dt) + {} + /** + * @brief Destructor. + */ + ~CPLAutoClose() + { + if(m_ResourcePtr && m_CloseFunc) + m_CloseFunc(m_ResourcePtr); + } +}; + +#define CPL_AUTO_CLOSE_WARP(hObject,closeFunc) \ + CPLAutoClose tAutoClose##hObject(hObject,closeFunc) + +#endif /* __cplusplus */ + +#endif /* CPL_AUTO_CLOSE_H_INCLUDED */ diff --git a/modules/globebrowsing/ext/gdal/include/cpl_aws.h b/modules/globebrowsing/ext/gdal/include/cpl_aws.h index d9b3bd7b86..237a3c83c4 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_aws.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_aws.h @@ -1,5 +1,5 @@ /********************************************************************** - * $Id: cpl_aws.h 1d0f559204e90d0e54d4aebe6ea8b65f0851be69 2018-06-20 16:38:42 +0200 Even Rouault $ + * $Id: cpl_aws.h 5318f6d39d2006a10cb6c1410334c56d76a74aa6 2018-06-20 16:38:42 +0200 Even Rouault $ * * Name: cpl_aws.h * Project: CPL - Common Portability Library @@ -83,15 +83,17 @@ CPLString CPLGetAWS_SIGN4_Authorization(const CPLString& osSecretAccessKey, class IVSIS3LikeHandleHelper { + CPL_DISALLOW_COPY_ASSIGN(IVSIS3LikeHandleHelper) + protected: - std::map m_oMapQueryParameters; + std::map m_oMapQueryParameters{}; virtual void RebuildURL() = 0; CPLString GetQueryString(bool bAddEmptyValueAfterEqual) const; public: - IVSIS3LikeHandleHelper() {} - virtual ~IVSIS3LikeHandleHelper() {} + IVSIS3LikeHandleHelper() = default; + virtual ~IVSIS3LikeHandleHelper() = default; void ResetQueryParameters(); void AddQueryParameter(const CPLString& osKey, const CPLString& osValue); @@ -123,17 +125,19 @@ public: class VSIS3HandleHelper final: public IVSIS3LikeHandleHelper { - CPLString m_osURL; - CPLString m_osSecretAccessKey; - CPLString m_osAccessKeyId; - CPLString m_osSessionToken; - CPLString m_osEndpoint; - CPLString m_osRegion; - CPLString m_osRequestPayer; - CPLString m_osBucket; - CPLString m_osObjectKey; - bool m_bUseHTTPS; - bool m_bUseVirtualHosting; + CPL_DISALLOW_COPY_ASSIGN(VSIS3HandleHelper) + + CPLString m_osURL{}; + CPLString m_osSecretAccessKey{}; + CPLString m_osAccessKeyId{}; + CPLString m_osSessionToken{}; + CPLString m_osEndpoint{}; + CPLString m_osRegion{}; + CPLString m_osRequestPayer{}; + CPLString m_osBucket{}; + CPLString m_osObjectKey{}; + bool m_bUseHTTPS = false; + bool m_bUseVirtualHosting = false; void RebuildURL() override; @@ -208,13 +212,12 @@ class VSIS3HandleHelper final: public IVSIS3LikeHandleHelper class VSIS3UpdateParams { public: - CPLString m_osRegion; - CPLString m_osEndpoint; - CPLString m_osRequestPayer; - bool m_bUseVirtualHosting; + CPLString m_osRegion{}; + CPLString m_osEndpoint{}; + CPLString m_osRequestPayer{}; + bool m_bUseVirtualHosting = false; - VSIS3UpdateParams() : - m_bUseVirtualHosting(false) {} + VSIS3UpdateParams() = default; explicit VSIS3UpdateParams(const VSIS3HandleHelper* poHelper) : m_osRegion(poHelper->GetRegion()), diff --git a/modules/globebrowsing/ext/gdal/include/cpl_azure.h b/modules/globebrowsing/ext/gdal/include/cpl_azure.h index 25729732c5..f449412ae1 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_azure.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_azure.h @@ -41,6 +41,7 @@ class VSIAzureBlobHandleHelper final: public IVSIS3LikeHandleHelper { CPLString m_osURL; CPLString m_osEndpoint; + CPLString m_osBlobEndpoint; CPLString m_osBucket; CPLString m_osObjectKey; CPLString m_osStorageAccount; @@ -50,10 +51,12 @@ class VSIAzureBlobHandleHelper final: public IVSIS3LikeHandleHelper static bool GetConfiguration(CSLConstList papszOptions, bool& bUseHTTPS, CPLString& osEndpoint, + CPLString& osBlobEndpoint, CPLString& osStorageAccount, CPLString& osStorageKey); static CPLString BuildURL(const CPLString& osEndpoint, + const CPLString& osBlobEndpoint, const CPLString& osStorageAccount, const CPLString& osBucket, const CPLString& osObjectKey, @@ -63,6 +66,7 @@ class VSIAzureBlobHandleHelper final: public IVSIS3LikeHandleHelper public: VSIAzureBlobHandleHelper(const CPLString& osEndpoint, + const CPLString& osBlobEndpoint, const CPLString& osBucket, const CPLString& osObjectKey, const CPLString& osStorageAccount, diff --git a/modules/globebrowsing/ext/gdal/include/cpl_config.h b/modules/globebrowsing/ext/gdal/include/cpl_config.h index 1bb02b1d6d..1dfedac2ba 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_config.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_config.h @@ -1,6 +1,5 @@ #ifndef CPL_CONFIG_H #define CPL_CONFIG_H - /* We define this here in general so that a VC++ build will publicly declare STDCALL interfaces even if an application is built against it using MinGW */ @@ -111,9 +110,6 @@ #pragma warning(disable: 4786) -/* #define CPL_DISABLE_DLL */ - /* Define to 1, if your compiler supports long long data type */ #define HAVE_LONG_LONG 1 - #endif /* CPL_CONFIG_H */ diff --git a/modules/globebrowsing/ext/gdal/include/cpl_conv.h b/modules/globebrowsing/ext/gdal/include/cpl_conv.h index 6069b54ffb..7982dc268e 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_conv.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_conv.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: cpl_conv.h dfac92801bd83819cbae2501803e02e06b361a43 2018-04-23 18:07:32 +0200 Martin Landa $ + * $Id: cpl_conv.h c39d156816d937c3139360b11786c769aeabd21e 2018-05-05 19:48:08 +0200 Even Rouault $ * * Project: CPL - Common Portability Library * Purpose: Convenience functions declarations. @@ -296,14 +296,11 @@ extern "C++" { class CPL_DLL CPLLocaleC { + CPL_DISALLOW_COPY_ASSIGN(CPLLocaleC) public: CPLLocaleC(); ~CPLLocaleC(); - /* Make it non-copyable */ - CPLLocaleC(const CPLLocaleC&) = delete; - CPLLocaleC& operator=(const CPLLocaleC&) = delete; - private: char *pszOldLocale; }; @@ -315,14 +312,12 @@ private: class CPLThreadLocaleCPrivate; class CPL_DLL CPLThreadLocaleC { + CPL_DISALLOW_COPY_ASSIGN(CPLThreadLocaleC) + public: CPLThreadLocaleC(); ~CPLThreadLocaleC(); - /* Make it non-copyable */ - CPLThreadLocaleC(const CPLThreadLocaleC&) = delete; - CPLThreadLocaleC& operator=(const CPLThreadLocaleC&) = delete; - private: CPLThreadLocaleCPrivate* m_private; }; @@ -344,15 +339,12 @@ extern "C++" { class CPL_DLL CPLConfigOptionSetter { + CPL_DISALLOW_COPY_ASSIGN(CPLConfigOptionSetter) public: CPLConfigOptionSetter(const char* pszKey, const char* pszValue, bool bSetOnlyIfUndefined); ~CPLConfigOptionSetter(); - /* Make it non-copyable */ - CPLConfigOptionSetter(const CPLConfigOptionSetter&) = delete; - CPLConfigOptionSetter& operator=(const CPLConfigOptionSetter&) = delete; - private: char* m_pszKey; char *m_pszOldValue; diff --git a/modules/globebrowsing/ext/gdal/include/cpl_error.h b/modules/globebrowsing/ext/gdal/include/cpl_error.h index 9038a07b92..c2f0d5d2ee 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_error.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_error.h @@ -1,5 +1,5 @@ /********************************************************************** - * $Id: cpl_error.h f5361e0be8e2ae819dde996e6c6aa5985b8fefec 2018-04-02 15:11:21 +0200 Even Rouault $ + * $Id: cpl_error.h 340ad0d703534a256ec3de94176c95b0cf20cbd4 2018-10-13 00:33:14 +0200 Even Rouault $ * * Name: cpl_error.h * Project: CPL - Common Portability Library @@ -130,7 +130,9 @@ typedef int CPLErrorNum; /** AWSInvalidCredentials */ #define CPLE_AWSInvalidCredentials 15 /** AWSSignatureDoesNotMatch */ -#define CPLE_AWSSignatureDoesNotMatch 16 +#define CPLE_AWSSignatureDoesNotMatch 16 +/** VSIE_AWSError */ +#define CPLE_AWSError 17 /* 100 - 299 reserved for GDAL */ @@ -177,9 +179,18 @@ void CPL_DLL CPL_STDCALL _CPLAssert( const char *, const char *, int ) CPL_NO_RE #ifdef DEBUG /** Assert on an expression. Only enabled in DEBUG mode */ # define CPLAssert(expr) ((expr) ? (void)(0) : _CPLAssert(#expr,__FILE__,__LINE__)) +/** Assert on an expression in DEBUG mode. Evaluate it also in non-DEBUG mode (useful to 'consume' a error return variable) */ +# define CPLAssertAlwaysEval(expr) CPLAssert(expr) #else /** Assert on an expression. Only enabled in DEBUG mode */ # define CPLAssert(expr) +#ifdef __cplusplus +/** Assert on an expression in DEBUG mode. Evaluate it also in non-DEBUG mode (useful to 'consume' a error return variable) */ +# define CPLAssertAlwaysEval(expr) CPL_IGNORE_RET_VAL(expr) +#else +/** Assert on an expression in DEBUG mode. Evaluate it also in non-DEBUG mode (useful to 'consume' a error return variable) */ +# define CPLAssertAlwaysEval(expr) (void)(expr) +#endif #endif CPL_C_END diff --git a/modules/globebrowsing/ext/gdal/include/cpl_google_cloud.h b/modules/globebrowsing/ext/gdal/include/cpl_google_cloud.h index f26ed83f66..9522c965f5 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_google_cloud.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_google_cloud.h @@ -43,6 +43,8 @@ class VSIGSHandleHelper final: public IVSIS3LikeHandleHelper { + CPL_DISALLOW_COPY_ASSIGN(VSIGSHandleHelper) + CPLString m_osURL; CPLString m_osEndpoint; CPLString m_osBucketObjectKey; diff --git a/modules/globebrowsing/ext/gdal/include/cpl_http.h b/modules/globebrowsing/ext/gdal/include/cpl_http.h index 3d42101a91..7a6b58f541 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_http.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_http.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: cpl_http.h 07238f4cbcdc1a56c9db7e8dc3a5727346194074 2018-04-02 14:34:13 +0200 Even Rouault $ + * $Id: cpl_http.h 15748d502551e341d73d0e388eb9f2e5209aa902 2018-10-06 19:05:17 +0200 Denis Rykov $ * * Project: Common Portability Library * Purpose: Function wrapper for libcurl HTTP access. @@ -136,9 +136,9 @@ CPL_C_END #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) /*! @cond Doxygen_Suppress */ // Not sure if this belong here, used in cpl_http.cpp, cpl_vsil_curl.cpp and frmts/wms/gdalhttp.cpp -void* CPLHTTPSetOptions(void *pcurl, const char * const* papszOptions); +void* CPLHTTPSetOptions(void *pcurl, const char *pszURL, const char * const* papszOptions); char** CPLHTTPGetOptionsFromEnv(); -double CPLHTTPGetNewRetryDelay(int response_code, double dfOldDelay); +double CPLHTTPGetNewRetryDelay(int response_code, double dfOldDelay, const char* pszErrBuf); void* CPLHTTPIgnoreSigPipe(); void CPLHTTPRestoreSigPipeHandler(void* old_handler); bool CPLMultiPerformWait(void* hCurlMultiHandle, int& repeats); @@ -193,22 +193,22 @@ class GOA2Manager private: - mutable CPLString m_osCurrentBearer; - mutable time_t m_nExpirationTime; - AuthMethod m_eMethod; + mutable CPLString m_osCurrentBearer{}; + mutable time_t m_nExpirationTime = 0; + AuthMethod m_eMethod = NONE; // for ACCESS_TOKEN_FROM_REFRESH - CPLString m_osClientId; - CPLString m_osClientSecret; - CPLString m_osRefreshToken; + CPLString m_osClientId{}; + CPLString m_osClientSecret{}; + CPLString m_osRefreshToken{}; // for SERVICE_ACCOUNT - CPLString m_osPrivateKey; - CPLString m_osClientEmail; - CPLString m_osScope; - CPLStringList m_aosAdditionalClaims; + CPLString m_osPrivateKey{}; + CPLString m_osClientEmail{}; + CPLString m_osScope{}; + CPLStringList m_aosAdditionalClaims{}; - CPLStringList m_aosOptions; + CPLStringList m_aosOptions{}; }; diff --git a/modules/globebrowsing/ext/gdal/include/cpl_json.h b/modules/globebrowsing/ext/gdal/include/cpl_json.h index fcea31e026..3325a58db1 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_json.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_json.h @@ -149,8 +149,8 @@ protected: /*! @endcond */ private: - JSONObjectH m_poJsonObject; - std::string m_osKey; + JSONObjectH m_poJsonObject = nullptr; + std::string m_osKey{}; }; /** diff --git a/modules/globebrowsing/ext/gdal/include/cpl_json_streaming_parser.h b/modules/globebrowsing/ext/gdal/include/cpl_json_streaming_parser.h index 734bb73af3..c2079fb315 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_json_streaming_parser.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_json_streaming_parser.h @@ -39,6 +39,8 @@ class CPL_DLL CPLJSonStreamingParser { + CPL_DISALLOW_COPY_ASSIGN(CPLJSonStreamingParser) + enum State { INIT, @@ -51,19 +53,25 @@ class CPL_DLL CPLJSonStreamingParser STATE_NULL }; - bool m_bExceptionOccurred; - bool m_bElementFound; - int m_nLastChar; - int m_nLineCounter; - int m_nCharCounter; - std::vector m_aState; - std::string m_osToken; - std::vector m_abFirstElement; - bool m_bInStringEscape; - bool m_bInUnicode; - std::string m_osUnicodeHex; - size_t m_nMaxDepth; - size_t m_nMaxStringSize; + bool m_bExceptionOccurred = false; + bool m_bElementFound = false; + int m_nLastChar = 0; + int m_nLineCounter = 1; + int m_nCharCounter = 1; + std::vector m_aState{}; + std::string m_osToken{}; + enum class ArrayState + { + INIT, + AFTER_COMMA, + AFTER_VALUE + }; + std::vector m_abArrayState{}; + bool m_bInStringEscape = false; + bool m_bInUnicode = false; + std::string m_osUnicodeHex{}; + size_t m_nMaxDepth = 1024; + size_t m_nMaxStringSize = 10000000; enum MemberState { @@ -72,13 +80,13 @@ class CPL_DLL CPLJSonStreamingParser KEY_FINISHED, IN_VALUE }; - std::vector m_aeObjectState; + std::vector m_aeObjectState{}; enum State currentState() { return m_aState.back(); } void SkipSpace(const char*& pStr, size_t& nLength); void AdvanceChar(const char*& pStr, size_t& nLength); bool EmitException(const char* pszMessage); - bool EmitUnexpectedChar(char ch); + bool EmitUnexpectedChar(char ch, const char* pszExpecting = nullptr); bool StartNewToken(const char*& pStr, size_t& nLength); bool CheckAndEmitTrueFalseOrNull(char ch); bool CheckStackEmpty(); diff --git a/modules/globebrowsing/ext/gdal/include/cpl_mem_cache.h b/modules/globebrowsing/ext/gdal/include/cpl_mem_cache.h index 264eb6650c..3721fd2240 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_mem_cache.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_mem_cache.h @@ -172,6 +172,16 @@ class Cache { return cache_.find(k) != cache_.end(); } + bool getOldestEntry(Key& kOut, Value& vOut) { + Guard g(lock_); + if( keys_.empty() ) { + return false; + } + kOut = keys_.back().key; + vOut = keys_.back().value; + return true; + } + size_t getMaxSize() const { return maxSize_; } size_t getElasticity() const { return elasticity_; } size_t getMaxAllowedSize() const { return maxSize_ + elasticity_; } diff --git a/modules/globebrowsing/ext/gdal/include/cpl_minizip_ioapi.h b/modules/globebrowsing/ext/gdal/include/cpl_minizip_ioapi.h index dfd986b07a..dd0e7050dd 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_minizip_ioapi.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_minizip_ioapi.h @@ -1,4 +1,4 @@ -/* $Id: cpl_minizip_ioapi.h 2f03d19efafeda04a990e03e7fb3cf56dd11b213 2016-11-24 06:35:54Z Kurt Schwehr $ */ +/* $Id: cpl_minizip_ioapi.h 105d437a91a1a110bdeaba3bab046cd235701173 2018-07-02 12:01:26 +0200 Even Rouault $ */ /* Modified version by Even Rouault. : - change fill_fopen_filefunc to cpl_fill_fopen_filefunc @@ -80,6 +80,13 @@ void cpl_fill_fopen_filefunc (zlib_filefunc_def* pzlib_filefunc_def); #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) +#define ZREAD64 ZREAD +#define ZWRITE64 ZWRITE +#define ZTELL64 ZTELL +#define ZSEEK64 ZSEEK +#define ZCLOSE64 ZCLOSE +#define ZERROR64 ZERROR + #ifdef __cplusplus } #endif diff --git a/modules/globebrowsing/ext/gdal/include/cpl_minizip_zip.h b/modules/globebrowsing/ext/gdal/include/cpl_minizip_zip.h index bb67b724d9..2f9d8c5e50 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_minizip_zip.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_minizip_zip.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: cpl_minizip_zip.h 44e0c0ecc2e12f7885d8572d0f18dd94e7fbda1c 2016-10-25 02:28:29Z Kurt Schwehr $ + * $Id: cpl_minizip_zip.h 105d437a91a1a110bdeaba3bab046cd235701173 2018-07-02 12:01:26 +0200 Even Rouault $ * * Project: CPL - Common Portability Library * Author: Frank Warmerdam, warmerdam@pobox.com @@ -64,6 +64,7 @@ #include "cpl_vsi.h" #define uLong64 vsi_l_offset +typedef vsi_l_offset ZPOS64_T; #ifdef __cplusplus extern "C" { @@ -234,7 +235,7 @@ extern int ZEXPORT cpl_zipCloseFileInZip (zipFile file); */ extern int ZEXPORT cpl_zipCloseFileInZipRaw (zipFile file, - uLong uncompressed_size, + ZPOS64_T uncompressed_size, uLong crc32); /* Close the current file in the zipfile, for file opened with diff --git a/modules/globebrowsing/ext/gdal/include/cpl_multiproc.h b/modules/globebrowsing/ext/gdal/include/cpl_multiproc.h index 9b32e5a0bc..21d449990a 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_multiproc.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_multiproc.h @@ -1,5 +1,5 @@ /********************************************************************** - * $Id: cpl_multiproc.h b5fb552a68377945dc4bff235f0e1af3728c75c6 2018-03-11 23:57:13Z Even Rouault $ + * $Id: cpl_multiproc.h 49f2075cf4be6b103a5ab0b5a64f1ed3e2e7f46b 2018-11-27 21:21:53Z Robert Coup $ * * Project: CPL - Common Portability Library * Purpose: CPL Multi-Threading, and process handling portability functions. @@ -139,22 +139,24 @@ CPL_C_END class CPL_DLL CPLMutexHolder { private: - CPLMutex *hMutex; + CPLMutex *hMutex = nullptr; // Only used for debugging. - const char *pszFile; - int nLine; + const char *pszFile = nullptr; + int nLine = 0; + + CPL_DISALLOW_COPY_ASSIGN(CPLMutexHolder) public: /** Instantiates the mutex if not already done. */ - CPLMutexHolder( CPLMutex **phMutex, double dfWaitInSeconds = 1000.0, + explicit CPLMutexHolder( CPLMutex **phMutex, double dfWaitInSeconds = 1000.0, const char *pszFile = __FILE__, int nLine = __LINE__, int nOptions = CPL_MUTEX_RECURSIVE); /** This variant assumes the mutex has already been created. If not, it will * be a no-op */ - CPLMutexHolder( CPLMutex* hMutex, double dfWaitInSeconds = 1000.0, + explicit CPLMutexHolder( CPLMutex* hMutex, double dfWaitInSeconds = 1000.0, const char *pszFile = __FILE__, int nLine = __LINE__ ); @@ -172,9 +174,11 @@ class CPL_DLL CPLMutexHolder class CPL_DLL CPLLockHolder { private: - CPLLock *hLock; - const char *pszFile; - int nLine; + CPLLock *hLock = nullptr; + const char *pszFile = nullptr; + int nLine = 0; + + CPL_DISALLOW_COPY_ASSIGN(CPLLockHolder) public: @@ -185,7 +189,7 @@ class CPL_DLL CPLLockHolder /** This variant assumes the lock has already been created. If not, it will * be a no-op */ - CPLLockHolder( CPLLock* hSpin, + explicit CPLLockHolder( CPLLock* hSpin, const char *pszFile = __FILE__, int nLine = __LINE__ ); @@ -203,7 +207,7 @@ class CPL_DLL CPLLockHolder #define CTLS_CSVTABLEPTR 3 /* cpl_csv.cpp */ #define CTLS_CSVDEFAULTFILENAME 4 /* cpl_csv.cpp */ #define CTLS_ERRORCONTEXT 5 /* cpl_error.cpp */ -#define CTLS_GDALDATASET_REC_PROTECT_MAP 6 /* gdaldataset.cpp */ +/* 6: unused */ #define CTLS_PATHBUF 7 /* cpl_path.cpp */ #define CTLS_ABSTRACTARCHIVE_SPLIT 8 /* cpl_vsil_abstract_archive.cpp */ #define CTLS_UNUSED4 9 @@ -214,6 +218,7 @@ class CPL_DLL CPLLockHolder #define CTLS_CONFIGOPTIONS 14 /* cpl_conv.cpp */ #define CTLS_FINDFILE 15 /* cpl_findfile.cpp */ #define CTLS_VSIERRORCONTEXT 16 /* cpl_vsi_error.cpp */ +#define CTLS_ERRORHANDLERACTIVEDATA 17 /* cpl_error.cpp */ #define CTLS_MAX 32 diff --git a/modules/globebrowsing/ext/gdal/include/cpl_odbc.h b/modules/globebrowsing/ext/gdal/include/cpl_odbc.h index 8c3a7938d7..a070fb6063 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_odbc.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_odbc.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: cpl_odbc.h 7e07230bbff24eb333608de4dbd460b7312839d0 2017-12-11 19:08:47Z Even Rouault $ + * $Id: cpl_odbc.h 97890c6814b40588defbe147a3189f056d50cf97 2018-05-14 20:12:48 +0200 KovBal $ * * Project: OGR ODBC Driver * Purpose: Declarations for ODBC Access Cover API. @@ -159,11 +159,14 @@ class CPLODBCStatement; */ class CPL_DLL CPLODBCSession { - char m_szLastError[SQL_MAX_MESSAGE_LENGTH + 1]; - HENV m_hEnv; - HDBC m_hDBC; - int m_bInTransaction; - int m_bAutoCommit; + + CPL_DISALLOW_COPY_ASSIGN(CPLODBCSession) + + CPLString m_osLastError{}; + HENV m_hEnv = nullptr; + HDBC m_hDBC = nullptr; + int m_bInTransaction = false; + int m_bAutoCommit = true; public: CPLODBCSession(); @@ -205,26 +208,28 @@ class CPL_DLL CPLODBCSession { class CPL_DLL CPLODBCStatement { - CPLODBCSession *m_poSession; - HSTMT m_hStmt; + CPL_DISALLOW_COPY_ASSIGN(CPLODBCStatement) - SQLSMALLINT m_nColCount; - char **m_papszColNames; - SQLSMALLINT *m_panColType; - char **m_papszColTypeNames; - CPL_SQLULEN *m_panColSize; - SQLSMALLINT *m_panColPrecision; - SQLSMALLINT *m_panColNullable; - char **m_papszColColumnDef; + CPLODBCSession *m_poSession = nullptr; + HSTMT m_hStmt = nullptr; - char **m_papszColValues; - CPL_SQLLEN *m_panColValueLengths; + SQLSMALLINT m_nColCount = 0; + char **m_papszColNames = nullptr; + SQLSMALLINT *m_panColType = nullptr; + char **m_papszColTypeNames = nullptr; + CPL_SQLULEN *m_panColSize = nullptr; + SQLSMALLINT *m_panColPrecision = nullptr; + SQLSMALLINT *m_panColNullable = nullptr; + char **m_papszColColumnDef = nullptr; + + char **m_papszColValues = nullptr; + CPL_SQLLEN *m_panColValueLengths = nullptr; int Failed( int ); - char *m_pszStatement; - size_t m_nStatementMax; - size_t m_nStatementLen; + char *m_pszStatement = nullptr; + size_t m_nStatementMax = 0; + size_t m_nStatementLen = 0; public: explicit CPLODBCStatement( CPLODBCSession * ); diff --git a/modules/globebrowsing/ext/gdal/include/cpl_port.h b/modules/globebrowsing/ext/gdal/include/cpl_port.h index c162b0c3d0..af9850a304 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_port.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_port.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: cpl_port.h 9b81cd476af4dd1a40b1a79f9e3e355114e2cd33 2018-05-08 11:21:07 +0200 Even Rouault $ + * $Id: cpl_port.h c55171b249f96a1cfa0e54f83dfa872c722e493c 2018-05-12 13:46:40 -0700 Lucian Plesea $ * * Project: CPL - Common Portability Library * Author: Frank Warmerdam, warmerdam@pobox.com @@ -186,10 +186,12 @@ # if !(__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900)) # error Must have C++11 or newer. # endif -# if __cplusplus >= 201402L +# if __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) # define HAVE_CXX14 1 # endif -/* TODO(schwehr): What is the correct test for C++ 17? */ +# if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) +# define HAVE_CXX17 1 +# endif #endif /* __cplusplus */ /*--------------------------------------------------------------------- diff --git a/modules/globebrowsing/ext/gdal/include/cpl_string.h b/modules/globebrowsing/ext/gdal/include/cpl_string.h index 8d0a5cd09b..e5f733390c 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_string.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_string.h @@ -1,5 +1,5 @@ /********************************************************************** - * $Id: cpl_string.h 2a269ed2b136bd254b213f39846587c1eb237662 2018-04-18 23:42:24 +0200 Even Rouault $ + * $Id: cpl_string.h e12a0fc61edef91a039e13c7baff2ce58288a552 2018-08-10 00:53:29 +0200 Juergen E. Fischer $ * * Name: cpl_string.h * Project: CPL - Common Portability Library @@ -177,6 +177,8 @@ char CPL_DLL ** CSLParseCommandLine(const char* pszCommandLine); #define CPLES_XML_BUT_QUOTES 5 /** Scheme for CPLEscapeString()/CPLUnescapeString() for CSV (forced quoting) */ #define CPLES_CSV_FORCE_QUOTING 6 +/** Scheme for CPLEscapeString()/CPLUnescapeString() for SQL identifiers */ +#define CPLES_SQLI 7 char CPL_DLL *CPLEscapeString( const char *pszString, int nLength, int nScheme ) CPL_WARN_UNUSED_RESULT; @@ -304,51 +306,40 @@ extern "C++" #include #endif -// VC++ implicitly applies __declspec(dllexport) to template base -// classes of classes marked with __declspec(dllexport). -// Hence, VC++ would export symbols for the specialization of std::basic_string, -// since it is a base class of CPLString, which is marked with CPL_DLL. +// VC++ implicitly applies __declspec(dllexport) to template base classes +// of classes marked with __declspec(dllexport). +// Hence, if marked with CPL_DLL, VC++ would export symbols for the specialization +// of std::basic_string, since it is a base class of CPLString. // As a result, if an application linked both gdal.dll and a static library that // (implicitly) instantiates std::string (almost all do!), then the linker would // emit an error concerning duplicate symbols for std::string. -// The least intrusive solution is to turn CPLString into a template class -// (that is not marked with CPL_DLL), make CPLString a typedef for a specialization -// of that template class, and mark only the few non-inline member functions of -// CPLStringT with CPL_DLL. +// The least intrusive solution is to not mark the whole class with +// __declspec(dllexport) for VC++, but only its non-inline methods. #ifdef _MSC_VER - -# define CPLSTRING_DLL CPL_DLL - -template< class Dummy = void > class CPLStringT; -typedef CPLStringT<> CPLString; - -template< class Dummy > -class CPLStringT : public std::string - +# define CPLSTRING_CLASS_DLL +# define CPLSTRING_METHOD_DLL CPL_DLL #else - /*! @cond Doxygen_Suppress */ -# define CPLSTRING_DLL -# define CPLStringT CPLString +# define CPLSTRING_CLASS_DLL CPL_DLL +# define CPLSTRING_METHOD_DLL /*! @endcond */ +#endif //! Convenient string class based on std::string. -class CPL_DLL CPLString : public std::string - -#endif +class CPLSTRING_CLASS_DLL CPLString : public std::string { public: /** Constructor */ - CPLStringT(void) {} + CPLString(void) {} /** Constructor */ // cppcheck-suppress noExplicitConstructor - CPLStringT( const std::string &oStr ) : std::string( oStr ) {} + CPLString( const std::string &oStr ) : std::string( oStr ) {} /** Constructor */ // cppcheck-suppress noExplicitConstructor - CPLStringT( const char *pszStr ) : std::string( pszStr ) {} + CPLString( const char *pszStr ) : std::string( pszStr ) {} /** Constructor */ - CPLStringT( const char *pszStr, size_t n ) : std::string( pszStr, n ) {} + CPLString( const char *pszStr, size_t n ) : std::string( pszStr, n ) {} /** Return string as zero terminated character array */ operator const char* (void) const { return c_str(); } @@ -398,39 +389,39 @@ public: /* There seems to be a bug in the way the compiler count indices... * Should be CPL_PRINT_FUNC_FORMAT (1, 2) */ - CPLSTRING_DLL CPLString &Printf( + CPLSTRING_METHOD_DLL CPLString &Printf( CPL_FORMAT_STRING(const char *pszFormat), ... ) CPL_PRINT_FUNC_FORMAT (2, 3); - CPLSTRING_DLL CPLString &vPrintf( + CPLSTRING_METHOD_DLL CPLString &vPrintf( CPL_FORMAT_STRING(const char *pszFormat), va_list args ) CPL_PRINT_FUNC_FORMAT(2, 0); - CPLSTRING_DLL CPLString &FormatC( double dfValue, const char *pszFormat = nullptr ); - CPLSTRING_DLL CPLString &Trim(); - CPLSTRING_DLL CPLString &Recode( const char *pszSrcEncoding, const char *pszDstEncoding ); - CPLSTRING_DLL CPLString &replaceAll( + CPLSTRING_METHOD_DLL CPLString &FormatC( double dfValue, const char *pszFormat = nullptr ); + CPLSTRING_METHOD_DLL CPLString &Trim(); + CPLSTRING_METHOD_DLL CPLString &Recode( const char *pszSrcEncoding, const char *pszDstEncoding ); + CPLSTRING_METHOD_DLL CPLString &replaceAll( const std::string &osBefore, const std::string& osAfter ); - CPLSTRING_DLL CPLString &replaceAll( const std::string &osBefore, char chAfter ); - CPLSTRING_DLL CPLString &replaceAll( char chBefore, const std::string &osAfter ); - CPLSTRING_DLL CPLString &replaceAll( char chBefore, char chAfter ); + CPLSTRING_METHOD_DLL CPLString &replaceAll( const std::string &osBefore, char chAfter ); + CPLSTRING_METHOD_DLL CPLString &replaceAll( char chBefore, const std::string &osAfter ); + CPLSTRING_METHOD_DLL CPLString &replaceAll( char chBefore, char chAfter ); /* case insensitive find alternates */ - CPLSTRING_DLL size_t ifind( const std::string & str, size_t pos = 0 ) const; - CPLSTRING_DLL size_t ifind( const char * s, size_t pos = 0 ) const; - CPLSTRING_DLL CPLString &toupper( void ); - CPLSTRING_DLL CPLString &tolower( void ); + CPLSTRING_METHOD_DLL size_t ifind( const std::string & str, size_t pos = 0 ) const; + CPLSTRING_METHOD_DLL size_t ifind( const char * s, size_t pos = 0 ) const; + CPLSTRING_METHOD_DLL CPLString &toupper( void ); + CPLSTRING_METHOD_DLL CPLString &tolower( void ); - CPLSTRING_DLL bool endsWith( const std::string& osStr ) const; + CPLSTRING_METHOD_DLL bool endsWith( const std::string& osStr ) const; }; -#ifndef _MSC_VER -# undef CPLStringT -#endif +#undef CPLSTRING_CLASS_DLL +#undef CPLSTRING_METHOD_DLL CPLString CPL_DLL CPLOPrintf(CPL_FORMAT_STRING(const char *pszFormat), ... ) CPL_PRINT_FUNC_FORMAT (1, 2); CPLString CPL_DLL CPLOvPrintf( CPL_FORMAT_STRING(const char *pszFormat), va_list args) CPL_PRINT_FUNC_FORMAT (1, 0); +CPLString CPL_DLL CPLQuotedSQLIdentifier(const char *pszIdent); /* -------------------------------------------------------------------- */ /* URL processing functions, here since they depend on CPLString. */ @@ -446,22 +437,20 @@ CPLString CPL_DLL CPLURLAddKVP(const char* pszURL, const char* pszKey, //! String list class designed around our use of C "char**" string lists. class CPL_DLL CPLStringList { - char **papszList; - mutable int nCount; - mutable int nAllocation; - bool bOwnList; - bool bIsSorted; + char **papszList = nullptr; + mutable int nCount = 0; + mutable int nAllocation = 0; + bool bOwnList = false; + bool bIsSorted = false; - void Initialize(); void MakeOurOwnCopy(); void EnsureAllocation( int nMaxLength ); int FindSortedInsertionPoint( const char *pszLine ); public: CPLStringList(); - CPLStringList( char **papszList, int bTakeOwnership=TRUE ); - // cppcheck-suppress noExplicitConstructor - CPLStringList( CSLConstList papszList ); + explicit CPLStringList( char **papszList, int bTakeOwnership=TRUE ); + explicit CPLStringList( CSLConstList papszList ); CPLStringList( const CPLStringList& oOther ); ~CPLStringList(); diff --git a/modules/globebrowsing/ext/gdal/include/cpl_userfaultfd.h b/modules/globebrowsing/ext/gdal/include/cpl_userfaultfd.h new file mode 100644 index 0000000000..77d48031d9 --- /dev/null +++ b/modules/globebrowsing/ext/gdal/include/cpl_userfaultfd.h @@ -0,0 +1,52 @@ +/****************************************************************************** + * + * Name: cpl_userfault.h + * Project: CPL - Common Portability Library + * Purpose: Use userfaultfd and VSIL to service page faults + * Author: James McClain, + * + ****************************************************************************** + * Copyright (c) 2018, Dr. James McClain + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + ****************************************************************************/ + +#ifndef CPL_USERFAULTFD +#define CPL_USERFAULTFD + +#include + +#include +#include + +#include +#include +#include +#include + + +#define GDAL_UFFD_LIMIT "GDAL_UFFD_LIMIT" + +typedef struct cpl_uffd_context cpl_uffd_context; + +bool CPLIsUserFaultMappingSupported(); +cpl_uffd_context * CPLCreateUserFaultMapping(const char * pszFilename, void ** ppVma, uint64_t * pnVmaSize); +void CPLDeleteUserFaultMapping(cpl_uffd_context * ctx); + +#endif diff --git a/modules/globebrowsing/ext/gdal/include/cpl_vsi.h b/modules/globebrowsing/ext/gdal/include/cpl_vsi.h index e246f7bf08..9f4632788b 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_vsi.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_vsi.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: cpl_vsi.h 07238f4cbcdc1a56c9db7e8dc3a5727346194074 2018-04-02 14:34:13 +0200 Even Rouault $ + * $Id: cpl_vsi.h fe66521fc5854bf38bc2eb42326d9a17d2f0f275 2018-12-22 13:46:01 +0100 Juergen E. Fischer $ * * Project: CPL - Common Portability Library * Author: Frank Warmerdam, warmerdam@pobox.com @@ -33,6 +33,7 @@ #define CPL_VSI_H_INCLUDED #include "cpl_port.h" +#include "cpl_progress.h" /** * \file cpl_vsi.h @@ -301,12 +302,59 @@ GIntBig CPL_DLL CPLGetUsablePhysicalRAM(void); char CPL_DLL **VSIReadDir( const char * ); char CPL_DLL **VSIReadDirRecursive( const char *pszPath ); char CPL_DLL **VSIReadDirEx( const char *pszPath, int nMaxFiles ); + +/** Opaque type for a directory iterator */ +typedef struct VSIDIR VSIDIR; + +VSIDIR CPL_DLL *VSIOpenDir( const char *pszPath, + int nRecurseDepth, + const char* const *papszOptions); + +/** Directory entry. */ +typedef struct VSIDIREntry +{ + /** Filename */ + char* pszName; + /** File mode. See VSI_ISREG() / VSI_ISDIR() */ + int nMode; + /** File size */ + vsi_l_offset nSize; + /** Last modification time (seconds since 1970/01/01) */ + GIntBig nMTime; + /** Whether nMode is known: 0 = unknown, 1 = known. */ + char bModeKnown; + /** Whether nSize is known: 0 = unknown, 1 = known. */ + char bSizeKnown; + /** Whether nMTime is known: 0 = unknown, 1 = known. */ + char bMTimeKnown; + /** NULL-terminated list of extra properties. */ + char** papszExtra; + +#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) +/*! @cond Doxygen_Suppress */ + VSIDIREntry(); + ~VSIDIREntry(); + VSIDIREntry(const VSIDIREntry&) = delete; + VSIDIREntry& operator=(VSIDIREntry&) = delete; +/*! @endcond */ +#endif +} VSIDIREntry; + +const VSIDIREntry CPL_DLL *VSIGetNextDirEntry(VSIDIR* dir); +void CPL_DLL VSICloseDir(VSIDIR* dir); + int CPL_DLL VSIMkdir( const char * pszPathname, long mode ); int CPL_DLL VSIMkdirRecursive( const char * pszPathname, long mode ); int CPL_DLL VSIRmdir( const char * pszDirname ); int CPL_DLL VSIRmdirRecursive( const char * pszDirname ); int CPL_DLL VSIUnlink( const char * pszFilename ); int CPL_DLL VSIRename( const char * oldpath, const char * newpath ); +int CPL_DLL VSISync( const char* pszSource, const char* pszTarget, + const char* const * papszOptions, + GDALProgressFunc pProgressFunc, + void *pProgressData, + char*** ppapszOutputs ); + char CPL_DLL *VSIStrerror( int ); GIntBig CPL_DLL VSIGetDiskFreeSpace(const char *pszDirname); @@ -320,6 +368,7 @@ void CPL_DLL VSIInstallLargeFileHandler(void); void CPL_DLL VSIInstallSubFileHandler(void); void VSIInstallCurlFileHandler(void); void CPL_DLL VSICurlClearCache(void); +void CPL_DLL VSICurlPartialClearCache(const char* pszFilenamePrefix); void VSIInstallCurlStreamingFileHandler(void); void VSIInstallS3FileHandler(void); void VSIInstallS3StreamingFileHandler(void); @@ -334,6 +383,8 @@ void VSIInstallSwiftStreamingFileHandler(void); void VSIInstallGZipFileHandler(void); /* No reason to export that */ void VSIInstallZipFileHandler(void); /* No reason to export that */ void VSIInstallStdinHandler(void); /* No reason to export that */ +void VSIInstallHdfsHandler(void); /* No reason to export that */ +void VSIInstallWebHdfsHandler(void); /* No reason to export that */ void VSIInstallStdoutHandler(void); /* No reason to export that */ void CPL_DLL VSIInstallSparseFileHandler(void); void VSIInstallTarFileHandler(void); /* No reason to export that */ diff --git a/modules/globebrowsing/ext/gdal/include/cpl_vsi_virtual.h b/modules/globebrowsing/ext/gdal/include/cpl_vsi_virtual.h index df839af6a4..24bcb558cf 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_vsi_virtual.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_vsi_virtual.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: cpl_vsi_virtual.h 07238f4cbcdc1a56c9db7e8dc3a5727346194074 2018-04-02 14:34:13 +0200 Even Rouault $ + * $Id: cpl_vsi_virtual.h 7b937306fdeb31f6adefa6675d83ccd60f99e619 2018-11-25 23:10:44 +0100 Even Rouault $ * * Project: VSI Virtual File System * Purpose: Declarations for classes related to the virtual filesystem. @@ -113,6 +113,14 @@ public: virtual const char* GetActualURL(const char* /*pszFilename*/) { return nullptr; } virtual const char* GetOptions() { return nullptr; } virtual char* GetSignedURL(const char* /*pszFilename*/, CSLConstList /* papszOptions */) { return nullptr; } + virtual bool Sync( const char* pszSource, const char* pszTarget, + const char* const * papszOptions, + GDALProgressFunc pProgressFunc, + void *pProgressData, + char*** ppapszOutputs ); + + virtual VSIDIR* OpenDir( const char *pszPath, int nRecurseDepth, + const char* const *papszOptions); }; #endif /* #ifndef DOXYGEN_SKIP */ @@ -124,13 +132,15 @@ public: class CPL_DLL VSIFileManager { private: - VSIFilesystemHandler *poDefaultHandler; - std::map oHandlers; + VSIFilesystemHandler *poDefaultHandler = nullptr; + std::map oHandlers{}; VSIFileManager(); static VSIFileManager *Get(); + CPL_DISALLOW_COPY_ASSIGN(VSIFileManager) + public: ~VSIFileManager(); @@ -170,12 +180,11 @@ typedef struct class VSIArchiveContent { public: - time_t mTime; - vsi_l_offset nFileSize; - int nEntries; - VSIArchiveEntry* entries; + time_t mTime = 0; + vsi_l_offset nFileSize = 0; + int nEntries = 0; + VSIArchiveEntry* entries = nullptr; - VSIArchiveContent() : mTime(0), nFileSize(0), nEntries(0), entries(nullptr) {} ~VSIArchiveContent(); }; @@ -195,12 +204,14 @@ class VSIArchiveReader class VSIArchiveFilesystemHandler : public VSIFilesystemHandler { + CPL_DISALLOW_COPY_ASSIGN(VSIArchiveFilesystemHandler) + protected: - CPLMutex* hMutex; + CPLMutex* hMutex = nullptr; /* We use a cache that contains the list of files contained in a VSIArchive file as */ /* unarchive.c is quite inefficient in listing them. This speeds up access to VSIArchive files */ /* containing ~1000 files like a CADRG product */ - std::map oFileList; + std::map oFileList{}; virtual const char* GetPrefix() = 0; virtual std::vector GetExtensions() = 0; @@ -224,6 +235,22 @@ public: virtual int FindFileInArchive(const char* archiveFilename, const char* fileInArchiveName, const VSIArchiveEntry** archiveEntry); }; +/************************************************************************/ +/* VSIDIR */ +/************************************************************************/ + +struct CPL_DLL VSIDIR +{ + VSIDIR() = default; + virtual ~VSIDIR(); + + virtual const VSIDIREntry* NextDirEntry() = 0; + + private: + VSIDIR(const VSIDIR&) = delete; + VSIDIR& operator=(const VSIDIR&) = delete; +}; + #endif /* #ifndef DOXYGEN_SKIP */ VSIVirtualHandle CPL_DLL *VSICreateBufferedReaderHandle(VSIVirtualHandle* poBaseHandle); @@ -231,6 +258,10 @@ VSIVirtualHandle* VSICreateBufferedReaderHandle(VSIVirtualHandle* poBaseHandle, const GByte* pabyBeginningContent, vsi_l_offset nCheatFileSize); VSIVirtualHandle CPL_DLL *VSICreateCachedFile( VSIVirtualHandle* poBaseHandle, size_t nChunkSize = 32768, size_t nCacheSize = 0 ); -VSIVirtualHandle CPL_DLL *VSICreateGZipWritable( VSIVirtualHandle* poBaseHandle, int bRegularZLibIn, int bAutoCloseBaseHandle ); + +const int CPL_DEFLATE_TYPE_GZIP = 0; +const int CPL_DEFLATE_TYPE_ZLIB = 1; +const int CPL_DEFLATE_TYPE_RAW_DEFLATE = 2; +VSIVirtualHandle CPL_DLL *VSICreateGZipWritable( VSIVirtualHandle* poBaseHandle, int nDeflateType, int bAutoCloseBaseHandle ); #endif /* ndef CPL_VSI_VIRTUAL_H_INCLUDED */ diff --git a/modules/globebrowsing/ext/gdal/include/cpl_vsil_curl_class.h b/modules/globebrowsing/ext/gdal/include/cpl_vsil_curl_class.h new file mode 100644 index 0000000000..6ccf86214f --- /dev/null +++ b/modules/globebrowsing/ext/gdal/include/cpl_vsil_curl_class.h @@ -0,0 +1,554 @@ +/****************************************************************************** + * + * Project: CPL - Common Portability Library + * Purpose: Declarations for /vsicurl/ and related file systems + * Author: Even Rouault, even.rouault at spatialys.com + * + ****************************************************************************** + * Copyright (c) 2010-2018, Even Rouault + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + ****************************************************************************/ + +#ifndef CPL_VSIL_CURL_CLASS_H_INCLUDED +#define CPL_VSIL_CURL_CLASS_H_INCLUDED + +#ifdef HAVE_CURL + +#include "cpl_aws.h" +#include "cpl_port.h" +#include "cpl_string.h" +#include "cpl_vsil_curl_priv.h" +#include "cpl_mem_cache.h" + +#include + +#include +#include +#include + +//! @cond Doxygen_Suppress + +// 7.18.1 +#if LIBCURL_VERSION_NUM >= 0x071201 +#define HAVE_CURLINFO_REDIRECT_URL +#endif + +void VSICurlStreamingClearCache( void ); // from cpl_vsil_curl_streaming.cpp + +struct curl_slist* VSICurlSetOptions(CURL* hCurlHandle, const char* pszURL, + const char * const* papszOptions); +struct curl_slist* VSICurlMergeHeaders( struct curl_slist* poDest, + struct curl_slist* poSrcToDestroy ); + +namespace cpl { + +typedef enum +{ + EXIST_UNKNOWN = -1, + EXIST_NO, + EXIST_YES, +} ExistStatus; + +class FileProp +{ + public: + ExistStatus eExists = EXIST_UNKNOWN; + vsi_l_offset fileSize = 0; + time_t mTime = 0; + time_t nExpireTimestampLocal = 0; + CPLString osRedirectURL{}; + bool bHasComputedFileSize = false; + bool bIsDirectory = false; + bool bS3LikeRedirect = false; + CPLString ETag{}; +}; + +typedef struct +{ + bool bGotFileList = false; + CPLStringList oFileList{}; /* only file name without path */ +} CachedDirList; + +typedef struct +{ + char* pBuffer; + size_t nSize; + bool bIsHTTP; + bool bIsInHeader; + bool bMultiRange; + vsi_l_offset nStartOffset; + vsi_l_offset nEndOffset; + int nHTTPCode; + vsi_l_offset nContentLength; + bool bFoundContentRange; + bool bError; + bool bDownloadHeaderOnly; + bool bDetectRangeDownloadingError; + GIntBig nTimestampDate; // Corresponds to Date: header field + + VSILFILE *fp; + VSICurlReadCbkFunc pfnReadCbk; + void *pReadCbkUserData; + bool bInterrupted; +} WriteFuncStruct; + +/************************************************************************/ +/* VSICurlFilesystemHandler */ +/************************************************************************/ + +class VSICurlHandle; + +class VSICurlFilesystemHandler : public VSIFilesystemHandler +{ + CPL_DISALLOW_COPY_ASSIGN(VSICurlFilesystemHandler) + + struct FilenameOffsetPair + { + std::string filename_; + vsi_l_offset offset_; + + FilenameOffsetPair(const std::string& filename, + vsi_l_offset offset) : + filename_(filename), offset_(offset) {} + + bool operator==(const FilenameOffsetPair& other) const + { + return filename_ == other.filename_ && + offset_ == other.offset_; + } + }; + struct FilenameOffsetPairHasher + { + std::size_t operator()(const FilenameOffsetPair& k) const + { + return std::hash()(k.filename_) ^ + std::hash()(k.offset_); + } + }; + + using RegionCacheType = + lru11::Cache, + lru11::NullLock, + std::unordered_map< + FilenameOffsetPair, + typename std::list>>::iterator, + FilenameOffsetPairHasher>>; + + RegionCacheType oRegionCache; + + lru11::Cache oCacheFileProp; + + int nCachedFilesInDirList = 0; + lru11::Cache oCacheDirList; + + char** ParseHTMLFileList(const char* pszFilename, + int nMaxFiles, + char* pszData, + bool* pbGotFileList); + +protected: + CPLMutex *hMutex = nullptr; + + virtual VSICurlHandle* CreateFileHandle(const char* pszFilename); + virtual char** GetFileList(const char *pszFilename, + int nMaxFiles, + bool* pbGotFileList); + + void RegisterEmptyDir( const CPLString& osDirname ); + + bool AnalyseS3FileList( const CPLString& osBaseURL, + const char* pszXML, + CPLStringList& osFileList, + int nMaxFiles, + bool bIgnoreGlacierStorageClass, + bool& bIsTruncated ); + + void AnalyseSwiftFileList( const CPLString& osBaseURL, + const CPLString& osPrefix, + const char* pszJson, + CPLStringList& osFileList, + int nMaxFilesThisQuery, + int nMaxFiles, + bool& bIsTruncated, + CPLString& osNextMarker ); + + static const char* GetOptionsStatic(); + + static bool IsAllowedFilename( const char* pszFilename ); + +public: + VSICurlFilesystemHandler(); + ~VSICurlFilesystemHandler() override; + + VSIVirtualHandle *Open( const char *pszFilename, + const char *pszAccess, + bool bSetError ) override; + + int Stat( const char *pszFilename, VSIStatBufL *pStatBuf, + int nFlags ) override; + int Unlink( const char *pszFilename ) override; + int Rename( const char *oldpath, const char *newpath ) override; + int Mkdir( const char *pszDirname, long nMode ) override; + int Rmdir( const char *pszDirname ) override; + char **ReadDir( const char *pszDirname ) override + { return ReadDirEx(pszDirname, 0); } + char **ReadDirEx( const char *pszDirname, int nMaxFiles ) override; + + int HasOptimizedReadMultiRange( const char* /* pszPath */ ) + override { return true; } + + const char* GetActualURL(const char* pszFilename) override; + + const char* GetOptions() override; + + char **ReadDirInternal( const char *pszDirname, int nMaxFiles, + bool* pbGotFileList ); + void InvalidateDirContent( const char *pszDirname ); + + virtual CPLString GetFSPrefix() { return "/vsicurl/"; } + virtual bool AllowCachedDataFor(const char* pszFilename); + + std::shared_ptr GetRegion( const char* pszURL, + vsi_l_offset nFileOffsetStart ); + + void AddRegion( const char* pszURL, + vsi_l_offset nFileOffsetStart, + size_t nSize, + const char *pData ); + + bool GetCachedFileProp( const char* pszURL, + FileProp& oFileProp ); + void SetCachedFileProp( const char* pszURL, + const FileProp& oFileProp ); + void InvalidateCachedData( const char* pszURL ); + + CURLM *GetCurlMultiHandleFor( const CPLString& osURL ); + + virtual void ClearCache(); + virtual void PartialClearCache(const char* pszFilename); + + + bool GetCachedDirList( const char* pszURL, + CachedDirList& oCachedDirList ); + void SetCachedDirList( const char* pszURL, + const CachedDirList& oCachedDirList ); + bool ExistsInCacheDirList( const CPLString& osDirname, bool *pbIsDir ); + + virtual CPLString GetURLFromFilename( const CPLString& osFilename ); +}; + +/************************************************************************/ +/* VSICurlHandle */ +/************************************************************************/ + +class VSICurlHandle : public VSIVirtualHandle +{ + CPL_DISALLOW_COPY_ASSIGN(VSICurlHandle) + + protected: + VSICurlFilesystemHandler* poFS = nullptr; + + bool m_bCached = true; + + FileProp oFileProp{}; + + CPLString m_osFilename{}; // e.g "/vsicurl/http://example.com/foo" + char* m_pszURL = nullptr; // e.g "http://example.com/foo" + + char **m_papszHTTPOptions = nullptr; + + vsi_l_offset lastDownloadedOffset = VSI_L_OFFSET_MAX; + int nBlocksToDownload = 1; + + bool bStopOnInterruptUntilUninstall = false; + bool bInterrupted = false; + VSICurlReadCbkFunc pfnReadCbk = nullptr; + void *pReadCbkUserData = nullptr; + + int m_nMaxRetry = 0; + double m_dfRetryDelay = 0.0; + + void DownloadRegionPostProcess( const vsi_l_offset startOffset, + const int nBlocks, + const char* pBuffer, + size_t nSize ); + + private: + + vsi_l_offset curOffset = 0; + + bool bEOF = false; + + virtual bool DownloadRegion(vsi_l_offset startOffset, int nBlocks); + + bool m_bUseHead = false; + + int ReadMultiRangeSingleGet( int nRanges, void ** ppData, + const vsi_l_offset* panOffsets, + const size_t* panSizes ); + CPLString GetRedirectURLIfValid(bool& bHasExpired); + + protected: + virtual struct curl_slist* GetCurlHeaders( const CPLString& /*osVerb*/, + const struct curl_slist* /* psExistingHeaders */) + { return nullptr; } + virtual bool AllowAutomaticRedirection() { return true; } + virtual bool CanRestartOnError( const char*, const char*, bool ) { return false; } + virtual bool UseLimitRangeGetInsteadOfHead() { return false; } + virtual bool IsDirectoryFromExists( const char* /*pszVerb*/, int /*response_code*/ ) { return false; } + virtual void ProcessGetFileSizeResult(const char* /* pszContent */ ) {} + void SetURL(const char* pszURL); + + public: + + VSICurlHandle( VSICurlFilesystemHandler* poFS, + const char* pszFilename, + const char* pszURLIn = nullptr ); + ~VSICurlHandle() override; + + int Seek( vsi_l_offset nOffset, int nWhence ) override; + vsi_l_offset Tell() override; + size_t Read( void *pBuffer, size_t nSize, size_t nMemb ) override; + int ReadMultiRange( int nRanges, void ** ppData, + const vsi_l_offset* panOffsets, + const size_t* panSizes ) override; + size_t Write( const void *pBuffer, size_t nSize, size_t nMemb ) override; + int Eof() override; + int Flush() override; + int Close() override; + + bool IsKnownFileSize() const { return oFileProp.bHasComputedFileSize; } + vsi_l_offset GetFileSize() { return GetFileSize(false); } + virtual vsi_l_offset GetFileSize( bool bSetError ); + bool Exists( bool bSetError ); + bool IsDirectory() const { return oFileProp.bIsDirectory; } + time_t GetMTime() const { return oFileProp.mTime; } + + int InstallReadCbk( VSICurlReadCbkFunc pfnReadCbk, + void* pfnUserData, + int bStopOnInterruptUntilUninstall ); + int UninstallReadCbk(); + + const char *GetURL() const { return m_pszURL; } +}; + +/************************************************************************/ +/* IVSIS3LikeFSHandler */ +/************************************************************************/ + +class IVSIS3LikeFSHandler: public VSICurlFilesystemHandler +{ + CPL_DISALLOW_COPY_ASSIGN(IVSIS3LikeFSHandler) + + protected: + char** GetFileList( const char *pszFilename, + int nMaxFiles, + bool* pbGotFileList ) override; + + virtual IVSIS3LikeHandleHelper* CreateHandleHelper( + const char* pszURI, bool bAllowNoObject) = 0; + + IVSIS3LikeFSHandler() = default; + + public: + int Unlink( const char *pszFilename ) override; + int Mkdir( const char *pszDirname, long nMode ) override; + int Rmdir( const char *pszDirname ) override; + int Stat( const char *pszFilename, VSIStatBufL *pStatBuf, + int nFlags ) override; + + virtual int DeleteObject( const char *pszFilename ); + + virtual const char* GetDebugKey() const = 0; + + virtual void UpdateMapFromHandle(IVSIS3LikeHandleHelper*) {} + virtual void UpdateHandleFromMap( IVSIS3LikeHandleHelper * ) {} + + bool Sync( const char* pszSource, const char* pszTarget, + const char* const * papszOptions, + GDALProgressFunc pProgressFunc, + void *pProgressData, + char*** ppapszOutputs ) override; + + VSIDIR* OpenDir( const char *pszPath, int nRecurseDepth, + const char* const *papszOptions) override; +}; + +/************************************************************************/ +/* IVSIS3LikeHandle */ +/************************************************************************/ + +class IVSIS3LikeHandle: public VSICurlHandle +{ + CPL_DISALLOW_COPY_ASSIGN(IVSIS3LikeHandle) + + protected: + bool UseLimitRangeGetInsteadOfHead() override { return true; } + bool IsDirectoryFromExists( const char* pszVerb, + int response_code ) override + { + // A bit dirty, but on S3, a GET on a existing directory returns a 416 + return response_code == 416 && EQUAL(pszVerb, "GET") && + CPLString(m_pszURL).back() == '/'; + } + void ProcessGetFileSizeResult( const char* pszContent ) override + { + oFileProp.bIsDirectory = strstr(pszContent, "ListBucketResult") != nullptr; + } + + public: + IVSIS3LikeHandle( VSICurlFilesystemHandler* poFSIn, + const char* pszFilename, + const char* pszURLIn = nullptr ) : + VSICurlHandle(poFSIn, pszFilename, pszURLIn) {} + ~IVSIS3LikeHandle() override {} +}; + +/************************************************************************/ +/* VSIS3WriteHandle */ +/************************************************************************/ + +class VSIS3WriteHandle final : public VSIVirtualHandle +{ + CPL_DISALLOW_COPY_ASSIGN(VSIS3WriteHandle) + + IVSIS3LikeFSHandler *m_poFS = nullptr; + CPLString m_osFilename{}; + IVSIS3LikeHandleHelper *m_poS3HandleHelper = nullptr; + bool m_bUseChunked = false; + + vsi_l_offset m_nCurOffset = 0; + int m_nBufferOff = 0; + int m_nBufferSize = 0; + int m_nBufferOffReadCallback = 0; + bool m_bClosed = false; + GByte *m_pabyBuffer = nullptr; + CPLString m_osUploadID{}; + int m_nPartNumber = 0; + std::vector m_aosEtags{}; + CPLString m_osXML{}; + int m_nOffsetInXML = 0; + bool m_bError = false; + + CURLM *m_hCurlMulti = nullptr; + CURL *m_hCurl = nullptr; + const void *m_pBuffer = nullptr; + CPLString m_osCurlErrBuf{}; + size_t m_nChunkedBufferOff = 0; + size_t m_nChunkedBufferSize = 0; + + static size_t ReadCallBackBuffer( char *buffer, size_t size, + size_t nitems, void *instream ); + bool InitiateMultipartUpload(); + bool UploadPart(); + static size_t ReadCallBackXML( char *buffer, size_t size, + size_t nitems, void *instream ); + bool CompleteMultipart(); + bool AbortMultipart(); + bool DoSinglePartPUT(); + + static size_t ReadCallBackBufferChunked( char *buffer, size_t size, + size_t nitems, void *instream ); + size_t WriteChunked( const void *pBuffer, + size_t nSize, size_t nMemb ); + int FinishChunkedTransfer(); + + void InvalidateParentDirectory(); + + public: + VSIS3WriteHandle( IVSIS3LikeFSHandler* poFS, + const char* pszFilename, + IVSIS3LikeHandleHelper* poS3HandleHelper, + bool bUseChunked ); + ~VSIS3WriteHandle() override; + + int Seek( vsi_l_offset nOffset, int nWhence ) override; + vsi_l_offset Tell() override; + size_t Read( void *pBuffer, size_t nSize, size_t nMemb ) override; + size_t Write( const void *pBuffer, size_t nSize, size_t nMemb ) override; + int Eof() override; + int Close() override; + + bool IsOK() { return m_bUseChunked || m_pabyBuffer != nullptr; } +}; + +/************************************************************************/ +/* VSIAppendWriteHandle */ +/************************************************************************/ + +class VSIAppendWriteHandle : public VSIVirtualHandle +{ + CPL_DISALLOW_COPY_ASSIGN(VSIAppendWriteHandle) + + protected: + + VSICurlFilesystemHandler* m_poFS = nullptr; + CPLString m_osFSPrefix{}; + CPLString m_osFilename{}; + + vsi_l_offset m_nCurOffset = 0; + int m_nBufferOff = 0; + int m_nBufferSize = 0; + int m_nBufferOffReadCallback = 0; + bool m_bClosed = false; + GByte *m_pabyBuffer = nullptr; + bool m_bError = false; + + static size_t ReadCallBackBuffer( char *buffer, size_t size, + size_t nitems, void *instream ); + virtual bool Send(bool bIsLastBlock) = 0; + + public: + VSIAppendWriteHandle( VSICurlFilesystemHandler* poFS, + const char* pszFSPrefix, + const char* pszFilename, + int nChunkSize ); + virtual ~VSIAppendWriteHandle(); + + int Seek( vsi_l_offset nOffset, int nWhence ) override; + vsi_l_offset Tell() override; + size_t Read( void *pBuffer, size_t nSize, size_t nMemb ) override; + size_t Write( const void *pBuffer, size_t nSize, size_t nMemb ) override; + int Eof() override; + int Close() override; + + bool IsOK() { return m_pabyBuffer != nullptr; } +}; + +int VSICURLGetDownloadChunkSize(); + +void VSICURLInitWriteFuncStruct( WriteFuncStruct *psStruct, + VSILFILE *fp, + VSICurlReadCbkFunc pfnReadCbk, + void *pReadCbkUserData ); +size_t VSICurlHandleWriteFunc( void *buffer, size_t count, + size_t nmemb, void *req ); +void MultiPerform(CURLM* hCurlMultiHandle, + CURL* hEasyHandle = nullptr); +void VSICURLResetHeaderAndWriterFunctions(CURL* hCurlHandle); + +} // namespace cpl + +//! @endcond + +#endif // HAVE_CURL + +#endif // CPL_VSIL_CURL_CLASS_H_INCLUDED diff --git a/modules/globebrowsing/ext/gdal/include/cpl_worker_thread_pool.h b/modules/globebrowsing/ext/gdal/include/cpl_worker_thread_pool.h index 00a8b6ef8b..1bd8422d5b 100644 --- a/modules/globebrowsing/ext/gdal/include/cpl_worker_thread_pool.h +++ b/modules/globebrowsing/ext/gdal/include/cpl_worker_thread_pool.h @@ -1,5 +1,5 @@ /********************************************************************** - * $Id: cpl_worker_thread_pool.h 9ff327806cd64df6d73a6c91f92d12ca0c5e07df 2018-04-07 20:25:06 +0200 Even Rouault $ + * $Id: cpl_worker_thread_pool.h 9b93d5aaef0e512d52da849390cb72856db540b6 2018-07-01 22:10:36 +0200 Even Rouault $ * * Project: CPL - Common Portability Library * Purpose: CPL worker thread pool @@ -74,15 +74,17 @@ typedef enum /** Pool of worker threads */ class CPL_DLL CPLWorkerThreadPool { - std::vector aWT; - CPLCond* hCond; - CPLMutex* hMutex; - volatile CPLWorkerThreadState eState; - CPLList* psJobQueue; - volatile int nPendingJobs; + CPL_DISALLOW_COPY_ASSIGN(CPLWorkerThreadPool) - CPLList* psWaitingWorkerThreadsList; - int nWaitingWorkerThreads; + std::vector aWT{}; + CPLCond* hCond = nullptr; + CPLMutex* hMutex = nullptr; + volatile CPLWorkerThreadState eState = CPLWTS_OK; + CPLList* psJobQueue = nullptr; + volatile int nPendingJobs = 0; + + CPLList* psWaitingWorkerThreadsList = nullptr; + int nWaitingWorkerThreads = 0; static void WorkerThreadFunction(void* user_data); @@ -96,9 +98,14 @@ class CPL_DLL CPLWorkerThreadPool bool Setup(int nThreads, CPLThreadFunc pfnInitFunc, void** pasInitData); + bool Setup(int nThreads, + CPLThreadFunc pfnInitFunc, + void** pasInitData, + bool bWaitallStarted); bool SubmitJob(CPLThreadFunc pfnFunc, void* pData); bool SubmitJobs(CPLThreadFunc pfnFunc, const std::vector& apData); void WaitCompletion(int nMaxRemainingJobs = 0); + void WaitEvent(); /** Return the number of threads setup */ int GetThreadCount() const { return static_cast(aWT.size()); } diff --git a/modules/globebrowsing/ext/gdal/include/cplkeywordparser.h b/modules/globebrowsing/ext/gdal/include/cplkeywordparser.h index 25bca05d3a..2b747b5863 100644 --- a/modules/globebrowsing/ext/gdal/include/cplkeywordparser.h +++ b/modules/globebrowsing/ext/gdal/include/cplkeywordparser.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: cplkeywordparser.h 21e39584409342c2c70c6635a2b0329113de8975 2018-01-06 16:34:40Z Even Rouault $ + * $Id: cplkeywordparser.h c39d156816d937c3139360b11786c769aeabd21e 2018-05-05 19:48:08 +0200 Even Rouault $ * * Project: Common Portability Library * Purpose: Implementation of CPLKeywordParser - a class for parsing @@ -45,16 +45,18 @@ class CPLKeywordParser { - char **papszKeywordList; + char **papszKeywordList = nullptr; - CPLString osHeaderText; - const char *pszHeaderNext; + CPLString osHeaderText{}; + const char *pszHeaderNext = nullptr; void SkipWhite(); bool ReadWord( CPLString &osWord ); bool ReadPair( CPLString &osName, CPLString &osValue ); bool ReadGroup( const char *pszPathPrefix, int nRecLevel ); + CPL_DISALLOW_COPY_ASSIGN(CPLKeywordParser) + public: CPLKeywordParser(); ~CPLKeywordParser(); diff --git a/modules/globebrowsing/ext/gdal/include/gdal.h b/modules/globebrowsing/ext/gdal/include/gdal.h index 48ee3c2c15..e075d65382 100644 --- a/modules/globebrowsing/ext/gdal/include/gdal.h +++ b/modules/globebrowsing/ext/gdal/include/gdal.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdal.h 2a145ae8e090b07cdddea4397fd43a26d2a78591 2018-05-07 20:12:57 +0200 Even Rouault $ + * $Id: gdal.h 2519a7eb0e1649dbf8625ae8ffc7bb7c3ef9514b 2018-07-10 12:05:23 +0100 Robert Coup $ * * Project: GDAL Core * Purpose: GDAL Core C/Public declarations. @@ -225,7 +225,7 @@ const char CPL_DLL *GDALGetPaletteInterpretationName( GDALPaletteInterp ); /* "well known" metadata items. */ -/** Metadata item for dataset that indicates the spatial interpreation of a +/** Metadata item for dataset that indicates the spatial interpretation of a * pixel */ #define GDALMD_AREA_OR_POINT "AREA_OR_POINT" /** Value for GDALMD_AREA_OR_POINT that indicates that a pixel represents an @@ -1102,8 +1102,17 @@ typedef enum { /*! Maximum GFU value (equals to GFU_AlphaMax+1 currently) */ GFU_MaxCount } GDALRATFieldUsage; +/** RAT table type (thematic or athematic) + * @since GDAL 2.4 + */ +typedef enum { + /*! Thematic table type */ GRTT_THEMATIC, + /*! Athematic table type */ GRTT_ATHEMATIC +} GDALRATTableType; + GDALRasterAttributeTableH CPL_DLL CPL_STDCALL GDALCreateRasterAttributeTable(void) CPL_WARN_UNUSED_RESULT; + void CPL_DLL CPL_STDCALL GDALDestroyRasterAttributeTable( GDALRasterAttributeTableH ); @@ -1153,19 +1162,23 @@ CPLErr CPL_DLL CPL_STDCALL GDALRATSetLinearBinning( GDALRasterAttributeTableH, double, double ); int CPL_DLL CPL_STDCALL GDALRATGetLinearBinning( GDALRasterAttributeTableH, double *, double * ); +CPLErr CPL_DLL CPL_STDCALL GDALRATSetTableType( GDALRasterAttributeTableH hRAT, + const GDALRATTableType eInTableType ); +GDALRATTableType CPL_DLL CPL_STDCALL GDALRATGetTableType( GDALRasterAttributeTableH hRAT); CPLErr CPL_DLL CPL_STDCALL GDALRATInitializeFromColorTable( GDALRasterAttributeTableH, GDALColorTableH ); GDALColorTableH CPL_DLL CPL_STDCALL GDALRATTranslateToColorTable( GDALRasterAttributeTableH, int nEntryCount ); void CPL_DLL CPL_STDCALL GDALRATDumpReadable( GDALRasterAttributeTableH, FILE * ); -GDALRasterAttributeTableH CPL_DLL CPL_STDCALL - GDALRATClone( GDALRasterAttributeTableH ); +GDALRasterAttributeTableH CPL_DLL CPL_STDCALL + GDALRATClone( const GDALRasterAttributeTableH ); void CPL_DLL* CPL_STDCALL GDALRATSerializeJSON( GDALRasterAttributeTableH ) CPL_WARN_UNUSED_RESULT; int CPL_DLL CPL_STDCALL GDALRATGetRowOfValue( GDALRasterAttributeTableH, double ); +void CPL_DLL CPL_STDCALL GDALRATRemoveStatistics( GDALRasterAttributeTableH ); /* ==================================================================== */ /* GDAL Cache Management */ diff --git a/modules/globebrowsing/ext/gdal/include/gdal_alg.h b/modules/globebrowsing/ext/gdal/include/gdal_alg.h index da9d091bf6..4dc8c0c59a 100644 --- a/modules/globebrowsing/ext/gdal/include/gdal_alg.h +++ b/modules/globebrowsing/ext/gdal/include/gdal_alg.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdal_alg.h ecc4064ad058e92440d85c2a83501cc45579c06c 2017-07-24 19:24:22Z Even Rouault $ + * $Id: gdal_alg.h b9ddc19f9ccd776cac9388f260aebc24439f10aa 2018-10-09 11:45:33 +0200 Julien Cabieces $ * * Project: GDAL Image Processing Algorithms * Purpose: Prototypes, and definitions for various GDAL based algorithms. @@ -306,6 +306,8 @@ typedef struct double adfGeoTransform[6]; int nElevField; + int nElevFieldMin; + int nElevFieldMax; int nIDField; int nNextID; } OGRContourWriterInfo; @@ -316,11 +318,16 @@ OGRContourWriter( double, int, double *, double *, void *pInfo ); CPLErr CPL_DLL GDALContourGenerate( GDALRasterBandH hBand, - double dfContourInterval, double dfContourBase, - int nFixedLevelCount, double *padfFixedLevels, - int bUseNoData, double dfNoDataValue, - void *hLayer, int iIDField, int iElevField, - GDALProgressFunc pfnProgress, void *pProgressArg ); + double dfContourInterval, double dfContourBase, + int nFixedLevelCount, double *padfFixedLevels, + int bUseNoData, double dfNoDataValue, + void *hLayer, int iIDField, int iElevField, + GDALProgressFunc pfnProgress, void *pProgressArg ); + +CPLErr CPL_DLL +GDALContourGenerateEx( GDALRasterBandH hBand, void *hLayer, + CSLConstList options, + GDALProgressFunc pfnProgress, void *pProgressArg ); /************************************************************************/ /* Rasterizer API - geometries burned into GDAL raster. */ diff --git a/modules/globebrowsing/ext/gdal/include/gdal_alg_priv.h b/modules/globebrowsing/ext/gdal/include/gdal_alg_priv.h index 3a8b3ee0a3..6bd09735b6 100644 --- a/modules/globebrowsing/ext/gdal/include/gdal_alg_priv.h +++ b/modules/globebrowsing/ext/gdal/include/gdal_alg_priv.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdal_alg_priv.h e13dcd4dc171dfeed63f912ba06b9374ce4f3bb2 2018-03-18 21:37:41Z Even Rouault $ + * $Id: gdal_alg_priv.h fe2d81c8819bf9794bce0210098e637565728350 2018-05-06 00:49:51 +0200 Even Rouault $ * * Project: GDAL Image Processing Algorithms * Purpose: Prototypes and definitions for various GDAL based algorithms: @@ -112,15 +112,17 @@ private: void MergePolygon( int nSrcId, int nDstId ); int NewPolygon( DataType nValue ); + CPL_DISALLOW_COPY_ASSIGN(GDALRasterPolygonEnumeratorT) + public: // these are intended to be readonly. - GInt32 *panPolyIdMap; - DataType *panPolyValue; + GInt32 *panPolyIdMap = nullptr; + DataType *panPolyValue = nullptr; - int nNextPolygonId; - int nPolyAlloc; + int nNextPolygonId = 0; + int nPolyAlloc = 0; - int nConnectedness; + int nConnectedness = 0; public: explicit GDALRasterPolygonEnumeratorT( int nConnectedness=4 ); diff --git a/modules/globebrowsing/ext/gdal/include/gdal_frmts.h b/modules/globebrowsing/ext/gdal/include/gdal_frmts.h index 570cdf36f8..9a793b09a0 100644 --- a/modules/globebrowsing/ext/gdal/include/gdal_frmts.h +++ b/modules/globebrowsing/ext/gdal/include/gdal_frmts.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdal_frmts.h cc3abf4797c390d97322b20caac26099104f0b58 2017-12-21 13:19:20Z Even Rouault $ + * $Id: gdal_frmts.h 91d70b77cc330670d972f2317dbdf3a5b424f845 2018-10-15 00:43:04 +0200 Even Rouault $ * * Project: GDAL * Purpose: Prototypes for all format specific driver initialization. @@ -157,6 +157,7 @@ void CPL_DLL GDALRegister_KMLSUPEROVERLAY(void); void CPL_DLL GDALRegister_GTX(void); void CPL_DLL GDALRegister_LOSLAS(void); void CPL_DLL GDALRegister_Istar(void); +void CPL_DLL GDALRegister_NTv1(void); void CPL_DLL GDALRegister_NTv2(void); void CPL_DLL GDALRegister_CTable2(void); void CPL_DLL GDALRegister_JP2OpenJPEG(void); @@ -192,6 +193,11 @@ void CPL_DLL GDALRegister_JP2Lura(void); void CPL_DLL GDALRegister_PRF(void); void CPL_DLL GDALRegister_NULL(void); void CPL_DLL GDALRegister_RDA(void); +void CPL_DLL GDALRegister_EEDAI(void); +void CPL_DLL GDALRegister_EEDA(void); +void CPL_DLL GDALRegister_SIGDEM(void); +void CPL_DLL GDALRegister_BYN(void); +void CPL_DLL GDALRegister_IGNFHeightASCIIGrid(void); CPL_C_END #endif /* ndef GDAL_FRMTS_H_INCLUDED */ diff --git a/modules/globebrowsing/ext/gdal/include/gdal_mdreader.h b/modules/globebrowsing/ext/gdal/include/gdal_mdreader.h index 1fd556ef9f..07bcb37c31 100644 --- a/modules/globebrowsing/ext/gdal/include/gdal_mdreader.h +++ b/modules/globebrowsing/ext/gdal/include/gdal_mdreader.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdal_mdreader.h 7cbc4992fe78542e3ade2da352b283218f4a5ffb 2017-12-19 16:39:24Z Even Rouault $ + * $Id: gdal_mdreader.h e37e476c4cf8f4b0df8995e0d95d5d672fca1a9b 2018-05-05 16:54:18 +0200 Even Rouault $ * * Project: GDAL Core * Purpose: Read metadata (mainly the remote sensing imagery) from files of @@ -97,6 +97,9 @@ typedef enum { * The base class for all metadata readers */ class GDALMDReaderBase{ + + CPL_DISALLOW_COPY_ASSIGN(GDALMDReaderBase) + public: GDALMDReaderBase(const char *pszPath, char **papszSiblingFiles); virtual ~GDALMDReaderBase(); @@ -161,11 +164,11 @@ protected: const char *pszValue); protected: //! @cond Doxygen_Suppress - char **m_papszIMDMD; - char **m_papszRPCMD; - char **m_papszIMAGERYMD; - char **m_papszDEFAULTMD; - bool m_bIsMetadataLoad; + char **m_papszIMDMD = nullptr; + char **m_papszRPCMD = nullptr; + char **m_papszIMAGERYMD = nullptr; + char **m_papszDEFAULTMD = nullptr; + bool m_bIsMetadataLoad = false; //! @endcond }; @@ -175,6 +178,9 @@ protected: * for provided path. */ class CPL_DLL GDALMDReaderManager{ + + CPL_DISALLOW_COPY_ASSIGN(GDALMDReaderManager) + public: GDALMDReaderManager(); virtual ~GDALMDReaderManager(); @@ -194,7 +200,7 @@ public: GUInt32 nType = MDR_ANY); protected: //! @cond Doxygen_Suppress - GDALMDReaderBase *m_pReader; + GDALMDReaderBase *m_pReader = nullptr; //! @endcond }; diff --git a/modules/globebrowsing/ext/gdal/include/gdal_pam.h b/modules/globebrowsing/ext/gdal/include/gdal_pam.h index 377fb6f252..37bb9571b7 100644 --- a/modules/globebrowsing/ext/gdal/include/gdal_pam.h +++ b/modules/globebrowsing/ext/gdal/include/gdal_pam.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdal_pam.h 773b7550bb86d46bc587f547f5db549566665834 2017-12-18 04:05:13Z Kurt Schwehr $ + * $Id: gdal_pam.h e37e476c4cf8f4b0df8995e0d95d5d672fca1a9b 2018-05-05 16:54:18 +0200 Even Rouault $ * * Project: GDAL Core * Purpose: Declaration for Peristable Auxiliary Metadata classes. @@ -87,22 +87,22 @@ class GDALPamRasterBand; class GDALDatasetPamInfo { public: - char *pszPamFilename; + char *pszPamFilename = nullptr; - char *pszProjection; + char *pszProjection = nullptr; - int bHaveGeoTransform; - double adfGeoTransform[6]; + int bHaveGeoTransform = false; + double adfGeoTransform[6]{0,0,0,0,0,0}; - int nGCPCount; - GDAL_GCP *pasGCPList; - char *pszGCPProjection; + int nGCPCount = 0; + GDAL_GCP *pasGCPList = nullptr; + char *pszGCPProjection = nullptr; - CPLString osPhysicalFilename; - CPLString osSubdatasetName; - CPLString osAuxFilename; + CPLString osPhysicalFilename{}; + CPLString osSubdatasetName{}; + CPLString osAuxFilename{}; - int bHasMetadata; + int bHasMetadata = false; }; //! @endcond @@ -122,8 +122,8 @@ class CPL_DLL GDALPamDataset : public GDALDataset GDALPamDataset(void); //! @cond Doxygen_Suppress - int nPamFlags; - GDALDatasetPamInfo *psPam; + int nPamFlags = 0; + GDALDatasetPamInfo *psPam = nullptr; virtual CPLXMLNode *SerializeToXML( const char *); virtual CPLErr XMLInit( CPLXMLNode *, const char * ); @@ -249,7 +249,7 @@ class CPL_DLL GDALPamRasterBand : public GDALRasterBand void PamInitialize(); void PamClear(); - GDALRasterBandPamInfo *psPam; + GDALRasterBandPamInfo *psPam = nullptr; //! @endcond public: diff --git a/modules/globebrowsing/ext/gdal/include/gdal_priv.h b/modules/globebrowsing/ext/gdal/include/gdal_priv.h index 1c5aac203a..f79fb2d5f7 100644 --- a/modules/globebrowsing/ext/gdal/include/gdal_priv.h +++ b/modules/globebrowsing/ext/gdal/include/gdal_priv.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdal_priv.h 12e52bca5d2ef4d60eac422db198aefa9577be63 2018-07-14 19:04:33 +0200 Even Rouault $ + * $Id: gdal_priv.h e5e7b313540f0ff913fadfe6a273fb7c356a22cb 2018-11-02 22:54:20 +0100 Even Rouault $ * * Name: gdal_priv.h * Project: GDAL Core @@ -134,8 +134,8 @@ class CPL_DLL GDALMajorObject protected: //! @cond Doxygen_Suppress int nFlags; // GMO_* flags. - CPLString sDescription; - GDALMultiDomainMetadata oMDMD; + CPLString sDescription{}; + GDALMultiDomainMetadata oMDMD{}; //! @endcond @@ -187,7 +187,7 @@ class CPL_DLL GDALDefaultOverviews GDALDataset *poDS; GDALDataset *poODS; - CPLString osOvrFilename; + CPLString osOvrFilename{}; bool bOvrIsAux; @@ -323,10 +323,6 @@ class swq_select_parse_options; typedef struct GDALSQLParseInfo GDALSQLParseInfo; //! @endcond -#ifdef DETECT_OLD_IRASTERIO -typedef void signature_changed; -#endif - //! @cond Doxygen_Suppress #ifdef GDAL_COMPILATION #define OPTIONAL_OUTSIDE_GDAL(val) @@ -352,26 +348,24 @@ class CPL_DLL GDALDataset : public GDALMajorObject void AddToDatasetOpenList(); - void Init( bool bForceCachedIO ); - protected: //! @cond Doxygen_Suppress - GDALDriver *poDriver; - GDALAccess eAccess; + GDALDriver *poDriver = nullptr; + GDALAccess eAccess = GA_ReadOnly; // Stored raster information. - int nRasterXSize; - int nRasterYSize; - int nBands; - GDALRasterBand **papoBands; + int nRasterXSize = 512; + int nRasterYSize = 512; + int nBands = 0; + GDALRasterBand **papoBands = nullptr; - int nOpenFlags; + int nOpenFlags = 0; - int nRefCount; - bool bForceCachedIO; - bool bShared; - bool bIsInternal; - bool bSuppressOnClose; + int nRefCount = 1; + bool bForceCachedIO = false; + bool bShared = false; + bool bIsInternal = true; + bool bSuppressOnClose = false; GDALDataset(void); explicit GDALDataset(int bForceCachedIO); @@ -379,17 +373,11 @@ class CPL_DLL GDALDataset : public GDALMajorObject void RasterInitialize( int, int ); void SetBand( int, GDALRasterBand * ); - GDALDefaultOverviews oOvManager; + GDALDefaultOverviews oOvManager{}; virtual CPLErr IBuildOverviews( const char *, int, int *, int, int *, GDALProgressFunc, void * ); -#ifdef DETECT_OLD_IRASTERIO - virtual signature_changed IRasterIO( GDALRWFlag, int, int, int, int, - void *, int, int, GDALDataType, - int, int *, int, int, int ) {}; -#endif - virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, int, int *, GSpacing, GSpacing, GSpacing, @@ -441,7 +429,7 @@ class CPL_DLL GDALDataset : public GDALMajorObject //! @cond Doxygen_Suppress int ValidateLayerCreationOptions( const char* const* papszLCO ); - char **papszOpenOptions; + char **papszOpenOptions = nullptr; friend class GDALRasterBand; @@ -484,7 +472,7 @@ class CPL_DLL GDALDataset : public GDALMajorObject public: Iterator(GDALDataset* poDS, bool bStart); Iterator(const Iterator& oOther); // declared but not defined. Needed for gcc 5.4 at least - Iterator(Iterator&& oOther); // declared but not defined. Needed for gcc 5.4 at least + Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least ~Iterator(); GDALRasterBand* operator*(); Iterator& operator++(); @@ -627,10 +615,10 @@ class CPL_DLL GDALDataset : public GDALMajorObject struct FeatureLayerPair { /** Unique pointer to a OGRFeature. */ - OGRFeatureUniquePtr feature; + OGRFeatureUniquePtr feature{}; /** Layer to which the feature belongs to. */ - OGRLayer* layer; + OGRLayer* layer = nullptr; }; private: @@ -641,7 +629,7 @@ private: OGRGeometry *poSpatialFilter, const char *pszDialect, swq_select_parse_options* poSelectParseOptions); - CPLStringList oDerivedMetadataList; + CPLStringList oDerivedMetadataList{}; public: @@ -679,11 +667,11 @@ private: Iterator(); /**< Default constructor */ Iterator(GDALDataset* poDS, bool bStart); /**< Constructor */ Iterator(const Iterator& oOther); /**< Copy constructor */ - Iterator(Iterator&& oOther); /**< Move constructor */ + Iterator(Iterator&& oOther) noexcept; /**< Move constructor */ ~Iterator(); /**< Destructor */ Iterator& operator=(const Iterator& oOther); /**< Assignment operator */ - Iterator& operator=(Iterator&& oOther); /**< Move assignment operator */ + Iterator& operator=(Iterator&& oOther) noexcept; /**< Move assignment operator */ OGRLayer* operator*() const; /**< Dereference operator */ Iterator& operator++(); /**< Pre-increment operator */ @@ -729,7 +717,7 @@ private: public: Iterator(GDALDataset* poDS, bool bStart); Iterator(const Iterator& oOther); // declared but not defined. Needed for gcc 5.4 at least - Iterator(Iterator&& oOther); // declared but not defined. Needed for gcc 5.4 at least + Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least ~Iterator(); const FeatureLayerPair& operator*() const; Iterator& operator++(); @@ -801,7 +789,7 @@ private: OGRErr ProcessSQLAlterTableAlterColumn( const char * ); OGRErr ProcessSQLAlterTableRenameColumn( const char * ); - OGRStyleTable *m_poStyleTable; + OGRStyleTable *m_poStyleTable = nullptr; //! @endcond private: @@ -950,7 +938,7 @@ class CPL_DLL GDALColorTable { GDALPaletteInterp eInterp; - std::vector aoEntries; + std::vector aoEntries{}; public: explicit GDALColorTable( GDALPaletteInterp = GPI_RGB ); @@ -995,13 +983,15 @@ public: class CPL_DLL GDALAbstractBandBlockCache { // List of blocks that can be freed or recycled, and its lock - CPLLock *hSpinLock; - GDALRasterBlock *psListBlocksToFree; + CPLLock *hSpinLock = nullptr; + GDALRasterBlock *psListBlocksToFree = nullptr; // Band keep alive counter, and its lock & condition - CPLCond *hCond; - CPLMutex *hCondMutex; - volatile int nKeepAliveCounter; + CPLCond *hCond = nullptr; + CPLMutex *hCondMutex = nullptr; + volatile int nKeepAliveCounter = 0; + + CPL_DISALLOW_COPY_ASSIGN(GDALAbstractBandBlockCache) protected: GDALRasterBand *poBand; @@ -1046,37 +1036,36 @@ class CPL_DLL GDALRasterBand : public GDALMajorObject friend class GDALHashSetBandBlockCache; friend class GDALRasterBlock; - CPLErr eFlushBlockErr; - GDALAbstractBandBlockCache* poBandBlockCache; + CPLErr eFlushBlockErr = CE_None; + GDALAbstractBandBlockCache* poBandBlockCache = nullptr; void SetFlushBlockErr( CPLErr eErr ); CPLErr UnreferenceBlock( GDALRasterBlock* poBlock ); - - void Init(int bForceCachedIO); + void SetValidPercent( GUIntBig nSampleCount, GUIntBig nValidCount ); protected: //! @cond Doxygen_Suppress - GDALDataset *poDS; - int nBand; /* 1 based */ + GDALDataset *poDS = nullptr; + int nBand = 0; /* 1 based */ - int nRasterXSize; - int nRasterYSize; + int nRasterXSize = 0; + int nRasterYSize = 0; - GDALDataType eDataType; - GDALAccess eAccess; + GDALDataType eDataType = GDT_Byte; + GDALAccess eAccess = GA_ReadOnly; /* stuff related to blocking, and raster cache */ - int nBlockXSize; - int nBlockYSize; - int nBlocksPerRow; - int nBlocksPerColumn; + int nBlockXSize = -1; + int nBlockYSize = -1; + int nBlocksPerRow = 0; + int nBlocksPerColumn = 0; - int nBlockReads; - int bForceCachedIO; + int nBlockReads = 0; + int bForceCachedIO = 0; - GDALRasterBand *poMask; - bool bOwnMask; - int nMaskFlags; + GDALRasterBand *poMask = nullptr; + bool bOwnMask = false; + int nMaskFlags = 0; void InvalidateMaskBand(); @@ -1097,12 +1086,6 @@ class CPL_DLL GDALRasterBand : public GDALMajorObject virtual CPLErr IReadBlock( int nBlockXOff, int nBlockYOff, void * pData ) = 0; virtual CPLErr IWriteBlock( int nBlockXOff, int nBlockYOff, void * pData ); -#ifdef DETECT_OLD_IRASTERIO - virtual signature_changed IRasterIO( GDALRWFlag, int, int, int, int, - void *, int, int, GDALDataType, - int, int ) {}; -#endif - virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, GSpacing, GSpacing, GDALRasterIOExtraArg* psExtraArg ) CPL_WARN_UNUSED_RESULT; @@ -1283,12 +1266,20 @@ class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand protected: CPLErr IReadBlock( int, int, void * ) override; + CPL_DISALLOW_COPY_ASSIGN(GDALAllValidMaskBand) + public: explicit GDALAllValidMaskBand( GDALRasterBand * ); ~GDALAllValidMaskBand() override; GDALRasterBand *GetMaskBand() override; int GetMaskFlags() override; + + CPLErr ComputeStatistics( int bApproxOK, + double *pdfMin, double *pdfMax, + double *pdfMean, double *pdfStdDev, + GDALProgressFunc, void *pProgressData ) override; + }; /* ******************************************************************** */ @@ -1300,6 +1291,8 @@ class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand double dfNoDataValue; GDALRasterBand *poParent; + CPL_DISALLOW_COPY_ASSIGN(GDALNoDataMaskBand) + protected: CPLErr IReadBlock( int, int, void * ) override; CPLErr IRasterIO( GDALRWFlag, int, int, int, int, @@ -1322,6 +1315,8 @@ class CPL_DLL GDALNoDataValuesMaskBand : public GDALRasterBand { double *padfNodataValues; + CPL_DISALLOW_COPY_ASSIGN(GDALNoDataValuesMaskBand) + protected: CPLErr IReadBlock( int, int, void * ) override; @@ -1339,6 +1334,8 @@ class GDALRescaledAlphaBand : public GDALRasterBand GDALRasterBand *poParent; void *pTemp; + CPL_DISALLOW_COPY_ASSIGN(GDALRescaledAlphaBand) + protected: CPLErr IReadBlock( int, int, void * ) override; CPLErr IRasterIO( GDALRWFlag, int, int, int, int, @@ -1472,6 +1469,12 @@ class CPL_DLL GDALDriver : public GDALMajorObject static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS, GDALDataset *poDstDS, int bStrict ); + static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS, + GDALDataset *poDstDS, + int bStrict, + CSLConstList papszOptions, + GDALProgressFunc pfnProgress, + void * pProgressData ); //! @endcond static CPLErr QuietDelete( const char * pszName ); @@ -1511,9 +1514,9 @@ private: class CPL_DLL GDALDriverManager : public GDALMajorObject { - int nDrivers; - GDALDriver **papoDrivers; - std::map oMapNameToDrivers; + int nDrivers = 0; + GDALDriver **papoDrivers = nullptr; + std::map oMapNameToDrivers{}; GDALDriver *GetDriver_unlocked( int iDriver ) { return (iDriver >= 0 && iDriver < nDrivers) ? @@ -1522,6 +1525,8 @@ class CPL_DLL GDALDriverManager : public GDALMajorObject GDALDriver *GetDriverByName_unlocked( const char * pszName ) { return oMapNameToDrivers[CPLString(pszName).toupper()]; } + CPL_DISALLOW_COPY_ASSIGN(GDALDriverManager) + public: GDALDriverManager(); ~GDALDriverManager(); @@ -1553,6 +1558,9 @@ CPL_C_END */ class CPL_DLL GDALAsyncReader { + + CPL_DISALLOW_COPY_ASSIGN(GDALAsyncReader) + protected: //! @cond Doxygen_Suppress GDALDataset* poDS; @@ -1811,6 +1819,8 @@ template inline bool ARE_REAL_EQUAL(T fVal1, T fVal2, int ulp = 2) std::abs(fVal1 - fVal2) < std::numeric_limits::epsilon() * std::abs(fVal1+fVal2) * ulp; } +double GDALAdjustNoDataCloseToFloatMax(double dfVal); + #define DIV_ROUND_UP(a, b) ( ((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1) ) // Number of data samples that will be used to compute approximate statistics diff --git a/modules/globebrowsing/ext/gdal/include/gdal_proxy.h b/modules/globebrowsing/ext/gdal/include/gdal_proxy.h index fed3572c3f..07e8a20fb8 100644 --- a/modules/globebrowsing/ext/gdal/include/gdal_proxy.h +++ b/modules/globebrowsing/ext/gdal/include/gdal_proxy.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdal_proxy.h d10f99bfacb1d7c3331a539c4667d1c95199313d 2017-12-18 12:00:18Z Kurt Schwehr $ + * $Id: gdal_proxy.h b10430acb1303d18052fc20ebc36de01e01398fd 2018-10-25 14:49:58 -0500 Sander Jansen $ * * Project: GDAL Core * Purpose: GDAL Core C++/Private declarations @@ -208,20 +208,20 @@ class GDALProxyPoolRasterBand; class CPL_DLL GDALProxyPoolDataset : public GDALProxyDataset { private: - GIntBig responsiblePID; + GIntBig responsiblePID = -1; - char *pszProjectionRef; - double adfGeoTransform[6]; - int bHasSrcProjection; - int bHasSrcGeoTransform; - char *pszGCPProjection; - int nGCPCount; - GDAL_GCP *pasGCPList; - CPLHashSet *metadataSet; - CPLHashSet *metadataItemSet; + char *pszProjectionRef = nullptr; + double adfGeoTransform[6]{0,1,0,0,0,1}; + int bHasSrcProjection = false; + int bHasSrcGeoTransform = false; + char *pszGCPProjection = nullptr; + int nGCPCount = 0; + GDAL_GCP *pasGCPList = nullptr; + CPLHashSet *metadataSet = nullptr; + CPLHashSet *metadataItemSet = nullptr; - GDALProxyPoolCacheEntry* cacheEntry; - char *m_pszOwner; + GDALProxyPoolCacheEntry* cacheEntry = nullptr; + char *m_pszOwner = nullptr; GDALDataset *RefUnderlyingDataset(bool bForceOpen); @@ -245,6 +245,11 @@ class CPL_DLL GDALProxyPoolDataset : public GDALProxyDataset void AddSrcBandDescription( GDALDataType eDataType, int nBlockXSize, int nBlockYSize ); + // Used by VRT SimpleSource to add a single GDALProxyPoolRasterBand while + // keeping all other bands initialized to a nullptr. This is under the assumption, + // VRT SimpleSource will not have to access any other bands than the one added. + void AddSrcBand(int nBand, GDALDataType eDataType, int nBlockXSize, + int nBlockYSize ); void FlushCache() override; const char *GetProjectionRef() override; @@ -279,17 +284,15 @@ class GDALProxyPoolMaskBand; class CPL_DLL GDALProxyPoolRasterBand : public GDALProxyRasterBand { private: - CPLHashSet *metadataSet; - CPLHashSet *metadataItemSet; - char *pszUnitType; - char **papszCategoryNames; - GDALColorTable *poColorTable; + CPLHashSet *metadataSet = nullptr; + CPLHashSet *metadataItemSet = nullptr; + char *pszUnitType = nullptr; + char **papszCategoryNames = nullptr; + GDALColorTable *poColorTable = nullptr; - int nSizeProxyOverviewRasterBand; - GDALProxyPoolOverviewRasterBand **papoProxyOverviewRasterBand; - GDALProxyPoolMaskBand *poProxyMaskBand; - - void Init(); + int nSizeProxyOverviewRasterBand = 0; + GDALProxyPoolOverviewRasterBand **papoProxyOverviewRasterBand = nullptr; + GDALProxyPoolMaskBand *poProxyMaskBand = nullptr; GDALRasterBand* RefUnderlyingRasterBand( bool bForceOpen ); @@ -338,11 +341,13 @@ class CPL_DLL GDALProxyPoolRasterBand : public GDALProxyRasterBand class GDALProxyPoolOverviewRasterBand : public GDALProxyPoolRasterBand { private: - GDALProxyPoolRasterBand *poMainBand; - int nOverviewBand; + GDALProxyPoolRasterBand *poMainBand = nullptr; + int nOverviewBand = 0; - GDALRasterBand *poUnderlyingMainRasterBand; - int nRefCountUnderlyingMainRasterBand; + GDALRasterBand *poUnderlyingMainRasterBand = nullptr; + int nRefCountUnderlyingMainRasterBand = 0; + + CPL_DISALLOW_COPY_ASSIGN(GDALProxyPoolOverviewRasterBand) protected: GDALRasterBand* RefUnderlyingRasterBand() override; @@ -364,10 +369,12 @@ class GDALProxyPoolOverviewRasterBand : public GDALProxyPoolRasterBand class GDALProxyPoolMaskBand : public GDALProxyPoolRasterBand { private: - GDALProxyPoolRasterBand *poMainBand; + GDALProxyPoolRasterBand *poMainBand = nullptr; - GDALRasterBand *poUnderlyingMainRasterBand; - int nRefCountUnderlyingMainRasterBand; + GDALRasterBand *poUnderlyingMainRasterBand = nullptr; + int nRefCountUnderlyingMainRasterBand = 0; + + CPL_DISALLOW_COPY_ASSIGN(GDALProxyPoolMaskBand) protected: GDALRasterBand* RefUnderlyingRasterBand() override; diff --git a/modules/globebrowsing/ext/gdal/include/gdal_rat.h b/modules/globebrowsing/ext/gdal/include/gdal_rat.h index bdce0dcd5b..05fa9d6af8 100644 --- a/modules/globebrowsing/ext/gdal/include/gdal_rat.h +++ b/modules/globebrowsing/ext/gdal/include/gdal_rat.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdal_rat.h 3c5e4ec07e57067c187d87dad3b6be5490b76a4e 2018-04-02 23:38:56 +0200 Even Rouault $ + * $Id: gdal_rat.h 2519a7eb0e1649dbf8625ae8ffc7bb7c3ef9514b 2018-07-10 12:05:23 +0100 Robert Coup $ * * Project: GDAL Core * Purpose: GDALRasterAttributeTable class declarations. @@ -60,7 +60,7 @@ public: * * @return new copy of the RAT as an in-memory implementation. */ - virtual GDALDefaultRasterAttributeTable *Clone() const = 0; + virtual GDALRasterAttributeTable *Clone() const = 0; /** * \brief Fetch table column count. @@ -238,6 +238,25 @@ public: */ virtual int ChangesAreWrittenToFile() = 0; + /** + * \brief Set the RAT table type. + * + * Set whether the RAT is thematic or athematic (continuous). + * + * @since GDAL 2.4 + */ + virtual CPLErr SetTableType(const GDALRATTableType eInTableType) = 0; + + /** + * \brief Get the RAT table type. + * + * Indicates whether the RAT is thematic or athematic (continuous). + * + * @since GDAL 2.4 + * @return table type + */ + virtual GDALRATTableType GetTableType() const = 0; + virtual CPLErr ValuesIO( GDALRWFlag eRWFlag, int iField, int iStartRow, int iLength, double *pdfData); @@ -285,6 +304,13 @@ public: */ static inline GDALRasterAttributeTable* FromHandle(GDALRasterAttributeTableH hRAT) { return static_cast(hRAT); } + + /** + * \brief Remove statistics from the RAT. + * + * @since GDAL 2.4 + */ + virtual void RemoveStatistics() = 0; }; /************************************************************************/ @@ -296,15 +322,15 @@ public: class GDALRasterAttributeField { public: - CPLString sName; + CPLString sName{}; - GDALRATFieldType eType; + GDALRATFieldType eType = GFT_Integer; - GDALRATFieldUsage eUsage; + GDALRATFieldUsage eUsage = GFU_Generic; - std::vector anValues; - std::vector adfValues; - std::vector aosValues; + std::vector anValues{}; + std::vector adfValues{}; + std::vector aosValues{}; }; //! @endcond @@ -314,28 +340,28 @@ class GDALRasterAttributeField //! Raster Attribute Table container. -// cppcheck-suppress copyCtorAndEqOperator class CPL_DLL GDALDefaultRasterAttributeTable : public GDALRasterAttributeTable { private: - std::vector aoFields; + std::vector aoFields{}; - int bLinearBinning; // TODO(schwehr): Can this be a bool? - double dfRow0Min; - double dfBinSize; + int bLinearBinning = false; // TODO(schwehr): Can this be a bool? + double dfRow0Min = -0.5; + double dfBinSize = 1.0; + + GDALRATTableType eTableType; void AnalyseColumns(); - int bColumnsAnalysed; // TODO(schwehr): Can this be a bool? - int nMinCol; - int nMaxCol; + int bColumnsAnalysed = false; // TODO(schwehr): Can this be a bool? + int nMinCol = -1; + int nMaxCol = -1; - int nRowCount; + int nRowCount = 0; - CPLString osWorkingResult; + CPLString osWorkingResult{}; public: GDALDefaultRasterAttributeTable(); - GDALDefaultRasterAttributeTable( const GDALDefaultRasterAttributeTable& ); ~GDALDefaultRasterAttributeTable() override; GDALDefaultRasterAttributeTable *Clone() const override; @@ -372,6 +398,11 @@ class CPL_DLL GDALDefaultRasterAttributeTable : public GDALRasterAttributeTable double dfBinSize ) override; int GetLinearBinning( double *pdfRow0Min, double *pdfBinSize ) const override; + + CPLErr SetTableType(const GDALRATTableType eInTableType) override; + GDALRATTableType GetTableType() const override; + + void RemoveStatistics() override; }; #endif /* ndef GDAL_RAT_H_INCLUDED */ diff --git a/modules/globebrowsing/ext/gdal/include/gdal_simplesurf.h b/modules/globebrowsing/ext/gdal/include/gdal_simplesurf.h index e3cd29c17a..260c819e13 100644 --- a/modules/globebrowsing/ext/gdal/include/gdal_simplesurf.h +++ b/modules/globebrowsing/ext/gdal/include/gdal_simplesurf.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdal_simplesurf.h 1b31a5ae8474bacb2fb8cce9c7121b390e192c4c 2016-12-04 04:32:31Z Kurt Schwehr $ + * $Id: gdal_simplesurf.h fe2d81c8819bf9794bce0210098e637565728350 2018-05-06 00:49:51 +0200 Even Rouault $ * Project: GDAL * Purpose: Correlator * Author: Andrew Migal, migal.drew@gmail.com @@ -187,6 +187,8 @@ private: */ class GDALIntegralImage { + CPL_DISALLOW_COPY_ASSIGN(GDALIntegralImage) + public: GDALIntegralImage(); virtual ~GDALIntegralImage(); @@ -260,9 +262,9 @@ public: int GetWidth(); private: - double **pMatrix; - int nWidth; - int nHeight; + double **pMatrix = nullptr; + int nWidth = 0; + int nHeight = 0; }; /** @@ -275,6 +277,8 @@ private: */ class GDALOctaveLayer { + CPL_DISALLOW_COPY_ASSIGN(GDALOctaveLayer) + public: GDALOctaveLayer(); @@ -424,12 +428,8 @@ private: class MatchedPointPairInfo { public: - MatchedPointPairInfo(int nInd_1, int nInd_2, double dfDist) - { - ind_1 = nInd_1; - ind_2 = nInd_2; - euclideanDist = dfDist; - } + MatchedPointPairInfo(int nInd_1, int nInd_2, double dfDist): + ind_1(nInd_1), ind_2(nInd_2), euclideanDist(dfDist) {} int ind_1; int ind_2; diff --git a/modules/globebrowsing/ext/gdal/include/gdal_version.h b/modules/globebrowsing/ext/gdal/include/gdal_version.h index eb67e87dff..852adeafec 100644 --- a/modules/globebrowsing/ext/gdal/include/gdal_version.h +++ b/modules/globebrowsing/ext/gdal/include/gdal_version.h @@ -6,8 +6,8 @@ #ifndef GDAL_VERSION_MAJOR # define GDAL_VERSION_MAJOR 2 -# define GDAL_VERSION_MINOR 3 -# define GDAL_VERSION_REV 2 +# define GDAL_VERSION_MINOR 4 +# define GDAL_VERSION_REV 1 # define GDAL_VERSION_BUILD 0 #endif @@ -24,9 +24,9 @@ #if !defined(DO_NOT_DEFINE_GDAL_RELEASE_DATE_AND_GDAL_RELEASE_NAME) #ifndef GDAL_RELEASE_DATE -# define GDAL_RELEASE_DATE 20180921 +# define GDAL_RELEASE_DATE 20190315 #endif #ifndef GDAL_RELEASE_NAME -# define GDAL_RELEASE_NAME "2.3.2" +# define GDAL_RELEASE_NAME "2.4.1" #endif #endif diff --git a/modules/globebrowsing/ext/gdal/include/gdalgeorefpamdataset.h b/modules/globebrowsing/ext/gdal/include/gdalgeorefpamdataset.h index dfb2e39d98..b64b552ba1 100644 --- a/modules/globebrowsing/ext/gdal/include/gdalgeorefpamdataset.h +++ b/modules/globebrowsing/ext/gdal/include/gdalgeorefpamdataset.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdalgeorefpamdataset.h 773b7550bb86d46bc587f547f5db549566665834 2017-12-18 04:05:13Z Kurt Schwehr $ + * $Id: gdalgeorefpamdataset.h e37e476c4cf8f4b0df8995e0d95d5d672fca1a9b 2018-05-05 16:54:18 +0200 Even Rouault $ * * Project: GDAL * Purpose: GDALPamDataset with internal storage for georeferencing, with @@ -59,6 +59,8 @@ class CPL_DLL GDALGeorefPamDataset : public GDALPamDataset bool m_bPAMLoaded; char** m_papszMainMD; + CPL_DISALLOW_COPY_ASSIGN(GDALGeorefPamDataset) + public: GDALGeorefPamDataset(); ~GDALGeorefPamDataset() override; diff --git a/modules/globebrowsing/ext/gdal/include/gdaljp2abstractdataset.h b/modules/globebrowsing/ext/gdal/include/gdaljp2abstractdataset.h index 1098aa8a40..a5ed346b9c 100644 --- a/modules/globebrowsing/ext/gdal/include/gdaljp2abstractdataset.h +++ b/modules/globebrowsing/ext/gdal/include/gdaljp2abstractdataset.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdaljp2abstractdataset.h d10f99bfacb1d7c3331a539c4667d1c95199313d 2017-12-18 12:00:18Z Kurt Schwehr $ + * $Id: gdaljp2abstractdataset.h e37e476c4cf8f4b0df8995e0d95d5d672fca1a9b 2018-05-05 16:54:18 +0200 Even Rouault $ * * Project: GDAL * Purpose: GDALGeorefPamDataset with helper to read georeferencing and other @@ -36,11 +36,13 @@ class CPL_DLL GDALJP2AbstractDataset: public GDALGeorefPamDataset { - char* pszWldFilename; + char* pszWldFilename = nullptr; - GDALDataset* poMemDS; - char** papszMetadataFiles; - int m_nWORLDFILEIndex; + GDALDataset* poMemDS = nullptr; + char** papszMetadataFiles = nullptr; + int m_nWORLDFILEIndex = -1; + + CPL_DISALLOW_COPY_ASSIGN(GDALJP2AbstractDataset) protected: int CloseDependentDatasets() override; diff --git a/modules/globebrowsing/ext/gdal/include/gdaljp2metadata.h b/modules/globebrowsing/ext/gdal/include/gdaljp2metadata.h index 9861f9dfa3..0b7a2da5d2 100644 --- a/modules/globebrowsing/ext/gdal/include/gdaljp2metadata.h +++ b/modules/globebrowsing/ext/gdal/include/gdaljp2metadata.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdaljp2metadata.h 7e07230bbff24eb333608de4dbd460b7312839d0 2017-12-11 19:08:47Z Even Rouault $ + * $Id: gdaljp2metadata.h e37e476c4cf8f4b0df8995e0d95d5d672fca1a9b 2018-05-05 16:54:18 +0200 Even Rouault $ * * Project: GDAL * Purpose: JP2 Box Reader (and GMLJP2 Interpreter) @@ -59,6 +59,8 @@ class CPL_DLL GDALJP2Box GByte *pabyData; + CPL_DISALLOW_COPY_ASSIGN(GDALJP2Box) + public: explicit GDALJP2Box( VSILFILE * = nullptr ); ~GDALJP2Box(); @@ -140,6 +142,8 @@ private: GDALDataset* poSrcDS, int bMainMDDomainOnly ); + CPL_DISALLOW_COPY_ASSIGN(GDALJP2Metadata) + public: char **papszGMLMetadata; diff --git a/modules/globebrowsing/ext/gdal/include/gdalpansharpen.h b/modules/globebrowsing/ext/gdal/include/gdalpansharpen.h index 6c038df44f..e69bdc2004 100644 --- a/modules/globebrowsing/ext/gdal/include/gdalpansharpen.h +++ b/modules/globebrowsing/ext/gdal/include/gdalpansharpen.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdalpansharpen.h 4971449609881d6ffdca70188292293852d12691 2017-12-17 16:48:14Z Even Rouault $ + * $Id: gdalpansharpen.h fe2d81c8819bf9794bce0210098e637565728350 2018-05-06 00:49:51 +0200 Even Rouault $ * * Project: GDAL Pansharpening module * Purpose: Prototypes, and definitions for pansharpening related work. @@ -187,13 +187,15 @@ typedef struct */ class GDALPansharpenOperation { - GDALPansharpenOptions* psOptions; - std::vector anInputBands; - std::vector aVDS; // to destroy - std::vector aMSBands; // original multispectral bands potentially warped into a VRT - int bPositiveWeights; - CPLWorkerThreadPool* poThreadPool; - int nKernelRadius; + CPL_DISALLOW_COPY_ASSIGN(GDALPansharpenOperation) + + GDALPansharpenOptions* psOptions = nullptr; + std::vector anInputBands{}; + std::vector aVDS{}; // to destroy + std::vector aMSBands{}; // original multispectral bands potentially warped into a VRT + int bPositiveWeights = TRUE; + CPLWorkerThreadPool* poThreadPool = nullptr; + int nKernelRadius = 0; static void PansharpenJobThreadFunc(void* pUserData); static void PansharpenResampleJobThreadFunc(void* pUserData); diff --git a/modules/globebrowsing/ext/gdal/include/gdalsse_priv.h b/modules/globebrowsing/ext/gdal/include/gdalsse_priv.h index 2afa760c75..ffee289ed4 100644 --- a/modules/globebrowsing/ext/gdal/include/gdalsse_priv.h +++ b/modules/globebrowsing/ext/gdal/include/gdalsse_priv.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdalsse_priv.h a82a268adfd10bccfa254f9e416a68c105315d25 2018-04-08 13:53:09 +0200 Even Rouault $ + * $Id: gdalsse_priv.h e37e476c4cf8f4b0df8995e0d95d5d672fca1a9b 2018-05-05 16:54:18 +0200 Even Rouault $ * * Project: GDAL * Purpose: SSE2 helper @@ -96,10 +96,17 @@ class XMMReg2Double public: __m128d xmm; +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#endif /* coverity[uninit_member] */ - XMMReg2Double() {} + XMMReg2Double() = default; +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif - XMMReg2Double(double val) { xmm = _mm_load_sd (&val); } + XMMReg2Double(double val): xmm(_mm_load_sd (&val)) {} XMMReg2Double(const XMMReg2Double& other) : xmm(other.xmm) {} static inline XMMReg2Double Zero() @@ -1001,7 +1008,16 @@ class XMMReg4Double public: XMMReg2Double low, high; - XMMReg4Double() {} +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Weffc++" +#endif + /* coverity[uninit_member] */ + XMMReg4Double() = default; +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + XMMReg4Double(const XMMReg4Double& other) : low(other.low), high(other.high) {} static inline XMMReg4Double Zero() diff --git a/modules/globebrowsing/ext/gdal/include/gdalwarper.h b/modules/globebrowsing/ext/gdal/include/gdalwarper.h index e5dc1f7085..22f13a7fbd 100644 --- a/modules/globebrowsing/ext/gdal/include/gdalwarper.h +++ b/modules/globebrowsing/ext/gdal/include/gdalwarper.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: gdalwarper.h 7e07230bbff24eb333608de4dbd460b7312839d0 2017-12-11 19:08:47Z Even Rouault $ + * $Id: gdalwarper.h d16ecc80707f9c7097a11bfe47c8403bb9df310f 2018-07-27 20:14:48 -0700 piyush.agram@jpl.nasa.gov $ * * Project: GDAL High Performance Warper * Purpose: Prototypes, and definitions for warping related work. @@ -155,13 +155,15 @@ typedef struct { /*! The "nodata" value real component for each input band, if NULL there isn't one */ double *padfSrcNoDataReal; /*! The "nodata" value imaginary component - may be NULL even if real - component is provided. */ + component is provided. This value is not used to flag invalid values. + Only the real component is used. */ double *padfSrcNoDataImag; /*! The "nodata" value real component for each output band, if NULL there isn't one */ double *padfDstNoDataReal; /*! The "nodata" value imaginary component - may be NULL even if real - component is provided. */ + component is provided. Note that warp operations only use real component + for flagging invalid data.*/ double *padfDstNoDataImag; /*! GDALProgressFunc() compatible progress reporting function, or NULL @@ -317,6 +319,8 @@ CPL_C_END */ class CPL_DLL GDALWarpKernel { + CPL_DISALLOW_COPY_ASSIGN(GDALWarpKernel) + public: /** Warp options */ char **papszWarpOptions; @@ -436,6 +440,9 @@ typedef struct _GDALWarpChunk GDALWarpChunk; /*! @endcond */ class CPL_DLL GDALWarpOperation { + + CPL_DISALLOW_COPY_ASSIGN(GDALWarpOperation) + private: GDALWarpOptions *psOptions; @@ -449,6 +456,12 @@ private: double *pdfSrcXExtraSize, double *pdfSrcYExtraSize, double* pdfSrcFillRatio ); + void ComputeSourceWindowStartingFromSource( + int nDstXOff, int nDstYOff, + int nDstXSize, int nDstYSize, + double* padfSrcMinX, double* padfSrcMinY, + double* padfSrcMaxX, double* padfSrcMaxY); + static CPLErr CreateKernelMask( GDALWarpKernel *, int iBand, const char *pszType ); diff --git a/modules/globebrowsing/ext/gdal/include/memdataset.h b/modules/globebrowsing/ext/gdal/include/memdataset.h index 292ee38643..ae29fc97d3 100644 --- a/modules/globebrowsing/ext/gdal/include/memdataset.h +++ b/modules/globebrowsing/ext/gdal/include/memdataset.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: memdataset.h a570977d47b4689910835836ea861f77906d06ae 2018-03-13 17:44:13Z Even Rouault $ + * $Id: memdataset.h e37e476c4cf8f4b0df8995e0d95d5d672fca1a9b 2018-05-05 16:54:18 +0200 Even Rouault $ * * Project: Memory Array Translator * Purpose: Declaration of MEMDataset, and MEMRasterBand. @@ -54,6 +54,8 @@ class MEMRasterBand; class CPL_DLL MEMDataset : public GDALDataset { + CPL_DISALLOW_COPY_ASSIGN(MEMDataset) + friend class MEMRasterBand; int bGeoTransformSet; @@ -127,6 +129,8 @@ class CPL_DLL MEMRasterBand : public GDALPamRasterBand MEMRasterBand( GByte *pabyDataIn, GDALDataType eTypeIn, int nXSizeIn, int nYSizeIn ); + CPL_DISALLOW_COPY_ASSIGN(MEMRasterBand) + protected: friend class MEMDataset; diff --git a/modules/globebrowsing/ext/gdal/include/ogr_attrind.h b/modules/globebrowsing/ext/gdal/include/ogr_attrind.h index 75499ecf79..e9bdca4cb6 100644 --- a/modules/globebrowsing/ext/gdal/include/ogr_attrind.h +++ b/modules/globebrowsing/ext/gdal/include/ogr_attrind.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: ogr_attrind.h 2bc98a67d106359cbf36780cb385979e6c9a3b59 2016-08-04 22:26:31Z Even Rouault $ + * $Id: ogr_attrind.h e37e476c4cf8f4b0df8995e0d95d5d672fca1a9b 2018-05-05 16:54:18 +0200 Even Rouault $ * * Project: OpenGIS Simple Features Reference Implementation * Purpose: Classes related to generic implementation of attribute indexing. @@ -72,6 +72,7 @@ protected: char *pszIndexPath; OGRLayerAttrIndex(); + CPL_DISALLOW_COPY_ASSIGN(OGRLayerAttrIndex) public: virtual ~OGRLayerAttrIndex(); diff --git a/modules/globebrowsing/ext/gdal/include/ogr_core.h b/modules/globebrowsing/ext/gdal/include/ogr_core.h index e64db30cd0..5e374d9326 100644 --- a/modules/globebrowsing/ext/gdal/include/ogr_core.h +++ b/modules/globebrowsing/ext/gdal/include/ogr_core.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: ogr_core.h 971ad299681ca1ea2e1b800e88209f426b77e9aa 2018-04-17 12:14:43 +0200 Even Rouault $ + * $Id: ogr_core.h 1e082b59d067cf2edf5713e15101c0b369d37e9a 2018-12-02 22:16:23 +0300 drons $ * * Project: OpenGIS Simple Features Reference Implementation * Purpose: Define some core portability services for cross-platform OGR code. @@ -628,7 +628,11 @@ typedef enum OFSTInt16 = 2, /** Single precision (32 bit) floating point. Only valid for OFTReal and OFTRealList. */ OFSTFloat32 = 3, - OFSTMaxSubType = 3 + /** JSON content. Only valid for OFTString. + * @since GDAL 2.4 + */ + OFSTJSON = 4, + OFSTMaxSubType = 4 } OGRFieldSubType; /** @@ -869,7 +873,7 @@ typedef enum ogr_style_tool_param_symbol_id OGRSTSymbolPerp = 7, /**< Perpendicular */ OGRSTSymbolOffset = 8, /**< Offset */ OGRSTSymbolPriority = 9, /**< Priority */ - OGRSTSymbolFontName = 10, /**< OBSOLETE; do not use */ + OGRSTSymbolFontName = 10, /**< Font name */ OGRSTSymbolOColor = 11, /**< Outline color */ #ifndef DOXYGEN_SKIP OGRSTSymbolLast = 12 diff --git a/modules/globebrowsing/ext/gdal/include/ogr_feature.h b/modules/globebrowsing/ext/gdal/include/ogr_feature.h index ee51a80e36..d789eb2b7d 100644 --- a/modules/globebrowsing/ext/gdal/include/ogr_feature.h +++ b/modules/globebrowsing/ext/gdal/include/ogr_feature.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: ogr_feature.h 679491121ae29a3c28a310501b7dc3b89235ec1b 2018-04-11 13:53:49 +0200 Even Rouault $ + * $Id: ogr_feature.h 03663aa9cc098380fe5420faa4f424c3dac45a08 2018-10-29 23:18:12 +0100 Even Rouault $ * * Project: OpenGIS Simple Features Reference Implementation * Purpose: Class for representing a whole feature, and layer schemas. @@ -183,12 +183,12 @@ class CPL_DLL OGRGeomFieldDefn { protected: //! @cond Doxygen_Suppress - char *pszName; - OGRwkbGeometryType eGeomType; /* all values possible except wkbNone */ - mutable OGRSpatialReference* poSRS; + char *pszName = nullptr; + OGRwkbGeometryType eGeomType = wkbUnknown; /* all values possible except wkbNone */ + mutable OGRSpatialReference* poSRS = nullptr; - int bIgnore; - mutable int bNullable; + int bIgnore = false; + mutable int bNullable = true; void Initialize( const char *, OGRwkbGeometryType ); //! @endcond @@ -284,6 +284,7 @@ class CPL_DLL OGRFeatureDefn virtual OGRFieldDefn *GetFieldDefn( int i ); virtual const OGRFieldDefn *GetFieldDefn( int i ) const; virtual int GetFieldIndex( const char * ) const; + int GetFieldIndexCaseSensitive( const char * ) const; virtual void AddFieldDefn( OGRFieldDefn * ); virtual OGRErr DeleteFieldDefn( int iField ); @@ -530,7 +531,7 @@ class CPL_DLL OGRFeature public: //! @cond Doxygen_Suppress - ConstFieldIterator(ConstFieldIterator&& oOther); // declared but not defined. Needed for gcc 5.4 at least + ConstFieldIterator(ConstFieldIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least ~ConstFieldIterator(); const FieldValue& operator*() const; ConstFieldIterator& operator++(); @@ -816,6 +817,9 @@ class CPL_DLL OGRFeatureQuery OGRErr Compile( OGRLayer *, OGRFeatureDefn*, const char *, int bCheck, swq_custom_func_registrar* poCustomFuncRegistrar ); + + CPL_DISALLOW_COPY_ASSIGN(OGRFeatureQuery) + public: OGRFeatureQuery(); ~OGRFeatureQuery(); diff --git a/modules/globebrowsing/ext/gdal/include/ogr_featurestyle.h b/modules/globebrowsing/ext/gdal/include/ogr_featurestyle.h index 883726d09f..35466b6ca5 100644 --- a/modules/globebrowsing/ext/gdal/include/ogr_featurestyle.h +++ b/modules/globebrowsing/ext/gdal/include/ogr_featurestyle.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: ogr_featurestyle.h 5da1c4d1b6c7e38f7f5917fff3ddbc8ad42af7aa 2018-03-30 21:59:13 +0200 Even Rouault $ + * $Id: ogr_featurestyle.h 1e082b59d067cf2edf5713e15101c0b369d37e9a 2018-12-02 22:16:23 +0300 drons $ * * Project: OpenGIS Simple Features Reference Implementation * Purpose: Define of Feature Representation @@ -84,10 +84,12 @@ typedef struct ogr_style_value class CPL_DLL OGRStyleTable { private: - char **m_papszStyleTable; + char **m_papszStyleTable = nullptr; - CPLString osLastRequestedStyleName; - int iNextStyle; + CPLString osLastRequestedStyleName{}; + int iNextStyle = 0; + + CPL_DISALLOW_COPY_ASSIGN(OGRStyleTable) public: OGRStyleTable(); @@ -117,8 +119,10 @@ class OGRStyleTool; class CPL_DLL OGRStyleMgr { private: - OGRStyleTable *m_poDataSetStyleTable; - char *m_pszStyleString; + OGRStyleTable *m_poDataSetStyleTable = nullptr; + char *m_pszStyleString = nullptr; + + CPL_DISALLOW_COPY_ASSIGN(OGRStyleMgr) public: explicit OGRStyleMgr(OGRStyleTable *poDataSetStyleTable = nullptr); @@ -161,15 +165,17 @@ class CPL_DLL OGRStyleMgr class CPL_DLL OGRStyleTool { private: - GBool m_bModified; - GBool m_bParsed; - double m_dfScale; - OGRSTUnitId m_eUnit; - OGRSTClassId m_eClassId; - char *m_pszStyleString; + GBool m_bModified = false; + GBool m_bParsed = false; + double m_dfScale = 1.0; + OGRSTUnitId m_eUnit = OGRSTUMM; + OGRSTClassId m_eClassId = OGRSTCNone; + char *m_pszStyleString = nullptr; virtual GBool Parse() = 0; + CPL_DISALLOW_COPY_ASSIGN(OGRStyleTool) + protected: #ifndef DOXYGEN_SKIP GBool Parse(const OGRStyleParamId* pasStyle, @@ -264,6 +270,8 @@ class CPL_DLL OGRStylePen : public OGRStyleTool GBool Parse() override; + CPL_DISALLOW_COPY_ASSIGN(OGRStylePen) + public: OGRStylePen(); @@ -312,6 +320,8 @@ class CPL_DLL OGRStyleBrush : public OGRStyleTool GBool Parse() override; + CPL_DISALLOW_COPY_ASSIGN(OGRStyleBrush) + public: OGRStyleBrush(); @@ -358,6 +368,8 @@ class CPL_DLL OGRStyleSymbol : public OGRStyleTool GBool Parse() override; + CPL_DISALLOW_COPY_ASSIGN(OGRStyleSymbol) + public: OGRStyleSymbol(); @@ -387,6 +399,10 @@ class CPL_DLL OGRStyleSymbol : public OGRStyleTool void SetPerp(double dfPerp){SetParamDbl(OGRSTSymbolPerp,dfPerp );} int Priority(GBool &bDefault){return GetParamNum(OGRSTSymbolPriority,bDefault);} void SetPriority(int nPriority){SetParamNum(OGRSTSymbolPriority,nPriority);} + const char *FontName(GBool &bDefault) + {return GetParamStr(OGRSTSymbolFontName,bDefault);} + void SetFontName(const char *pszFontName) + {SetParamStr(OGRSTSymbolFontName,pszFontName);} const char *OColor(GBool &bDefault){return GetParamStr(OGRSTSymbolOColor,bDefault);} void SetOColor(const char *pszColor){SetParamStr(OGRSTSymbolOColor,pszColor);} @@ -412,6 +428,8 @@ class CPL_DLL OGRStyleLabel : public OGRStyleTool GBool Parse() override; + CPL_DISALLOW_COPY_ASSIGN(OGRStyleLabel) + public: OGRStyleLabel(); diff --git a/modules/globebrowsing/ext/gdal/include/ogr_geometry.h b/modules/globebrowsing/ext/gdal/include/ogr_geometry.h index b7e7557983..2221650dec 100644 --- a/modules/globebrowsing/ext/gdal/include/ogr_geometry.h +++ b/modules/globebrowsing/ext/gdal/include/ogr_geometry.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: ogr_geometry.h 62c2ef9b70dfd1a0e087c7a27df0bfd375997093 2018-04-10 15:25:06 +0200 Even Rouault $ + * $Id: ogr_geometry.h 967fd78f12996d9faa39a977a2b93547b10db65b 2018-10-14 20:02:24 +0200 Even Rouault $ * * Project: OpenGIS Simple Features Reference Implementation * Purpose: Classes for manipulating simple features that is not specific @@ -286,13 +286,13 @@ class CPL_DLL OGRDefaultConstGeometryVisitor: public IOGRConstGeometryVisitor class CPL_DLL OGRGeometry { private: - OGRSpatialReference * poSRS; // may be NULL + OGRSpatialReference * poSRS = nullptr; // may be NULL protected: //! @cond Doxygen_Suppress friend class OGRCurveCollection; - unsigned int flags; + unsigned int flags = 0; OGRErr importPreambleFromWkt( const char ** ppszInput, int* pbHasZ, int* pbHasM, @@ -947,7 +947,7 @@ class CPL_DLL OGRCurve : public OGRGeometry std::unique_ptr m_poPrivate; public: ConstIterator(const OGRCurve* poSelf, bool bStart); - ConstIterator(ConstIterator&& oOther); // declared but not defined. Needed for gcc 5.4 at least + ConstIterator(ConstIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least ~ConstIterator(); const OGRPoint& operator*() const; ConstIterator& operator++(); @@ -1067,7 +1067,7 @@ class CPL_DLL OGRSimpleCurve: public OGRCurve void update(); public: Iterator(OGRSimpleCurve* poSelf, int nPos); - Iterator(Iterator&& oOther); // declared but not defined. Needed for gcc 5.4 at least + Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least ~Iterator(); OGRPoint& operator*(); Iterator& operator++(); @@ -1083,7 +1083,7 @@ class CPL_DLL OGRSimpleCurve: public OGRCurve std::unique_ptr m_poPrivate; public: ConstIterator(const OGRSimpleCurve* poSelf, int nPos); - ConstIterator(ConstIterator&& oOther); // declared but not defined. Needed for gcc 5.4 at least + ConstIterator(ConstIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least ~ConstIterator(); const OGRPoint& operator*() const; ConstIterator& operator++(); @@ -1240,6 +1240,7 @@ inline OGRSimpleCurve::ConstIterator end(const OGRSimpleCurve* poCurve) { return class CPL_DLL OGRLineString : public OGRSimpleCurve { + // cppcheck-suppress unusedPrivateFunction static OGRLinearRing* CasterToLinearRing(OGRCurve* poCurve); protected: @@ -1485,8 +1486,8 @@ class CPL_DLL OGRCurveCollection friend class OGRPolygon; friend class OGRTriangle; - int nCurveCount; - OGRCurve **papoCurves; + int nCurveCount = 0; + OGRCurve **papoCurves = nullptr; public: OGRCurveCollection(); @@ -1579,7 +1580,7 @@ class CPL_DLL OGRCurveCollection class CPL_DLL OGRCompoundCurve : public OGRCurve { private: - OGRCurveCollection oCC; + OGRCurveCollection oCC{}; OGRErr addCurveDirectlyInternal( OGRCurve* poCurve, double dfToleranceEps, @@ -1591,7 +1592,9 @@ class CPL_DLL OGRCompoundCurve : public OGRCurve OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees, const char* const* papszOptions, int bIsLinearRing ) const; + // cppcheck-suppress unusedPrivateFunction static OGRLineString* CasterToLineString( OGRCurve* poCurve ); + // cppcheck-suppress unusedPrivateFunction static OGRLinearRing* CasterToLinearRing( OGRCurve* poCurve ); protected: @@ -1775,7 +1778,7 @@ class CPL_DLL OGRCurvePolygon : public OGRSurface //! @cond Doxygen_Suppress friend class OGRPolygon; friend class OGRTriangle; - OGRCurveCollection oCC; + OGRCurveCollection oCC{}; virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override; @@ -2032,6 +2035,7 @@ inline OGRPolygon::ChildType** end(OGRPolygon* poGeom) { return poGeom->end(); } class CPL_DLL OGRTriangle : public OGRPolygon { private: + // cppcheck-suppress unusedPrivateFunction static OGRPolygon* CasterToPolygon(OGRSurface* poSurface); bool quickValidityCheck() const; @@ -2098,8 +2102,8 @@ class CPL_DLL OGRGeometryCollection : public OGRGeometry protected: //! @cond Doxygen_Suppress - int nGeomCount; - OGRGeometry **papoGeoms; + int nGeomCount = 0; + OGRGeometry **papoGeoms = nullptr; OGRErr exportToWktInternal( char ** ppszDstText, OGRwkbVariant eWkbVariant, @@ -2394,7 +2398,7 @@ class CPL_DLL OGRPolyhedralSurface : public OGRSurface protected: //! @cond Doxygen_Suppress friend class OGRTriangulatedSurface; - OGRMultiPolygon oMP; + OGRMultiPolygon oMP{}; virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override; virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() diff --git a/modules/globebrowsing/ext/gdal/include/ogr_spatialref.h b/modules/globebrowsing/ext/gdal/include/ogr_spatialref.h index 9e5ccb5f04..e9e8d822b8 100644 --- a/modules/globebrowsing/ext/gdal/include/ogr_spatialref.h +++ b/modules/globebrowsing/ext/gdal/include/ogr_spatialref.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: ogr_spatialref.h a5d470bdd8e89e3146e962ff5909fa30e2cb6cdf 2018-04-18 22:09:11 +0200 Even Rouault $ + * $Id: ogr_spatialref.h e37e476c4cf8f4b0df8995e0d95d5d672fca1a9b 2018-05-05 16:54:18 +0200 Even Rouault $ * * Project: OpenGIS Simple Features Reference Implementation * Purpose: Classes for manipulating spatial reference systems in a @@ -74,6 +74,8 @@ class CPL_DLL OGR_SRSNode int NeedsQuoting() const; OGRErr importFromWkt( const char **, int nRecLevel, int* pnNodes ); + CPL_DISALLOW_COPY_ASSIGN(OGR_SRSNode) + public: explicit OGR_SRSNode(const char * = nullptr); ~OGR_SRSNode(); diff --git a/modules/globebrowsing/ext/gdal/include/ogrsf_frmts.h b/modules/globebrowsing/ext/gdal/include/ogrsf_frmts.h index d36cb21c71..a7c21a9fa5 100644 --- a/modules/globebrowsing/ext/gdal/include/ogrsf_frmts.h +++ b/modules/globebrowsing/ext/gdal/include/ogrsf_frmts.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: ogrsf_frmts.h 857bdf514fa1373c19fe6eb91dff4f90a07f2020 2018-04-10 11:06:29 +0200 Even Rouault $ + * $Id: ogrsf_frmts.h 4db9ec884a59751d80c7482f9f3d621ef3c640f6 2018-12-13 11:54:36 +0300 Dmitry Baryshnikov $ * * Project: OpenGIS Simple Features Reference Implementation * Purpose: Classes related to format registration, and file opening. @@ -81,7 +81,7 @@ class CPL_DLL OGRLayer : public GDALMajorObject std::unique_ptr m_poPrivate; public: FeatureIterator(OGRLayer* poLayer, bool bStart); - FeatureIterator(FeatureIterator&& oOther); // declared but not defined. Needed for gcc 5.4 at least + FeatureIterator(FeatureIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least ~FeatureIterator(); OGRFeatureUniquePtr& operator*(); FeatureIterator& operator++(); @@ -91,6 +91,8 @@ class CPL_DLL OGRLayer : public GDALMajorObject friend inline FeatureIterator begin(OGRLayer* poLayer); friend inline FeatureIterator end(OGRLayer* poLayer); + CPL_DISALLOW_COPY_ASSIGN(OGRLayer) + protected: //! @cond Doxygen_Suppress int m_bFilterIsEnvelope; @@ -445,6 +447,7 @@ void CPL_DLL RegisterOGRGML(); void CPL_DLL RegisterOGRLIBKML(); void CPL_DLL RegisterOGRKML(); void CPL_DLL RegisterOGRGeoJSON(); +void CPL_DLL RegisterOGRGeoJSONSeq(); void CPL_DLL RegisterOGRESRIJSON(); void CPL_DLL RegisterOGRTopoJSON(); void CPL_DLL RegisterOGRAVCBin(); @@ -515,6 +518,7 @@ void CPL_DLL RegisterOGRMongoDB(); void CPL_DLL RegisterOGRVDV(); void CPL_DLL RegisterOGRGMLAS(); void CPL_DLL RegisterOGRMVT(); +void CPL_DLL RegisterOGRNGW(); // @endcond CPL_C_END diff --git a/modules/globebrowsing/ext/gdal/include/rawdataset.h b/modules/globebrowsing/ext/gdal/include/rawdataset.h index 0c61ded110..12bcef7425 100644 --- a/modules/globebrowsing/ext/gdal/include/rawdataset.h +++ b/modules/globebrowsing/ext/gdal/include/rawdataset.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: rawdataset.h 002b050d9a9ef403a732c1210784736ef97216d4 2018-04-09 21:34:55 +0200 Even Rouault $ + * $Id: rawdataset.h b2723bb9ee29fb36de5c3afec9e9a6b757ef743c 2018-05-10 21:21:26 +0200 Even Rouault $ * * Project: Raw Translator * Purpose: Implementation of RawDataset class. Intended to be subclassed @@ -80,27 +80,25 @@ class CPL_DLL RawRasterBand : public GDALPamRasterBand protected: friend class RawDataset; - FILE *fpRaw; - VSILFILE *fpRawL; - int bIsVSIL; + VSILFILE *fpRawL{}; - vsi_l_offset nImgOffset; - int nPixelOffset; - int nLineOffset; - int nLineSize; - int bNativeOrder; + vsi_l_offset nImgOffset{}; + int nPixelOffset{}; + int nLineOffset{}; + int nLineSize{}; + int bNativeOrder{}; - int nLoadedScanline; - void *pLineBuffer; - void *pLineStart; - int bDirty; + int nLoadedScanline{}; + void *pLineBuffer{}; + void *pLineStart{}; + int bDirty{}; - GDALColorTable *poCT; - GDALColorInterp eInterp; + GDALColorTable *poCT{}; + GDALColorInterp eInterp{}; - char **papszCategoryNames; + char **papszCategoryNames{}; - int bOwnsFP; + int bOwnsFP{}; int Seek( vsi_l_offset, int ); size_t Read( void *, size_t, size_t ); @@ -121,17 +119,24 @@ protected: public: - RawRasterBand( GDALDataset *poDS, int nBand, void * fpRaw, - vsi_l_offset nImgOffset, int nPixelOffset, - int nLineOffset, - GDALDataType eDataType, int bNativeOrder, - int bIsVSIL = FALSE, int bOwnsFP = FALSE ); + enum class OwnFP + { + NO, + YES + }; - RawRasterBand( void * fpRaw, + RawRasterBand( GDALDataset *poDS, int nBand, VSILFILE* fpRaw, vsi_l_offset nImgOffset, int nPixelOffset, int nLineOffset, GDALDataType eDataType, int bNativeOrder, - int nXSize, int nYSize, int bIsVSIL = FALSE, int bOwnsFP = FALSE ); + OwnFP bOwnsFP ); + + RawRasterBand( VSILFILE* fpRaw, + vsi_l_offset nImgOffset, int nPixelOffset, + int nLineOffset, + GDALDataType eDataType, int bNativeOrder, + int nXSize, int nYSize, + OwnFP bOwnsFP ); virtual ~RawRasterBand() /* = 0 */ ; @@ -165,9 +170,7 @@ public: int GetPixelOffset() const { return nPixelOffset; } int GetLineOffset() const { return nLineOffset; } int GetNativeOrder() const { return bNativeOrder; } - int GetIsVSIL() const { return bIsVSIL; } - FILE *GetFP() const { return (bIsVSIL) ? reinterpret_cast( fpRawL ) : fpRaw; } - VSILFILE *GetFPL() const { CPLAssert(bIsVSIL); return fpRawL; } + VSILFILE *GetFPL() const { return fpRawL; } int GetOwnsFP() const { return bOwnsFP; } private: diff --git a/modules/globebrowsing/ext/gdal/include/swq.h b/modules/globebrowsing/ext/gdal/include/swq.h index 569da6a93b..b36c1d268a 100644 --- a/modules/globebrowsing/ext/gdal/include/swq.h +++ b/modules/globebrowsing/ext/gdal/include/swq.h @@ -123,7 +123,6 @@ public: ~swq_expr_node(); - void Initialize(); void MarkAsTimestamp(); CPLString UnparseOperationFromUnparsedSubExpr(char** apszSubExpr); char *Unparse( swq_field_list *, char chColumnQuote ); @@ -137,30 +136,30 @@ public: void ReplaceBetweenByGEAndLERecurse(); - swq_node_type eNodeType; - swq_field_type field_type; + swq_node_type eNodeType = SNT_CONSTANT; + swq_field_type field_type = SWQ_INTEGER; /* only for SNT_OPERATION */ void PushSubExpression( swq_expr_node * ); void ReverseSubExpressions(); - int nOperation; - int nSubExprCount; - swq_expr_node **papoSubExpr; + int nOperation = 0; + int nSubExprCount = 0; + swq_expr_node **papoSubExpr = nullptr; /* only for SNT_COLUMN */ - int field_index; - int table_index; - char *table_name; + int field_index = 0; + int table_index = 0; + char *table_name = nullptr; /* only for SNT_CONSTANT */ - int is_null; - GIntBig int_value; - double float_value; - OGRGeometry *geometry_value; + int is_null = false; + GIntBig int_value = 0; + double float_value = 0.0; + OGRGeometry *geometry_value = nullptr; /* shared by SNT_COLUMN, SNT_CONSTANT and also possibly SNT_OPERATION when */ /* nOperation == SWQ_CUSTOM_FUNC */ - char *string_value; /* column name when SNT_COLUMN */ + char *string_value = nullptr; /* column name when SNT_COLUMN */ static CPLString QuoteIfNecessary( const CPLString &, char chQuote = '\'' ); static CPLString Quote( const CPLString &, char chQuote = '\'' ); @@ -306,17 +305,15 @@ public: bool operator() (const CPLString&, const CPLString &) const; }; - GIntBig count; + GIntBig count = 0; - std::vector oVectorDistinctValues; - std::set oSetDistinctValues; - double sum; - double min; - double max; - CPLString osMin; - CPLString osMax; - - swq_summary() : count(0), sum(0.0), min(0.0), max(0.0) {} + std::vector oVectorDistinctValues{}; + std::set oSetDistinctValues{}; + double sum = 0.0; + double min = 0.0; + double max = 0.0; + CPLString osMin{}; + CPLString osMax{}; }; typedef struct { @@ -354,43 +351,45 @@ class swq_select { void postpreparse(); + CPL_DISALLOW_COPY_ASSIGN(swq_select) + public: swq_select(); ~swq_select(); - int query_mode; + int query_mode = 0; - char *raw_select; + char *raw_select = nullptr; int PushField( swq_expr_node *poExpr, const char *pszAlias=nullptr, int distinct_flag = FALSE ); - int result_columns; - swq_col_def *column_defs; - std::vector column_summary; + int result_columns = 0; + swq_col_def *column_defs = nullptr; + std::vector column_summary{}; int PushTableDef( const char *pszDataSource, const char *pszTableName, const char *pszAlias ); - int table_count; - swq_table_def *table_defs; + int table_count = 0; + swq_table_def *table_defs = nullptr; void PushJoin( int iSecondaryTable, swq_expr_node* poExpr ); - int join_count; - swq_join_def *join_defs; + int join_count = 0; + swq_join_def *join_defs = nullptr; - swq_expr_node *where_expr; + swq_expr_node *where_expr = nullptr; void PushOrderBy( const char* pszTableName, const char *pszFieldName, int bAscending ); - int order_specs; - swq_order_def *order_defs; + int order_specs = 0; + swq_order_def *order_defs = nullptr; void SetLimit( GIntBig nLimit ); - GIntBig limit; + GIntBig limit = -1; void SetOffset( GIntBig nOffset ); - GIntBig offset; + GIntBig offset = 0; - swq_select *poOtherSelect; + swq_select *poOtherSelect = nullptr; void PushUnionAll( swq_select* poOtherSelectIn ); CPLErr preparse( const char *select_statement, diff --git a/modules/globebrowsing/ext/gdal/include/thinplatespline.h b/modules/globebrowsing/ext/gdal/include/thinplatespline.h index 761586aad6..ae1a019a12 100644 --- a/modules/globebrowsing/ext/gdal/include/thinplatespline.h +++ b/modules/globebrowsing/ext/gdal/include/thinplatespline.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: thinplatespline.h 7e07230bbff24eb333608de4dbd460b7312839d0 2017-12-11 19:08:47Z Even Rouault $ + * $Id: thinplatespline.h c85c58ac781ef781cd126006d91cb5eed2dd53e2 2018-05-18 18:16:52 +0200 Even Rouault $ * * Project: GDAL Warp API * Purpose: Declarations for 2D Thin Plate Spline transformer. @@ -76,7 +76,9 @@ class VizGeorefSpline2D y(nullptr), u(nullptr), unused(nullptr), - index(nullptr) + index(nullptr), + x_mean(0), + y_mean(0) { for( int i = 0; i < VIZGEOREF_MAX_VARS; i++ ) { @@ -187,6 +189,8 @@ class VizGeorefSpline2D int *unused; // [VIZ_GEOREF_SPLINE_MAX_POINTS]; int *index; // [VIZ_GEOREF_SPLINE_MAX_POINTS]; + double x_mean; + double y_mean; private: CPL_DISALLOW_COPY_ASSIGN(VizGeorefSpline2D) }; diff --git a/modules/globebrowsing/ext/gdal/include/vrtdataset.h b/modules/globebrowsing/ext/gdal/include/vrtdataset.h index e6ff81e7ec..312ed1c7e1 100644 --- a/modules/globebrowsing/ext/gdal/include/vrtdataset.h +++ b/modules/globebrowsing/ext/gdal/include/vrtdataset.h @@ -1,5 +1,5 @@ /****************************************************************************** - * $Id: vrtdataset.h c14f7e09fe06fcc8a02cdcce2f0ebc5d192d1597 2018-08-27 13:29:12 +0200 Even Rouault $ + * $Id: vrtdataset.h b10430acb1303d18052fc20ebc36de01e01398fd 2018-10-25 14:49:58 -0500 Sander Jansen $ * * Project: Virtual GDAL Datasets * Purpose: Declaration of virtual gdal dataset classes. @@ -38,6 +38,7 @@ #include "gdal_priv.h" #include "gdal_rat.h" #include "gdal_vrt.h" +#include "gdal_rat.h" #include #include @@ -60,13 +61,24 @@ void* VRTDeserializeWarpedOverviewTransformer( CPLXMLNode *psTree ); /************************************************************************/ class VRTOverviewInfo { -public: - CPLString osFilename; - int nBand; - GDALRasterBand *poBand; - int bTriedToOpen; + CPL_DISALLOW_COPY_ASSIGN(VRTOverviewInfo) + +public: + CPLString osFilename{}; + int nBand = 0; + GDALRasterBand *poBand = nullptr; + int bTriedToOpen = FALSE; + + VRTOverviewInfo() = default; + VRTOverviewInfo(VRTOverviewInfo&& oOther) noexcept: + osFilename(std::move(oOther.osFilename)), + nBand(oOther.nBand), + poBand(oOther.poBand), + bTriedToOpen(oOther.bTriedToOpen) + { + oOther.poBand = nullptr; + } - VRTOverviewInfo() : nBand(0), poBand(nullptr), bTriedToOpen(FALSE) {} ~VRTOverviewInfo() { if( poBand == nullptr ) /* do nothing */; @@ -131,9 +143,20 @@ VRTSource *VRTParseFilterSources( CPLXMLNode *psTree, const char *, void* pUniqu class VRTRasterBand; +template struct VRTFlushCacheStruct +{ + static void FlushCache(T& obj); +}; + +class VRTWarpedDataset; +class VRTPansharpenedDataset; + class CPL_DLL VRTDataset : public GDALDataset { friend class VRTRasterBand; + friend struct VRTFlushCacheStruct; + friend struct VRTFlushCacheStruct; + friend struct VRTFlushCacheStruct; char *m_pszProjection; @@ -153,6 +176,8 @@ class CPL_DLL VRTDataset : public GDALDataset int m_bCompatibleForDatasetIO; int CheckCompatibleForDatasetIO(); + void ExpandProxyBands(); + std::vector m_apoOverviews; std::vector m_apoOverviewsBak; char **m_papszXMLVRTMetadata; @@ -160,6 +185,8 @@ class CPL_DLL VRTDataset : public GDALDataset VRTRasterBand* InitBand(const char* pszSubclass, int nBand, bool bAllowPansharpened); + CPL_DISALLOW_COPY_ASSIGN(VRTDataset) + protected: virtual int CloseDependentDatasets() override; @@ -266,6 +293,8 @@ class CPL_DLL VRTWarpedDataset : public VRTDataset friend class VRTWarpedRasterBand; + CPL_DISALLOW_COPY_ASSIGN(VRTWarpedDataset) + protected: virtual int CloseDependentDatasets() override; @@ -273,6 +302,8 @@ public: VRTWarpedDataset( int nXSize, int nYSize ); virtual ~VRTWarpedDataset(); + virtual void FlushCache() override; + CPLErr Initialize( /* GDALWarpOptions */ void * ); virtual CPLErr IBuildOverviews( const char *, int, int *, @@ -340,6 +371,8 @@ class VRTPansharpenedDataset : public VRTDataset std::vector m_apoDatasetsToClose; + CPL_DISALLOW_COPY_ASSIGN(VRTPansharpenedDataset) + protected: virtual int CloseDependentDatasets() override; @@ -347,6 +380,8 @@ public: VRTPansharpenedDataset( int nXSize, int nYSize ); virtual ~VRTPansharpenedDataset(); + virtual void FlushCache() override; + virtual CPLErr XMLInit( CPLXMLNode *, const char * ) override; virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath ) override; @@ -411,6 +446,8 @@ class CPL_DLL VRTRasterBand : public GDALRasterBand std::unique_ptr m_poRAT; + CPL_DISALLOW_COPY_ASSIGN(VRTRasterBand) + public: VRTRasterBand(); @@ -503,6 +540,8 @@ class CPL_DLL VRTSourcedRasterBand : public VRTRasterBand bool CanUseSourcesMinMaxImplementations(); void CheckSource( VRTSimpleSource *poSS ); + CPL_DISALLOW_COPY_ASSIGN(VRTSourcedRasterBand) + public: int nSources; VRTSource **papoSources; @@ -668,6 +707,8 @@ class CPL_DLL VRTDerivedRasterBand : public VRTSourcedRasterBand VRTDerivedRasterBandPrivateData* m_poPrivate; bool InitializePython(); + CPL_DISALLOW_COPY_ASSIGN(VRTDerivedRasterBand) + public: char *pszFuncName; GDALDataType eSourceTransferType; @@ -728,6 +769,8 @@ class CPL_DLL VRTRawRasterBand : public VRTRasterBand char *m_pszSourceFilename; int m_bRelativeToVRT; + CPL_DISALLOW_COPY_ASSIGN(VRTRawRasterBand) + public: VRTRawRasterBand( GDALDataset *poDS, int nBand, GDALDataType eType = GDT_Unknown ); @@ -763,6 +806,8 @@ class CPL_DLL VRTRawRasterBand : public VRTRasterBand class VRTDriver : public GDALDriver { + CPL_DISALLOW_COPY_ASSIGN(VRTDriver) + public: VRTDriver(); virtual ~VRTDriver(); @@ -786,6 +831,8 @@ class VRTDriver : public GDALDriver class CPL_DLL VRTSimpleSource : public VRTSource { + CPL_DISALLOW_COPY_ASSIGN(VRTSimpleSource) + protected: friend class VRTSourcedRasterBand; @@ -899,6 +946,8 @@ public: class VRTAveragedSource : public VRTSimpleSource { + CPL_DISALLOW_COPY_ASSIGN(VRTAveragedSource) + public: VRTAveragedSource(); virtual CPLErr RasterIO( GDALDataType eBandDataType, @@ -942,6 +991,7 @@ typedef enum class CPL_DLL VRTComplexSource : public VRTSimpleSource { + CPL_DISALLOW_COPY_ASSIGN(VRTComplexSource) bool AreValuesUnchanged() const; protected: @@ -1026,6 +1076,8 @@ class VRTFilteredSource : public VRTComplexSource private: int IsTypeSupported( GDALDataType eTestType ) const; + CPL_DISALLOW_COPY_ASSIGN(VRTFilteredSource) + protected: int m_nSupportedTypesCount; GDALDataType m_aeSupportedTypes[20]; @@ -1056,6 +1108,8 @@ public: class VRTKernelFilteredSource : public VRTFilteredSource { + CPL_DISALLOW_COPY_ASSIGN(VRTKernelFilteredSource) + protected: int m_nKernelSize; @@ -1085,6 +1139,8 @@ public: class VRTAverageFilteredSource : public VRTKernelFilteredSource { + CPL_DISALLOW_COPY_ASSIGN(VRTAverageFilteredSource) + public: explicit VRTAverageFilteredSource( int nKernelSize ); virtual ~VRTAverageFilteredSource(); @@ -1098,6 +1154,8 @@ public: /************************************************************************/ class VRTFuncSource : public VRTSource { + CPL_DISALLOW_COPY_ASSIGN(VRTFuncSource) + public: VRTFuncSource(); virtual ~VRTFuncSource(); diff --git a/modules/globebrowsing/ext/gdal/lib/gdal203.dll b/modules/globebrowsing/ext/gdal/lib/gdal241.dll similarity index 66% rename from modules/globebrowsing/ext/gdal/lib/gdal203.dll rename to modules/globebrowsing/ext/gdal/lib/gdal241.dll index 4fcbda7fe1..730ed9516e 100644 Binary files a/modules/globebrowsing/ext/gdal/lib/gdal203.dll and b/modules/globebrowsing/ext/gdal/lib/gdal241.dll differ diff --git a/modules/globebrowsing/ext/gdal/lib/gdal_i.lib b/modules/globebrowsing/ext/gdal/lib/gdal_i.lib index 8b6de90921..f92c225f40 100644 Binary files a/modules/globebrowsing/ext/gdal/lib/gdal_i.lib and b/modules/globebrowsing/ext/gdal/lib/gdal_i.lib differ diff --git a/modules/globebrowsing/gdal_data/bag_template.xml b/modules/globebrowsing/gdal_data/bag_template.xml new file mode 100644 index 0000000000..9f5928833c --- /dev/null +++ b/modules/globebrowsing/gdal_data/bag_template.xml @@ -0,0 +1,201 @@ + + + + eng + + + + + ${INDIVIDUAL_NAME:unknown} + + + ${ORGANISATION_NAME:unknown} + + + ${POSITION_NAME:unknown} + + + ${CONTACT_ROLE:author} + + + + + ${DATE} + + + ${METADATA_STANDARD_NAME:ISO 19139} + + + ${METADATA_STANDARD_VERSION:1.1.0} + + + + + 2 + + + + + row + + + ${HEIGHT} + + + ${RESY} + + + + + + + column + + + ${WIDTH} + + + ${RESX} + + + + + point + + + 1 + + + 0 + + + + ${CORNER_POINTS} + + + + center + + + + + + + + + ${HORIZ_WKT} + + + WKT + + + + + + + + + + + ${VERT_WKT:VERT_CS["unknown", VERT_DATUM["unknown", 2000]]} + + + WKT + + + + + + + + ${XML_IDENTIFICATION_CITATION:} + + ${ABSTRACT:} + + + grid + + + + + ${RES} + + + + + eng + + + elevation + + + + + + + ${WEST_LONGITUDE} + + + ${EAST_LONGITUDE} + + + ${SOUTH_LATITUDE} + + + ${NORTH_LATITUDE} + + + + + + + ${VERTICAL_UNCERT_CODE:unknown} + + + + + + + + + dataset + + + + + + + + + ${PROCESS_STEP_DESCRIPTION} + + + ${DATETIME} + + + + + + + + + + + ${RESTRICTION_CODE:otherRestrictions} + + + ${RESTRICTION_OTHER_CONSTRAINTS:unknown} + + + + + + + ${CLASSIFICATION:unclassified} + + + ${SECURITY_USER_NOTE:none} + + + + diff --git a/modules/globebrowsing/gdal_data/eedaconf.json b/modules/globebrowsing/gdal_data/eedaconf.json new file mode 100644 index 0000000000..44359e5544 --- /dev/null +++ b/modules/globebrowsing/gdal_data/eedaconf.json @@ -0,0 +1,11 @@ +{ + "##example_collection/example_subcollection": { + "fields": [ + { "name": "a_int_field", "type": "int" }, + { "name": "a_int64_field", "type": "int64" }, + { "name": "a_int64_field", "type": "int64" }, + { "name": "a_real_field", "type": "double" } + ], + "add_other_properties_field": true + } +} diff --git a/modules/globebrowsing/gdal_data/gdalvrt.xsd b/modules/globebrowsing/gdal_data/gdalvrt.xsd index 5f8023fc5b..38232d9e77 100644 --- a/modules/globebrowsing/gdal_data/gdalvrt.xsd +++ b/modules/globebrowsing/gdal_data/gdalvrt.xsd @@ -1,7 +1,7 @@ @@ -245,6 +246,29 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/globebrowsing/gdal_data/gmlasconf.xml b/modules/globebrowsing/gdal_data/gmlasconf.xml index 8fc6b67b9e..029dade363 100644 --- a/modules/globebrowsing/gdal_data/gmlasconf.xml +++ b/modules/globebrowsing/gdal_data/gmlasconf.xml @@ -25,7 +25,7 @@ false true - 60