[Spice-devel] [PATCH spice] Add missing struct field initializers

Hans de Goede hdegoede at redhat.com
Wed Apr 25 04:46:20 PDT 2012


Hi,

$subject: Why? The C standard guarantees that if any
member of a struct (or array) gets initialized all non
specifically initialized members will get initalized
to a value of 0.

Regards,

Hans


On 04/25/2012 12:00 PM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange"<berrange at redhat.com>
>
> Signed-off-by: Daniel P. Berrange<berrange at redhat.com>
> ---
>   client/x11/platform.cpp |   10 +++++-----
>   1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
> index f35d537..0669b69 100644
> --- a/client/x11/platform.cpp
> +++ b/client/x11/platform.cpp
> @@ -128,12 +128,12 @@ struct clipboard_format_info {
>
>   static struct clipboard_format_info clipboard_formats[] = {
>       { VD_AGENT_CLIPBOARD_UTF8_TEXT, { "UTF8_STRING",
> -      "text/plain;charset=UTF-8", "text/plain;charset=utf-8", NULL }, },
> -    { VD_AGENT_CLIPBOARD_IMAGE_PNG, { "image/png", NULL }, },
> +      "text/plain;charset=UTF-8", "text/plain;charset=utf-8", NULL }, { 0 }, 0},
> +    { VD_AGENT_CLIPBOARD_IMAGE_PNG, { "image/png", NULL }, { 0 }, 0},
>       { VD_AGENT_CLIPBOARD_IMAGE_BMP, { "image/bmp", "image/x-bmp",
> -      "image/x-MS-bmp", "image/x-win-bitmap", NULL }, },
> -    { VD_AGENT_CLIPBOARD_IMAGE_TIFF, { "image/tiff", NULL }, },
> -    { VD_AGENT_CLIPBOARD_IMAGE_JPG, { "image/jpeg", NULL }, },
> +      "image/x-MS-bmp", "image/x-win-bitmap", NULL }, { 0 }, 0},
> +    { VD_AGENT_CLIPBOARD_IMAGE_TIFF, { "image/tiff", NULL }, { 0 }, 0},
> +    { VD_AGENT_CLIPBOARD_IMAGE_JPG, { "image/jpeg", NULL }, { 0 }, 0},
>   };
>
>   #define clipboard_format_count ((int)(sizeof(clipboard_formats)/sizeof(clipboard_formats[0])))


More information about the Spice-devel mailing list