All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ui/cocoa: Do not perform unsafe cast of argv
@ 2021-07-08  5:46 Akihiko Odaki
  2021-07-08  9:01 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Akihiko Odaki @ 2021-07-08  5:46 UTC (permalink / raw)
  Cc: Peter Maydell, qemu-devel, Akihiko Odaki, Gerd Hoffmann

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
---
 ui/cocoa.m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index 9f72844b079..68a6302184a 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -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);
-- 
2.30.1 (Apple Git-130)



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ui/cocoa: Do not perform unsafe cast of argv
  2021-07-08  5:46 [PATCH] ui/cocoa: Do not perform unsafe cast of argv Akihiko Odaki
@ 2021-07-08  9:01 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2021-07-08  9:01 UTC (permalink / raw)
  To: Akihiko Odaki; +Cc: QEMU Developers, Gerd Hoffmann

On Thu, 8 Jul 2021 at 06:46, Akihiko Odaki <akihiko.odaki@gmail.com> wrote:
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
> ---
>  ui/cocoa.m | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 9f72844b079..68a6302184a 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -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);
> --
> 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 <peter.maydell@linaro.org>
for the code change; you might want to adjust the commit message.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-08  9:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08  5:46 [PATCH] ui/cocoa: Do not perform unsafe cast of argv Akihiko Odaki
2021-07-08  9:01 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.