Commit Graph

130 Commits

Author SHA1 Message Date
rubidium42
6ba55e663e Codechange: do not hide variables with other variables 2023-01-29 07:21:34 +01:00
rubidium42
1951af07c0 Codechange: do not hide parameters with local variables 2023-01-29 07:21:34 +01:00
Rubidium
71b46db8d0 Cleanup: remove commented out code 2023-01-26 23:47:55 +01:00
Rubidium
5863d78cb4 Codechange: use commented out code, or guard by #ifdef 2023-01-26 23:47:55 +01:00
Rubidium
ae422be979 Cleanup: remove/replace trailing ; with . in comments 2023-01-26 23:47:55 +01:00
Rubidium
20a9e13272 Fix: inconsistent definition of copy constructor and assignment 2023-01-15 00:24:20 +01:00
Rubidium
f7af9a299a Codechange: prevent suspicious pointer scaling 2023-01-06 19:34:35 +01:00
glx22
012fd2be0d Codechange: Suppress warnings when asserts are disabled 2022-12-30 02:17:38 +01:00
Loïc Guilloux
ccd586a736
Fix #9588, 140a96b: [Squirrel] Reaching memory limit during script registration could prevent further script detections (#9589)
Also the memory allocation triggering the limit was never freed.
And if the exception was thrown in a constructor using placement new, the pre-allocated memory was not freed either.
2021-10-02 15:13:58 +02:00
Rubidium
281a65b3e1 Cleanup: simplify some boolean expressions 2021-06-17 16:18:30 +02:00
Rubidium
a9774f3e34 Cleanup: [Squirrel] Use nullptr instead of 0 or NULL 2021-06-17 16:18:30 +02:00
rubidium42
c811d42d0c Fix a99ac62: fmt's include of cassert breaks our assert logic 2021-06-13 21:02:17 +02:00
rubidium42
662d8dfc30 Add: minimal set of headers from {fmt} 7.1.3 to 3rdparty 2021-06-13 12:45:45 +02:00
glx22
00e3fddd0c Fix: [MinGW] Unused squirrel code triggering a warning 2021-06-10 23:17:29 +02:00
Patric Stout
28e90769f7 Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways we had
While at it, replace OTTD_ASSERT with WITH_ASSERT, as this
is always set if assert() is valid. No matter if NDEBUG is set
or not.
2021-06-03 17:30:00 +02:00
Rubidium
5c01f9ea52 Fix #9267, 47a99bb: [Squirrel] Heap use after free
Due to 47a99bb the order of elements in the garbage collection chain has
changed causing the class to be finalised before the instances of that class.
Since the instance's array of member values depends on the size of the values
in the class, the class finalisation resetting that size to 0 causes not all
finalisations to run, which subsequently causes a heap use after free. So,
just set the SQObjectPtrs to 'null' during the finalisation of the SQClass
so the SQInstance can release all instance variables during its finalisation.
2021-05-16 10:07:38 +02:00
Rubidium
44d1b964bf Fix #7513: recursive array/class/table release caused stack overflow 2021-04-17 19:18:51 +01:00
Rubidium
47a99bb676 Fix #7513: recursive garbage collection caused stack overflow 2021-04-17 19:18:51 +01:00
Charles Pigott
dd798d688b
Fix #8919: Release builds with asserts enabled (#8925) 2021-04-01 23:57:49 +01:00
Charles Pigott
591ea9862d
Codechange: Suppress warnings when asserts are disabled (#8916) 2021-04-01 10:03:12 +02:00
Michael Lutz
9a069faa01 Codechange: [Win32] Try to get an OpenGL 3.2+ context if possible. 2021-02-22 22:16:07 +01:00
Michael Lutz
ef478ade64 Add: [Win32] Video driver that uses OpenGL to transfer the video buffer to the screen. 2021-02-22 22:16:07 +01:00
Charles Pigott
9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
frosch
484ea62a62 Cleanup: use std::optional instead of custom implementation. 2020-12-14 23:50:50 +01:00
Charles Pigott
64b1c70fdd Codechange: Add WARN_FORMAT to vseprintf and fix the cascade of warnings that followed 2020-06-27 14:51:14 +01:00
Niels Martin Hansen
9895ced6af Fix: Silence some warnings when building with clang-cl on VS 2019
Clang-cl presents as both _MSC_VER and __clang__ in the preprocessor which makes some things confusing.
2020-06-18 08:56:27 +01:00
Patric Stout
56d54cf60e Add: introduce CMake for project management
CMake works on all our supported platforms, like MSVC, Mingw, GCC,
Clang, and many more. It allows for a single way of doing things,
so no longer we need shell scripts and vbs scripts to work on all
our supported platforms.

Additionally, CMake allows to generate project files for like MSVC,
KDevelop, etc.

This heavily reduces the lines of code we need to support multiple
platforms from a project perspective.

Addtiionally, this heavily improves our detection of libraries, etc.
2020-06-05 19:36:05 +02:00
Michael Lutz
8aef14386f Add: Optional implementation of std::optional for pre-C++17 compilers.
Sourced from https://github.com/akrzemi1/Optional, Boost Software License, Version 1.0.
2020-05-21 20:02:34 +02:00
glx
196157b29e Fix #7966: SQInteger is 64-bit, print it as 64-bit 2020-02-01 10:14:51 +00:00
S. D. Cloudt
13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Charles Pigott
6378a78817 Codechange: Explicitly move a few variables to avoid a copy constructor (fixes warning from clang) 2019-09-30 14:00:06 +01:00
Charles Pigott
71a3e83468 Fix: GCC9's warnings about deprecated implicit assignment operators 2019-09-30 14:00:06 +01:00
Niels Martin Hansen
140a96b3a0 Change: Limit memory allocations for each Squirrel instance
This can avoid out-of-memory situations due to single scripts using up the entire address space.
Instead, scripts that go above the maximum are killed.
The maximum is default 1 GB per script, but can be configured by a setting.
2019-05-11 15:34:33 +02:00
Charles Pigott
5f86e1a390 Codechange: Silence -Wclass-memaccess warnings with GCC8 2018-06-27 22:54:46 +02:00
Niels Martin Hansen
836d25e738 Codechange: Address some MSVC compiler warnings 2018-06-15 22:36:55 +02:00
frosch
062c736437 (svn r27896) -Fix: some warnings 2017-08-20 21:04:21 +00:00
frosch
b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
rubidium
ac6312d33c (svn r27605) -Fix: GCC 6 warning about misleading indentation 2016-06-27 17:52:30 +00:00
matthijs
576005b714 (svn r27561) -Fix [Squirrel]: Fix typos in error messages 2016-05-11 21:28:39 +00:00
rubidium
d05ac99d52 (svn r27289) -Fix: some uninitialised instance variables 2015-05-20 18:17:50 +00:00
rubidium
5ed8ac8a81 (svn r27233) -Fix [FS#6272]: crash when no AIs were installed due to improper handling of non-ASCII characters by the string pointer lexer 2015-04-11 19:33:36 +00:00
frosch
396dde1636 (svn r27092) -Fix/Add [FS#6186]: Compilation on OS/2 (smedles) 2014-12-24 17:17:18 +00:00
rubidium
771dcf3b7b (svn r27003) -Cleanup: fix the use of spaces and asterices "around" some comments 2014-10-12 18:41:53 +00:00
rubidium
79ca66eb67 (svn r26853) -Cleanup [Squirrel]: remove some stuff that we never did and especially never should use 2014-09-19 20:06:51 +00:00
rubidium
dba98e85cb (svn r26845) -Fix [Squirrel]: more uninitialized variables in constructors 2014-09-17 18:35:45 +00:00
rubidium
6defde275c (svn r26844) -Fix: clang compile error 2014-09-17 17:52:50 +00:00
rubidium
3c85109c49 (svn r26842) -Codechange [Squirrel]: other simple cases of non-initialised instance variables 2014-09-16 21:14:18 +00:00
rubidium
a1d4148be5 (svn r26841) -Codechange [Squirrel]: move the actual initialisation of instance variables of SQString into the constructor 2014-09-16 21:13:24 +00:00
rubidium
1685118169 (svn r26840) -Fix [Squirrel]: merge Init and constructor of SQSharedState 2014-09-16 21:11:14 +00:00
rubidium
22fc96ad6b (svn r26839) -Fix [Squirrel]: some dead code and making switch fall throughs more explicit 2014-09-16 21:10:01 +00:00