Skip to content

Commit 97e9029

Browse files
committed
refactor(sound): streamline OpenAL device handling and enhance test stubs
- Removed conditional compilation for OpenAL device and context in snd_openal.c, simplifying the code structure. - Updated MSG_Init function in test_net_protocol_validation.c to provide a more complete stub implementation for testing purposes. - Improved clarity and maintainability of sound-related code by eliminating unnecessary preprocessor directives.
1 parent e1b45a3 commit 97e9029

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

src/client/snd_openal.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@
77

88
// Global variables for OpenAL state (available even when OpenAL is not compiled)
99
int numOpenALSounds = 0;
10-
#ifdef USE_OPENAL
11-
ALCdevice *openalDevice = NULL;
12-
ALCcontext *openalContext = NULL;
13-
#else
1410
void *openalDevice = NULL;
1511
void *openalContext = NULL;
16-
#endif
1712
qboolean openalEfxAvailable = qfalse;
1813

1914
#ifdef USE_OPENAL

src/tests/test_net_protocol_validation.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ Tests network protocol validation and bounds checking functionality
1313
#include <string.h>
1414

1515
// Stub for MSG_Init (not available in test environment)
16-
void MSG_Init(void) {}
16+
void MSG_Init(msg_t *buf, byte *data, int length) {
17+
// Stub implementation for testing
18+
if (buf) {
19+
buf->data = data;
20+
buf->maxsize = length;
21+
buf->cursize = 0;
22+
buf->readcount = 0;
23+
buf->bit = 0;
24+
}
25+
}
1726

1827
// Test data
1928
static const byte valid_packet_data[] = {

0 commit comments

Comments
 (0)