Commit d69251d
committed
cocoa: fix UTF8String misuse + move AVFoundation link to HAVE_MICROPHONE
Two issues on the PPC/Leopard make build:
cocoa_common.m:1062: warning: passing argument 1 of
'config_file_new_from_string' discards qualifiers from
pointer target type
ld: framework not found AVFoundation
ISSUE 1: config_file_new_from_string() takes (char*) and the header
explicitly documents that it mutates its input in place. -[NSString
UTF8String] returns an Apple-owned buffer that is not writable.
Passing it through directly is undefined behavior, not merely a
qualifier warning - modern Obj-C with tagged-pointer string
optimizations may crash or corrupt other strings.
Follow the pattern already used at tasks/task_autodetect.c:374:
strdup() the UTF-8 copy, pass the duplicate, free() it after. This
fix matters on every platform, not just PPC.
ISSUE 2: AVFoundation is 10.7+ and doesn't exist on the 10.5 SDK.
Makefile.common linked it unconditionally whenever HAVE_COREAUDIO
was set, even though the base coreaudio.c path doesn't use it;
only coreaudio_mic_macos.m does. HAVE_MICROPHONE was already auto-
disabled on pre-10.7 by c11279c, so the AVFoundation link is
unnecessary on those targets and breaks the build.
Move '-framework AVFoundation' into the ifeq ($(HAVE_MICROPHONE), 1)
block. Modern builds with microphone support still link it;
pre-10.7 builds (microphone auto-disabled) skip it. Accelerate and
AudioToolbox stay in the outer block - both are 10.3+ and always
needed when coreaudio is built.1 parent f4d1390 commit d69251d
2 files changed
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
814 | 814 | | |
815 | 815 | | |
816 | 816 | | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
817 | 822 | | |
818 | 823 | | |
819 | | - | |
| 824 | + | |
820 | 825 | | |
821 | 826 | | |
822 | 827 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1059 | 1059 | | |
1060 | 1060 | | |
1061 | 1061 | | |
1062 | | - | |
1063 | | - | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
1064 | 1073 | | |
1065 | 1074 | | |
1066 | 1075 | | |
| |||
0 commit comments