Commit graph

90 commits

Author SHA1 Message Date
Daniel Gibson
b756276b54 ID_MAYBE_INLINE for not-forced inlining
On Windows, ID_INLINE does __forceinline, which is bad if the function
calls alloca() and is called in a loop..
So use just __inline there so the compiler can choose not to inline
(if called in a loop).
This didn't cause actual stack overflows as far as I know, but it could
(and MSVC warns about it).
2020-01-11 16:15:34 +01:00
Daniel Gibson
dd7a6b2832 idLangDict: Workaround for Doom3: Lost Mission stringtables #265
The Doom3: Lost Mission (aka D3LE) mod uses string table entry keys that
don't follow the proper Doom3 scheme of "#str_01234", but look like
"#str_adil_exis_pda_01_audio_info" - the "hash" algorithm of idLangDict,
which basically just converts the number after "#str_" into an int,
probably doesn't work very well with this and there was an assertion
to prevent this..
However, it seems to work well enough, so now I only print one warning
for the first "invalid" key and otherwise accept those keys.

The stringtable (strings/*.lang) also has font-related entries
(like "#font" "Chainlink_Semi-Bold") that triggered another assertion,
now everything that starts with "#font" is silently skipped.
2020-01-05 02:34:53 +01:00
yamir
12fa28b260 Fix ppc64le build 2019-09-11 13:02:55 -01:00
Daniel Gibson
596d40d5c9 MSVC: Shut up Compiler warning in Matrix.h if asserts are disabled 2019-01-13 22:12:36 +01:00
Daniel Gibson
3ab553bcf9 Fix pot. Crash in idWinding2D::ExpandForAxialBox()
it could happen that i is 1 but numPlanes is still 0
(=> if for i = 0:  ( p[j] - p[i] ).LengthSqr() < 0.01f )
so planes[-1] would be accessed which of course is invalid and can crash
2018-12-09 04:16:43 +01:00
Kalamatee
46279bf11f import AROS changes 2017-04-02 00:42:28 +01:00
Turo Lamminen
5da6374663 Fix idStr self-assignment
Was calling memcpy with overlapping parameters which is inefficient,
undefined behavior and Valgrind complained about it.
2017-03-14 21:45:40 +01:00
Turo Lamminen
f26f70c717 Fix stack overflow in SSE code
This was checking the wrong variable so when count was < 4 it was writing
past the end of buffer and potentially breaking the stack.
2017-03-14 21:11:13 +01:00
Daniel Gibson
befe732dbb Fix new[]/delete missmatches and memory leaks found by clang's ASAN
Sometimes memory was allocated with new[] but freed with delete instead
of delete[], which is wrong.
And there were some small memory leaks, too.
Furtunately clang's AddressSanitizer detected all that so I could easily
fix it.

(There seem to be some more small memory leaks which are harder to fix,
though)
2015-12-17 18:11:03 +01:00
Daniel Gibson
48511003b6 Unix: On failed assertion, break gracefully into debugger
__builtin_trap() causes an illegal instruction and thus the process
can't resume afterwards.
raise(SIGTRAP) only breaks into the debugger and thus allows to
"ignore" the assertion while debugging.
2015-12-13 03:30:03 +01:00
leffmann
db461045bf make idlib build with Visual Studio 14 2015-10-11 00:36:25 +02:00
Daniel Gibson
1de6ab0d50 Fix some compiler warnings (wrong types, superfluous checks, printf-fuckup) 2015-09-27 18:12:16 +02:00
Tobias Frost
73fa334c2a Fixing some spelling errors: s/unkown/unknown, s/seperate/separate. (#107) 2015-02-25 22:01:00 +01:00
Daniel Gibson
f8de73862e math.h should #include sys/platform.h
Similar to f317b05
2012-11-13 23:58:50 +01:00
Daniel Gibson
f317b056c6 List.h needs sys/platform.h for ID_INLINE
Everytime List.h is included in a new file (and sys/platform.h isn't)
there are confusing compiler-errors..
So just #include sys/platform.h in List.h directly, because it uses
ID_INLINE which is defined there
2012-11-13 23:28:21 +01:00
Daniel Gibson
a7bfd05797 Use current type for BT_CLOSED enum
doesn't really make a difference code-wise, but removes one compiler warning.
2012-11-13 23:27:07 +01:00
Daniel Gibson
3202f0aa0f Get rid of some compiler warnings
GCC had shitloads of superfluous warnings wherever List.h and Str.h were
included.. get rid of them by using #pragma GCC diagnostic at some places
in List.h and Str.h.
Also add some casts, initialize some variables for other warnings
2012-11-13 23:24:13 +01:00
dhewg
4675ecb6d3 Get rid of precompiled.[h|.cpp]
Both unused, except for the mfc editors, which don't compile anyway.
2012-07-20 00:12:58 +02:00
dhewg
d22865b8a1 Use _exit() in AssertFailed()
Ensure application exit.
2012-07-06 01:06:59 +02:00
dhewg
5fee87be2a Replace "__asm int 0x03" with __debugbreak()
Fixes compilation with msvc 64bit.
2012-07-06 01:06:58 +02:00
dhewg
30c66d5ef8 Only compile msvc style asm with 32bit msvc
The 64bit compiler doesn't support __asm.
2012-07-06 01:06:57 +02:00
dhewg
f000947d4e Fixes issues with MacOSX.
- Fixes compiler errors with mismatching types in DoomController.mm
- Adds PPC_INTRINSICS fix to Simd_Altivec.h
2012-06-28 14:08:39 +02:00
dhewg
902a9cee8a s/ReadDeltaLong/ReadDeltaInt/
to match the argument type
2012-06-28 13:52:25 +02:00
dhewg
f767af9d72 s/WriteDeltaLong/WriteDeltaInt/
to match the return type
2012-06-28 13:52:25 +02:00
dhewg
822b0b84af s/ReadDeltaLongCounter/ReadDeltaIntCounter/
to match the return type
2012-06-28 13:52:24 +02:00
dhewg
c51f59cb15 s/WriteDeltaLongCounter/WriteDeltaIntCounter/
to match the argument type.
2012-06-28 13:52:24 +02:00
dhewg
9034da11d0 s/ReadLong/ReadInt/ to match the return type 2012-06-28 13:52:24 +02:00
dhewg
94df46637a s/WriteLong/WriteInt/ to match the argument type 2012-06-28 13:52:23 +02:00
dhewg
5f5a6e7043 s/BigLong/BigInt/ to match the return type 2012-06-28 13:52:22 +02:00
dhewg
49c4d028a5 s/LittleLong/LittleInt/ to match the return type 2012-06-28 13:02:47 +02:00
Daniel Gibson
0d27bfe7b9 Remove usage of long type from idlib/
Apart from some minor stuff, this changes the signature of some methods
of Parser and Token classes and of the (unused) Random2 class.
That no problem though, because the calling code uses normal ints
anyway.
2012-06-28 13:02:45 +02:00
Daniel Gibson
1e087d9bf6 Fix idMatX::IsOrthonormal()
The original implementation was pretty broken (but not used anyway),
it is now fixed and improved a bit (got rid of one inner loop).
This (at least part of the problem) was detected by PVS-Studio,
see http://www.viva64.com/en/b/0120/ Fragment 3
2012-05-13 03:04:34 +02:00
dhewg
6d6c5c8ce7 Fix "unreachable code" warnings 2012-01-15 14:13:44 +01:00
dhewg
b83868090c Use SDL GLimp and input implementations on Windows
The DirectX SDK is not required anymore.
2012-01-02 15:44:40 -05:00
spiral
13bab7a7e5 Remove MWERKS stuff 2011-12-23 13:04:21 +01:00
dhewg
826dfb0e5b Fix alignment issue with idBlockAlloc::Free()
Bug introduced with e97d3288. This doesn't work with MinGW, since
the struct members might not be aligned to the native pointer
size (in this case idSampleDecoderLocal was aligned to a 8 byte
boundary on win32).
Just switch the two members to avoid ugly code.
2011-12-22 18:51:17 +01:00
dhewg
2c1186dc1b Fix -Woverloaded-virtual warnings
We want to use the SIMD functions of the base class if the
deriving class does not implement every overloaded variant.

Added missing idLight::SetColor(idVec3) which is declared in
idEntity.
2011-12-22 12:33:27 +01:00
dhewg
d37fe69f85 Change another _WIN32 to _MSC_VER for MinGW
Older MinGW versions do not know about __assume().
Change _WIN32 in comments too to match their opening #if.

Reported by serpentine.
2011-12-22 12:32:39 +01:00
dhewg
cdf6fa3702 New define IDSTR_NO_REDIRECT
The defines in idlib/Str.h won't be set to redirect the low
level c string functions to idStr when IDSTR_NO_REDIRECT is
set.

Fixes compilation for MSVC:
error C2761: 'Cmp' : member function redeclaration not allowed

Reported by spiral.
2011-12-22 11:21:55 +01:00
spiral
7e5795dd56 Add missing includes for MSVC
- MSVC doesn't provide C99 headers
- Default to min. req. 64Mb video mem if no COM present
- Move misplaced __attribute__((packed)) from MSVC to MinGW
2011-12-22 11:07:01 +01:00
dhewg
4150029322 Unify CPUID_FTZ and CPUID_DAZ
Get rid of the 2 CPUID flags and combine them with SSE in one
implementation.
SSE flags can now be set on all x86 and x86_64 platforms -
independent of -ffast-math.
Helper defines borrowed from STREFLOP.
2011-12-22 10:38:40 +01:00
dhewg
280c95b52c Use idSys::GetMilliseconds() for idTimer
The class is only used for debugging and statistical purposes.
The precision is now reduced to milliseconds, but that's only
relevant for fine grained debug timings - where the old code
was inaccurate at anyway.
2011-12-22 10:38:39 +01:00
dhewg
0f3c2ebf52 Use SDL for everything endian 2011-12-21 17:40:38 +01:00
dhewg
736ec20d4d Untangle the epic precompiled.h mess
Don't include the lazy precompiled.h everywhere, only what's
required for the compilation unit.
platform.h needs to be included instead to provide all essential
defines and types.
All includes use the relative path to the neo or the game
specific root.
Move all idlib related includes from idlib/Lib.h to precompiled.h.
precompiled.h still exists for the MFC stuff in tools/.
Add some missing header guards.
2011-12-19 23:21:47 +01:00
dhewg
966a380793 Move BuildDefines.h include to platform.h 2011-12-19 20:33:09 +01:00
dhewg
90a53d0977 Move idlib typedefs to platform.h 2011-12-19 20:33:03 +01:00
dhewg
cf57db42e9 Move common includes from precompiled.h to platform.h 2011-12-19 20:31:32 +01:00
dhewg
96ef0754e2 Split platform specific code from precompiled.h
New header sys/platform.h.
2011-12-19 20:31:28 +01:00
dhewg
dbf3b43140 Move the virtual abstract idGame to framework/Game.h
This is game independent and code outside of game/ and d3xp/
doesn't need to know about anything game specific.
2011-12-19 20:19:14 +01:00
dhewg
e5ec63ce06 Move the game include directory to the build system
Don't include based on a preprocessor symbol, let the build
system make the correct decision.
2011-12-19 20:05:20 +01:00