[Speex-dev] Patch : Make speex_bits_read_from and speex_bits_read_whole_bytes const correct

Erik de Castro Lopo mle+la at mega-nerd.com
Fri Nov 7 14:49:11 PST 2008


Jean-Marc,

The following patch makes the above two read functions const correct.

Cheers,
Erik


diff --git a/include/speex/speex_bits.h b/include/speex/speex_bits.h
index a26fb4c..234ec53 100644
--- a/include/speex/speex_bits.h
+++ b/include/speex/speex_bits.h
@@ -77,7 +77,7 @@ void speex_bits_reset(SpeexBits *bits);
 void speex_bits_rewind(SpeexBits *bits);
 
 /** Initializes the bit-stream from the data in an area of memory */
-void speex_bits_read_from(SpeexBits *bits, char *bytes, int len);
+void speex_bits_read_from(SpeexBits *bits, const char *bytes, int len);
 
 /** Append bytes to the bit-stream
  * 
@@ -85,7 +85,7 @@ void speex_bits_read_from(SpeexBits *bits, char *bytes, int len);
  * @param bytes pointer to the bytes what will be appended
  * @param len Number of bytes of append
  */
-void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len);
+void speex_bits_read_whole_bytes(SpeexBits *bits, const char *bytes, int len);
 
 /** Write the content of a bit-stream to an area of memory
  * 
diff --git a/libspeex/bits.c b/libspeex/bits.c
index 8e5e6b6..95adbfd 100644
--- a/libspeex/bits.c
+++ b/libspeex/bits.c
@@ -106,7 +106,7 @@ EXPORT void speex_bits_rewind(SpeexBits *bits)
    bits->overflow=0;
 }
 
-EXPORT void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
+EXPORT void speex_bits_read_from(SpeexBits *bits, const char *chars, int len)
 {
    int i;
    int nchars = len / BYTES_PER_CHAR;
@@ -153,7 +153,7 @@ static void speex_bits_flush(SpeexBits *bits)
    bits->charPtr=0;
 }
 
-EXPORT void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
+EXPORT void speex_bits_read_whole_bytes(SpeexBits *bits, const char *chars, int nbytes)
 {
    int i,pos;
    int nchars = nbytes/BYTES_PER_CHAR;


-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"Perl as a language has less a design than a thousand special
features flying in close formation."
-- From the c2 wiki


More information about the Speex-dev mailing list