Commit Graph

63077 Commits

Author SHA1 Message Date
Vadim Zeitlin
9d0df5707a Include the required standard headers used in archives unit test
These files are currently implicitly included from other headers, but we
shouldn't rely on this and include them explicitly as we use std::map<>
and std::auto_ptr<> in this header.

No real changes.
2017-10-30 15:29:30 +01:00
Vadim Zeitlin
7b10210763 Move WX_ASSERT_STRARRAY_EQUAL() to the only test using it
It doesn't seem useful to have this macro in the header included by all
tests when it's only used in a single one of them.
2017-10-30 14:44:20 +01:00
Vadim Zeitlin
9f609a8148 Remove WXTEST_WITH_CONDITION macro to simplify the code
It was only used as part of WXTEST_WITH_GZIP_CONDITION which was
necessary only to support running the tests on systems using zlib < 1.2
which is not a concern since many years any more, so simplify the code
by using the simple non-conditional CPPUNIT_TEST instead and drop the
helper macros which were required only for this.
2017-10-30 14:16:11 +01:00
Vadim Zeitlin
b5aaede7b1 Add a helper for running fuzz function with a single input
This is useful when not using libFuzzer (e.g. because the compiler is
gcc or MSVC and not clang) as it allows to debug the problems found by
libFuzzer with the reproducers generated by it.
2017-10-28 15:12:14 +02:00
Vadim Zeitlin
ce3d416247 Make wx/buffer.h header self-contained
Including this header as the first wxWidgets header in a translation
unit resulted in compilation errors due to including the internal
wx/wxcrtbase.h header before including wx/defs.h, which must be included
before it (at least to define DLL import/export macros and sized char
types used in wx/wxcrtbase.h).

Fix this by simply including wx/defs.h from wx/buffer.h.
2017-10-28 15:07:35 +02:00
Vadim Zeitlin
d83b144727 Fix integer overflow in ZIP reading code
Check for the record size before subtracting it from the end position:
the former must be smaller than the latter for all valid ZIP files and
not performing this check could result in an integer overflow error from
the undefined behaviour sanitizer for bad input.

Credit to OSS-Fuzz: this solves its issue 3828.
2017-10-28 15:02:12 +02:00
Vadim Zeitlin
bb949e9847 Slightly improve wxMBConv::IsUTF8() documentation
Mention that this method is supposed to be used only as an optimization
and also mention that it hadn't been universally available until 3.1.1.

See https://github.com/wxWidgets/wxWidgets/pull/570
2017-10-28 01:10:51 +02:00
Tobias Taschner
fe77b2d593
Add support for UTF8 filenames in wxZipOutputStream
Zip filenames containing non ASCII characters will be marked with
bit 11 in the general purpose flags and will use UTF-8 encoding.

By only setting the flag when non ASCII characters are used the
created archives should be binary identical to previous versions.

The old behavior can be achieved by explicitly using wxConvLocal
with the constructor. This should also ensure that
existing code using a custom wxMBConv should work as before.
2017-10-27 20:27:44 +02:00
Tobias Taschner
73a22766ee
Always enable wxMBConv::IsUTF8()
These where previously guarded by wxUSE_UNICODE_UTF8 but
may be useful in other configurations too.
2017-10-27 20:13:04 +02:00
Paul Cornett
0cb55df404 Remove test code accidently committed in 44b30c1a60 2017-10-27 10:10:18 -07:00
Paul Cornett
44b30c1a60 Avoid use of GDBusServer object after it is destroyed 2017-10-27 10:05:43 -07:00
Vadim Zeitlin
677051b6e7 Remove hack with TLW focus reset from wxWindowMSW dtor
This shouldn't be needed any more, after the previous commit which
replaces the raw pointer to the focused child in wxTopLevelWindowMSW
with a safe weak reference.
2017-10-27 18:20:09 +02:00
Vadim Zeitlin
31d51186e2 Fix crash when reparenting the focused window to another TLW
If the window stored as m_winLastFocused in one TLW was reparented to
another one and then destroyed, this pointer to it wasn't updated and
became dangling.

Fix this by using a safe weak reference instead of raw pointer for
m_winLastFocused. This ensures that it can never be used when it becomes
invalid.

Closes #17980.
2017-10-27 18:18:14 +02:00
Vadim Zeitlin
c2d11dc275 Fix harmless MSVC warning about int to bool conversion
Compare the integer result of a bitwise operation with 0 explicitly to
avoid the C4800 warning given since the changes of the recent commit
802eac475d
2017-10-27 00:07:55 +02:00
Vadim Zeitlin
8a4573223e Fix invalid memcpy() call when reading corrupted ZIP files
Skip memcpy() call if its source and destination would overlap: this is
not allowed and is correctly flagged as an error by address sanitizer
and is unnecessary anyhow as we're certainly not going to find the magic
value in fewer than 3 remaining bytes.

Credit to OSS-Fuzz: this solves its issue 3794.
2017-10-25 17:11:36 +02:00
Vadim Zeitlin
802eac475d Fix undefined behaviour when reading corrupted ZIP files
Don't shift by m_SystemMadeBy value which can potentially be an
arbitrary (8 bit) integer and not necessarily one of the known (and
small) wxZIP_SYSTEM_XXX values, this results in undefined behaviour
whenever this value is greater than 32 or 64 (depending on int size) and
is flagged as such by clang undefined behaviour sanitizer.

To fix the problem, just use a more clear switch statement instead of
using a bit pattern for the lookup, this function is not nearly
performance-sensitive enough to worry about the overhead of the switch
here (assuming it's even slower, in the first place...) and the new
version is much more clear and maintainable.

Credit to OSS-Fuzz: this solves its issue 3792.
2017-10-25 16:38:37 +02:00
Vadim Zeitlin
d5a6568b21 Add a fuzzer for ZIP reading code
The new source file needs to be compiled with a recent clang using
libfuzzer using a command line similar to the following:

	$ clang++ -g -fsanitize=address -fsanitize-coverage=trace-pc-guard tests/fuzz/readzip.cpp `wx-config --cxxflags --libs base` -lFuzzer

and then executed passing it the corpus directory as parameter:

	$ ./a.out tests/fuzz/corpus/zip

This will be useful for finding more bugs like #17947 (and, indeed,
running it locally already found another assert failure, which will be
fixed soon).
2017-10-25 00:38:52 +02:00
Vadim Zeitlin
1519042018 Add missing wxOVERRIDE to avoid clang warning to wxAny unit test
Mark ConvertValue() virtual method inherited from the base class as
overridden to avoid clang -Winconsistent-missing-override warning.
2017-10-22 23:39:53 +02:00
Vadim Zeitlin
aa4c270d73 Fix warning about local variable shadowing in clipping unit test
Use "col" for the "wxColour" variable to avoid clash with "c" one used
for the corner index.

Also just construct the colour directly from the RGB values instead of
default-initializing it and then using Set(), which also allows to make
it "const".
2017-10-22 23:39:47 +02:00
Vadim Zeitlin
9f4f075034 Disable the use of precompiled headers under Unix by default
The speed advantage from using them is very variable, rarely big and
sometimes even negative, while the space penalty is consistently huge,
so it doesn't seem like a good trade-off to enable them by default.
2017-10-21 22:34:45 +02:00
Artur Wieczorek
afdfc02a49 Allow changing wxPropertyGridManager wxPG_EX_NO_TOOLBAR_DIVIDER style
Currently this style can be set only at toolbar creation and cannot
be changed afterwards.
2017-10-21 22:17:54 +02:00
Vadim Zeitlin
0a093193cf Merge branch 'mac-configure-fixes'
Miscellaneous improvements to configure under macOS, see
https://github.com/wxWidgets/wxWidgets/pull/568
2017-10-21 22:12:31 +02:00
Vadim Zeitlin
d5e1851a40 Merge branch 'remove-mac-res'
Remove all Mac resources and related stuff, see
https://github.com/wxWidgets/wxWidgets/pull/567
2017-10-21 22:11:42 +02:00
Vadim Zeitlin
e98d7181b5 Use wxDataViewCtrl::GetTopItem() and GetCountPerPage() in the sample
Demonstrate the use of these methods and also allow testing them easily.

See #17498.
2017-10-21 22:10:35 +02:00
Andreas Falkenhahn
eb035485d7 Add wxDataViewCtrl::GetTopItem() and GetCountPerPage()
Add methods doing the same thing for wxDataViewCtrl as the existing wxListBox
methods.

Closes #17498.
2017-10-21 22:10:35 +02:00
Andreas Falkenhahn
e77cb6f31f Improve wxListBox::GetCountPerPage() in wxGTK and wxOSX
Provide native implementation of this function instead of using the ad hoc one
in common code, which didn't really work -- so remove it completely now.

Closes #17189.
2017-10-21 22:10:35 +02:00
Andreas Falkenhahn
accf7ab117 Add wxFontPickerCtrl::SetMinPointSize()
Allow setting the minimal, as well as maximal, point size.

Closes #17126.
2017-10-21 22:10:35 +02:00
Vadim Zeitlin
60c93971b3 Merge branch 'dvc-compare-values'
Fix comparing items with checkboxes in wxTreeListCtrl and make it
simpler to correctly implement item comparison in other
wxDataViewCtrl-derived classes.

See https://github.com/wxWidgets/wxWidgets/pull/558
2017-10-21 19:59:12 +02:00
Vadim Zeitlin
6974280ee1 Merge branch 'better-assert-dialog'
Use wxRichMessageDialog for showing asserts if possible.
2017-10-21 19:55:15 +02:00
Vadim Zeitlin
d9e4f72fd2 Remove unused configure --enable-objc_uniquifying option
This was only ever used in the alternative wxCocoa port which was itself
removed quite a long time ago.
2017-10-21 19:06:33 +02:00
Vadim Zeitlin
7b373703f7 Only use macOS-specific options when configuring for macOS
Don't even check for options such as --with-macosx-xxx or
--enable-universal_binaries when not targeting macOS, as they only make
sense for this platform.
2017-10-21 19:04:20 +02:00
Vadim Zeitlin
4754621959 Do Mac-specific checks in configure for all ports under Darwin
Configure options such as --enable-universal_binary or
--with-macosx-version-min should be taken into account for any port
being built under macOS, not just wxOSX itself.

In particular, this ensures that PCH and dependencies tracking is
correctly disabled automatically when building universal wxGTK
libraries.

Closes #15454.
2017-10-21 18:59:16 +02:00
Vadim Zeitlin
a1a3efe03b Use wxRichMessageDialog for showing assertion failures
This allows to hide the long (and possibly not fitting on the screen)
call stack by default to avoid intimidating people not used to it and
provides a much more clear way to ignore the subsequent asserts, by
clicking a dedicated checkbox instead of having to choose the "Cancel"
button which didn't make much sense.

See #15430.
2017-10-21 18:19:35 +02:00
Vadim Zeitlin
352a06ad22 Remove old Carbon Mac resource files themselves
They are not used any longer.
2017-10-21 17:49:34 +02:00
Vadim Zeitlin
c77c43cf8c Remove checks for Carbon Mac tools not used any longer
We don't use Rez, DeRez and SetFile any longer and they are not
referenced in bakefile-generated makefiles any longer since the previous
commit.
2017-10-21 17:47:33 +02:00
Vadim Zeitlin
0d394eec9c Update to bakefile 0.2.11 and rebake everything
The main/only change in this version is the removal of automatic rules
using old Carbon Rez/DeRez/SetFile tools.
2017-10-21 17:42:30 +02:00
Paul Cornett
5ba7a1d166 Draw a point instead of a line in wxGCDC::DrawPoint()
See #9674, #4550
2017-10-20 09:40:43 -07:00
Vadim Zeitlin
c52ed1aff3 Make "No" button default in the assert dialog
This makes more sense than the default default (sic) "Yes" button,
pressing which accidentally could kill the program if not running under
the debugger.
2017-10-20 02:40:05 +02:00
Vadim Zeitlin
2e3f0d95dd Open debugger at assert location from the GUI assert handler too
This should have been part of 55fd62c1e3
which only updated the default assert handler, but not the one used by
default in all GUI applications, for some reason, see there for more
explanations.

Do this now to ensure that after pressing "Yes" in the assert failure
dialog, the debugger opens at the assert location and not deep inside
wxWidgets code.

See #11184.
2017-10-20 02:36:01 +02:00
Vadim Zeitlin
1cf41eced6 Use __DARWIN__ for -psn command line argument test
This code should be used in all ports that can be used under macOS, i.e.
also wxGTK and not just wxMac.

Closes #15432.
2017-10-19 19:01:08 +02:00
Robin Dunn
8fca138d29 Add missing wxGetLocale 2017-10-18 18:14:43 -07:00
Artur Wieczorek
892def066c Pass only relevant extra style bits to wxPropertyGrid
When extra style bits are set with the call to
wxPropertyGridManager::SetExtraStyle(), only those which are relevant
to wxPropertyGrid should be passed to the underlying property grid object.
Because it can happen that not all extra style bits of the underlying
wxPropertyGrid have been effectively changed by call to SetExtraStyle()
(e.g. wxPG_EX_NATIVE_DOUBLE_BUFFERING), we have to get the actual style
bits prior to storing them.
2017-10-18 22:58:21 +02:00
Artur Wieczorek
2f3376c4c5 Allow changing wxPG_EX_ALWAYS_ALLOW_FOCUS in propgrid sample
Add wxPG_EX_ALWAYS_ALLOW_FOCUS to the list of flags which can be changed.
2017-10-18 22:57:39 +02:00
Artur Wieczorek
19dbdca53b Rely on native double buffering by default in propgrid sample
If the platform has native double-buffering, create wxPropertyGrid
relying on it by default.
2017-10-18 22:56:44 +02:00
Artur Wieczorek
aaf1d505c6 Rely on native double buffering by default in wxPropertyGrid
If the platform has native double-buffering, instruct wxPropertyGrid
to rely on it by default.

Closes #16978.
2017-10-17 21:13:45 +02:00
Artur Wieczorek
cd669aea71 Use GetContentScaleFactor() to obtain the scale of the back buffer
GetContentScaleFactor() is implemented on all platforms and therefore
can be used to obtain the proper scale not only under wxOSX.
2017-10-17 20:32:29 +02:00
Paul Cornett
ed8a541463 Use wxFALLTHROUGH 2017-10-17 09:21:45 -07:00
Paul Cornett
4ec80a35f9 Define wxFALLTHROUGH for more compilers
Avoids -Wimplicit-fallthrough warning with GCC 7
2017-10-17 09:21:03 -07:00
Artur Wieczorek
cb799483b7 Rely on native double buffering by default in wxSTC
To avoid unnecessary buffering, turn off Scintilla buffered drawing
by default on platforms which have native double-buffering already.
2017-10-16 19:40:01 +02:00
Artur Wieczorek
2c69d27c0d Directly generate EVT_CONTEXT_MENU when Applications (Menu) key is pressed
WM_CONTEXTMENU message is generated directly by the system when the user presses and releases the VK_APPS key so there is no need to do this by emulating right mouse button click.

Closes #17969.
2017-10-09 16:14:50 +02:00