Bug 279534 - Fix -Wcast-function-type-mismatch in CoreAudioSharedUnit.mm
Summary: Fix -Wcast-function-type-mismatch in CoreAudioSharedUnit.mm
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-09-11 12:20 PDT by David Kilzer (:ddkilzer)
Modified: 2024-09-12 18:49 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2024-09-11 12:20:24 PDT
Fix -Wcast-function-type-mismatch in CoreAudioSharedUnit.mm.

The static speechActivityListenerCallback() function has a `void` return type, but `AudioObjectPropertyListenerProc` has an `int` return type.

Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.mm:68:92: error: cast from 'void (*)(AudioObjectID, UInt32, const AudioObjectPropertyAddress *, void *)' (aka 'void (*)(unsigned int, unsigned int, const AudioObjectPropertyAddress *, void *)') to 'AudioObjectPropertyListenerProc' (aka 'int (*)(unsigned int, unsigned int, const AudioObjectPropertyAddress * _Nonnull, void * _Nullable)') converts to incompatible function type [-Werror,-Wcast-function-type-mismatch]
   68 |         error = AudioObjectRemovePropertyListener(deviceID, &kVoiceActivityDetectionState, (AudioObjectPropertyListenerProc)speechActivityListenerCallback, NULL);
      |                                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.mm:73:85: error: cast from 'void (*)(AudioObjectID, UInt32, const AudioObjectPropertyAddress *, void *)' (aka 'void (*)(unsigned int, unsigned int, const AudioObjectPropertyAddress *, void *)') to 'AudioObjectPropertyListenerProc' (aka 'int (*)(unsigned int, unsigned int, const AudioObjectPropertyAddress * _Nonnull, void * _Nullable)') converts to incompatible function type [-Werror,-Wcast-function-type-mismatch]
   73 |     error = AudioObjectAddPropertyListener(deviceID, &kVoiceActivityDetectionState, (AudioObjectPropertyListenerProc)speechActivityListenerCallback, NULL);
      |                                                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
Comment 1 Radar WebKit Bug Importer 2024-09-11 12:20:44 PDT
<rdar://problem/135818490>
Comment 2 David Kilzer (:ddkilzer) 2024-09-11 12:26:41 PDT
Pull request: https://github.com/WebKit/WebKit/pull/33483
Comment 3 David Kilzer (:ddkilzer) 2024-09-12 18:49:59 PDT
Committed 283590@main (28185c7): https://commits.webkit.org/283590@main

Reviewed commits have been landed. Closing PR #33483 and removing active labels.