[xiph-cvs] cvs commit: speex/libspeex bits.c speex_bits.h

Jean-Marc Valin jm at xiph.org
Mon Aug 25 22:42:43 PDT 2003



jm          03/08/26 01:42:43

  Modified:    libspeex bits.c speex_bits.h
  Log:
  fixed an "off by one". Moved definition of MAX_BYTES_PER_FRAME to the .c
  file.

Revision  Changes    Path
1.31      +5 -2      speex/libspeex/bits.c

Index: bits.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/bits.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- bits.c	23 Aug 2003 03:10:40 -0000	1.30
+++ bits.c	26 Aug 2003 05:42:43 -0000	1.31
@@ -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 @@
 {
    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);

<p><p>1.22      +0 -3      speex/libspeex/speex_bits.h

Index: speex_bits.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/speex_bits.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- speex_bits.h	30 May 2003 19:44:54 -0000	1.21
+++ speex_bits.h	26 Aug 2003 05:42:43 -0000	1.22
@@ -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 */

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list