@@ -1719,9 +1719,9 @@ static void UnpackSFMPEG2(BitStreamInfo *bsi, SideInfoSub *sis, ScaleFactorInfoS
17191719 * Return: length (in bytes) of scale factor data, -1 if null input
17201720 *pointers
17211721 **************************************************************************************/
1722- int UnpackScaleFactors (MP3DecInfo *mp3DecInfo, unsigned char *buf, int *bitOffset, int bitsAvail, int gr, int ch) {
1722+ int UnpackScaleFactors (MP3DecInfo *mp3DecInfo, const unsigned char *buf, int *bitOffset, int bitsAvail, int gr, int ch) {
17231723 int bitsUsed;
1724- unsigned char *startBuf;
1724+ const unsigned char *startBuf;
17251725 BitStreamInfo bitStreamInfo, *bsi;
17261726 FrameHeader *fh;
17271727 SideInfo *si;
@@ -7119,7 +7119,7 @@ const int quadTabMaxBits[2] = {6, 4};
71197119 *not necessarily all linBits outputs for x,y > 15)
71207120 **************************************************************************************/
71217121// no improvement with section=data
7122- static int DecodeHuffmanPairs (int *xy, int nVals, int tabIdx, int bitsLeft, unsigned char *buf, int bitOffset) {
7122+ static int DecodeHuffmanPairs (int *xy, int nVals, int tabIdx, int bitsLeft, const unsigned char *buf, int bitOffset) {
71237123 int i, x, y;
71247124 int cachedBits, padBits, len, startBits, linBits, maxBits, minBits;
71257125 HuffTabType tabType;
@@ -7351,7 +7351,7 @@ static int DecodeHuffmanPairs(int *xy, int nVals, int tabIdx, int bitsLeft, unsi
73517351 * Notes: si_huff.bit tests every vwxy output in both quad tables
73527352 **************************************************************************************/
73537353// no improvement with section=data
7354- static int DecodeHuffmanQuads (int *vwxy, int nVals, int tabIdx, int bitsLeft, unsigned char *buf, int bitOffset) {
7354+ static int DecodeHuffmanQuads (int *vwxy, int nVals, int tabIdx, int bitsLeft, const unsigned char *buf, int bitOffset) {
73557355 int i, v, w, x, y;
73567356 int len, maxBits, cachedBits, padBits;
73577357 unsigned int cache;
@@ -7467,10 +7467,10 @@ static int DecodeHuffmanQuads(int *vwxy, int nVals, int tabIdx, int bitsLeft, un
74677467 * out of bits prematurely (invalid bitstream)
74687468 **************************************************************************************/
74697469// .data about 1ms faster per frame
7470- int DecodeHuffman (MP3DecInfo *mp3DecInfo, unsigned char *buf, int *bitOffset, int huffBlockBits, int gr, int ch) {
7470+ int DecodeHuffman (MP3DecInfo *mp3DecInfo, const unsigned char *buf, int *bitOffset, int huffBlockBits, int gr, int ch) {
74717471 int r1Start, r2Start, rEnd[4 ]; /* region boundaries */
74727472 int i, w, bitsUsed, bitsLeft;
7473- unsigned char *startBuf = buf;
7473+ const unsigned char *startBuf = buf;
74747474
74757475 FrameHeader *fh;
74767476 SideInfo *si;
@@ -8145,7 +8145,7 @@ void FreeBuffers(MP3DecInfo *mp3DecInfo) {
81458145 *
81468146 * Return: none
81478147 **************************************************************************************/
8148- void SetBitstreamPointer (BitStreamInfo *bsi, int nBytes, unsigned char *buf) {
8148+ void SetBitstreamPointer (BitStreamInfo *bsi, int nBytes, const unsigned char *buf) {
81498149 /* init bitstream */
81508150 bsi->bytePtr = buf;
81518151 bsi->iCache = 0 ; /* 4-byte unsigned int */
@@ -8249,7 +8249,7 @@ unsigned int GetBits(BitStreamInfo *bsi, int nBits) {
82498249 * Return: number of bits read from bitstream, as offset from
82508250 *startBuf:startOffset
82518251 **************************************************************************************/
8252- int CalcBitsUsed (BitStreamInfo *bsi, unsigned char *startBuf, int startOffset) {
8252+ int CalcBitsUsed (BitStreamInfo *bsi, const unsigned char *startBuf, int startOffset) {
82538253 int bitsUsed;
82548254
82558255 bitsUsed = (bsi->bytePtr - startBuf) * 8 ;
@@ -8301,7 +8301,7 @@ int CheckPadBit(MP3DecInfo *mp3DecInfo) {
83018301 * TODO: check for valid modes, depending on capabilities of decoder
83028302 * test CRC on actual stream (verify no endian problems)
83038303 **************************************************************************************/
8304- int UnpackFrameHeader (MP3DecInfo *mp3DecInfo, unsigned char *buf) {
8304+ int UnpackFrameHeader (MP3DecInfo *mp3DecInfo, const unsigned char *buf) {
83058305 int verIdx;
83068306 FrameHeader *fh;
83078307
@@ -8386,7 +8386,7 @@ int UnpackFrameHeader(MP3DecInfo *mp3DecInfo, unsigned char *buf) {
83868386 * Return: length (in bytes) of side info data
83878387 * -1 if null input pointers
83888388 **************************************************************************************/
8389- int UnpackSideInfo (MP3DecInfo *mp3DecInfo, unsigned char *buf) {
8389+ int UnpackSideInfo (MP3DecInfo *mp3DecInfo, const unsigned char *buf) {
83908390 int gr, ch, bd, nBytes;
83918391 BitStreamInfo bitStreamInfo, *bsi;
83928392 FrameHeader *fh;
@@ -8530,7 +8530,7 @@ void MP3FreeDecoder(HMP3Decoder hMP3Decoder) {
85308530 * Return: offset to first sync word (bytes from start of buf)
85318531 * -1 if sync not found after searching nBytes
85328532 **************************************************************************************/
8533- int MP3FindSyncWord (unsigned char *buf, int nBytes) {
8533+ int MP3FindSyncWord (const unsigned char *buf, int nBytes) {
85348534 int i;
85358535
85368536 /* find byte-aligned syncword - need 12 (MPEG 1,2) or 11 (MPEG 2.5) matching
@@ -8567,9 +8567,9 @@ int MP3FindSyncWord(unsigned char *buf, int nBytes) {
85678567 *function once (first frame) then store the result (nSlots) and just use it
85688568 *from then on
85698569 **************************************************************************************/
8570- static int MP3FindFreeSync (unsigned char *buf, unsigned char firstFH[4 ], int nBytes) {
8570+ static int MP3FindFreeSync (const unsigned char *buf, const unsigned char firstFH[4 ], int nBytes) {
85718571 int offset = 0 ;
8572- unsigned char *bufPtr = buf;
8572+ const unsigned char *bufPtr = buf;
85738573
85748574 /* loop until we either:
85758575 * - run out of nBytes (FindMP3SyncWord() returns -1)
@@ -8648,7 +8648,7 @@ void MP3GetLastFrameInfo(HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo) {
86488648 * Return: error code, defined in mp3dec.h (0 means no error, < 0 means
86498649 *error)
86508650 **************************************************************************************/
8651- int MP3GetNextFrameInfo (HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo, unsigned char *buf) {
8651+ int MP3GetNextFrameInfo (HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo, const unsigned char *buf) {
86528652 MP3DecInfo *mp3DecInfo = (MP3DecInfo *) hMP3Decoder;
86538653
86548654 if (!mp3DecInfo)
@@ -8707,10 +8707,10 @@ static void MP3ClearBadFrame(MP3DecInfo *mp3DecInfo, short *outbuf) {
87078707 * is not supported (bit reservoir is not maintained if useSize
87088708 *on)
87098709 **************************************************************************************/
8710- int MP3Decode (HMP3Decoder hMP3Decoder, unsigned char **inbuf, int *bytesLeft, short *outbuf, int useSize) {
8710+ int MP3Decode (HMP3Decoder hMP3Decoder, const unsigned char **inbuf, int *bytesLeft, short *outbuf, int useSize) {
87118711 int offset, bitOffset, mainBits, gr, ch, fhBytes, siBytes, freeFrameBytes;
87128712 int prevBitOffset, sfBlockBits, huffBlockBits;
8713- unsigned char *mainPtr;
8713+ const unsigned char *mainPtr;
87148714 MP3DecInfo *mp3DecInfo = (MP3DecInfo *) hMP3Decoder;
87158715
87168716 if (!mp3DecInfo)
0 commit comments