aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2016-04-06 07:47:11 -0700
committerGlenn Kasten <gkasten@google.com>2016-04-06 08:15:46 -0700
commit946e1bc4a013eb501b65d344efff58a9ae4e247a (patch)
treed0fea501bcc6791353712c83e5d1ad6e8a57dbcb
parente2e3bf4b4dcd0743531bf561500e8677f6b5e778 (diff)
downloadtremolo-946e1bc4a013eb501b65d344efff58a9ae4e247a.tar.gz
Fix build warnings
Remove unused parameters to _VDBG_free. Avoid arithmetic on void *. Avoid left shift of signed integers. Use ogg_uint8_t instead of the implementation-defined char. This is assumed to be safe because char is unsigned on ARM, and Tremolo was originally designed as an ARM-optimized version of Tremor. Bug: 28027395 Change-Id: I4e0ee2361bbb81d64828ff66c06c1a07d579f8a0
-rw-r--r--Tremolo/codebook.c2
-rw-r--r--Tremolo/codec_internal.h8
-rw-r--r--Tremolo/config_types.h1
-rw-r--r--Tremolo/floor0.c4
-rw-r--r--Tremolo/floor1.c12
-rw-r--r--Tremolo/misc.c2
-rw-r--r--Tremolo/misc.h4
7 files changed, 17 insertions, 16 deletions
diff --git a/Tremolo/codebook.c b/Tremolo/codebook.c
index ff280b7..4d0dd91 100644
--- a/Tremolo/codebook.c
+++ b/Tremolo/codebook.c
@@ -786,7 +786,7 @@ static int decode_map(codebook *s, oggpack_buffer *b, ogg_int32_t *v, int point)
}
case 3:{
/* offset into array */
- void *ptr=s->q_val+entry*s->q_pack;
+ void *ptr=((char *)s->q_val)+entry*s->q_pack;
if(s->q_bits<=8){
for(i=0;i<s->dim;i++)
diff --git a/Tremolo/codec_internal.h b/Tremolo/codec_internal.h
index 1d4a146..c94db5f 100644
--- a/Tremolo/codec_internal.h
+++ b/Tremolo/codec_internal.h
@@ -114,11 +114,11 @@ typedef struct{
typedef struct{
floor1class *klass; /* [VIF_CLASS] */
- char *partitionclass; /* [VIF_PARTS]; 0 to 15 */
+ ogg_uint8_t *partitionclass; /* [VIF_PARTS]; 0 to 15 */
ogg_uint16_t *postlist; /* [VIF_POSIT+2]; first two implicit */
- char *forward_index; /* [VIF_POSIT+2]; */
- char *hineighbor; /* [VIF_POSIT]; */
- char *loneighbor; /* [VIF_POSIT]; */
+ ogg_uint8_t *forward_index; /* [VIF_POSIT+2]; */
+ ogg_uint8_t *hineighbor; /* [VIF_POSIT]; */
+ ogg_uint8_t *loneighbor; /* [VIF_POSIT]; */
int partitions; /* 0 to 31 */
int posts;
diff --git a/Tremolo/config_types.h b/Tremolo/config_types.h
index 2b85570..a411aef 100644
--- a/Tremolo/config_types.h
+++ b/Tremolo/config_types.h
@@ -42,5 +42,6 @@ typedef int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef short ogg_int16_t;
typedef unsigned short ogg_uint16_t;
+typedef unsigned char ogg_uint8_t;
#endif
diff --git a/Tremolo/floor0.c b/Tremolo/floor0.c
index 1e06200..581efcb 100644
--- a/Tremolo/floor0.c
+++ b/Tremolo/floor0.c
@@ -72,13 +72,13 @@ static inline ogg_int32_t vorbis_invsqlook_i(long a,long e){
#ifdef _LOW_ACCURACY_
static inline ogg_int32_t vorbis_fromdBlook_i(long a){
if(a>0) return 0x7fffffff;
- if(a<(-140<<12)) return 0;
+ if(a<(int)(((unsigned)-140)<<12)) return 0;
return FLOOR_fromdB_LOOKUP[((a+140)*467)>>20]<<9;
}
#else
static inline ogg_int32_t vorbis_fromdBlook_i(long a){
if(a>0) return 0x7fffffff;
- if(a<(-140<<12)) return 0;
+ if(a<(int)(((unsigned)-140)<<12)) return 0;
return FLOOR_fromdB_LOOKUP[((a+(140<<12))*467)>>20];
}
#endif
diff --git a/Tremolo/floor1.c b/Tremolo/floor1.c
index 4a4937d..7811aba 100644
--- a/Tremolo/floor1.c
+++ b/Tremolo/floor1.c
@@ -73,9 +73,9 @@ static int ilog(unsigned int v){
return(ret);
}
-static void mergesort(char *index,ogg_uint16_t *vals,ogg_uint16_t n){
+static void mergesort(ogg_uint8_t *index,ogg_uint16_t *vals,ogg_uint16_t n){
ogg_uint16_t i,j;
- char *temp,*A=index,*B=_ogg_malloc(n*sizeof(*B));
+ ogg_uint8_t *temp,*A=index,*B=_ogg_malloc(n*sizeof(*B));
for(i=1;i<n;i<<=1){
for(j=0;j+i<n;){
@@ -112,7 +112,7 @@ vorbis_info_floor *floor1_info_unpack (vorbis_info *vi,oggpack_buffer *opb){
/* read partitions */
info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */
info->partitionclass=
- (char *)_ogg_malloc(info->partitions*sizeof(*info->partitionclass));
+ (ogg_uint8_t *)_ogg_malloc(info->partitions*sizeof(*info->partitionclass));
for(j=0;j<info->partitions;j++){
info->partitionclass[j]=(char)oggpack_read(opb,4); /* only 0 to 15 legal */
if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j];
@@ -146,11 +146,11 @@ vorbis_info_floor *floor1_info_unpack (vorbis_info *vi,oggpack_buffer *opb){
info->postlist=
(ogg_uint16_t *)_ogg_malloc((count+2)*sizeof(*info->postlist));
info->forward_index=
- (char *)_ogg_malloc((count+2)*sizeof(*info->forward_index));
+ (ogg_uint8_t *)_ogg_malloc((count+2)*sizeof(*info->forward_index));
info->loneighbor=
- (char *)_ogg_malloc(count*sizeof(*info->loneighbor));
+ (ogg_uint8_t *)_ogg_malloc(count*sizeof(*info->loneighbor));
info->hineighbor=
- (char *)_ogg_malloc(count*sizeof(*info->hineighbor));
+ (ogg_uint8_t *)_ogg_malloc(count*sizeof(*info->hineighbor));
count=0;
for(j=0,k=0;j<info->partitions;j++){
diff --git a/Tremolo/misc.c b/Tremolo/misc.c
index a85b8da..164250b 100644
--- a/Tremolo/misc.c
+++ b/Tremolo/misc.c
@@ -219,7 +219,7 @@ extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line){
return _insert(ptr,bytes,file,line);
}
-extern void _VDBG_free(void *ptr,char *file,long line){
+extern void _VDBG_free(void *ptr){
if(ptr){
ptr=(void *)(((char *)ptr)-HEAD_ALIGN);
_ripremove(ptr);
diff --git a/Tremolo/misc.h b/Tremolo/misc.h
index bd2eab3..b75a6d8 100644
--- a/Tremolo/misc.h
+++ b/Tremolo/misc.h
@@ -45,7 +45,7 @@
#ifdef _VDBG_GRAPHFILE
extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line);
-extern void _VDBG_free(void *ptr,char *file,long line);
+extern void _VDBG_free(void *ptr);
#undef _ogg_malloc
#undef _ogg_calloc
@@ -55,7 +55,7 @@ extern void _VDBG_free(void *ptr,char *file,long line);
#define _ogg_malloc(x) _VDBG_malloc(NULL,(x),__FILE__,__LINE__)
#define _ogg_calloc(x,y) _VDBG_malloc(NULL,(x)*(y),__FILE__,__LINE__)
#define _ogg_realloc(x,y) _VDBG_malloc((x),(y),__FILE__,__LINE__)
-#define _ogg_free(x) _VDBG_free((x),__FILE__,__LINE__)
+#define _ogg_free(x) _VDBG_free((x))
#endif
#include "asm_arm.h"