1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Core: Drop custom copymem/zeromem defines

We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.

Backport of #48239.
This commit is contained in:
Rémi Verschelde
2021-04-29 12:34:11 +02:00
parent 1db31d0afa
commit 70ae90e0e8
66 changed files with 173 additions and 242 deletions

View File

@@ -70,7 +70,7 @@ OSStatus AudioDriverCoreAudio::output_device_address_cb(AudioObjectID inObjectID
Error AudioDriverCoreAudio::init() {
AudioComponentDescription desc;
zeromem(&desc, sizeof(desc));
memset(&desc, 0, sizeof(desc));
desc.componentType = kAudioUnitType_Output;
#ifdef OSX_ENABLED
desc.componentSubType = kAudioUnitSubType_HALOutput;
@@ -97,7 +97,7 @@ Error AudioDriverCoreAudio::init() {
AudioStreamBasicDescription strdesc;
zeromem(&strdesc, sizeof(strdesc));
memset(&strdesc, 0, sizeof(strdesc));
UInt32 size = sizeof(strdesc);
result = AudioUnitGetProperty(audio_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kOutputBus, &strdesc, &size);
ERR_FAIL_COND_V(result != noErr, FAILED);
@@ -118,7 +118,7 @@ Error AudioDriverCoreAudio::init() {
mix_rate = GLOBAL_GET("audio/mix_rate");
zeromem(&strdesc, sizeof(strdesc));
memset(&strdesc, 0, sizeof(strdesc));
strdesc.mFormatID = kAudioFormatLinearPCM;
strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
strdesc.mChannelsPerFrame = channels;
@@ -148,7 +148,7 @@ Error AudioDriverCoreAudio::init() {
print_verbose("CoreAudio: audio buffer frames: " + itos(buffer_frames) + " calculated latency: " + itos(buffer_frames * 1000 / mix_rate) + "ms");
AURenderCallbackStruct callback;
zeromem(&callback, sizeof(AURenderCallbackStruct));
memset(&callback, 0, sizeof(AURenderCallbackStruct));
callback.inputProc = &AudioDriverCoreAudio::output_callback;
callback.inputProcRefCon = this;
result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
@@ -174,7 +174,7 @@ OSStatus AudioDriverCoreAudio::output_callback(void *inRefCon,
if (!ad->active || !ad->try_lock()) {
for (unsigned int i = 0; i < ioData->mNumberBuffers; i++) {
AudioBuffer *abuf = &ioData->mBuffers[i];
zeromem(abuf->mData, abuf->mDataByteSize);
memset(abuf->mData, 0, abuf->mDataByteSize);
};
return 0;
};
@@ -298,7 +298,7 @@ void AudioDriverCoreAudio::finish() {
lock();
AURenderCallbackStruct callback;
zeromem(&callback, sizeof(AURenderCallbackStruct));
memset(&callback, 0, sizeof(AURenderCallbackStruct));
result = AudioUnitSetProperty(audio_unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, kOutputBus, &callback, sizeof(callback));
if (result != noErr) {
ERR_PRINT("AudioUnitSetProperty failed");
@@ -342,7 +342,7 @@ void AudioDriverCoreAudio::finish() {
Error AudioDriverCoreAudio::capture_init() {
AudioComponentDescription desc;
zeromem(&desc, sizeof(desc));
memset(&desc, 0, sizeof(desc));
desc.componentType = kAudioUnitType_Output;
#ifdef OSX_ENABLED
desc.componentSubType = kAudioUnitSubType_HALOutput;
@@ -388,7 +388,7 @@ Error AudioDriverCoreAudio::capture_init() {
#endif
AudioStreamBasicDescription strdesc;
zeromem(&strdesc, sizeof(strdesc));
memset(&strdesc, 0, sizeof(strdesc));
size = sizeof(strdesc);
result = AudioUnitGetProperty(input_unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kInputBus, &strdesc, &size);
ERR_FAIL_COND_V(result != noErr, FAILED);
@@ -410,7 +410,7 @@ Error AudioDriverCoreAudio::capture_init() {
mix_rate = GLOBAL_GET("audio/mix_rate");
zeromem(&strdesc, sizeof(strdesc));
memset(&strdesc, 0, sizeof(strdesc));
strdesc.mFormatID = kAudioFormatLinearPCM;
strdesc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
strdesc.mChannelsPerFrame = capture_channels;
@@ -424,7 +424,7 @@ Error AudioDriverCoreAudio::capture_init() {
ERR_FAIL_COND_V(result != noErr, FAILED);
AURenderCallbackStruct callback;
zeromem(&callback, sizeof(AURenderCallbackStruct));
memset(&callback, 0, sizeof(AURenderCallbackStruct));
callback.inputProc = &AudioDriverCoreAudio::input_callback;
callback.inputProcRefCon = this;
result = AudioUnitSetProperty(input_unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, kInputBus, &callback, sizeof(callback));
@@ -441,7 +441,7 @@ void AudioDriverCoreAudio::capture_finish() {
lock();
AURenderCallbackStruct callback;
zeromem(&callback, sizeof(AURenderCallbackStruct));
memset(&callback, 0, sizeof(AURenderCallbackStruct));
OSStatus result = AudioUnitSetProperty(input_unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &callback, sizeof(callback));
if (result != noErr) {
ERR_PRINT("AudioUnitSetProperty failed");