5522: Fix unsafe defines r=heinrich5991 a=Chairn

These are unsafe define that should be parenthesized due to operator precedency that can change operation order in expression such as:
```c++
#define ABCD 1 + 2
int foo = 36/ABCD; // foo is actually 38 and not 12
```

I didn't change engine/client/graphics_threaded/h as it is included in https://github.com/ddnet/ddnet/pull/5520

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Chairn <chairn.nq@hotmail.fr>
This commit is contained in:
bors[bot] 2022-06-27 17:19:28 +00:00 committed by GitHub
commit 2603b38528
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -385,8 +385,8 @@ int io_sync(IOHANDLE io)
#endif #endif
} }
#define ASYNC_BUFSIZE 8 * 1024 #define ASYNC_BUFSIZE (8 * 1024)
#define ASYNC_LOCAL_BUFSIZE 64 * 1024 #define ASYNC_LOCAL_BUFSIZE (64 * 1024)
// TODO: Use Thread Safety Analysis when this file is converted to C++ // TODO: Use Thread Safety Analysis when this file is converted to C++
struct ASYNCIO struct ASYNCIO

View file

@ -20,7 +20,7 @@
// support older SDL version (pre 2.0.6) // support older SDL version (pre 2.0.6)
#ifndef SDL_JOYSTICK_AXIS_MIN #ifndef SDL_JOYSTICK_AXIS_MIN
#define SDL_JOYSTICK_AXIS_MIN -32768 #define SDL_JOYSTICK_AXIS_MIN (-32768)
#endif #endif
#ifndef SDL_JOYSTICK_AXIS_MAX #ifndef SDL_JOYSTICK_AXIS_MAX
#define SDL_JOYSTICK_AXIS_MAX 32767 #define SDL_JOYSTICK_AXIS_MAX 32767

View file

@ -84,7 +84,7 @@ struct CFontSizeData
#define MIN_FONT_SIZE 6 #define MIN_FONT_SIZE 6
#define MAX_FONT_SIZE 128 #define MAX_FONT_SIZE 128
#define NUM_FONT_SIZES MAX_FONT_SIZE - MIN_FONT_SIZE + 1 #define NUM_FONT_SIZES (MAX_FONT_SIZE - MIN_FONT_SIZE + 1)
class CFont class CFont
{ {