Commit 6fc7b5dc authored by jm's avatar jm
Browse files

fixed an "off by one". Moved definition of MAX_BYTES_PER_FRAME to the .c

file.


git-svn-id: http://svn.xiph.org/trunk/speex@5248 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 44815066
......@@ -35,6 +35,9 @@
#include "speex_bits.h"
#include "misc.h"
/** Maximum size of the bit-stream (for fixed-size allocation) */
#define MAX_BYTES_PER_FRAME 2000
void speex_bits_init(SpeexBits *bits)
{
int i;
......@@ -136,9 +139,9 @@ void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len)
{
int i,pos;
if ((bits->nbBits>>3)+len+1 > bits->buf_size)
if (((bits->nbBits+7)>>3)+len > bits->buf_size)
{
speex_warning_int("Packet if larger than allocated buffer: ", len);
/* Packet is larger than allocated buffer */
if (bits->owner)
{
char *tmp = (char*)speex_realloc(bits->bytes, (bits->nbBits>>3)+len+1);
......
......@@ -40,9 +40,6 @@
extern "C" {
#endif
/** Maximum size of the bit-stream (for fixed-size allocation) */
#define MAX_BYTES_PER_FRAME 2000
/** Bit-packing data structure representing (part of) a bit-stream. */
typedef struct SpeexBits {
char *bytes; /**< "raw" data */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment