if ((bits->nbBits>>3)+len+1 > bits->buf_size) { speex_warning_int("Packet if larger than allocated buffer: ", len); if (bits->owner) { char *tmp = speex_realloc(bits->bytes, (bits->nbBits>>3)+len+1); if (tmp) { bits->buf_size=(bits->nbBits>>3)+len+1; bits->bytes=tmp; } else { len=bits->buf_size-(bits->nbBits>>3)-1; speex_warning("Could not resize input buffer: truncating input"); } } else { speex_warning("Do not own input buffer: truncating input"); len=bits->buf_size; } }
void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len){   int i,pos;   /*FIXME: check for overflow*/   speex_bits_flush(bits);   pos=bits->nbBits>>3;   for (i=0;i<len;i++)      bits->bytes[pos+i]=bytes[i];   bits->nbBits+=len<<3;}