Пример #1
0
void vorbis_packet_free(vorbis_packet_t *pkt){
  
  vorbis_pkt_cache_t *pkt_cache = (vorbis_pkt_cache_t*) pkt;

  //Free filter
  free(pkt_cache->filter);

  //Free cache
  for(uint32_t i=0;i<pkt_cache->base.nb_chan;i++)
    free(pkt_cache->cache[i]);
  free(pkt_cache->cache);

  //Free envelope
  envelope_free(pkt_cache->envelope);
  
  //Free dec_residues
  for(uint32_t i=0;i<pkt_cache->base.nb_chan;i++)
    free(pkt_cache->base.dec_residues[i]);
  free(pkt_cache->base.dec_residues);

  //do not decode
  free(pkt_cache->base.do_not_decode);

  //no residue
  free(pkt_cache->base.no_residue);

  //pcm
  for(uint32_t i=0;i<pkt_cache->base.nb_chan;i++)
    free(pkt_cache->base.pcm[i]);
  free(pkt_cache->base.pcm);

  //free residues
  free(pkt_cache->base.residues);

  //free spectral
  for(uint32_t i=0;i<pkt_cache->base.nb_chan;i++)
    free(pkt_cache->base.spectral[i]);
  free(pkt_cache->base.spectral);

  //free spectral
  for(uint32_t i=0;i<pkt_cache->base.nb_chan;i++)
    free(pkt_cache->base.temporal[i]);
  free(pkt_cache->base.temporal);
  
  free(pkt_cache);
}
Пример #2
0
void
bodystruct_free (bodystruct_t *node)
{
	struct _bodystruct *next;

	while (node != NULL) {
		g_free (node->content.type);
		g_free (node->content.subtype);
		g_free (node->content.lang);
		g_free (node->content.loc);
		g_free (node->content.cid);
		g_free (node->content.md5);

		if (node->content.params)
			mimeparam_destroy (node->content.params);
		
		g_free (node->disposition.type);
		if (node->disposition.params)
			mimeparam_destroy (node->disposition.params);
		
		g_free (node->encoding);
		g_free (node->description);

		if (node->envelope)
			envelope_free (node->envelope);

		if (node->subparts)
			bodystruct_free (node->subparts);

		g_free (node->part_spec);

		/* leave node->parent, recursiveness will take care of it */

		next = node->next;
		g_slice_free (struct _bodystruct, node);
		node = next;
	}
}
Пример #3
0
static struct _envelope *
decode_envelope (unsigned char **in, unsigned char *inend, GError **err)
{
	struct _envelope *node;
	unsigned char *inptr;
	
	inptr = *in;

	while (inptr < inend && *inptr == ' ')
		inptr++;

	if (inptr == inend || *inptr != '(') {
		*in = inptr;
		set_error (err, in);
		return NULL;
	}

	inptr++;

	node = envelope_new ();

	node->date = decode_qstring (&inptr, inend, err);
	debug_printf ("env date: %s\n", PRINT_NULL (node->date));
	node->subject = decode_qstring (&inptr, inend, err);
	debug_printf ("env subject: %s\n", PRINT_NULL (node->subject));

	node->from = decode_estring (&inptr, inend, err);
	debug_printf ("env from: %s\n", PRINT_NULL (node->from));

	node->sender = decode_estring (&inptr, inend, err);
	debug_printf ("env sender: %s\n", PRINT_NULL (node->sender));

	node->reply_to = decode_estring (&inptr, inend, err);
	debug_printf ("env reply_to: %s\n", PRINT_NULL (node->reply_to));

	node->to = decode_estring (&inptr, inend, err);
	debug_printf ("env to: %s\n", PRINT_NULL (node->to));

	node->cc = decode_estring (&inptr, inend, err);
	debug_printf ("env cc: %s\n", PRINT_NULL (node->cc));

	node->bcc = decode_estring (&inptr, inend, err);
	debug_printf ("env bcc: %s\n", PRINT_NULL (node->bcc));

	node->in_reply_to = decode_estring (&inptr, inend, err);
	debug_printf ("env in_reply_to: %s\n", PRINT_NULL (node->in_reply_to));

	node->message_id = decode_qstring (&inptr, inend, err);
	debug_printf ("env message_id: %s\n", PRINT_NULL (node->message_id));

	while (inptr < inend && *inptr == ' ')
		inptr++;


	if (*inptr != ')') {
		envelope_free (node);
		*in = inptr;
		set_error (err, in);
		return NULL;
	}


	inptr++;

	*in = inptr;

	return node;
}