Hi,

On Thu, Feb 26, 2009 at 09:15:04AM -0600, [email protected] wrote:
> const BYTE* target;
> tvb_memcpy(tvb, target, offset, data_length);
> 
> and i get the error:
> packet-icom.c
> packet-icom.c(246) : error C2220: warning treated as error - no 'object' file 
> ge
> nerated
> packet-icom.c(246) : warning C4090: 'function' : different 'const' qualifiers
> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 
> 9.0\VC\BIN
> \cl.EXE"' : return code '0x2'
> Stop.
> 
> can someone please clarify this?

If you have problems with memory management in C,
you can use tvb_memdup() (which automagiclly allocates buffer)

assuming prototype: FOO *yourFunc(const BYTE *ptr, unsigned int len)

you can call:
{
        guint plen;
        void *ptr;
        FOO *bar;

        plen = tvb_length(tvb);                 /* packet len */
        ptr  = tvb_memdup(tvb, 0, plen);        /* buffer */
        bar  = yourFunc((const BYTE *) ptr, plen);

        /* do what you want with bar */

        g_free(ptr);    /* free memory */
}

(and wireshark API has got also ep_tvb_memdup(), where you don't care
about freeing memory)

and that's all, hth!
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?subject=unsubscribe

Reply via email to