samba-technical@lists.samba.org
[Top] [All Lists]

Re: Fix traffic analyzer developer build

Subject: Re: Fix traffic analyzer developer build
From: Jeremy Allison
Date: Thu, 18 Mar 2010 15:30:42 -0700
On Thu, Mar 18, 2010 at 11:15:02PM +0100, Holger Hetterich wrote:

>  static char *smb_traffic_analyzer_create_header( TALLOC_CTX *ctx,
> -     const char *state_flags, size_t data_len)
> +     const char *state_flags, int data_len)
>  {
> -     char *header = talloc_asprintf( ctx, "V2.%s%017u",
> +     char *header = talloc_asprintf( ctx, "V2.%s%017d",
>                                       state_flags, data_len);

In cases like this, rather than change data_len from an
unsigned size_t to a signed int, for a value that can
never be negative, just to fix a talloc_asprintf format,
just add a cast to the asprintf. i.e. the change should
be:

> -                                     state_flags, data_len);
> +                                     state_flags, (unsigned int)data_len);

instead of changing the aprintf format from "%u" -> "%d".

Jeremy.

<Prev in Thread] Current Thread [Next in Thread>