Ethereal-dev: Re: [Ethereal-dev] Create new tvbuff

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxx>
Date: Fri, 30 Mar 2001 14:49:15 -0800 (PST)
>         TRY {		/* create the new tvbuffer with your data */
>                 tvb = tvb_new_real_data( data, len, len, "DataName");
> 		
>         }
>         CATCH(BoundsError) {
>                 g_assert_not_reached();
> 		g_free(buf);
> 		return NULL;
>         }
>         CATCH(ReportedBoundsError) {
>  		g_free(buf);
>                return NULL;
>         }

Note that the only exception "tvb_new_real_data()" throws is
ReportedBoundsError, and it only throws that if you pass in -1 as the
third argument, which you shouldn't be doing - you should be specifying
how much data there would have been if the entire packet had been
captured or, if that information isn't available, specifying how much
data there is (i.e., third argument being the same as the second
argument).