Commit Graph

286 Commits

Author SHA1 Message Date
1944e3ddc0 Rename and move SAL_U/W to o3tl::toU/W
Previosly (since commit 9ac98e6e3488e434bf4864ecfb13a121784f640b)
it was expected to gradually remove SAL_U/W usage in Windows code
by replacing with reinterpret_cast or changing to some bettertypes.
But as it's useful to make use of fact that LibreOffice and Windows
use compatible representation of strings, this commit puts these
functions to a better-suited o3tl, and recommends that the functions
be consistently used throughout Windows-specific code to reflect the
compatibility and keep the casts safe.

Change-Id: I2f7c65606d0e2d0c01a00f08812bb4ab7659c5f6
Reviewed-on: https://gerrit.libreoffice.org/43150
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-05 16:02:52 +02:00
c3609f107b Use SAL_W/SAL_U instead of reinterpret_cast btwn wchar_t* and sal_Unicode*
This is type-safe, and allows to catch cases where a source type
is changed for some reason, but reinterpret_cast masks that

Change-Id: Ib64b6fa2e22d94a6bba890f0ccc3e20325c6f0a1
Reviewed-on: https://gerrit.libreoffice.org/42961
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-30 19:08:28 +02:00
362a21d3a1 Use explicit function names for fooA/fooW WinAPI; prefer fooW
We should only use generic foo function name when it takes params
that are also dependent on UNICODE define, like
LoadCursor( nullptr, IDC_ARROW )
where IDC_ARROW is defined in MSVC headers synchronised with
LoadCursor definition.

We should always use Unicode API for any file paths operations,
because otherwise we will get "?" for any character in path that
is not in current non-unicode codepage, which will result in failed
file operations.

Change-Id: I3a7f453ca0f893002d8a9764318919709fd8b633
Reviewed-on: https://gerrit.libreoffice.org/42935
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-30 11:23:41 +02:00
16549dc267 tdf#96505 Get rid of cargo cult "long" integer literals
Remove unnecessary "Long" literals in multiple locations

Change-Id: Icc44546f10fed841683053eee01b788274e0add1
Reviewed-on: https://gerrit.libreoffice.org/42683
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-09-24 20:18:56 +02:00
caea628196 Better not modify const RECTs passed in
...through IOleInPlaceObject::SetObjectRects, via
EmbedDocument_Impl::SetObjectRects

Change-Id: Ia2533822795776d18132a457dc41f80fadb7c809
Reviewed-on: https://gerrit.libreoffice.org/42615
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-09-22 13:37:23 +02:00
aaa26a58ba Some more WIN32_LEAN_AND_MEAN
Change-Id: Iadb0ebb66809c192fb817b8c7cf2f8cdb4d0b874
Reviewed-on: https://gerrit.libreoffice.org/42419
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-18 19:24:31 +02:00
d4bd86f52d loplugin:redundantpointerops (clang-cl)
Change-Id: I5d4a1c3746b0eec02e022e5ffefd1a30a01948cd
2017-09-14 08:37:19 +02:00
3e9619c747 loplugin:constparams: embedserv (clang-cl)
Change-Id: I6faa8df32e57a846968423cfbe026ce96f6ca7e8
2017-08-31 12:14:40 +02:00
19efa82509 loplugin:unnecessaryparen (clang-cl)
Change-Id: I11a535a5271ec15965877986f15adc0804c00a4f
2017-08-21 11:12:02 +02:00
fd924b397b loplugin:oncevar (clang-cl)
Change-Id: I0cbd9a87880070e2c1381ecd385c1fe4c3ad7505
2017-08-18 10:07:30 +02:00
ff1f6a5fc2 remove UL/L suffixes from integer constants in initialiser/call expressions
Change-Id: Iae081567c4fa5b88edbd12cf2fbafd2b8f31b300
Reviewed-on: https://gerrit.libreoffice.org/41214
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-17 08:14:31 +02:00
a81c6eb5ff loplugin:oncevar (clang-cl): embedserv
Change-Id: Icc9d01b46975505c54a6395edfbeb15cf25c8700
2017-07-03 14:03:45 +02:00
febbad7263 cleanup unused css/frame/* includes
Change-Id: I173a29fd1ee889127369d2bc2fce8e010b89ca65
Reviewed-on: https://gerrit.libreoffice.org/38633
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-12 13:05:38 +02:00
8c8f2a5285 remove unnecessary explicit linefeeds from end of SAL and OSL log calls
Change-Id: I3fa363c8e76e6cfb297f4ec346e3f031c09d6fbf
Reviewed-on: https://gerrit.libreoffice.org/36727
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-21 09:15:11 +02:00
bad606febb Clean up uses of SAL_U/SAL_W: embedserv
Change-Id: I5a73acf6ccfc1709e95e55fa15c32ec6dda2657a
2017-04-10 10:16:11 +02:00
9ac98e6e34 Finally switch MSVC to sal_Unicode = char16_t, too
There is lots of (Windows-only) code that relied on sal_Unicode being the same
as wchar_t, and the best change may be different in each case (and doing the
changes may be somewhat error prone).  So for now add SAL_U/SAL_W scaffolding
functions to sal/types.h, remove their uses one by one again, and finally drop
those functions again.

Change-Id: I2cc791bd941d089901abb5f6fc2f05fbc49e65ea
Reviewed-on: https://gerrit.libreoffice.org/36077
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-04-04 16:12:11 +00:00
f8cff53299 loplugin:redundantcast (clang-cl)
Change-Id: Ie096d75c1bc774e77c589845f61276d1478234ef
Reviewed-on: https://gerrit.libreoffice.org/36065
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-04-04 12:08:43 +00:00
68bd686b2c tdf#96505 - Get rid of cargo cult long integer literals
Change-Id: I56fbc7cd9c879b18ac65c5e6adf80f01c6b95b84
Reviewed-on: https://gerrit.libreoffice.org/35176
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
2017-03-21 14:12:00 +00:00
b57d51e32f Drop :: prefix from std in [de]*/
Change-Id: I3247894fe022dce7f0aa351bd85fefcd7c545dd4
Reviewed-on: https://gerrit.libreoffice.org/34377
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2017-02-17 18:41:19 +00:00
8646ab97dc Remove MinGW support
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>
2017-02-10 18:01:27 +00:00
fed3783e77 Add missing #includes
...like 6dce9c6757823b9e89863716ae70ff4e8ddd4e60, for Windows-only code

Change-Id: I35f37aae2e6f55ff8ed82afc710a9b59a43b028c
2017-02-08 08:40:06 +01:00
87087bab94 loplugin:stringconstant
Change-Id: I8b7611d6fdc55fc8cd9551e129a2e03e58682229
2017-02-01 16:00:41 +01:00
e57ca02849 Remove dynamic exception specifications
...(for now, from LIBO_INTERNAL_CODE only).  See the mail thread starting at
<https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html>
"Dynamic Exception Specifications" for details.

Most changes have been done automatically by the rewriting loplugin:dynexcspec
(after enabling the rewriting mode, to be committed shortly).  The way it only
removes exception specs from declarations if it also sees a definition, it
identified some dead declarations-w/o-definitions (that have been removed
manually) and some cases where a definition appeared in multiple include files
(which have also been cleaned up manually).  There's also been cases of macro
paramters (that were used to abstract over exception specs) that have become
unused now (and been removed).

Furthermore, some code needed to be cleaned up manually
(avmedia/source/quicktime/ and connectivity/source/drivers/kab/), as I had no
configurations available that would actually build that code.  Missing @throws
documentation has not been applied in such manual clean-up.

Change-Id: I3408691256c9b0c12bc5332de976743626e13960
Reviewed-on: https://gerrit.libreoffice.org/33574
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-26 12:54:43 +00:00
da1b98197a embedserv/source/embed/xwin.cxx is gone
...since f2abfdb94e111ba551bb97ec06fa5b57be3f6299 "embedserv: convert to gbuild"

Change-Id: I932da3595e0d7150ef320c2fa892ea8d5286991c
2017-01-25 10:25:00 +01:00
2597a2f1ad loplugin:externvar (clang-cl)
Change-Id: Ic7e4ba1ada97a0fff1ae6d209b22e372431cc6e7
2017-01-11 13:42:40 +01:00
3b658759c9 clang-cl loplugin: embedserv
Change-Id: I9901dac882a74453015881ded2355ff0a51b50d5
Reviewed-on: https://gerrit.libreoffice.org/29868
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-10-16 14:19:18 +00:00
60e264c4fd 64-bit Windows fix: InsertMenu takes a UINT_PTR
Change-Id: Id14c9ac30d52fdeb6b9157df7f57202e94838909
Reviewed-on: https://gerrit.libreoffice.org/29817
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-10-14 12:48:31 +00:00
d4aae1b104 -Werror,-Wnonportable-include-path (clang-cl)
Change-Id: Ia468adf0bea2f7fca9b370ef0ff8b05e34b3ac19
2016-08-25 17:39:19 +02:00
c11e60f11f tdf#99643 OLE automation bridge: fix 64-bit pointer conversions
XBridgeSupplier2::createBridge() is always called in-process and should
therefore expect and create Anys with native-sized encoded pointers,
so use sal_uIntPtr.

Change-Id: Ia757ff38568b07de8085a1a9d323d806bcca0f63
Note: Currently all calls in LO code are with source=UNO, target=OLE.
2016-06-01 00:11:10 +02:00
a890e3189b SAL_FALLTRHOUGH in Windows-only code
Change-Id: If35da46c209746a86687e1c3f60f72f2f08aa681
2016-05-25 08:42:15 +02:00
58a32075ca use Any constructor instead of temporaries
Change-Id: Iffb82a2cee1a28d89eeea2b905aaa14086ee475a
2016-05-04 12:39:40 +02:00
20f23c1a28 Fix typos
Change-Id: Ic4fbc8e7220eb4641f67ef4f85d4853608a369f4
Reviewed-on: https://gerrit.libreoffice.org/24257
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2016-04-21 20:36:29 +00:00
4c7ec9f112 cleanup: remove unused com/sun/star/uno includes
Sequence.h(xx), Any.h(xx) and Type.h(xx)
and remove unused using-declarations from these files.

Add a few missing includes provided by them.

Change-Id: I6b91b6d1fdf9d0496dd546c0aab9bdcc6831a5d4
Reviewed-on: https://gerrit.libreoffice.org/23805
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-12 06:38:26 +00:00
af662f323d -Werror,-Wshadow
In the second part, looks odd that those two lines are a perfect copy of what is
already done near the start of the function, but I have no insight at all into
that code, so just leave it at that.

Change-Id: I6b1d973f77a3d9389880ddec500968144ba615f2
2016-03-04 17:04:57 +01:00
b1d9fe788e -Werror,-Wshadow
Change-Id: Ie6a35ce1fece5de31f455d88ab3e12010b8047f5
2016-03-04 10:11:09 +01:00
6fbac177dd -Werror,-Wunused-macros
According to
<https://msdn.microsoft.com/en-us/library/windows/desktop/aa383681%28v=vs.85%29.aspx>
("Enabling STRICT"), it is used in combination with including windows.h, so
maybe this #define STRICT (which was there ever since
a934115b3ea90d7883681a6ca8922a4b859be36f "Initial revision," w/o also including
windows.h) was always unnecessary (as reported by clang-cl).

Change-Id: I02cf2584fe2fd52e9513791b18fdf6e7982e89b3
2016-03-04 10:11:09 +01:00
b955d437ca -Werror,-Wshadow
Change-Id: I40f92daa60a08d93ea7bbe309fd16fa7ef27e78b
2016-03-04 10:11:08 +01:00
a238b1f8d3 Remove excess newlines
A ridiculously fast way of doing this is:

for i in $(pcregrep -l -M -r --include='.*[hc]xx$' \
  --exclude-dir=workdir --exclude-dir=instdir '^
{3,}' .)
do
    perl -0777 -i -pe 's/^
{3,}/

/gm' $i
done

Change-Id: Iebb93eccbee9e4fc5c4380474ba595858a27ac2c
Reviewed-on: https://gerrit.libreoffice.org/22224
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2016-02-09 08:18:05 +00:00
4b68b6d323 Silence -Werror,-Wmissing-field-initializers in END_OBJECT_MAP (clang-cl)
Change-Id: Ia9ba7fc6cd94e2d726cd9b1dc72c140af16dd700
2016-01-26 17:06:42 +01:00
f719e15c0e more Windows build fixes
after my OInterfaceContainer2 change

Change-Id: Ic365cf09631ff58c7d1b54795e7024923ebe02d1
2016-01-25 14:32:37 +02:00
21e35e2e3b more Windows build fixes
after my OInterfaceContainer2 change

Change-Id: Idc8d9aa218fbeea0e6b00216bb12b0e50efea57c
2016-01-25 14:10:47 +02:00
c4d5feb3fe more Windows build fixes
after my OInterfaceContainer2 change

Change-Id: I8dabb07088c03795d6ac1989ad5ef318d011ccff
2016-01-25 13:56:36 +02:00
df1055ebde more Windows build fixes
after my OInterfaceContainer2 change

Change-Id: I2d59fd166672a2d0b6c05e5bf9368c8fa5cf111c
2016-01-25 13:19:29 +02:00
45b8337f6a more Windows build fixes
after my OInterfaceContainer2 change

Change-Id: I869126a90e67bd00e953182ccafa6569009316ea
2016-01-25 13:05:01 +02:00
752cd07d08 InterfaceContainer2 with vector instead of Sequence
create an InterfaceContainer2 class to replace InterfaceContainer.
It uses a std::vector instead of a Sequence for the mutable listener
list, which provides far better performance.

Switch all our internal use-sites to the new class.

Change-Id: I6b56cfa511ded2395faa22e68fab3b2f16c3cb88
2016-01-25 08:52:03 +02:00
803bff584c -Werror,-Wint-to-pointer-cast
Appart from the by-design type-punned use in CreateWindowEx, m_uID is (only)
used in a call to MAKEWPARAM (to create a WPARAM to pass into a SendMessage
call), so the most realistic type to use seems to be WORD.  And
CHatchWindow::Init is only called with a value of 2000 (from docholder.cxx),
anyway.

Change-Id: I4b6554d1ca9bb3926378c9e25a5473609f5951c5
2015-12-02 08:02:21 +01:00
31927f9703 -Werror,-Wunused-variable
Change-Id: I6800b97cfbf2e986c341d8893658f511951bc8f0
2015-11-28 13:59:59 +01:00
0ea6755161 -Werror,-Wunused-variable
Change-Id: If674f0a3199a43cec84eb8cfb3b3c1d334a288ca
2015-11-24 08:46:57 +01:00
fa257a38b0 Use Get/SetWindowLongPtr, for 64-bit build
Change-Id: I02e5ca8dad87c24f8bf6e192a6b37ffc82a5a04a
2015-11-24 08:46:56 +01:00
04277e7bcf -Werror,-Wbitwise-op-parentheses
Change-Id: I36bd91dc2bb77a09f59e865527db1e9c6724a652
2015-11-24 08:46:56 +01:00