summaryrefslogtreecommitdiff
path: root/include/systools
AgeCommit message (Collapse)Author
2022-03-22Move BSTR wrapper to systools, and fix some wrong BSTR usesMike Kaganski
BSTR is documented [1] to be prefixed by a 32-bit integer specifying its length *in bytes* (not characters), so passing wchar_t* as BSTR is wrong, and the length member of rtl_uString can't substitute the proper BSTR length, since rtl_uString::length specifies length in characters. Any code taking BSTR and using SysStringLen to get its length would only get half of the passed OUString data. In dbaccess/source/ui/dlg/adodatalinks.cxx, the abovementioned error was implemented. OTOH, OLEVariant::getByteSequence() in connectivity/source/drivers/ado/Aolevariant.cxx passed BSTR from tagVARIANT to ctor of OLEString, which resulted in the BSTR being freed in both dtors of OLEString and OLEVariant (the latter calls VariantClear, which itself clears string when vtfield is VT_BSTR). [1] https://docs.microsoft.com/en-us/previous-versions/windows/desktop/automat/bstr Change-Id: Iedbd62b20133644258af3660616add7b63cac258 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131950 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-22Simplify CoCreateInstance / CoGetClassObject with COMReferenceMike Kaganski
Change-Id: Ieb1035410c3c6c4b40ea779e829a940460d19b5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131922 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-21Use IID_PPV_ARGS to have less explicit castingMike Kaganski
Change-Id: Id8839a68320d7d0e2453b3d584dc5708c653cdf2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131863 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-13Simplify COMReference a bitMike Kaganski
Use ThrowIfFailed and small refactor Change-Id: I0bcd57c26cd169380364cdaaaa76e764b9662d07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128362 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-21Use sal::systools::CoInitializeGuard and sal::systools::ThrowIfFailedMike Kaganski
Change-Id: Ifb40e7672671df03b5ffc89905ad1e7b68451b68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127232 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-21Use sal::systools::COMReference in getAdoDatalinkMike Kaganski
Change-Id: If0c474209da5390c0c6e28c11ca26a1c915ab51f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127218 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-21Use sal::systools::COMReference in connectivity/adoMike Kaganski
Change-Id: Ic3c59f70cf0e1ed0020bf4f11d7dee14c69f2119 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127189 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-21Introduce move ctor/assignment for sal::systools::COMReferenceMike Kaganski
Change-Id: I063a1d4a42eb28e2b81956b9b2baefaad3208234 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127190 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-21Introduce sal::systools::COMReference::TryCoCreateInstanceMike Kaganski
Helps fixing uncaught exceptions introduced in commit 00eb9b8954a129fb365191ce8cdcbc4cf66a7333. TryCoCreateInstance returns HRESULT, because it allows to pass the info to the caller, which must check the result (either HRESULT, or validity of the reference) anyway. In case of failure, the previous contents of com_ptr_ is kept, which would be consistent with existing code in connectivity/ado replaced in a follow-up patch. Change-Id: I4c94695de96861ec312247acaa0c8fd35a23010a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127192 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-16Use sal::systools::COMReference and drop ComSmartMike Kaganski
Change-Id: Ic6e0c87f607264629cdec1fdcd0c3144d8fbf8e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123695 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-25use prewin.h/postwin.h around a win32 headerLuboš Luňák
Change-Id: I45051b003defa7e48358abeff3944accf16849a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120995 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-03-16systools is no longer part of the URE interfaceStephan Bergmann
...since de030cd7a234fd9191364647deb1a4836ca992cb "gbuild: Remove MSVC 2013 legacy code", so no longer treat it as such in compilerplugins. (Which caused a few loplugin:includeform and loplugin:nullptr warnings.) Change-Id: I99b42e76992e31aff56b417c05738d4d29e3faf9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112575 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-03-09Missing "template" (clang-cl)Stephan Bergmann
> In file included from C:/lo-clang/core/vcl/win/dtrans/FmtFilter.cxx:37: > C:/lo-clang/core/include\systools/win32/comtools.hxx(72,30): error: use 'template' keyword to treat 'QueryInterface' as a dependent template name [-Werror] > : COMReference(p.QueryInterface<T>(t)) > ^ > template Not sure why this only started to show up now with my clang-cl build on Windows. (The Clang warning itself is available ever since <https://github.com/llvm/ llvm-project/commit/4e7a2c09b22bb04819702ac6b8ea8b59ca396fa5> "Improve recovery (error + fix-it) when parsing type dependent template name without the 'template' keyword" from 2011; its "Also the error is downgraded to an ExtWarn in Microsoft mode." implies that not requiring the "template" here is a non- standard MSVC extension.) Change-Id: I4f8e9d6fa80871fdd212417c1b935d76ffde34c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112192 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-03-04Improve unit test accuracyMike Kaganski
I didn't take clock resolution into account when created the test, and it failed for me occasionally because the value was slightly less than expected. The typical system tick resolution is documented at https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/high-resolution-timers Change-Id: Ie48b10d15b14f9ac7d292a2cc9916bcbfff44b6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111946 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-03-03tdf#116983 tdf#136175: retry if failedMike Kaganski
Debugging the test case from the latter bug report shows that indeed the call to OleGetClipboard may fail first time, as jasonkres had suspected in the former bug. So follow the suggestion in tdf#116983, and retry the failing calls several times in case of failure. Many thanks to Telesto for preparing a clear bug report with reliable test case. Co-authored-by: jasonkres Change-Id: Ib3c497da830bc5faac586bcfe1eededa54bfa117 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111825 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-02-27Drop ComPtr and use sal::systools::COMReferenceMike Kaganski
Change-Id: I9eb6d99d883b44943ad69c2c28d4e55716dc34f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111673 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-02-27Drop the includeMike Kaganski
unused since commit e1e261fef393730b22dc2c4fe3a7d63966d8c737, which dropped checks for macros from the include Change-Id: I746f7f93efbcc950fe84f9419e6931471be0ff8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111693 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-02-26Slightly simplify COMReferenceMike Kaganski
Change-Id: I6447dbdc3e2549d0e55feeee80249bdf75924ca8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111466 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-21tdf#123936 Formatting files in module include with clang-formatPhilipp Hofer
Change-Id: I0507dd797cd5a35e0ae14f4b69ee4e172d08a71a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105681 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Jenkins
2018-02-02sal: MSVC: pragma warning: make more specific, remove obsoleteMike Kaganski
Change-Id: Ib7ad23257a966447d627b4f73698d9298790f759 Reviewed-on: https://gerrit.libreoffice.org/49042 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-27loplugin:includeform: systools (Windows)Stephan Bergmann
Change-Id: If0eee76e3f2844718718906da403e3c09a4688f8
2017-09-22Windows: avoid dependence on UNICODE define; prefer W functionsMike Kaganski
Change-Id: I95b90128e93f0d88ed73601bcc5a7ca9279d4cf1 Reviewed-on: https://gerrit.libreoffice.org/42560 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-04-21gbuild: Remove MSVC 2013 legacy codeDavid Ostrovsky
Uwinapi is discontinued. Change-Id: I063b4d0d8fab2d60de168e960a63b8181158ac01 Reviewed-on: https://gerrit.libreoffice.org/23198 Reviewed-by: David Ostrovsky <david@ostrovsky.org> Tested-by: David Ostrovsky <david@ostrovsky.org>
2017-03-07Remove unused include/systools/win32/comptr.hxxStephan Bergmann
(there's a close cousin in fpicker/source/win32/filepicker/ that's actually in use there) Change-Id: I3250112703f09871e7451257b0417d1d3c332f73 Reviewed-on: https://gerrit.libreoffice.org/34932 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-03Fix typosAndrea Gelmini
Change-Id: I5e3c9683741ddc66283008c20794be5c2b2bc53f Reviewed-on: https://gerrit.libreoffice.org/34804 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-11Remove dead #ifdef _UWINAPI_Stephan Bergmann
...a macro originally introduced with 173db4f242e55172bef92ef78f9d28a4ffc7f204 "#91296# UWINAPI wrapper added", missed by 1f357a5f03401bbc0138eb73807534f59d647121 "Clean out cruft from systools and especially uwinapi" Change-Id: Ide3f83d6ea45f4821adb4043ae2a814762d4fafd Reviewed-on: https://gerrit.libreoffice.org/34152 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-02-10Remove MinGW supportStephan Bergmann
In OOo times, there'd originally been efforts to allow building on Windows with MinGW. Later, in LO times, this has been shifted to an attempt of cross- compiling for Windows on Linux. That attempt can be considered abandoned, and the relevant code rotting. Due to this heritage, there are now three kinds of MinGW-specific code in LO: * Code from the original OOo native Windows effort that is no longer relevant for the LO cross-compilation effort, but has never been removed properly. * Code from the original OOo native Windows effort that is re-purposed for the LO cross-compilation effort. * Code that has been added specifially for the LO cross-compilation effort. All three kinds of code are removed. (An unrelated, remaining use of MinGW is for --enable-build-unowinreg, utilizing --with-mingw-cross-compiler, MINGWCXX, and MINGWSTRIP.) Change-Id: I49daad8669b4cbe49fa923050c4a4a6ff7dda568 Reviewed-on: https://gerrit.libreoffice.org/34127 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-10-04clang-cl loplugin: salStephan Bergmann
Change-Id: If04d3f07dc8bffac8887773b5424c09848cd8f1a Reviewed-on: https://gerrit.libreoffice.org/29404 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2015-11-12Windows header sanitizationAshod Nakashian
Isolation of windows headers using prewin.h and postwin.h headers and making headers dependent on them more self contained. Conversion of TCHAR to WCHAR and LPCTSTR to LPCWSTR etc. and cleanup of unnecessary casts. Change-Id: I7eff5c477d9223a064bfb4d962ff6d61960ee69c Reviewed-on: https://gerrit.libreoffice.org/19901 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-09-02Don't redefine snprintf as VS 2015 supports ISO standardDavid Ostrovsky
Make the workaround in snprintf.h conditional on older MSVC version. Investigation reveals that the GetShortPathNameW is presumably used by legacy Duden extension that was built by Sun in a setsolar environment. The uwinapi.lib was never part of the SDK, so ordinary extensions cannot link against it. The PRIVATE export of the symbol that is only possible with DEF file therefore does not matter much. With VC2015 there is no need for LO code to use uwinapi.dll at all and gb_UWINAPI can be unset in this case. Change-Id: I23a5636db9431b0fa4350b665a6a69613d625264 Reviewed-on: https://gerrit.libreoffice.org/16677 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
2015-08-04include: inline some use-once typedefsNoel Grandin
Change-Id: I064e95c72e5f67178cf2875f457adac241cee529
2014-06-06fixincludeguards: fix include guardsThomas Arnhold
Change-Id: Ie6e8d4272b0b1d0d2ce93bcbc2e818a9eac1a56b Reviewed-on: https://gerrit.libreoffice.org/9629 Reviewed-by: Thomas Arnhold <thomas@arnhold.org> Tested-by: Thomas Arnhold <thomas@arnhold.org>
2014-05-15Resolves fdo#70681: fixincludeguards.pl: all that's leftThomas Arnhold
Change-Id: I3e51a62710bb46c8255fd228d41d9300c90a1fb5 Reviewed-on: https://gerrit.libreoffice.org/9360 Reviewed-by: Thomas Arnhold <thomas@arnhold.org> Tested-by: Thomas Arnhold <thomas@arnhold.org>
2014-04-03remove unnecessary scope qualifier from sal_Bool usesNoel Grandin
i.e. convert "::sal_Bool" to "sal_Bool" Change-Id: Ie5943aee4fee617bf2670655558927ed25b7e067
2014-03-01Remove visual noise from includeAlexander Wilms
Conflicts: include/framework/preventduplicateinteraction.hxx include/sfx2/sfxbasecontroller.hxx include/sfx2/sfxbasemodel.hxx include/toolkit/awt/vclxtabpagemodel.hxx include/vcl/field.hxx include/vcl/settings.hxx Change-Id: Ibccf9f88c68267a3d7e656012b51eaf644c418c2 Reviewed-on: https://gerrit.libreoffice.org/8272 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2013-10-23fixincludeguards.sh: include/s*Thomas Arnhold
Change-Id: I57fcfd442d2b5815e7c07a9cbd660f3698168dee
2013-06-10mingw64: don't cast handle to 32-bit int in a macroFridrich Štrba
Change-Id: I06063d3c171256c54151be04c810b79bd2d194e1
2013-04-24move sal_inc headers to include/David Tardon
Change-Id: I840c681b7c500640d3983e05e9895f3fa8bb1313 Reviewed-on: https://gerrit.libreoffice.org/3501 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
2013-04-24move URE headers to include/David Tardon
Change-Id: Ib48a12e902f2311c295b2007f08f44dee28f431d Reviewed-on: https://gerrit.libreoffice.org/3499 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>