summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorConrad Parker <conrad@xiph.org>2004-08-11 04:29:11 +0000
committerConrad Parker <conrad@xiph.org>2004-08-11 04:29:11 +0000
commit3996cbef413083a2c4e6899e8c7a9de87bca5cec (patch)
treef7ddcc89660b0003de472caa1e94d4024223da4a /src
parentd94d0d6643cad44734c1cfcb6726f0639f6f0879 (diff)
downloadogg-3996cbef413083a2c4e6899e8c7a9de87bca5cec.tar.gz
add explicit casts and consts to fix visual c compiler warnings
(patch from Colin Ward) + tested on linux/gcc git-svn-id: http://svn.xiph.org/trunk/ogg@7525 0101bb08-14d6-0310-b084-bc0e0c8e3800
Diffstat (limited to 'src')
-rw-r--r--src/bitwise.c38
-rw-r--r--src/framing.c24
2 files changed, 31 insertions, 31 deletions
diff --git a/src/bitwise.c b/src/bitwise.c
index b1514cc..cfceddc 100644
--- a/src/bitwise.c
+++ b/src/bitwise.c
@@ -11,7 +11,7 @@
********************************************************************
function: packing variable sized words into an octet stream
- last mod: $Id: bitwise.c,v 1.19 2004/03/16 18:31:49 xiphmont Exp $
+ last mod: $Id$
********************************************************************/
@@ -24,7 +24,7 @@
#define BUFFER_INCREMENT 256
-static unsigned long mask[]=
+static const unsigned long mask[]=
{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f,
0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff,
0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff,
@@ -33,7 +33,7 @@ static unsigned long mask[]=
0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff,
0x3fffffff,0x7fffffff,0xffffffff };
-static unsigned int mask8B[]=
+static const unsigned int mask8B[]=
{0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};
void oggpack_writeinit(oggpack_buffer *b){
@@ -79,14 +79,14 @@ void oggpack_write(oggpack_buffer *b,unsigned long value,int bits){
b->ptr[0]|=value<<b->endbit;
if(bits>=8){
- b->ptr[1]=value>>(8-b->endbit);
+ b->ptr[1]=(unsigned char)(value>>(8-b->endbit));
if(bits>=16){
- b->ptr[2]=value>>(16-b->endbit);
+ b->ptr[2]=(unsigned char)(value>>(16-b->endbit));
if(bits>=24){
- b->ptr[3]=value>>(24-b->endbit);
+ b->ptr[3]=(unsigned char)(value>>(24-b->endbit));
if(bits>=32){
if(b->endbit)
- b->ptr[4]=value>>(32-b->endbit);
+ b->ptr[4]=(unsigned char)(value>>(32-b->endbit));
else
b->ptr[4]=0;
}
@@ -113,14 +113,14 @@ void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits){
b->ptr[0]|=value>>(24+b->endbit);
if(bits>=8){
- b->ptr[1]=value>>(16+b->endbit);
+ b->ptr[1]=(unsigned char)(value>>(16+b->endbit));
if(bits>=16){
- b->ptr[2]=value>>(8+b->endbit);
+ b->ptr[2]=(unsigned char)(value>>(8+b->endbit));
if(bits>=24){
- b->ptr[3]=value>>(b->endbit);
+ b->ptr[3]=(unsigned char)(value>>(b->endbit));
if(bits>=32){
if(b->endbit)
- b->ptr[4]=value<<(8-b->endbit);
+ b->ptr[4]=(unsigned char)(value<<(8-b->endbit));
else
b->ptr[4]=0;
}
@@ -310,14 +310,14 @@ void oggpackB_adv1(oggpack_buffer *b){
/* bits <= 32 */
long oggpack_read(oggpack_buffer *b,int bits){
- unsigned long ret;
+ long ret;
unsigned long m=mask[bits];
bits+=b->endbit;
if(b->endbyte+4>=b->storage){
/* not the main path */
- ret=-1UL;
+ ret=-1L;
if(b->endbyte*8+bits>b->storage*8)goto overflow;
}
@@ -346,14 +346,14 @@ long oggpack_read(oggpack_buffer *b,int bits){
/* bits <= 32 */
long oggpackB_read(oggpack_buffer *b,int bits){
- unsigned long ret;
+ long ret;
long m=32-bits;
bits+=b->endbit;
if(b->endbyte+4>=b->storage){
/* not the main path */
- ret=-1UL;
+ ret=-1L;
if(b->endbyte*8+bits>b->storage*8)goto overflow;
}
@@ -380,11 +380,11 @@ long oggpackB_read(oggpack_buffer *b,int bits){
}
long oggpack_read1(oggpack_buffer *b){
- unsigned long ret;
+ long ret;
if(b->endbyte>=b->storage){
/* not the main path */
- ret=-1UL;
+ ret=-1L;
goto overflow;
}
@@ -402,11 +402,11 @@ long oggpack_read1(oggpack_buffer *b){
}
long oggpackB_read1(oggpack_buffer *b){
- unsigned long ret;
+ long ret;
if(b->endbyte>=b->storage){
/* not the main path */
- ret=-1UL;
+ ret=-1L;
goto overflow;
}
diff --git a/src/framing.c b/src/framing.c
index 655d99e..69adb86 100644
--- a/src/framing.c
+++ b/src/framing.c
@@ -12,7 +12,7 @@
function: code raw [Vorbis] packets into framed OggSquish stream and
decode Ogg streams back into raw packets
- last mod: $Id: framing.c,v 1.23 2002/09/29 07:10:37 giles Exp $
+ last mod: $Id$
note: The CRC code is directly derived from public domain code by
Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html
@@ -117,7 +117,7 @@ static ogg_uint32_t _ogg_crc_entry(unsigned long index){
}
#endif
-static ogg_uint32_t crc_lookup[256]={
+static const ogg_uint32_t crc_lookup[256]={
0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,
0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005,
0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61,
@@ -260,10 +260,10 @@ void ogg_page_checksum_set(ogg_page *og){
for(i=0;i<og->body_len;i++)
crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]];
- og->header[22]=crc_reg&0xff;
- og->header[23]=(crc_reg>>8)&0xff;
- og->header[24]=(crc_reg>>16)&0xff;
- og->header[25]=(crc_reg>>24)&0xff;
+ og->header[22]=(unsigned char)(crc_reg&0xff);
+ og->header[23]=(unsigned char)((crc_reg>>8)&0xff);
+ og->header[24]=(unsigned char)((crc_reg>>16)&0xff);
+ og->header[25]=(unsigned char)((crc_reg>>24)&0xff);
}
}
@@ -378,7 +378,7 @@ int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){
/* 64 bits of PCM position */
for(i=6;i<14;i++){
- os->header[i]=(granule_pos&0xff);
+ os->header[i]=(unsigned char)(granule_pos&0xff);
granule_pos>>=8;
}
@@ -386,7 +386,7 @@ int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){
{
long serialno=os->serialno;
for(i=14;i<18;i++){
- os->header[i]=(serialno&0xff);
+ os->header[i]=(unsigned char)(serialno&0xff);
serialno>>=8;
}
}
@@ -401,7 +401,7 @@ int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){
{
long pageno=os->pageno++;
for(i=18;i<22;i++){
- os->header[i]=(pageno&0xff);
+ os->header[i]=(unsigned char)(pageno&0xff);
pageno>>=8;
}
}
@@ -413,9 +413,9 @@ int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){
os->header[25]=0;
/* segment table */
- os->header[26]=vals&0xff;
+ os->header[26]=(unsigned char)(vals&0xff);
for(i=0;i<vals;i++)
- bytes+=os->header[i+27]=(os->lacing_vals[i]&0xff);
+ bytes+=os->header[i+27]=(unsigned char)(os->lacing_vals[i]&0xff);
/* set pointers in the ogg_page struct */
og->header=os->header;
@@ -645,7 +645,7 @@ int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){
buffer. If it doesn't verify, we look for the next potential
frame */
- while(1){
+ for(;;){
long ret=ogg_sync_pageseek(oy,og);
if(ret>0){
/* have a page */