ui/cocoa: Do not perform unsafe cast of argv
PATCH 1/1 ui/cocoa: Do not perform unsafe cast of argv
Signed-off-by Akihiko Odaki <[email protected]>
--- ui/cocoa.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
ui/cocoa.m +2 -2
@@ -1888,12 +1888,12 @@ static void cocoa_clipboard_request(QemuClipboardInfo *info, exit(status); } -int main (int argc, const char * argv[]) { +int main (int argc, char **argv) { QemuThread thread; COCOA_DEBUG("Entered main()\n"); gArgc = argc; - gArgv = (char **)argv; + gArgv = argv; qemu_sem_init(&display_init_sem, 0); qemu_sem_init(&app_started_sem, 0);
Signature · 1 line
2.30.1 (Apple Git-130)
Quoted 26 lines · Akihiko Odaki
Signed-off-by Akihiko Odaki <[email protected]>--- ui/cocoa.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)ui/cocoa.m +2
-3@@ -1888,12 +1888,12 @@ static void cocoa_clipboard_request(QemuClipboardInfo *info, exit(status); } -int main (int argc, const char * argv[]) { +int main (int argc, char **argv) { QemuThread thread; COCOA_DEBUG("Entered main()\n"); gArgc = argc; - gArgv = (char **)argv; + gArgv = argv; qemu_sem_init(&display_init_sem, 0); qemu_sem_init(&app_started_sem, 0); --
Quoted 1 line
2.30.1 (Apple Git-130)
Why do you consider this cast "unsafe" ? If it's unsafe, then all we've done is move the unsafety from the cast upwards to the function prototype. I think what we're really doing here is fixing the broken prototype of 'main', which should not have 'const' because that's not how the C standard defines it.
Reviewed-by Peter Maydell <[email protected]>
for the code change; you might want to adjust the commit message.
thanks
-- PMM