From 9748817ff819b25ecb8eced69237e5b278721508 Mon Sep 17 00:00:00 2001 From: Sergei Reznikov Date: Sat, 15 Feb 2020 14:52:59 +0300 Subject: Make Elementary the default on Haiku diff --git a/vcl/source/app/IconThemeSelector.cxx b/vcl/source/app/IconThemeSelector.cxx index e98d636..f154f7c 100644 --- a/vcl/source/app/IconThemeSelector.cxx +++ b/vcl/source/app/IconThemeSelector.cxx @@ -58,6 +58,9 @@ IconThemeSelector::GetIconThemeForDesktopEnvironment(const OUString& desktopEnvi #ifdef _WIN32 (void)desktopEnvironment; return "colibre"; +#elif defined(__HAIKU__) + (void)desktopEnvironment; + return "elementary"; #else OUString r; if ( desktopEnvironment.equalsIgnoreAsciiCase("plasma5") || -- 2.28.0 From 91225858d2661f8da5ac565cc2c1f0327466b116 Mon Sep 17 00:00:00 2001 From: Sergei Reznikov Date: Fri, 7 Aug 2020 12:14:40 +0300 Subject: Show used vcl backend in About window on Haiku diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index faf2d6f..684a925 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1191,7 +1191,7 @@ OUString Application::GetHWOSConfInfo(const int bSelection, const bool bLocalize #endif appendDetails("", Localize(SV_APP_DEFAULT, bLocalize)); -#if (defined LINUX || defined _WIN32 || defined MACOSX) +#if (defined LINUX || defined _WIN32 || defined MACOSX || defined __HAIKU__) appendDetails("; ", SV_APP_VCLBACKEND + GetToolkitName()); #endif } -- 2.28.0 From 50ad745ee8cfc2049b0bd8f919c2b7ab2a598a5e Mon Sep 17 00:00:00 2001 From: Sergei Reznikov Date: Wed, 24 Oct 2018 17:01:34 +0300 Subject: Identify Haiku in about window diff --git a/vcl/unx/generic/app/geninst.cxx b/vcl/unx/generic/app/geninst.cxx index b661163..329265a 100644 --- a/vcl/unx/generic/app/geninst.cxx +++ b/vcl/unx/generic/app/geninst.cxx @@ -70,6 +70,8 @@ OUString SalGenericInstance::getOSVersion() } fclose( pVersion ); } +#elif defined(__HAIKU__) + aKernelVer = "Haiku"; #endif return aKernelVer; } -- 2.28.0 From fd9509c486889dc97f658b68d40009d6438e784d Mon Sep 17 00:00:00 2001 From: Sergei Reznikov Date: Sat, 15 Feb 2020 15:04:53 +0300 Subject: Implement ShellExec on Haiku diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx index 58c5ef4..93f7f7b 100644 --- a/shell/source/unix/exec/shellexec.cxx +++ b/shell/source/unix/exec/shellexec.cxx @@ -180,6 +180,9 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar aBuffer.append(" -R"); } aBuffer.append(" --"); + +#elif __HAIKU__ + aBuffer.append("open"); #else // Just use xdg-open on non-Mac aBuffer.append("/usr/bin/xdg-open"); -- 2.28.0 From 83e4857c2e719b9d01755a584577804595243045 Mon Sep 17 00:00:00 2001 From: Sergei Reznikov Date: Sat, 20 Jul 2019 01:18:50 +0300 Subject: Comment out linking with pthread diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index 6abfb75..69b8d0e 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -45,9 +45,9 @@ gb_CFLAGS := \ # At least libstdc++ (which is approximated here with !HAVE_LIBCXX) needs -pthread when including # various C++ headers like , see : -ifeq ($(HAVE_LIBCXX),) -gb_CXX_LINKFLAGS := -pthread -endif +#ifeq ($(HAVE_LIBCXX),) +#gb_CXX_LINKFLAGS := -pthread +#endif gb_CXXFLAGS := \ $(gb_CXXFLAGS_COMMON) \ -- 2.28.0 From f89aee806e71b4161b00fdb310ddc316267788ed Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Sun, 11 Aug 2019 11:46:49 +1000 Subject: Workaround for ambiguous methods diff --git a/include/o3tl/sorted_vector.hxx b/include/o3tl/sorted_vector.hxx index 28ef758..6f63c2e 100644 --- a/include/o3tl/sorted_vector.hxx +++ b/include/o3tl/sorted_vector.hxx @@ -92,6 +92,17 @@ public: return 0; } + size_type erase2( const Value& x ) + { + std::pair const ret(Find_t()(m_vector.begin(), m_vector.end(), x)); + if (ret.second) + { + m_vector.erase(m_vector.begin() + (ret.first - m_vector.begin())); + return 1; + } + return 0; + } + void erase( size_t index ) { m_vector.erase(m_vector.begin() + index); diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index a4c57ca..bbe89ce 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -375,7 +375,7 @@ void ScAttrArray::RemoveCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 n if(itr != rCondFormatData.end()) { ScCondFormatIndexes aNewCondFormatData(rCondFormatData); - aNewCondFormatData.erase(nIndex); + aNewCondFormatData.erase2(nIndex); ScCondFormatItem aItem( std::move(aNewCondFormatData) ); pPatternAttr->GetItemSet().Put( aItem ); SetPatternArea( nTempStartRow, nTempEndRow, std::move(pPatternAttr), true ); -- 2.28.0 From aaa099840c8ff36085f228c4d654d74d82f9c841 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Sun, 11 Aug 2019 11:47:40 +1000 Subject: Add XP_HAIKU defs for xmlsec diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk index b2ed3f5..384dfb9 100644 --- a/svl/Library_svl.mk +++ b/svl/Library_svl.mk @@ -96,6 +96,12 @@ $(eval $(call gb_Library_use_system_win32_libs,svl,\ shlwapi \ )) +ifeq ($(OS),HAIKU) +$(eval $(call gb_Library_add_defs,svl,\ + -DXP_HAIKU=1 \ +)) +endif + ifeq ($(OS),WNT) $(eval $(call gb_Library_add_defs,svl,\ -DSVL_CRYPTO_MSCRYPTO \ diff --git a/xmlsecurity/Library_xsec_xmlsec.mk b/xmlsecurity/Library_xsec_xmlsec.mk index bd2cb6a..9d6a90c 100644 --- a/xmlsecurity/Library_xsec_xmlsec.mk +++ b/xmlsecurity/Library_xsec_xmlsec.mk @@ -116,6 +116,12 @@ $(eval $(call gb_Library_add_defs,xsec_xmlsec,\ -DXMLSEC_CRYPTO_NSS \ )) +ifeq ($(OS),HAIKU) +$(eval $(call gb_Library_add_defs,xsec_xmlsec,\ + -DXP_HAIKU=1 \ +)) +endif + ifeq ($(SYSTEM_XMLSEC),) $(eval $(call gb_Library_add_libs,xsec_xmlsec,\ $(call gb_UnpackedTarball_get_dir,xmlsec)/src/nss/.libs/libxmlsec1-nss.a \ -- 2.28.0 From 34cbded565aae3b4ae2799eca45679b22d6dcb96 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Fri, 7 Aug 2020 12:37:45 +0300 Subject: Cast to boolean diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx index c1fbb53..4dddb21 100644 --- a/vcl/source/filter/jpeg/jpegc.cxx +++ b/vcl/source/filter/jpeg/jpegc.cxx @@ -172,13 +172,13 @@ static void ReadJPEG(JpegStuff& rContext, JPEGReader* pJPEGReader, void* pInputS rContext.aOwner.set(&rContext.cinfo); jpeg_svstream_src(&rContext.cinfo, pInputStream); SourceManagerStruct *source = reinterpret_cast(rContext.cinfo.src); - jpeg_read_header(&rContext.cinfo, TRUE); + jpeg_read_header(&rContext.cinfo, static_cast(TRUE)); rContext.cinfo.scale_num = 1; rContext.cinfo.scale_denom = 1; rContext.cinfo.output_gamma = 1.0; - rContext.cinfo.raw_data_out = FALSE; - rContext.cinfo.quantize_colors = FALSE; + rContext.cinfo.raw_data_out = static_cast(FALSE); + rContext.cinfo.quantize_colors = static_cast(FALSE); jpeg_calc_output_dimensions(&rContext.cinfo); @@ -365,7 +365,7 @@ bool WriteJPEG( JPEGWriter* pJPEGWriter, void* pOutputStream, } jpeg_set_defaults( &cinfo ); - jpeg_set_quality( &cinfo, static_cast(nQualityPercent), FALSE ); + jpeg_set_quality( &cinfo, static_cast(nQualityPercent), static_cast(FALSE) ); if (o3tl::convertsToAtMost(rPPI.getX(), 65535) && o3tl::convertsToAtMost(rPPI.getY(), 65535)) { @@ -397,7 +397,7 @@ bool WriteJPEG( JPEGWriter* pJPEGWriter, void* pOutputStream, cinfo.comp_info[0].v_samp_factor = 2; } - jpeg_start_compress( &cinfo, TRUE ); + jpeg_start_compress( &cinfo, static_cast(TRUE) ); for( nY = 0; nY < nHeight; nY++ ) { @@ -432,10 +432,10 @@ void Transform(void* pInputStream, void* pOutputStream, long nAngle) jvirt_barray_ptr* aSourceCoefArrays = nullptr; jvirt_barray_ptr* aDestinationCoefArrays = nullptr; - aTransformOption.force_grayscale = FALSE; - aTransformOption.trim = FALSE; - aTransformOption.perfect = FALSE; - aTransformOption.crop = FALSE; + aTransformOption.force_grayscale = static_cast(FALSE); + aTransformOption.trim = static_cast(FALSE); + aTransformOption.perfect = static_cast(FALSE); + aTransformOption.crop = static_cast(FALSE); // Angle to transform option // 90 Clockwise = 270 Counterclockwise @@ -464,7 +464,7 @@ void Transform(void* pInputStream, void* pOutputStream, long nAngle) aDestinationInfo.err->error_exit = errorExit; aDestinationInfo.err->output_message = outputMessage; - aDestinationInfo.optimize_coding = TRUE; + aDestinationInfo.optimize_coding = static_cast(TRUE); JpegDecompressOwner aDecompressOwner; JpegCompressOwner aCompressOwner; @@ -490,7 +490,7 @@ void Transform(void* pInputStream, void* pOutputStream, long nAngle) jpeg_svstream_src (&aSourceInfo, pInputStream); jcopy_markers_setup(&aSourceInfo, aCopyOption); - jpeg_read_header(&aSourceInfo, TRUE); + jpeg_read_header(&aSourceInfo, static_cast(TRUE)); jtransform_request_workspace(&aSourceInfo, &aTransformOption); aSourceCoefArrays = jpeg_read_coefficients(&aSourceInfo); @@ -500,7 +500,7 @@ void Transform(void* pInputStream, void* pOutputStream, long nAngle) jpeg_svstream_dest (&aDestinationInfo, pOutputStream); // Compute optimal Huffman coding tables instead of precomputed tables - aDestinationInfo.optimize_coding = TRUE; + aDestinationInfo.optimize_coding = static_cast(TRUE); jpeg_write_coefficients(&aDestinationInfo, aDestinationCoefArrays); jcopy_markers_execute(&aSourceInfo, &aDestinationInfo, aCopyOption); jtransform_execute_transformation(&aSourceInfo, &aDestinationInfo, aSourceCoefArrays, &aTransformOption); -- 2.28.0 From b81ec6d5c19132723d4cc48c58892f6e83dd0ea7 Mon Sep 17 00:00:00 2001 From: Sergei Reznikov Date: Fri, 7 Aug 2020 12:47:56 +0300 Subject: Revert fstack-protector check removal in 9db11a8ab648f4d04e59e6bb94cd640f64835447 diff --git a/config_host.mk.in b/config_host.mk.in index dc3da7e..3a8a222 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -270,6 +270,7 @@ export HAMCREST_JAR=@HAMCREST_JAR@ export HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=@HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED@ export HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=@HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR@ export HAVE_GCC_AVX=@HAVE_GCC_AVX@ +export HAVE_GCC_STACK_PROTECTOR_STRONG=@HAVE_GCC_STACK_PROTECTOR_STRONG@ export HAVE_GCC_BUILTIN_ATOMIC=@HAVE_GCC_BUILTIN_ATOMIC@ export HAVE_GCC_FNO_ENFORCE_EH_SPECS=@HAVE_GCC_FNO_ENFORCE_EH_SPECS@ export HAVE_GCC_FNO_SIZED_DEALLOCATION=@HAVE_GCC_FNO_SIZED_DEALLOCATION@ diff --git a/configure.ac b/configure.ac index 5a14369..5044e61 100644 --- a/configure.ac +++ b/configure.ac @@ -6298,6 +6298,17 @@ if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then AC_MSG_RESULT([no]) fi + AC_MSG_CHECKING([whether $CC_BASE supports -fstack-protector-strong]) + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -O0 -Werror -fstack-protector-strong" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; a[7] = 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[]) + CFLAGS=$save_CFLAGS + if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + AC_MSG_CHECKING([whether $CC_BASE supports atomic functions]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ int v = 0; @@ -6449,6 +6460,7 @@ AC_LANG_POP([C++]) fi AC_SUBST(HAVE_GCC_AVX) +AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG) AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC) AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION) diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk index 1707a74..901f0e6 100644 --- a/solenv/gbuild/platform/com_GCC_defs.mk +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -67,7 +67,6 @@ gb_CFLAGS_COMMON := \ -fmessage-length=0 \ -fno-common \ -pipe \ - -fstack-protector-strong \ $(if $(gb_COLOR),-fdiagnostics-color=always) \ gb_CXXFLAGS_COMMON := \ @@ -84,7 +83,6 @@ gb_CXXFLAGS_COMMON := \ -fmessage-length=0 \ -fno-common \ -pipe \ - -fstack-protector-strong \ $(if $(gb_COLOR),-fdiagnostics-color=always) \ ifeq ($(HAVE_WDEPRECATED_COPY_DTOR),TRUE) @@ -143,7 +141,11 @@ endif gb_VISIBILITY_FLAGS_CXX := -fvisibility-inlines-hidden gb_CXXFLAGS_COMMON += $(gb_VISIBILITY_FLAGS_CXX) +ifeq ($(HAVE_GCC_STACK_PROTECTOR_STRONG),TRUE) +gb_CFLAGS_COMMON += -fstack-protector-strong +gb_CXXFLAGS_COMMON += -fstack-protector-strong gb_LinkTarget_LDFLAGS += -fstack-protector-strong +endif ifneq ($(gb_ENABLE_PCH),) ifeq ($(COM_IS_CLANG),TRUE) -- 2.28.0 From 287897fc23816f84635c2b95329713c2e8d64cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 20 Jul 2020 09:52:27 +0100 Subject: fix some warnings with --with-tls=openssl diff --git a/oox/source/crypto/CryptTools.cxx b/oox/source/crypto/CryptTools.cxx index ff11ebb..77b6f8c 100644 --- a/oox/source/crypto/CryptTools.cxx +++ b/oox/source/crypto/CryptTools.cxx @@ -27,16 +27,46 @@ namespace oox::crypto { #if USE_TLS_OPENSSL + +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) + +static HMAC_CTX *HMAC_CTX_new(void) +{ + HMAC_CTX *pContext = new HMAC_CTX; + HMAC_CTX_init(pContext); + return pContext; +} + +static void HMAC_CTX_free(HMAC_CTX *pContext) +{ + HMAC_CTX_cleanup(pContext); + delete pContext; +} +#endif + +namespace +{ + struct cipher_delete + { + void operator()(EVP_CIPHER_CTX* p) { EVP_CIPHER_CTX_free(p); } + }; + + struct hmac_delete + { + void operator()(HMAC_CTX* p) { HMAC_CTX_free(p); } + }; +} + struct CryptoImpl { - std::unique_ptr mpContext; - std::unique_ptr mpHmacContext; + std::unique_ptr mpContext; + std::unique_ptr mpHmacContext; CryptoImpl() = default; void setupEncryptContext(std::vector& key, std::vector& iv, Crypto::CryptoType eType) { - mpContext.reset(new EVP_CIPHER_CTX); + mpContext.reset(EVP_CIPHER_CTX_new()); EVP_CIPHER_CTX_init(mpContext.get()); const EVP_CIPHER* cipher = getCipher(eType); @@ -44,7 +74,7 @@ struct CryptoImpl return; if (iv.empty()) - EVP_EncryptInit_ex(mpContext.get(), cipher, nullptr, key.data(), 0); + EVP_EncryptInit_ex(mpContext.get(), cipher, nullptr, key.data(), nullptr); else EVP_EncryptInit_ex(mpContext.get(), cipher, nullptr, key.data(), iv.data()); EVP_CIPHER_CTX_set_padding(mpContext.get(), 0); @@ -52,7 +82,7 @@ struct CryptoImpl void setupDecryptContext(std::vector& key, std::vector& iv, Crypto::CryptoType eType) { - mpContext.reset(new EVP_CIPHER_CTX); + mpContext.reset(EVP_CIPHER_CTX_new()); EVP_CIPHER_CTX_init(mpContext.get()); const EVP_CIPHER* pCipher = getCipher(eType); @@ -64,7 +94,7 @@ struct CryptoImpl key.resize(nMinKeySize, 0); if (iv.empty()) - EVP_DecryptInit_ex(mpContext.get(), pCipher, nullptr, key.data(), 0); + EVP_DecryptInit_ex(mpContext.get(), pCipher, nullptr, key.data(), nullptr); else { const size_t nMinIVSize = EVP_CIPHER_iv_length(pCipher); @@ -78,8 +108,7 @@ struct CryptoImpl void setupCryptoHashContext(std::vector& rKey, CryptoHashType eType) { - mpHmacContext.reset(new HMAC_CTX); - HMAC_CTX_init(mpHmacContext.get()); + mpHmacContext.reset(HMAC_CTX_new()); const EVP_MD* aEvpMd; switch (eType) { @@ -90,18 +119,16 @@ struct CryptoImpl case CryptoHashType::SHA512: aEvpMd = EVP_sha512(); break; } - HMAC_Init(mpHmacContext.get(), rKey.data(), rKey.size(), aEvpMd); + HMAC_Init_ex(mpHmacContext.get(), rKey.data(), rKey.size(), aEvpMd, nullptr); } ~CryptoImpl() { if (mpContext) EVP_CIPHER_CTX_cleanup(mpContext.get()); - if (mpHmacContext) - HMAC_CTX_cleanup(mpHmacContext.get()); } - const EVP_CIPHER* getCipher(Crypto::CryptoType type) + static const EVP_CIPHER* getCipher(Crypto::CryptoType type) { switch(type) { -- 2.28.0 From 68bae1356f5c0d9f7ad955ddb42932a8f4708fcf Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Sun, 25 Oct 2020 18:51:26 +1000 Subject: Fix build diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index 3066c4d..93c88d6 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -218,7 +218,6 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector& rBi (void)rBitmaps; (void)nFirstPage; (void)nPages; - (void)fResolutionDPI; return 0; #endif // HAVE_FEATURE_PDFIUM } -- 2.28.0