this commit fix and error in HWDetect when the libraries versions use
only MAJOR.MINOR like zlib in some linux os that is "1.3" that need
char[4] (1.3\0) conversion from Script::ToJSVal.
this commit create an overload template that matches "references to
array of uknown bound" and forward it to existing const char* / const
wchar_t* specializations.
this bug was reported by Vantha.
The first header was used to include the SpiderMonkey JS API at once,
with safeguards and preprocessor defines. Nowadays, SpiderMonkey
provides modular headers allowing us to include what we use, refs #8086.
Some defines have to be moved to compiler options but it is apparently
a mistake from the SM developers:
https://bugzilla.mozilla.org/show_bug.cgi?id=1987876
Now that size uses float when emulating positioning, it was getting a
different value, like 0.008. This commit fixed that issue by using
std::floor to remove small noise.
Symmetrical for LEFT with std::ceil.
When scaling the GUI, GetCapHeight was incorrectly accounting for
m_Scale which caused text to be hidden due to improper clipping
calculations.
This commit corrects the CapHeight calculation by ensuring that the
division by m_Scale is applied, allowing text to be displayed correctly
at all GUI scale levels.
wxWidgets can use X11 APIs or the GUI toolkits GTK or QT on Linux, with
pure Wayland only the option to use the toolkits remains for
wxGetKeyState().
wxGetKeyState() is only usable for modifier keys with either toolkit and
so we need to bookkeep ourself.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Commit 8b11f6a151 requires InitAttributes to be available, which isn't
the case for the secondary context in serialization test. So clone
InitAttributes to make it available.
```
ERROR: JavaScript error: simulation/helpers/Commands.js line 89
InitAttributes is not defined
reveal-map@simulation/helpers/Commands.js:89:7
ProcessCommand@simulation/helpers/Commands.js:932:23
ERROR: Failed to call ProcessCommand() global script function
```
Reported-by: phosit <phosit@autistici.org>
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
`TaskManager` and `Future` where coupled together. When a task is pushed
a future is returned. Also the `Future::Wrap` function was inconvenient
to use.
Now `TaskManager::PushTask` doesn't return a `Future` anymore. This
alows to use different `Future`-like types.
Also it's possible to easily use the `Future` with a different type that
implements a `PushTask` function.
Remove manual memory management throughout the SoundManager subsystem
in favor of unorderedmap.
Key changes:
- Eliminate manual new/delete calls and potential memory leaks
- Update all sound item classes to use SoundManager factory
- Modernize resource management in OggData and related components
- Ensure exception-safe memory handling across the audio pipeline
This refactoring improves code maintainability, reduces crash risk from
memory errors, and aligns with modern C++ best practices.
As per the docs[1]: Note that since wxWidgets 2.9.1 you are strongly
encouraged to create the windows which are added to wxStaticBoxSizer as
children of wxStaticBox itself.
wxWigets 3.3 added a warning to that end.
[1] https://docs.wxwidgets.org/3.2/classwx_static_box_sizer.html
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
We don't gain anything using a span here, so just don't.
```
source/graphics/Font.cpp:535:35: error: Out of bounds access in 'tempDstRow[3]', if 'tempDstRow' size is 2 and '3' is 3 [containerOutOfBounds]
const float dstAlpha{tempDstRow[3] / 255.0f};
^
source/graphics/Font.cpp:543:14: error: Out of bounds access in 'tempDstRow[2]', if 'tempDstRow' size is 2 and '2' is 2 [containerOutOfBounds]
tempDstRow[2] = static_cast<u8>(std::round(((b * srcAlpha + tempDstRow[2] * dstAlpha * (1.0f - srcAlpha)) / outAlpha)));
^
source/graphics/Font.cpp:544:14: error: Out of bounds access in 'tempDstRow[3]', if 'tempDstRow' size is 2 and '3' is 3 [containerOutOfBounds]
tempDstRow[3] = static_cast<u8>(std::round(outAlpha * 255.0f));
^
```
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
With C++20 the custom container PS:span, which was a backport of
std::span is no longer needed.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
The method's point is to calculate a text's height and width if it was written
in a single line -- no matter how long the caption, even if it's wider
than the window.
With v3.12.0 shfmt changed the behavior of the `--simplify` option to
ignore any EditorConfig when it's provided. Therefore, this option is
now moved to the EditorConfig as suggested by the shfmt author. See
https://github.com/mvdan/sh/issues/1173 for details.
Make include-what-you-use happy with some files in source/tools/atlas
and fix what needs to be fixed.
Update premake script to include missing deps and drop various extra
paths for simplification.
Don't always include wx/wx.h via precompiled.h in case PCH is disabled.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Make include-what-you-use happy with some files in source and fix what
needs to be fixed.
Add markers to precompiled.h header includes to avoid
include-what-you-use wanting them to be removed.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
GetGUIObjectByName was previously made stricter, logging an
error if it doesn't find the target object.
This commit deals with the resulting error-causing (invalid) calls,
by deleting them if they're unnecessary or converting them to the new
TryGetGUIObjectByName (which doesn't log any errors).
It previously failed silently and just returned undefined which would often
only cause errors later on. Printing an error as soon as that happens helps
with debugging, by directly catching typos, for example.
For cases where the queried object may not exist, a new Engine function
called TryGetGUIObjectByName is introduced. It doesn't log any errors
and behaves exactly as GetGUIObjectByName used to.
Make include-what-you-use happy with some files in source and fix what
needs to be fixed.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
For the memleak warning actually wx will free it for us, so just
suppress the warning.
```
source/soundmanager/data/SoundData.cpp:48:29: error: Iterators of different containers 'CSoundData::sSoundData' and 'sSoundData' are used together. [mismatchingContainers]
if ((itemFind = CSoundData::sSoundData.find( theData->GetFileName().string() )) != sSoundData.end())
^
source/soundmanager/data/SoundData.cpp:62:28: error: Iterators of different containers 'CSoundData::sSoundData' and 'sSoundData' are used together. [mismatchingContainers]
if ((itemFind = CSoundData::sSoundData.find(itemPath.string())) != sSoundData.end())
^
source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Terrain/Terrain.cpp:145:3: error: Memory leak: buf [memleak]
}
^
```
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
While std::is_pod is required it is not sufficient so use
std::is_integral as condition which is.
Further replace the static_assert with a requires and use the new endian
support to avoid use preprocessor.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
The implicit conversion form sting literal to char* for C compatibility
was removed with C++11, seems MSVC caught up with this in C++20.
Use explicit cast instead where needed and change API to const char*
otherwise.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Was done for Android support but the cleanup didn't revert to the
original version and at least clang-20 warns -Wmain
Ref: f4625e69af
Ref: 20d23eb340
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
C++20 removed a sizable portion of valid places to use volatile
specifier. As mongoose is on the way out just add the warning to the
list of suppressed warnings. Further add a warning already suppressed
when using GCC to the list of suppressed warnings with Clang.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
std::is_pod is deprecated in C++20 and as such triggers
-Wdeprecated-declarations when built with C++20, "is_standard_layout &&
is_trivial" is the equivalent, so migrate to that.
While at it replace runtime dispatch with compile time and reduce the
required trait for memcpy to what is really needed.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Make include-what-you-use happy with some files in source/tools/atlas
and fix what needs to be fixed.
Define ATLASDLLIMPEXP in a regular header instead of a PCH header and
dedupe its definition.
wxWidgets uses WX_ATTRIBUTE_PRINTF this days, so remove the workaround
for ATTRIBUTE_PRINTF.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
- Explicitly delete move constructor and move assignment operator to
avoid risk of memory leaks
- Remove unused class and typo
- Use same invocation of ScriptInterface as elsewhere
Those functions were added to the C11 standard as an extension under the
name wcsnlen_s and strnlen_s. Also supported under that name in Windows.
Renaming avoids a possible name conflict with the posix functions of the
same name. Further this new name follows the pattern of names of the
other "secure" functions.
Fixes: #8274
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Make include-what-you-use happy with some files in source/tools/atlas
and fix what needs to be fixed.
Drop the wxWidgets specific handling of precompiled headers in some
places, it isn't consistently used which it would have to to have meaning
and was mostly for early VS implementation of precompiled headers and a
lot of time has gone by since.
Drop Borland C++ compiler specific quirk, that compiler was
discontinued long ago and doesn't support modern C++.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Make include-what-you-use happy with some files in source/tools/atlas
and fix what needs to be fixed.
Add "source" to include path for AtlasUI target to allow for absolute
includes. In the future all but one should be removed.
Drop check for at least boost 1.40.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Make include-what-you-use happy with some files in source/simulatation2
and fix what needs to be fixed.
source/simulation2/system/ComponentTest.h uses cxxtest, so add cxxtest
to the deps for simulation2 target.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Make include-what-you-use happy with some files in source/simulation2
and fix what needs to be fixed.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Make include-what-you-use happy with files in source/scriptinterface and
fix what needs to be fixed.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Make include-what-you-use happy with some files in source/simulation2
and fix what needs to be fixed.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>