Check partword is in range for # of partitions am: 4da931ed17 am: 2214429dcd am: 6ff98fe50d am: 615f5e52a0 am: a184912344 am: d2cc408b9b am: c299f659a4 am: eea37099a5 am: ef47215e8f am: 4baca3a3ca
am: 746bcf14e4

* commit '746bcf14e4a67a4c7dad186f1409d3f962ab0784':
  Check partword is in range for # of partitions

Change-Id: Icead88335018e260b63dd2052e31505b5b134849
diff --git a/Android.mk b/Android.mk
index 880405b..b6ad701 100644
--- a/Android.mk
+++ b/Android.mk
@@ -16,21 +16,22 @@
 	Tremolo/treminfo.c \
 	Tremolo/vorbisfile.c
 
-ifeq ($(TARGET_ARCH),arm)
-LOCAL_SRC_FILES += \
+LOCAL_SRC_FILES_arm += \
 	Tremolo/bitwiseARM.s \
 	Tremolo/dpen.s \
 	Tremolo/floor1ARM.s \
 	Tremolo/mdctARM.s
-LOCAL_CFLAGS += \
+LOCAL_CFLAGS_arm += \
     -D_ARM_ASSEM_
 # Assembly code in asm_arm.h does not compile with Clang.
-LOCAL_CLANG_ASFLAGS += \
+LOCAL_CLANG_ASFLAGS_arm += \
     -no-integrated-as
-else
-LOCAL_CFLAGS += \
-    -DONLY_C
-endif
+LOCAL_CFLAGS_arm64 += -DONLY_C
+LOCAL_CFLAGS_mips += -DONLY_C
+LOCAL_CFLAGS_mips64 += -DONLY_C
+LOCAL_CFLAGS_x86 += -DONLY_C
+LOCAL_CFLAGS_x86_64 += -DONLY_C
+
 LOCAL_CFLAGS+= -O2
 
 LOCAL_C_INCLUDES:= \
diff --git a/README.version b/README.version
new file mode 100644
index 0000000..fe58e9d
--- /dev/null
+++ b/README.version
@@ -0,0 +1,3 @@
+URL: http://wss.co.uk/pinknoise/tremolo/Tremolo007.zip
+Version: 0.07
+BugComponent: 99142
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 @@
   }
   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{
   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 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 @@
 #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 @@
   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 @@
   /* 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 @@
   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 @@
   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 @@
 #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"